hookehuyr

✨ feat(回复模块):判断实名认证使用新组件

...@@ -52,19 +52,13 @@ ...@@ -52,19 +52,13 @@
52 </van-popup> 52 </van-popup>
53 53
54 <!-- 写评论时,如果没有实名认证提示弹框 --> 54 <!-- 写评论时,如果没有实名认证提示弹框 -->
55 - <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose"> 55 + <notice-overlay-module :show="showNotice" :type="userInfo.can_upload" @on-submit="onSubmit" @on-close="onClose" />
56 - <div style="color: #333333;">
57 - <div v-html="noticeHtml" />
58 - </div>
59 - </notice-overlay>
60 </template> 56 </template>
61 57
62 <script setup> 58 <script setup>
63 import CommentBox from '@/components/CommentBox/index.vue' 59 import CommentBox from '@/components/CommentBox/index.vue'
64 -import NoticeOverlay from '@/components/NoticeOverlay/index.vue' 60 +import NoticeOverlayModule from '@/components/NoticeOverlayModule/index.vue'
65 import no_image from '@images/que-shuju@2x.png' 61 import no_image from '@images/que-shuju@2x.png'
66 -
67 -import icon_x from '@images/x.png'
68 import icon_y from '@images/y.png' 62 import icon_y from '@images/y.png'
69 import icon_avatar from '@images/que-touxiang@2x.png' 63 import icon_avatar from '@images/que-touxiang@2x.png'
70 64
...@@ -74,9 +68,12 @@ import axios from '@/utils/axios'; ...@@ -74,9 +68,12 @@ import axios from '@/utils/axios';
74 import _ from 'lodash' 68 import _ from 'lodash'
75 import { Toast } from 'vant'; 69 import { Toast } from 'vant';
76 70
77 -import { ref, reactive, onMounted, watch } from 'vue' 71 +import { ref, watch } from 'vue'
78 // 获取是否实名认证 72 // 获取是否实名认证
79 import { useDefaultPerf } from '@/composables'; 73 import { useDefaultPerf } from '@/composables';
74 +import { USER_STATUS } from '@/constant'
75 +import { useGo } from '@/hooks/useGo'
76 +const go = useGo();
80 77
81 const $router = useRouter(); 78 const $router = useRouter();
82 const $route = useRoute(); 79 const $route = useRoute();
...@@ -100,32 +97,17 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为 ...@@ -100,32 +97,17 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为
100 * @param {*} v 单行评论数据 97 * @param {*} v 单行评论数据
101 * @param {*} type 类型 comment 为评论/类型 reply 为回复 98 * @param {*} type 类型 comment 为评论/类型 reply 为回复
102 */ 99 */
103 -const noticeText = ref('')
104 -const noticeHtml = ref('')
105 const commentId = ref('') 100 const commentId = ref('')
106 const replayUser = ref('') 101 const replayUser = ref('')
107 const setComment = (v, type) => { // 102 const setComment = (v, type) => { //
108 - if (userInfo.value.can_upload === 1) { 103 + if (userInfo.value.can_upload === USER_STATUS.PASS) {
109 showCommentBoxPopup.value = true; 104 showCommentBoxPopup.value = true;
110 commentType.value = type; 105 commentType.value = type;
111 replayUser.value = v.name; 106 replayUser.value = v.name;
112 commentId.value = props.data.id; 107 commentId.value = props.data.id;
113 - } else if (userInfo.value.can_upload === -1) { // 未实名认证 108 + } else {
114 - closeBtn();
115 - showNotice.value = true;
116 - noticeText.value = '前往认证'
117 - noticeHtml.value = `
118 - <p>您还没有实名认证</p>
119 - <p>请前往个人中心进行实名认证</p>
120 - `
121 - } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
122 closeBtn(); 109 closeBtn();
123 showNotice.value = true; 110 showNotice.value = true;
124 - noticeText.value = '前往新增'
125 - noticeHtml.value = `
126 - <p>您还没有新增儿童</p>
127 - <p>请前往个人中心进行新增</p>
128 - `
129 } 111 }
130 } 112 }
131 113
...@@ -184,24 +166,10 @@ const onSubmit = () => { ...@@ -184,24 +166,10 @@ const onSubmit = () => {
184 setTimeout(() => { 166 setTimeout(() => {
185 showNotice.value = false; 167 showNotice.value = false;
186 }, 1000); 168 }, 1000);
187 - if (userInfo.value.can_upload === -1) { // 未实名认证 169 + if (userInfo.value.can_upload === USER_STATUS.NON_VERIFIED) { // 未实名认证
188 - $router.push({ 170 + go('/me/verifyUser', { back_url: $route.fullPath })
189 - path: '/me/verifyUser', 171 + } else if (userInfo.value.can_upload === USER_STATUS.NON_DEFAULT_CHILD) { // 没有默认儿童
190 - query: { 172 + go('/me/handleUser', { perf_id: '', kg_id: '', kg_name: '', type: 'ADD', back_url: $route.fullPath })
191 - back_url: $route.fullPath
192 - }
193 - });
194 - } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
195 - $router.push({
196 - path: '/me/handleUser',
197 - query: {
198 - perf_id: '',
199 - kg_id: '',
200 - kg_name: '',
201 - type: 'ADD',
202 - back_url: $route.fullPath
203 - }
204 - });
205 } 173 }
206 } 174 }
207 175
...@@ -279,21 +247,6 @@ const closeBtn = () => { ...@@ -279,21 +247,6 @@ const closeBtn = () => {
279 } 247 }
280 </script> 248 </script>
281 249
282 -<script>
283 -export default {
284 - data() {
285 - return {
286 - }
287 - },
288 - mounted() {
289 - },
290 - watch: {
291 - },
292 - methods: {
293 - }
294 -}
295 -</script>
296 -
297 <style lang="less" scoped> 250 <style lang="less" scoped>
298 .comment-wrapper { 251 .comment-wrapper {
299 color: #999999; 252 color: #999999;
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +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-06-30 17:49:41 5 + * @LastEditTime: 2022-07-01 14:55:12
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 NoticeOverlayModule from '@/components/NoticeOverlayModule/index.vue'
13 import DonateBook from '@/components/DonateBook/index.vue' 13 import DonateBook from '@/components/DonateBook/index.vue'
14 import ShortcutFixed from '@/components/ShortcutFixed/index.vue' 14 import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
15 import BookCard from '@/components/BookCard/index.vue' 15 import BookCard from '@/components/BookCard/index.vue'
...@@ -21,7 +21,7 @@ export { ...@@ -21,7 +21,7 @@ export {
21 MyButton, 21 MyButton,
22 VideoCard, 22 VideoCard,
23 NoticeOverlay, 23 NoticeOverlay,
24 - NoticeOverlayTest, 24 + NoticeOverlayModule,
25 DonateBook, 25 DonateBook,
26 ShortcutFixed, 26 ShortcutFixed,
27 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 18:26:54 5 + * @LastEditTime: 2022-07-01 15:14:26
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,8 @@ ...@@ -109,12 +109,8 @@
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-module :show="showNotice" :type="userInfo.can_upload" @on-submit="onSubmit" @on-close="onClose" />
113 - <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose"> 113 +
114 - <div style="color: #333333;">
115 - <div v-html="noticeHtml" />
116 - </div>
117 - </notice-overlay>
118 <donate-flower :user-type="donateType" :show-popup="showDonate" :item="donateInfo" @on-close="closeDonate" /> 114 <donate-flower :user-type="donateType" :show-popup="showDonate" :item="donateInfo" @on-close="closeDonate" />
119 115
120 <van-overlay :show="show" z-index="9999"> 116 <van-overlay :show="show" z-index="9999">
...@@ -125,10 +121,10 @@ ...@@ -125,10 +121,10 @@
125 </template> 121 </template>
126 122
127 <script setup> 123 <script setup>
128 -import { ref, onActivated, nextTick, onMounted, computed } from 'vue' 124 +import { ref, onActivated, onMounted, computed } from 'vue'
129 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' 125 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router'
130 import { Cookies, _, storeToRefs, mainStore, Toast, hasEllipsis } from '@/utils/generatePackage' 126 import { Cookies, _, storeToRefs, mainStore, Toast, hasEllipsis } from '@/utils/generatePackage'
131 -import { MyButton, VideoCard, NoticeOverlay, NoticeOverlayTest, DonateFlower, ShortcutFixed } from '@/utils/generateModules' 127 +import { MyButton, VideoCard, NoticeOverlayModule, DonateFlower, ShortcutFixed } from '@/utils/generateModules'
132 import { icon_video, icon_up, icon_down, icon_subscribed, icon_unsubscribe, no_image } from '@/utils/generateIcons' 128 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' 129 import { JSJ_FORM_C, JSJ_FORM_MANDARIN, JSJ_FORM_LOCALISM } from '@/constant'
134 import { useVideoList, useDefaultPerf, useScrollTop } from '@/composables'; 130 import { useVideoList, useDefaultPerf, useScrollTop } from '@/composables';
...@@ -262,8 +258,6 @@ const onSubmit = () => { ...@@ -262,8 +258,6 @@ const onSubmit = () => {
262 } 258 }
263 } 259 }
264 260
265 -const noticeText = ref('')
266 -const noticeHtml = ref('')
267 const show = ref(false); // 跳转等待提示 261 const show = ref(false); // 跳转等待提示
268 const uploadVideo = () => { 262 const uploadVideo = () => {
269 if (userInfo.value.can_upload === USER_STATUS.PASS) { 263 if (userInfo.value.can_upload === USER_STATUS.PASS) {
...@@ -280,25 +274,9 @@ const uploadVideo = () => { ...@@ -280,25 +274,9 @@ const uploadVideo = () => {
280 setTimeout(() => { 274 setTimeout(() => {
281 show.value = false; 275 show.value = false;
282 }, 2000); 276 }, 2000);
283 - } else if (userInfo.value.can_upload === USER_STATUS.NON_VERIFIED) { 277 + } else {
284 - showNotice.value = true;
285 - noticeText.value = '前往认证'
286 - noticeHtml.value = `
287 - <p>您还没有实名认证</p>
288 - <p>请前往个人中心进行实名认证</p>
289 - `
290 - } else if (userInfo.value.can_upload === USER_STATUS.NON_DEFAULT_CHILD) {
291 showNotice.value = true; 278 showNotice.value = true;
292 - noticeText.value = '前往新增'
293 - noticeHtml.value = `
294 - <p>您还没有新增儿童</p>
295 - <p>请前往个人中心进行新增</p>
296 - `
297 } 279 }
298 - // 测试新组件条件
299 - // else {
300 - // showNotice.value = true;
301 - // }
302 } 280 }
303 281
304 /****************** keepAlive 模块 *******************/ 282 /****************** keepAlive 模块 *******************/
......
...@@ -53,12 +53,8 @@ ...@@ -53,12 +53,8 @@
53 <comment-box :show-popup="showCommentBoxPopup" :type="commentType" :replay-user="replayUser" 53 <comment-box :show-popup="showCommentBoxPopup" :type="commentType" :replay-user="replayUser"
54 @on-submit="submitCommentBox" @on-close="closeCommentBox" /> 54 @on-submit="submitCommentBox" @on-close="closeCommentBox" />
55 55
56 - <!-- 写评论时,如果没有实名认证提示弹框 --> 56 + <!-- 提示实名认证和新增儿童提示 -->
57 - <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose"> 57 + <notice-overlay-module :show="showNotice" :type="userInfo.can_upload" @on-submit="onSubmit" @on-close="onClose" />
58 - <div style="color: #333333;">
59 - <div v-html="noticeHtml" />
60 - </div>
61 - </notice-overlay>
62 </template> 58 </template>
63 59
64 <script setup> 60 <script setup>
...@@ -66,26 +62,26 @@ import { mainStore } from '@/store' ...@@ -66,26 +62,26 @@ import { mainStore } from '@/store'
66 62
67 import CommentList from '@/components/CommentList/index.vue' 63 import CommentList from '@/components/CommentList/index.vue'
68 import CommentBox from '@/components/CommentBox/index.vue' 64 import CommentBox from '@/components/CommentBox/index.vue'
69 -import NoticeOverlay from '@/components/NoticeOverlay/index.vue' 65 +import NoticeOverlayModule from '@/components/NoticeOverlayModule/index.vue'
70 import icon_avatar from '@images/que-touxiang@2x.png' 66 import icon_avatar from '@images/que-touxiang@2x.png'
71 import no_image from '@images/que-shuju@2x.png' 67 import no_image from '@images/que-shuju@2x.png'
72 68
73 -import { ref, reactive, onMounted, provide, inject, nextTick } from 'vue' 69 +import { ref, onMounted } from 'vue'
74 -import { useRoute, useRouter } from 'vue-router' 70 +import { useRoute } from 'vue-router'
75 import axios from '@/utils/axios'; 71 import axios from '@/utils/axios';
76 -import $ from 'jquery'
77 import _ from 'lodash' 72 import _ from 'lodash'
78 import { Toast } from 'vant'; 73 import { Toast } from 'vant';
74 +import { USER_STATUS } from '@/constant'
75 +import { useGo } from '@/hooks/useGo'
79 76
80 // 获取是否实名认证 77 // 获取是否实名认证
81 import { useDefaultPerf } from '@/composables'; 78 import { useDefaultPerf } from '@/composables';
82 -
83 import { sharePage } from '@/composables/useShare.js' 79 import { sharePage } from '@/composables/useShare.js'
84 // TAG:微信分享 80 // TAG:微信分享
85 sharePage({}); 81 sharePage({});
86 82
83 +const go = useGo();
87 const $route = useRoute(); 84 const $route = useRoute();
88 -const $router = useRouter();
89 85
90 const { userInfo } = useDefaultPerf($route.query.book_id); 86 const { userInfo } = useDefaultPerf($route.query.book_id);
91 87
...@@ -180,28 +176,13 @@ const onSubmit = () => { ...@@ -180,28 +176,13 @@ const onSubmit = () => {
180 setTimeout(() => { 176 setTimeout(() => {
181 showNotice.value = false; 177 showNotice.value = false;
182 }, 1000); 178 }, 1000);
183 - if (userInfo.value.can_upload === -1) { // 未实名认证 179 + if (userInfo.value.can_upload === USER_STATUS.NON_VERIFIED) {
184 - $router.push({ 180 + go('/me/verifyUser', { back_url: $route.fullPath })
185 - path: '/me/verifyUser', 181 + } else if (userInfo.value.can_upload === USER_STATUS.NON_DEFAULT_CHILD) {
186 - query: { 182 + go('/me/handleUser', { perf_id: '', kg_id: '', kg_name: '', type: 'ADD', back_url: $route.fullPath })
187 - back_url: $route.fullPath
188 - }
189 - });
190 - } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
191 - $router.push({
192 - path: '/me/handleUser',
193 - query: {
194 - perf_id: '',
195 - kg_id: '',
196 - kg_name: '',
197 - type: 'ADD',
198 - back_url: $route.fullPath
199 - }
200 - });
201 } 183 }
202 } 184 }
203 185
204 -
205 /******** 留言框相关操作 START *******/ 186 /******** 留言框相关操作 START *******/
206 // 回复评论控件 187 // 回复评论控件
207 const showCommentBoxPopup = ref(false); 188 const showCommentBoxPopup = ref(false);
...@@ -212,30 +193,16 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为 ...@@ -212,30 +193,16 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为
212 * @param {*} v 单行评论数据 193 * @param {*} v 单行评论数据
213 * @param {*} type 类型 comment 为评论/类型 reply 为回复 194 * @param {*} type 类型 comment 为评论/类型 reply 为回复
214 */ 195 */
215 -const noticeText = ref('')
216 -const noticeHtml = ref('')
217 const commentId = ref('') 196 const commentId = ref('')
218 const replayUser = ref('') 197 const replayUser = ref('')
219 const setComment = (v, type) => { 198 const setComment = (v, type) => {
220 - if (userInfo.value.can_upload === 1) { 199 + if (userInfo.value.can_upload === USER_STATUS.PASS) {
221 showCommentBoxPopup.value = true; 200 showCommentBoxPopup.value = true;
222 commentType.value = type; 201 commentType.value = type;
223 replayUser.value = v.name; 202 replayUser.value = v.name;
224 commentId.value = v.id; 203 commentId.value = v.id;
225 - } else if (userInfo.value.can_upload === -1) { // 未实名认证 204 + } else {
226 - showNotice.value = true;
227 - noticeText.value = '前往认证'
228 - noticeHtml.value = `
229 - <p>您还没有实名认证</p>
230 - <p>请前往个人中心进行实名认证</p>
231 - `
232 - } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
233 showNotice.value = true; 205 showNotice.value = true;
234 - noticeText.value = '前往新增'
235 - noticeHtml.value = `
236 - <p>您还没有新增儿童</p>
237 - <p>请前往个人中心进行新增</p>
238 - `
239 } 206 }
240 } 207 }
241 208
......
...@@ -83,20 +83,15 @@ ...@@ -83,20 +83,15 @@
83 83
84 <van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" /> 84 <van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" />
85 85
86 - <!-- 如果没有实名认证,新增儿童提示弹框 --> 86 + <!-- 实名认证弹框-->
87 - <notice-overlay :show="showNotice" text="前往认证" @on-submit="go('/me/verifyUser')" @on-close="onClose"> 87 + <notice-overlay-module :show="showNotice" :type="USER_STATUS.NON_VERIFIED" @on-submit="go('/me/verifyUser')" @on-close="onClose" />
88 - <div style="color: #333333;">
89 - <p>您还没有实名认证</p>
90 - <p>请前往个人中心进行实名认证</p>
91 - </div>
92 - </notice-overlay>
93 </template> 88 </template>
94 89
95 <script setup> 90 <script setup>
96 import { ref, onMounted } from 'vue' 91 import { ref, onMounted } from 'vue'
97 import { useRouter } from 'vue-router' 92 import { useRouter } from 'vue-router'
98 import { _ } from '@/utils/generatePackage.js' 93 import { _ } from '@/utils/generatePackage.js'
99 -import { MyButton, NoticeOverlay } from '@/utils/generateModules.js' 94 +import { MyButton, NoticeOverlayModule } from '@/utils/generateModules.js'
100 import { icon_avatar } from '@/utils/generateIcons.js' 95 import { icon_avatar } from '@/utils/generateIcons.js'
101 import { changePerformerAPI, myInfoAPI, myPerformerAPI } from '@/api/C/me.js' 96 import { changePerformerAPI, myInfoAPI, myPerformerAPI } from '@/api/C/me.js'
102 import meRoute from '@/router/routes/modules/me' 97 import meRoute from '@/router/routes/modules/me'
...@@ -104,6 +99,7 @@ import meRoute from '@/router/routes/modules/me' ...@@ -104,6 +99,7 @@ import meRoute from '@/router/routes/modules/me'
104 import { styleObject7, styleObject4, styleObject5, styleObject6 } from '@/settings/designSetting.js' 99 import { styleObject7, styleObject4, styleObject5, styleObject6 } from '@/settings/designSetting.js'
105 import { useGo } from '@/hooks/useGo' 100 import { useGo } from '@/hooks/useGo'
106 import { killPages } from '@/hooks/useKeepAlive' 101 import { killPages } from '@/hooks/useKeepAlive'
102 +import { USER_STATUS } from '@/constant'
107 103
108 const go = useGo(); 104 const go = useGo();
109 const $router = useRouter(); 105 const $router = useRouter();
......