hookehuyr

测试把身份验证错误提示框合并到新组件里面

1 +<!--
2 + * @Date: 2022-06-30 17:48:46
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2022-06-30 18:11:08
5 + * @FilePath: /tswj/src/components/NoticeOverlayTest/index.vue
6 + * @Description: 文件描述
7 +-->
8 +<template>
9 + <van-overlay :show="showNotice" z-index="1000">
10 + <div class="wrapper" @click.stop>
11 + <div class="block">
12 + <div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
13 + <van-icon name="close" color="#FFFFFF" @click="handleClose" />
14 + </div>
15 + <div>
16 + <van-image width="100" height="100" :src="icon_notice" />
17 + <p style="margin: 1rem; font-size: 1.15rem; font-weight: bold; color: #222222;">温馨提示</p>
18 + </div>
19 + <div style="color: #333333;">
20 + <div v-html="noticeHtml" />
21 + </div>
22 + <div style="margin: 3rem 0;">
23 + <my-button type="primary" @on-click="handleSubmit">{{ noticeText }}</my-button>
24 + </div>
25 + </div>
26 + </div>
27 + </van-overlay>
28 +</template>
29 +
30 +<script setup>
31 +import MyButton from '@/components/MyButton/index.vue'
32 +import icon_notice from '@images/que-tishi@2x.png'
33 +import { USER_STATUS } from '@/constant'
34 +
35 +const props = defineProps({
36 + show: Boolean,
37 + type: {
38 + type: Number,
39 + default: -1,
40 + }
41 +})
42 +
43 +const emit = defineEmits(['on-close', 'on-submit']);
44 +
45 +const handleClose = () => { // 关闭提示框回调
46 + showNotice.value = false
47 + emit('on-close', false)
48 +}
49 +// 底部按钮
50 +const handleSubmit = () => {
51 + emit('on-submit', false)
52 +}
53 +
54 +const noticeText = ref('')
55 +const noticeHtml = ref('')
56 +const showNotice = ref(false)
57 +// 监听弹出框
58 +watch(() => props.show, (v) => {
59 + showNotice.value = v;
60 + if (props.type === USER_STATUS.NON_VERIFIED) {
61 + noticeText.value = '前往认证'
62 + noticeHtml.value = `
63 + <p>您还没有实名认证</p>
64 + <p>请前往个人中心进行实名认证</p>
65 + `
66 + } else if (props.type === USER_STATUS.NON_DEFAULT_CHILD) {
67 + noticeText.value = '前往新增'
68 + noticeHtml.value = `
69 + <p>您还没有新增儿童</p>
70 + <p>请前往个人中心进行新增</p>
71 + `
72 + }
73 +})
74 +</script>
75 +
76 +<style lang="less" scoped>
77 +.wrapper {
78 + display: flex;
79 + align-items: center;
80 + justify-content: center;
81 + height: 100%;
82 + width: auto;
83 + text-align: center;
84 +}
85 +
86 +.block {
87 + width: 80%;
88 + // height: 25rem;
89 + background-color: #fff;
90 + border-radius: 10px;
91 + padding: 1rem;
92 + position: relative;
93 + margin-top: 1rem;
94 + margin-bottom: 5rem;
95 +}
96 +</style>
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-17 11:17:58 3 * @Date: 2022-05-17 11:17:58
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-05-31 22:11:29 5 + * @LastEditTime: 2022-06-30 17:49:41
6 * @FilePath: /tswj/src/utils/generateModules.js 6 * @FilePath: /tswj/src/utils/generateModules.js
7 * @Description: 7 * @Description:
8 */ 8 */
9 import MyButton from '@/components/MyButton/index.vue' 9 import MyButton from '@/components/MyButton/index.vue'
10 import VideoCard from '@/components/VideoCard/index.vue' 10 import VideoCard from '@/components/VideoCard/index.vue'
11 import NoticeOverlay from '@/components/NoticeOverlay/index.vue' 11 import NoticeOverlay from '@/components/NoticeOverlay/index.vue'
12 +import NoticeOverlayTest from '@/components/NoticeOverlayTest/index.vue'
12 import DonateBook from '@/components/DonateBook/index.vue' 13 import DonateBook from '@/components/DonateBook/index.vue'
13 import ShortcutFixed from '@/components/ShortcutFixed/index.vue' 14 import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
14 import BookCard from '@/components/BookCard/index.vue' 15 import BookCard from '@/components/BookCard/index.vue'
...@@ -20,6 +21,7 @@ export { ...@@ -20,6 +21,7 @@ export {
20 MyButton, 21 MyButton,
21 VideoCard, 22 VideoCard,
22 NoticeOverlay, 23 NoticeOverlay,
24 + NoticeOverlayTest,
23 DonateBook, 25 DonateBook,
24 ShortcutFixed, 26 ShortcutFixed,
25 BookCard, 27 BookCard,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-21 09:35:14 3 * @Date: 2022-05-21 09:35:14
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-30 17:17:14 5 + * @LastEditTime: 2022-06-30 18:26:54
6 * @FilePath: /tswj/src/views/client/bookDetail.vue 6 * @FilePath: /tswj/src/views/client/bookDetail.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -109,12 +109,12 @@ ...@@ -109,12 +109,12 @@
109 </div> 109 </div>
110 110
111 <!-- 上传时,如果没有默认儿童提示弹框, 如果没有实名认证提示弹框 --> 111 <!-- 上传时,如果没有默认儿童提示弹框, 如果没有实名认证提示弹框 -->
112 + <!-- <notice-overlay-test :show="showNotice" :type="userInfo.can_upload" @on-submit="onSubmit" @on-close="onClose" /> -->
112 <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose"> 113 <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose">
113 <div style="color: #333333;"> 114 <div style="color: #333333;">
114 <div v-html="noticeHtml" /> 115 <div v-html="noticeHtml" />
115 </div> 116 </div>
116 </notice-overlay> 117 </notice-overlay>
117 -
118 <donate-flower :user-type="donateType" :show-popup="showDonate" :item="donateInfo" @on-close="closeDonate" /> 118 <donate-flower :user-type="donateType" :show-popup="showDonate" :item="donateInfo" @on-close="closeDonate" />
119 119
120 <van-overlay :show="show" z-index="9999"> 120 <van-overlay :show="show" z-index="9999">
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
128 import { ref, onActivated, nextTick, onMounted, computed } from 'vue' 128 import { ref, onActivated, nextTick, onMounted, computed } from 'vue'
129 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' 129 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router'
130 import { Cookies, _, storeToRefs, mainStore, Toast, hasEllipsis } from '@/utils/generatePackage' 130 import { Cookies, _, storeToRefs, mainStore, Toast, hasEllipsis } from '@/utils/generatePackage'
131 -import { MyButton, VideoCard, NoticeOverlay, DonateFlower, ShortcutFixed } from '@/utils/generateModules' 131 +import { MyButton, VideoCard, NoticeOverlay, NoticeOverlayTest, DonateFlower, ShortcutFixed } from '@/utils/generateModules'
132 import { icon_video, icon_up, icon_down, icon_subscribed, icon_unsubscribe, no_image } from '@/utils/generateIcons' 132 import { icon_video, icon_up, icon_down, icon_subscribed, icon_unsubscribe, no_image } from '@/utils/generateIcons'
133 import { JSJ_FORM_C, JSJ_FORM_MANDARIN, JSJ_FORM_LOCALISM } from '@/constant' 133 import { JSJ_FORM_C, JSJ_FORM_MANDARIN, JSJ_FORM_LOCALISM } from '@/constant'
134 import { useVideoList, useDefaultPerf, useScrollTop } from '@/composables'; 134 import { useVideoList, useDefaultPerf, useScrollTop } from '@/composables';
...@@ -295,6 +295,10 @@ const uploadVideo = () => { ...@@ -295,6 +295,10 @@ const uploadVideo = () => {
295 <p>请前往个人中心进行新增</p> 295 <p>请前往个人中心进行新增</p>
296 ` 296 `
297 } 297 }
298 + // 测试新组件条件
299 + // else {
300 + // showNotice.value = true;
301 + // }
298 } 302 }
299 303
300 /****************** keepAlive 模块 *******************/ 304 /****************** keepAlive 模块 *******************/
......