Showing
4 changed files
with
63 additions
and
34 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-05-26 21:16:59 | 3 | * @Date: 2022-05-26 21:16:59 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-10 11:49:04 | 5 | + * @LastEditTime: 2022-06-10 13:30:31 |
| 6 | * @FilePath: /tswj/src/api/C/perf.js | 6 | * @FilePath: /tswj/src/api/C/perf.js |
| 7 | * @Description: 用户相关API | 7 | * @Description: 用户相关API |
| 8 | */ | 8 | */ |
| ... | @@ -13,6 +13,7 @@ const Api = { | ... | @@ -13,6 +13,7 @@ const Api = { |
| 13 | ADD_FOLLOW: '/srv/?a=add_follow', | 13 | ADD_FOLLOW: '/srv/?a=add_follow', |
| 14 | ADD_COMMENT: '/srv/?a=add_comment', | 14 | ADD_COMMENT: '/srv/?a=add_comment', |
| 15 | ADD_REPLY: '/srv/?a=add_reply', | 15 | ADD_REPLY: '/srv/?a=add_reply', |
| 16 | + MY_COMMENT_TIME: '/srv/?a=my_comment_time', | ||
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| ... | @@ -42,3 +43,11 @@ export const addCommentAPI = (params) => fn(fetch.post(Api.ADD_COMMENT, params)) | ... | @@ -42,3 +43,11 @@ export const addCommentAPI = (params) => fn(fetch.post(Api.ADD_COMMENT, params)) |
| 42 | * @returns | 43 | * @returns |
| 43 | */ | 44 | */ |
| 44 | export const addReplyAPI = (params) => fn(fetch.post(Api.ADD_REPLY, params)); | 45 | export const addReplyAPI = (params) => fn(fetch.post(Api.ADD_REPLY, params)); |
| 46 | + | ||
| 47 | +/** | ||
| 48 | + * @description: 更新用户留言事件 | ||
| 49 | + * @summary 处理留言已读未读问题 | ||
| 50 | + * @param {String} optr_type 操作类型 my_comment | atme_comment | ||
| 51 | + * @returns | ||
| 52 | + */ | ||
| 53 | +export const myCommentTimeAPI = (params) => fn(fetch.post(Api.MY_COMMENT_TIME, params)); | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | <van-col span="4" style="text-align: center;"> | 14 | <van-col span="4" style="text-align: center;"> |
| 15 | <p style="color: #333333; position: relative; text-align: right;" @click="setComment(item, 'reply')"> | 15 | <p style="color: #333333; position: relative; text-align: right;" @click="setComment(item, 'reply')"> |
| 16 | 回复 | 16 | 回复 |
| 17 | - <span class="spot">·</span> | 17 | + <span v-if="item.is_new" class="spot">·</span> |
| 18 | </p> | 18 | </p> |
| 19 | <p>2-25</p> | 19 | <p>2-25</p> |
| 20 | </van-col> | 20 | </van-col> |
| ... | @@ -53,22 +53,27 @@ | ... | @@ -53,22 +53,27 @@ |
| 53 | </template> | 53 | </template> |
| 54 | 54 | ||
| 55 | <script setup> | 55 | <script setup> |
| 56 | -import { mainStore } from '@/store' | 56 | +// import { mainStore } from '@/store' |
| 57 | -// import icon_player from '@images/bofang@2x.png' | ||
| 58 | import { no_image, icon_avatar } from '@/utils/generateIcons.js' | 57 | import { no_image, icon_avatar } from '@/utils/generateIcons.js' |
| 59 | import CommentBox from '@/components/CommentBox/index.vue' | 58 | import CommentBox from '@/components/CommentBox/index.vue' |
| 60 | import { ref, onActivated } from 'vue' | 59 | import { ref, onActivated } from 'vue' |
| 61 | -import { useRoute, useRouter } from 'vue-router' | 60 | +import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' |
| 62 | -import axios from '@/utils/axios'; | 61 | +// import axios from '@/utils/axios'; |
| 63 | import _ from 'lodash' | 62 | import _ from 'lodash' |
| 64 | import { Toast } from 'vant'; | 63 | import { Toast } from 'vant'; |
| 65 | -import { addPages, store } from '@/hooks/useKeepAlive' | 64 | +// import { addPages, store } from '@/hooks/useKeepAlive' |
| 66 | import { myAtmeAPI } from '@/api/C/me' | 65 | import { myAtmeAPI } from '@/api/C/me' |
| 67 | import { addCommentAPI, addReplyAPI } from '@/api/C/perf' | 66 | import { addCommentAPI, addReplyAPI } from '@/api/C/perf' |
| 67 | +import { myCommentTimeAPI } from '@/api/C/perf' | ||
| 68 | 68 | ||
| 69 | const $route = useRoute(); | 69 | const $route = useRoute(); |
| 70 | const $router = useRouter(); | 70 | const $router = useRouter(); |
| 71 | 71 | ||
| 72 | +onBeforeRouteLeave(async () => { | ||
| 73 | + // 更新留言阅读情况 | ||
| 74 | + await myCommentTimeAPI({ optr_type: 'atme_comment' }); | ||
| 75 | +}) | ||
| 76 | + | ||
| 72 | const loading = ref(false); | 77 | const loading = ref(false); |
| 73 | const finished = ref(false); | 78 | const finished = ref(false); |
| 74 | const commentList = ref([]) | 79 | const commentList = ref([]) | ... | ... |
| ... | @@ -4,7 +4,8 @@ | ... | @@ -4,7 +4,8 @@ |
| 4 | <div class="info"> | 4 | <div class="info"> |
| 5 | <van-row> | 5 | <van-row> |
| 6 | <van-col> | 6 | <van-col> |
| 7 | - <van-image round width="50" height="50" :src="userInfo.avatar ? userInfo.avatar : icon_avatar" style="padding-right: 1rem;" @click="handleUser('EDIT')" /> | 7 | + <van-image round width="50" height="50" :src="userInfo.avatar ? userInfo.avatar : icon_avatar" |
| 8 | + style="padding-right: 1rem;" @click="handleUser('EDIT')" /> | ||
| 8 | </van-col> | 9 | </van-col> |
| 9 | <van-col class="text-wrapper" span="18"> | 10 | <van-col class="text-wrapper" span="18"> |
| 10 | <div> | 11 | <div> |
| ... | @@ -35,9 +36,10 @@ | ... | @@ -35,9 +36,10 @@ |
| 35 | <van-col span="1" class="divide">|</van-col> | 36 | <van-col span="1" class="divide">|</van-col> |
| 36 | <van-col span="5" @click="go('/me/unwatchList')"> | 37 | <van-col span="5" @click="go('/me/unwatchList')"> |
| 37 | <p class="tap-color">未看</p> | 38 | <p class="tap-color">未看</p> |
| 38 | - <p> | 39 | + <!-- <p> |
| 39 | <van-tag round color="red">{{ userInfo.unplay_num }}</van-tag> | 40 | <van-tag round color="red">{{ userInfo.unplay_num }}</van-tag> |
| 40 | - </p> | 41 | + </p> --> |
| 42 | + <p>{{ userInfo.unplay_num }}</p> | ||
| 41 | </van-col> | 43 | </van-col> |
| 42 | </van-row> | 44 | </van-row> |
| 43 | </div> | 45 | </div> |
| ... | @@ -45,23 +47,32 @@ | ... | @@ -45,23 +47,32 @@ |
| 45 | 47 | ||
| 46 | <div class="van-hairline--bottom sub-handle"> | 48 | <div class="van-hairline--bottom sub-handle"> |
| 47 | <div> | 49 | <div> |
| 48 | - <my-button v-if="userInfo.status === 'apply'" type="custom" :custom-style="styleObject4" @on-click="go('/me/verifyUser', { kg_id: userInfo.kg_id, kg_name: userInfo.kg_name })">实名认证</my-button> | 50 | + <my-button v-if="userInfo.status === 'apply'" type="custom" :custom-style="styleObject4" |
| 51 | + @on-click="go('/me/verifyUser', { kg_id: userInfo.kg_id, kg_name: userInfo.kg_name })"> | ||
| 52 | + 实名认证 | ||
| 53 | + </my-button> | ||
| 49 | <my-button v-else type="custom" :custom-style="styleObject5">已认证</my-button> | 54 | <my-button v-else type="custom" :custom-style="styleObject5">已认证</my-button> |
| 50 | </div> | 55 | </div> |
| 51 | <div> | 56 | <div> |
| 52 | - <my-button v-if="userInfo.status === 'enable'" type="custom" :custom-style="styleObject7" @on-click="handleUser('ADD')">新增儿童</my-button> | 57 | + <my-button v-if="userInfo.status === 'enable'" type="custom" :custom-style="styleObject7" |
| 58 | + @on-click="handleUser('ADD')"> | ||
| 59 | + 新增儿童 | ||
| 60 | + </my-button> | ||
| 53 | <my-button v-else type="custom" :custom-style="styleObject6" @on-click="showNotice = true">新增儿童</my-button> | 61 | <my-button v-else type="custom" :custom-style="styleObject6" @on-click="showNotice = true">新增儿童</my-button> |
| 54 | </div> | 62 | </div> |
| 55 | </div> | 63 | </div> |
| 56 | 64 | ||
| 57 | <template v-for="(item, key) in itemList" :key="key"> | 65 | <template v-for="(item, key) in itemList" :key="key"> |
| 58 | - <div class="van-hairline--bottom item-list" @click="go(item.to, { kg_id: userInfo.kg_id, kg_name: userInfo.kg_name })"> | 66 | + <div class="van-hairline--bottom item-list" |
| 67 | + @click="go(item.to, { kg_id: userInfo.kg_id, kg_name: userInfo.kg_name })"> | ||
| 59 | <van-row> | 68 | <van-row> |
| 60 | <van-col span="12">{{ item.name }}</van-col> | 69 | <van-col span="12">{{ item.name }}</van-col> |
| 61 | <van-col span="12" style="text-align: right; color: #777777;"> | 70 | <van-col span="12" style="text-align: right; color: #777777;"> |
| 62 | - <span v-if="!item.tag">{{ item.sum }} </span> | 71 | + <span v-if="item.tag"> |
| 72 | + <van-tag v-if="item.sum" round color="red">{{ item.sum }}</van-tag> | ||
| 73 | + </span> | ||
| 63 | <span v-else> | 74 | <span v-else> |
| 64 | - <van-tag round color="red">{{ item.sum }}</van-tag> | 75 | + {{ item.sum }} |
| 65 | </span> | 76 | </span> |
| 66 | <van-icon name="arrow" /> | 77 | <van-icon name="arrow" /> |
| 67 | </van-col> | 78 | </van-col> | ... | ... |
| ... | @@ -13,15 +13,18 @@ | ... | @@ -13,15 +13,18 @@ |
| 13 | <p>{{ item.kg_name }}</p> | 13 | <p>{{ item.kg_name }}</p> |
| 14 | </van-col> | 14 | </van-col> |
| 15 | <van-col span="5" style="text-align: right;"> | 15 | <van-col span="5" style="text-align: right;"> |
| 16 | - <p style="color: #333333;" @click="deleteComment(item.id)">删除</p> | 16 | + <p style="color: #333333; position: relative;" @click="deleteComment(item.id)"> |
| 17 | + 删除 | ||
| 18 | + <span v-if="item.is_new" class="spot">·</span> | ||
| 19 | + </p> | ||
| 17 | <p>{{ item.comment_time }}</p> | 20 | <p>{{ item.comment_time }}</p> |
| 18 | </van-col> | 21 | </van-col> |
| 19 | </van-row> | 22 | </van-row> |
| 20 | <van-row> | 23 | <van-row> |
| 21 | <van-col> | 24 | <van-col> |
| 22 | <span style="color: #222222;">{{ item.c_action }}<span style="color: #0B3A72;">@{{ item.c_name }}</span>:{{ | 25 | <span style="color: #222222;">{{ item.c_action }}<span style="color: #0B3A72;">@{{ item.c_name }}</span>:{{ |
| 23 | - item.note | 26 | + item.note |
| 24 | - }}</span> | 27 | + }}</span> |
| 25 | </van-col> | 28 | </van-col> |
| 26 | </van-row> | 29 | </van-row> |
| 27 | </div> | 30 | </div> |
| ... | @@ -29,8 +32,7 @@ | ... | @@ -29,8 +32,7 @@ |
| 29 | <div class="raw-ref" @click="goToVideoDetail(item)"> | 32 | <div class="raw-ref" @click="goToVideoDetail(item)"> |
| 30 | <van-row> | 33 | <van-row> |
| 31 | <van-col span="8" class="image"> | 34 | <van-col span="8" class="image"> |
| 32 | - <van-image width="8rem" height="5rem" fit="cover" :src="item.cover" | 35 | + <van-image width="8rem" height="5rem" fit="cover" :src="item.cover" style="vertical-align: text-bottom;"> |
| 33 | - style="vertical-align: text-bottom;"> | ||
| 34 | <template #error>加载失败</template> | 36 | <template #error>加载失败</template> |
| 35 | </van-image> | 37 | </van-image> |
| 36 | <!-- <div style="position: absolute; top: 2rem; left: 3rem;"> | 38 | <!-- <div style="position: absolute; top: 2rem; left: 3rem;"> |
| ... | @@ -50,24 +52,20 @@ | ... | @@ -50,24 +52,20 @@ |
| 50 | 52 | ||
| 51 | <script lang="ts" setup> | 53 | <script lang="ts" setup> |
| 52 | // import { mainStore } from '@/store' | 54 | // import { mainStore } from '@/store' |
| 53 | - | 55 | +import { no_image, icon_avatar } from '@/utils/generateIcons.js' |
| 54 | -// import icon_player from '@images/bofang@2x.png' | ||
| 55 | -import no_image from '@images/que-shuju@2x.png' | ||
| 56 | -import icon_avatar from '@images/que-touxiang@2x.png' | ||
| 57 | - | ||
| 58 | import { ref, onActivated } from 'vue' | 56 | import { ref, onActivated } from 'vue' |
| 59 | -// import { useRouter } from 'vue-router' | 57 | +import { onBeforeRouteLeave } from 'vue-router' |
| 60 | -// import axios from '@/utils/axios'; | ||
| 61 | import _ from 'lodash' | 58 | import _ from 'lodash' |
| 62 | import { Toast, Dialog } from 'vant'; | 59 | import { Toast, Dialog } from 'vant'; |
| 63 | // import { addPages } from '@/hooks/useKeepAlive' | 60 | // import { addPages } from '@/hooks/useKeepAlive' |
| 64 | - | ||
| 65 | import goToVideoDetail from '@/router/methods/videoDetail' | 61 | import goToVideoDetail from '@/router/methods/videoDetail' |
| 62 | +import { myCommentAPI, delCommentAPI } from '@/api/C/me' | ||
| 63 | +import { myCommentTimeAPI } from '@/api/C/perf' | ||
| 66 | 64 | ||
| 67 | -import { myCommentAPI, delCommentAPI } from '@/api/C/me.js' | 65 | +onBeforeRouteLeave(async () => { |
| 68 | - | 66 | + // 更新留言阅读情况 |
| 69 | -// const $route = useRoute(); | 67 | + await myCommentTimeAPI({ optr_type: 'my_comment' }); |
| 70 | -// const $router = useRouter(); | 68 | +}) |
| 71 | 69 | ||
| 72 | // 我的留言接口联调 | 70 | // 我的留言接口联调 |
| 73 | const loading = ref(false); | 71 | const loading = ref(false); |
| ... | @@ -88,6 +86,7 @@ interface commentListType { | ... | @@ -88,6 +86,7 @@ interface commentListType { |
| 88 | perf_name: string; | 86 | perf_name: string; |
| 89 | book_name: string; | 87 | book_name: string; |
| 90 | localism_type: string; | 88 | localism_type: string; |
| 89 | + is_new: number; | ||
| 91 | } | 90 | } |
| 92 | const commentList = ref<commentListType[]>([]) | 91 | const commentList = ref<commentListType[]>([]) |
| 93 | let limit = ref(10); | 92 | let limit = ref(10); |
| ... | @@ -96,7 +95,6 @@ let offset = ref(0) | ... | @@ -96,7 +95,6 @@ let offset = ref(0) |
| 96 | // 因为不能让空图标提前出来的写法 | 95 | // 因为不能让空图标提前出来的写法 |
| 97 | const finishedTextStatus = ref(false); | 96 | const finishedTextStatus = ref(false); |
| 98 | const emptyStatus = ref(false); | 97 | const emptyStatus = ref(false); |
| 99 | - | ||
| 100 | const onLoad = async () => { | 98 | const onLoad = async () => { |
| 101 | const { data } = await myCommentAPI({ limit: limit.value, offset: offset.value }); | 99 | const { data } = await myCommentAPI({ limit: limit.value, offset: offset.value }); |
| 102 | // | 100 | // |
| ... | @@ -166,7 +164,6 @@ onActivated(() => { // keepAlive 重置后执行回调 | ... | @@ -166,7 +164,6 @@ onActivated(() => { // keepAlive 重置后执行回调 |
| 166 | color: #999999; | 164 | color: #999999; |
| 167 | padding: 1rem; | 165 | padding: 1rem; |
| 168 | line-height: 1.75; | 166 | line-height: 1.75; |
| 169 | - | ||
| 170 | .reply-wrapper { | 167 | .reply-wrapper { |
| 171 | background: #F7F7F7; | 168 | background: #F7F7F7; |
| 172 | border-radius: 10px; | 169 | border-radius: 10px; |
| ... | @@ -178,6 +175,13 @@ onActivated(() => { // keepAlive 重置后执行回调 | ... | @@ -178,6 +175,13 @@ onActivated(() => { // keepAlive 重置后执行回调 |
| 178 | color: #222222; | 175 | color: #222222; |
| 179 | } | 176 | } |
| 180 | } | 177 | } |
| 178 | + .spot { | ||
| 179 | + color: red; | ||
| 180 | + font-size: 2rem; | ||
| 181 | + position: absolute; | ||
| 182 | + right: -0.5rem; | ||
| 183 | + top: -1.75rem; | ||
| 184 | + } | ||
| 181 | } | 185 | } |
| 182 | 186 | ||
| 183 | .raw-ref { | 187 | .raw-ref { | ... | ... |
-
Please register or login to post a comment