hookehuyr

✨ feat: 完善用户没有实名认证和添加儿童时的操作跳转

...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
26 <div class="comment-wrapper"> 26 <div class="comment-wrapper">
27 <van-row style="font-size: 0.9rem;"> 27 <van-row style="font-size: 0.9rem;">
28 <van-col span="4"> 28 <van-col span="4">
29 - <van-image round width="3rem" height="3rem" 29 + <van-image round width="3rem" height="3rem" :src="item.avatar ? item.avatar : icon_avatar" />
30 - :src="item.avatar ? item.avatar : icon_avatar" />
31 </van-col> 30 </van-col>
32 <van-col span="14"> 31 <van-col span="14">
33 <p>{{ item.name }}</p> 32 <p>{{ item.name }}</p>
...@@ -53,10 +52,9 @@ ...@@ -53,10 +52,9 @@
53 </van-popup> 52 </van-popup>
54 53
55 <!-- 写评论时,如果没有实名认证提示弹框 --> 54 <!-- 写评论时,如果没有实名认证提示弹框 -->
56 - <notice-overlay :show="showNotice" text="前往认证" @on-submit="onSubmit" @on-close="onClose"> 55 + <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose">
57 <div style="color: #333333;"> 56 <div style="color: #333333;">
58 - <p>您还没有实名认证</p> 57 + <div v-html="noticeHtml" />
59 - <p>请前往个人中心进行实名认证</p>
60 </div> 58 </div>
61 </notice-overlay> 59 </notice-overlay>
62 </template> 60 </template>
...@@ -102,17 +100,32 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为 ...@@ -102,17 +100,32 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为
102 * @param {*} v 单行评论数据 100 * @param {*} v 单行评论数据
103 * @param {*} type 类型 comment 为评论/类型 reply 为回复 101 * @param {*} type 类型 comment 为评论/类型 reply 为回复
104 */ 102 */
103 +const noticeText = ref('')
104 +const noticeHtml = ref('')
105 const commentId = ref('') 105 const commentId = ref('')
106 const replayUser = ref('') 106 const replayUser = ref('')
107 const setComment = (v, type) => { // 107 const setComment = (v, type) => { //
108 - if (userInfo.value.can_upload) { 108 + if (userInfo.value.can_upload === 1) {
109 showCommentBoxPopup.value = true; 109 showCommentBoxPopup.value = true;
110 commentType.value = type; 110 commentType.value = type;
111 replayUser.value = v.name; 111 replayUser.value = v.name;
112 commentId.value = props.data.id; 112 commentId.value = props.data.id;
113 - } else { 113 + } else if (userInfo.value.can_upload === -1) { // 未实名认证
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) { // 没有默认儿童
114 closeBtn(); 122 closeBtn();
115 showNotice.value = true; 123 showNotice.value = true;
124 + noticeText.value = '前往新增'
125 + noticeHtml.value = `
126 + <p>您还没有新增儿童</p>
127 + <p>请前往个人中心进行新增</p>
128 + `
116 } 129 }
117 } 130 }
118 131
...@@ -168,9 +181,28 @@ const onClose = () => { // 关闭提示框回调 ...@@ -168,9 +181,28 @@ const onClose = () => { // 关闭提示框回调
168 } 181 }
169 // 跳转个人中心 182 // 跳转个人中心
170 const onSubmit = () => { 183 const onSubmit = () => {
184 + setTimeout(() => {
185 + showNotice.value = false;
186 + }, 1000);
187 + if (userInfo.value.can_upload === -1) { // 未实名认证
171 $router.push({ 188 $router.push({
172 - path: '/me/verifyUser' 189 + path: '/me/verifyUser',
190 + query: {
191 + back_url: $route.fullPath
192 + }
173 }); 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 + }
174 } 206 }
175 207
176 const show = ref(false); 208 const show = ref(false);
...@@ -209,6 +241,8 @@ const onLoad = () => { ...@@ -209,6 +241,8 @@ const onLoad = () => {
209 if (!replyList.value.length) { 241 if (!replyList.value.length) {
210 finishedTextStatus.value = false; 242 finishedTextStatus.value = false;
211 emptyStatus.value = true; 243 emptyStatus.value = true;
244 + } else {
245 + emptyStatus.value = false;
212 } 246 }
213 } else { 247 } else {
214 console.warn(res); 248 console.warn(res);
......
...@@ -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-09 15:23:36 5 + * @LastEditTime: 2022-06-09 16:34:04
6 * @FilePath: /tswj/src/views/client/bookDetail.vue 6 * @FilePath: /tswj/src/views/client/bookDetail.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -143,7 +143,7 @@ const $route = useRoute(); ...@@ -143,7 +143,7 @@ const $route = useRoute();
143 const $router = useRouter(); 143 const $router = useRouter();
144 144
145 const { toggleLanguage, onLoad, columns, prod_list, finished, loading, bookInfo, showPicker, checkLocalism, checkMandarin, onConfirm, chooseLanguage, finishedTextStatus, emptyStatus } = useVideoList(); 145 const { toggleLanguage, onLoad, columns, prod_list, finished, loading, bookInfo, showPicker, checkLocalism, checkMandarin, onConfirm, chooseLanguage, finishedTextStatus, emptyStatus } = useVideoList();
146 -const { userInfo } = useDefaultPerf($route.query.id); 146 +let { userInfo } = useDefaultPerf($route.query.id);
147 147
148 const donateInfo = ref({}) 148 const donateInfo = ref({})
149 const userType = Cookies.get('userType') 149 const userType = Cookies.get('userType')
...@@ -205,9 +205,15 @@ const onClose = () => { // 关闭提示框回调 ...@@ -205,9 +205,15 @@ const onClose = () => { // 关闭提示框回调
205 } 205 }
206 // 跳转个人中心 206 // 跳转个人中心
207 const onSubmit = () => { 207 const onSubmit = () => {
208 + setTimeout(() => {
209 + showNotice.value = false;
210 + }, 1000);
208 if (userInfo.value.can_upload === -1) { // 未实名认证 211 if (userInfo.value.can_upload === -1) { // 未实名认证
209 $router.push({ 212 $router.push({
210 - path: '/me/verifyUser' 213 + path: '/me/verifyUser',
214 + query: {
215 + back_url: $route.fullPath
216 + }
211 }); 217 });
212 } else if (userInfo.value.can_upload === -2) { // 没有默认儿童 218 } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
213 $router.push({ 219 $router.push({
...@@ -216,7 +222,8 @@ const onSubmit = () => { ...@@ -216,7 +222,8 @@ const onSubmit = () => {
216 perf_id: '', 222 perf_id: '',
217 kg_id: '', 223 kg_id: '',
218 kg_name: '', 224 kg_name: '',
219 - type: 'ADD' 225 + type: 'ADD',
226 + back_url: $route.fullPath
220 } 227 }
221 }); 228 });
222 } 229 }
...@@ -302,6 +309,9 @@ onActivated(() => { // keepAlive 重置后执行回调 ...@@ -302,6 +309,9 @@ onActivated(() => { // keepAlive 重置后执行回调
302 309
303 // 更新页面名称,因为不刷新副作用~ 310 // 更新页面名称,因为不刷新副作用~
304 document.title = $route.meta.title; 311 document.title = $route.meta.title;
312 + // 更新是否实名认证和儿童信息
313 + const data = useDefaultPerf($route.query.id);
314 + userInfo = data.userInfo;
305 }); 315 });
306 316
307 onBeforeRouteLeave(() => { 317 onBeforeRouteLeave(() => {
......
1 <template> 1 <template>
2 <div class=""> 2 <div class="">
3 - <van-list v-model:loading="loading" :finished="finished" :finished-text="finishedTextStatus ? '没有更多了' : ''" @load="onLoad" :immediate-check="false"> 3 + <van-list v-model:loading="loading" :finished="finished" :finished-text="finishedTextStatus ? '没有更多了' : ''"
4 + @load="onLoad" :immediate-check="false">
4 <template v-for="(item, key) in commentList" :key="key"> 5 <template v-for="(item, key) in commentList" :key="key">
5 <div class="comment-wrapper"> 6 <div class="comment-wrapper">
6 <van-row style="font-size: 0.9rem;"> 7 <van-row style="font-size: 0.9rem;">
...@@ -26,7 +27,8 @@ ...@@ -26,7 +27,8 @@
26 <van-col offset="4" span="20"> 27 <van-col offset="4" span="20">
27 <div v-if="item.total" class="reply-wrapper"> 28 <div v-if="item.total" class="reply-wrapper">
28 <template v-for="(reply, index) in item.reply_list" :key="index"> 29 <template v-for="(reply, index) in item.reply_list" :key="index">
29 - <p v-if="reply.reply_to"><span>{{ reply.name }}</span>&nbsp;回复&nbsp;<span>@{{ reply.reply_to }}:</span><span class="content">{{ reply.note }}</span></p> 30 + <p v-if="reply.reply_to"><span>{{ reply.name }}</span>&nbsp;回复&nbsp;<span>@{{ reply.reply_to
31 + }}:</span><span class="content">{{ reply.note }}</span></p>
30 <p v-else><span>{{ reply.name }}:</span><span class="content">{{ reply.note }}</span></p> 32 <p v-else><span>{{ reply.name }}:</span><span class="content">{{ reply.note }}</span></p>
31 </template> 33 </template>
32 <p @click="getReplyList(item)">共{{ item.total }}条回复 ></p> 34 <p @click="getReplyList(item)">共{{ item.total }}条回复 ></p>
...@@ -36,25 +38,21 @@ ...@@ -36,25 +38,21 @@
36 </div> 38 </div>
37 </template> 39 </template>
38 </van-list> 40 </van-list>
39 - <van-empty v-if="emptyStatus" 41 + <van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无留言" />
40 - class="custom-image"
41 - :image="no_image"
42 - description="暂无留言"
43 - />
44 <div style="height: 5rem;"></div> 42 <div style="height: 5rem;"></div>
45 <div class="reply-btn" @click="setComment('', 'comment')"> 43 <div class="reply-btn" @click="setComment('', 'comment')">
46 <div class="text">写下你友善的留言</div> 44 <div class="text">写下你友善的留言</div>
47 </div> 45 </div>
48 </div> 46 </div>
49 47
50 - <comment-list :showPopup="showCommentListPopup" :data="commentData" @on-close="closeCommentList"></comment-list> 48 + <comment-list :show-popup="showCommentListPopup" :data="commentData" @on-close="closeCommentList" />
51 - <comment-box :showPopup="showCommentBoxPopup" :type="commentType" :replayUser="replayUser" @on-submit="submitCommentBox" @on-close="closeCommentBox"></comment-box> 49 + <comment-box :show-popup="showCommentBoxPopup" :type="commentType" :replay-user="replayUser"
50 + @on-submit="submitCommentBox" @on-close="closeCommentBox" />
52 51
53 <!-- 写评论时,如果没有实名认证提示弹框 --> 52 <!-- 写评论时,如果没有实名认证提示弹框 -->
54 - <notice-overlay :show="showNotice" text="前往认证" @on-submit="onSubmit" @on-close="onClose"> 53 + <notice-overlay :show="showNotice" :text="noticeText" @on-submit="onSubmit" @on-close="onClose">
55 <div style="color: #333333;"> 54 <div style="color: #333333;">
56 - <p>您还没有实名认证</p> 55 + <div v-html="noticeHtml" />
57 - <p>请前往个人中心进行实名认证</p>
58 </div> 56 </div>
59 </notice-overlay> 57 </notice-overlay>
60 </template> 58 </template>
...@@ -119,6 +117,8 @@ const onLoad = () => { ...@@ -119,6 +117,8 @@ const onLoad = () => {
119 if (!commentList.value.length) { 117 if (!commentList.value.length) {
120 finishedTextStatus.value = false; 118 finishedTextStatus.value = false;
121 emptyStatus.value = true; 119 emptyStatus.value = true;
120 + } else {
121 + emptyStatus.value = false;
122 } 122 }
123 } else { 123 } else {
124 console.warn(res); 124 console.warn(res);
...@@ -169,9 +169,28 @@ const onClose = () => { // 关闭提示框回调 ...@@ -169,9 +169,28 @@ const onClose = () => { // 关闭提示框回调
169 } 169 }
170 // 跳转个人中心 170 // 跳转个人中心
171 const onSubmit = () => { 171 const onSubmit = () => {
172 + setTimeout(() => {
173 + showNotice.value = false;
174 + }, 1000);
175 + if (userInfo.value.can_upload === -1) { // 未实名认证
172 $router.push({ 176 $router.push({
173 - path: '/me/verifyUser' 177 + path: '/me/verifyUser',
178 + query: {
179 + back_url: $route.fullPath
180 + }
181 + });
182 + } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
183 + $router.push({
184 + path: '/me/handleUser',
185 + query: {
186 + perf_id: '',
187 + kg_id: '',
188 + kg_name: '',
189 + type: 'ADD',
190 + back_url: $route.fullPath
191 + }
174 }); 192 });
193 + }
175 } 194 }
176 195
177 196
...@@ -185,16 +204,30 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为 ...@@ -185,16 +204,30 @@ const commentType = ref('comment'); // 类型 comment 为评论/类型 reply 为
185 * @param {*} v 单行评论数据 204 * @param {*} v 单行评论数据
186 * @param {*} type 类型 comment 为评论/类型 reply 为回复 205 * @param {*} type 类型 comment 为评论/类型 reply 为回复
187 */ 206 */
207 +const noticeText = ref('')
208 +const noticeHtml = ref('')
188 const commentId = ref('') 209 const commentId = ref('')
189 const replayUser = ref('') 210 const replayUser = ref('')
190 const setComment = (v, type) => { 211 const setComment = (v, type) => {
191 - if (userInfo.value.can_upload) { 212 + if (userInfo.value.can_upload === 1) {
192 showCommentBoxPopup.value = true; 213 showCommentBoxPopup.value = true;
193 commentType.value = type; 214 commentType.value = type;
194 replayUser.value = v.name; 215 replayUser.value = v.name;
195 commentId.value = v.id; 216 commentId.value = v.id;
196 - } else { 217 + } else if (userInfo.value.can_upload === -1) { // 未实名认证
197 showNotice.value = true; 218 showNotice.value = true;
219 + noticeText.value = '前往认证'
220 + noticeHtml.value = `
221 + <p>您还没有实名认证</p>
222 + <p>请前往个人中心进行实名认证</p>
223 + `
224 + } else if (userInfo.value.can_upload === -2) { // 没有默认儿童
225 + showNotice.value = true;
226 + noticeText.value = '前往新增'
227 + noticeHtml.value = `
228 + <p>您还没有新增儿童</p>
229 + <p>请前往个人中心进行新增</p>
230 + `
198 } 231 }
199 } 232 }
200 233
...@@ -221,8 +254,8 @@ const submitCommentBox = (note) => { ...@@ -221,8 +254,8 @@ const submitCommentBox = (note) => {
221 } 254 }
222 axios.post(`/srv/?a=${url}`, data) 255 axios.post(`/srv/?a=${url}`, data)
223 .then(res => { 256 .then(res => {
224 - if (res.data.code === 1) {
225 showCommentBoxPopup.value = false; 257 showCommentBoxPopup.value = false;
258 + if (res.data.code === 1) {
226 Toast.success('发布成功') 259 Toast.success('发布成功')
227 // 刷新列表 260 // 刷新列表
228 if (commentType.value === 'comment') { 261 if (commentType.value === 'comment') {
......
...@@ -134,8 +134,12 @@ const saveInfo = () => { ...@@ -134,8 +134,12 @@ const saveInfo = () => {
134 message: '保存成功', 134 message: '保存成功',
135 duration: 1000, 135 duration: 1000,
136 onClose: () => { 136 onClose: () => {
137 + if ($route.query.back_url) {
138 + $router.push($route.query.back_url)
139 + } else {
137 $router.go(-1) 140 $router.go(-1)
138 } 141 }
142 + }
139 }); 143 });
140 } else { 144 } else {
141 console.warn(res); 145 console.warn(res);
......
...@@ -44,11 +44,12 @@ import MyButton from '@/components/MyButton/index.vue' ...@@ -44,11 +44,12 @@ import MyButton from '@/components/MyButton/index.vue'
44 import { wxInfo } from '@/utils/tools'; 44 import { wxInfo } from '@/utils/tools';
45 45
46 import { ref, onMounted, nextTick } from 'vue' 46 import { ref, onMounted, nextTick } from 'vue'
47 -import { useRouter } from 'vue-router' 47 +import { useRoute, useRouter } from 'vue-router'
48 import axios from '@/utils/axios'; 48 import axios from '@/utils/axios';
49 import { Toast } from 'vant'; 49 import { Toast } from 'vant';
50 import { styleColor } from '@/constant.js'; 50 import { styleColor } from '@/constant.js';
51 51
52 +const $route = useRoute();
52 const $router = useRouter(); 53 const $router = useRouter();
53 54
54 const themeVars = { 55 const themeVars = {
...@@ -178,7 +179,11 @@ const onSubmit = (values) => { ...@@ -178,7 +179,11 @@ const onSubmit = (values) => {
178 .then(res => { 179 .then(res => {
179 if (res.data.code === 1) { 180 if (res.data.code === 1) {
180 Toast.success('录入成功') 181 Toast.success('录入成功')
181 - $router.go(-1); 182 + if ($route.query.back_url) {
183 + $router.push($route.query.back_url)
184 + } else {
185 + $router.go(-1)
186 + }
182 } else { 187 } else {
183 console.warn(res.data); 188 console.warn(res.data);
184 if (!res.data.show) return false; 189 if (!res.data.show) return false;
......