feat(profile): 添加隐私政策同意弹框组件及逻辑
新增 PrivacyAgreementModal 组件用于展示隐私政策和服务协议 在个人资料页添加隐私政策弹框逻辑,未完善资料的用户需先同意协议
Showing
3 changed files
with
41 additions
and
3 deletions
| ... | @@ -15,6 +15,7 @@ declare module 'vue' { | ... | @@ -15,6 +15,7 @@ declare module 'vue' { |
| 15 | NavBar: typeof import('./src/components/navBar.vue')['default'] | 15 | NavBar: typeof import('./src/components/navBar.vue')['default'] |
| 16 | NutActionSheet: typeof import('@nutui/nutui-taro')['ActionSheet'] | 16 | NutActionSheet: typeof import('@nutui/nutui-taro')['ActionSheet'] |
| 17 | NutButton: typeof import('@nutui/nutui-taro')['Button'] | 17 | NutButton: typeof import('@nutui/nutui-taro')['Button'] |
| 18 | + NutCheckbox: typeof import('@nutui/nutui-taro')['Checkbox'] | ||
| 18 | NutCol: typeof import('@nutui/nutui-taro')['Col'] | 19 | NutCol: typeof import('@nutui/nutui-taro')['Col'] |
| 19 | NutConfigProvider: typeof import('@nutui/nutui-taro')['ConfigProvider'] | 20 | NutConfigProvider: typeof import('@nutui/nutui-taro')['ConfigProvider'] |
| 20 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] | 21 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] |
| ... | @@ -42,6 +43,7 @@ declare module 'vue' { | ... | @@ -42,6 +43,7 @@ declare module 'vue' { |
| 42 | PayCard: typeof import('./src/components/payCard.vue')['default'] | 43 | PayCard: typeof import('./src/components/payCard.vue')['default'] |
| 43 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] | 44 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] |
| 44 | PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default'] | 45 | PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default'] |
| 46 | + PrivacyAgreementModal: typeof import('./src/components/PrivacyAgreementModal.vue')['default'] | ||
| 45 | RouterLink: typeof import('vue-router')['RouterLink'] | 47 | RouterLink: typeof import('vue-router')['RouterLink'] |
| 46 | RouterView: typeof import('vue-router')['RouterView'] | 48 | RouterView: typeof import('vue-router')['RouterView'] |
| 47 | SearchPopup: typeof import('./src/components/SearchPopup.vue')['default'] | 49 | SearchPopup: typeof import('./src/components/SearchPopup.vue')['default'] | ... | ... |
src/components/PrivacyAgreementModal.vue
0 → 100644
This diff is collapsed. Click to expand it.
| ... | @@ -74,16 +74,23 @@ | ... | @@ -74,16 +74,23 @@ |
| 74 | 74 | ||
| 75 | <!-- 自定义TabBar --> | 75 | <!-- 自定义TabBar --> |
| 76 | <TabBar /> | 76 | <TabBar /> |
| 77 | + | ||
| 78 | + <!-- 隐私政策同意弹框 --> | ||
| 79 | + <PrivacyAgreementModal | ||
| 80 | + v-model:visible="showPrivacyModal" | ||
| 81 | + @confirm="onPrivacyConfirm" | ||
| 82 | + @cancel="onPrivacyCancel" | ||
| 83 | + /> | ||
| 77 | </view> | 84 | </view> |
| 78 | </template> | 85 | </template> |
| 79 | 86 | ||
| 80 | <script setup> | 87 | <script setup> |
| 81 | -import { computed } from 'vue' | 88 | +import { computed, ref } from 'vue' |
| 82 | import { Heart, Clock, Notice, Cart, Message, Tips, Right, StarN } from '@nutui/icons-vue-taro' | 89 | import { Heart, Clock, Notice, Cart, Message, Tips, Right, StarN } from '@nutui/icons-vue-taro' |
| 83 | import Taro, { useDidShow } from '@tarojs/taro' | 90 | import Taro, { useDidShow } from '@tarojs/taro' |
| 84 | import TabBar from '@/components/TabBar.vue' | 91 | import TabBar from '@/components/TabBar.vue' |
| 92 | +import PrivacyAgreementModal from '@/components/PrivacyAgreementModal.vue' | ||
| 85 | import { useUserStore } from '@/stores/user' | 93 | import { useUserStore } from '@/stores/user' |
| 86 | -// import { checkPermission, PERMISSION_TYPES } from '@/utils/permission' | ||
| 87 | 94 | ||
| 88 | // 默认头像 | 95 | // 默认头像 |
| 89 | const defaultAvatar = 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' | 96 | const defaultAvatar = 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg' |
| ... | @@ -94,6 +101,9 @@ const userStore = useUserStore() | ... | @@ -94,6 +101,9 @@ const userStore = useUserStore() |
| 94 | // 用户信息计算属性 | 101 | // 用户信息计算属性 |
| 95 | const userInfo = computed(() => userStore.userInfo) | 102 | const userInfo = computed(() => userStore.userInfo) |
| 96 | 103 | ||
| 104 | +// 隐私政策弹框状态 | ||
| 105 | +const showPrivacyModal = ref(false) | ||
| 106 | + | ||
| 97 | useDidShow(async () => { | 107 | useDidShow(async () => { |
| 98 | await userStore.fetchUserInfo() | 108 | await userStore.fetchUserInfo() |
| 99 | }) | 109 | }) |
| ... | @@ -101,10 +111,36 @@ useDidShow(async () => { | ... | @@ -101,10 +111,36 @@ useDidShow(async () => { |
| 101 | /** | 111 | /** |
| 102 | * 编辑个人资料 | 112 | * 编辑个人资料 |
| 103 | */ | 113 | */ |
| 104 | -const onEditProfile = () => { | 114 | +const onEditProfile = async () => { |
| 115 | + // 检查用户是否已完善资料 | ||
| 116 | + const hasCompleteProfile = userStore.hasCompleteProfile | ||
| 117 | + | ||
| 118 | + if (hasCompleteProfile) { | ||
| 119 | + // 已完善资料,直接进入编辑页面 | ||
| 105 | Taro.navigateTo({ | 120 | Taro.navigateTo({ |
| 106 | url: '/pages/editProfile/index' | 121 | url: '/pages/editProfile/index' |
| 107 | }) | 122 | }) |
| 123 | + } else { | ||
| 124 | + // 未完善资料,显示隐私政策同意弹框 | ||
| 125 | + showPrivacyModal.value = true | ||
| 126 | + } | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +/** | ||
| 130 | + * 隐私政策确认 | ||
| 131 | + */ | ||
| 132 | +const onPrivacyConfirm = () => { | ||
| 133 | + // 用户同意隐私政策后,跳转到编辑资料页面 | ||
| 134 | + Taro.navigateTo({ | ||
| 135 | + url: '/pages/editProfile/index' | ||
| 136 | + }) | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +/** | ||
| 140 | + * 隐私政策取消 | ||
| 141 | + */ | ||
| 142 | +const onPrivacyCancel = () => { | ||
| 143 | + // 用户取消,不做任何操作 | ||
| 108 | } | 144 | } |
| 109 | 145 | ||
| 110 | /** | 146 | /** | ... | ... |
-
Please register or login to post a comment