Showing
2 changed files
with
90 additions
and
72 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-18 22:16:10 | 3 | * @Date: 2022-05-18 22:16:10 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-24 22:18:36 | 5 | + * @LastEditTime: 2022-09-06 11:32:16 |
| 6 | * @FilePath: /tswj/src/api/C/me.js | 6 | * @FilePath: /tswj/src/api/C/me.js |
| 7 | * @Description: 我的页面接口操作 | 7 | * @Description: 我的页面接口操作 |
| 8 | */ | 8 | */ |
| ... | @@ -19,12 +19,13 @@ const Api = { | ... | @@ -19,12 +19,13 @@ const Api = { |
| 19 | DEL_COMMENT: '/srv/?a=del_comment', | 19 | DEL_COMMENT: '/srv/?a=del_comment', |
| 20 | MY_SUBSCRIBE: '/srv/?a=my_subscribe', | 20 | MY_SUBSCRIBE: '/srv/?a=my_subscribe', |
| 21 | MY_FOLLOW: '/srv/?a=my_follow', | 21 | MY_FOLLOW: '/srv/?a=my_follow', |
| 22 | + MY_PROD: '/srv/?a=my_prod', | ||
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * @description: 切换儿童角色 | 26 | * @description: 切换儿童角色 |
| 26 | - * @param {*} params | 27 | + * @param {*} params |
| 27 | - * @returns | 28 | + * @returns |
| 28 | */ | 29 | */ |
| 29 | export const changePerformerAPI = (params) => fn(fetch.post(Api.CHANGE_PERFORMER, params)); | 30 | export const changePerformerAPI = (params) => fn(fetch.post(Api.CHANGE_PERFORMER, params)); |
| 30 | 31 | ||
| ... | @@ -37,22 +38,22 @@ export const myInfoAPI = (params) => fn(fetch.get(Api.MY_INFO, params)); | ... | @@ -37,22 +38,22 @@ export const myInfoAPI = (params) => fn(fetch.get(Api.MY_INFO, params)); |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * @description: 角色列表信息 | 40 | * @description: 角色列表信息 |
| 40 | - * @param {*} params | 41 | + * @param {*} params |
| 41 | - * @returns | 42 | + * @returns |
| 42 | */ | 43 | */ |
| 43 | export const myPerformerAPI = (params) => fn(fetch.get(Api.MY_PERFORMER, params)); | 44 | export const myPerformerAPI = (params) => fn(fetch.get(Api.MY_PERFORMER, params)); |
| 44 | 45 | ||
| 45 | /** | 46 | /** |
| 46 | * @description: 点赞列表信息 | 47 | * @description: 点赞列表信息 |
| 47 | - * @param {*} params | 48 | + * @param {*} params |
| 48 | - * @returns | 49 | + * @returns |
| 49 | */ | 50 | */ |
| 50 | export const myLikeAPI = (params) => fn(fetch.get(Api.MY_LIKE, params)); | 51 | export const myLikeAPI = (params) => fn(fetch.get(Api.MY_LIKE, params)); |
| 51 | 52 | ||
| 52 | /** | 53 | /** |
| 53 | * @description: 收藏列表信息 | 54 | * @description: 收藏列表信息 |
| 54 | - * @param {*} params | 55 | + * @param {*} params |
| 55 | - * @returns | 56 | + * @returns |
| 56 | */ | 57 | */ |
| 57 | export const myFavorAPI = (params) => fn(fetch.get(Api.MY_FAVOR, params)); | 58 | export const myFavorAPI = (params) => fn(fetch.get(Api.MY_FAVOR, params)); |
| 58 | 59 | ||
| ... | @@ -60,14 +61,14 @@ export const myFavorAPI = (params) => fn(fetch.get(Api.MY_FAVOR, params)); | ... | @@ -60,14 +61,14 @@ export const myFavorAPI = (params) => fn(fetch.get(Api.MY_FAVOR, params)); |
| 60 | * @description: 用户评论列表 | 61 | * @description: 用户评论列表 |
| 61 | * @param {string} limit | 62 | * @param {string} limit |
| 62 | * @param {string} offset | 63 | * @param {string} offset |
| 63 | - * @returns | 64 | + * @returns |
| 64 | */ | 65 | */ |
| 65 | export const myCommentAPI = (params) => fn(fetch.get(Api.MY_COMMENT, params)); | 66 | export const myCommentAPI = (params) => fn(fetch.get(Api.MY_COMMENT, params)); |
| 66 | 67 | ||
| 67 | /** | 68 | /** |
| 68 | * @description: 删除用户评论 | 69 | * @description: 删除用户评论 |
| 69 | * @param {string} comment_id 评论ID | 70 | * @param {string} comment_id 评论ID |
| 70 | - * @returns | 71 | + * @returns |
| 71 | */ | 72 | */ |
| 72 | export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)); | 73 | export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)); |
| 73 | 74 | ||
| ... | @@ -75,18 +76,24 @@ export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)) | ... | @@ -75,18 +76,24 @@ export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)) |
| 75 | * @description: /@/我的列表 | 76 | * @description: /@/我的列表 |
| 76 | * @param {string} limit | 77 | * @param {string} limit |
| 77 | * @param {string} offset | 78 | * @param {string} offset |
| 78 | - * @returns | 79 | + * @returns |
| 79 | */ | 80 | */ |
| 80 | export const myAtmeAPI = (params) => fn(fetch.get(Api.MY_ATME, params)); | 81 | export const myAtmeAPI = (params) => fn(fetch.get(Api.MY_ATME, params)); |
| 81 | 82 | ||
| 82 | /** | 83 | /** |
| 83 | * @description: 我的订阅 | 84 | * @description: 我的订阅 |
| 84 | - * @returns | 85 | + * @returns |
| 85 | */ | 86 | */ |
| 86 | export const mySubscribeAPI = (params) => fn(fetch.get(Api.MY_SUBSCRIBE, params)); | 87 | export const mySubscribeAPI = (params) => fn(fetch.get(Api.MY_SUBSCRIBE, params)); |
| 87 | 88 | ||
| 88 | /** | 89 | /** |
| 89 | * @description: 我的关注 | 90 | * @description: 我的关注 |
| 90 | - * @returns | 91 | + * @returns |
| 91 | */ | 92 | */ |
| 92 | export const myFollowAPI = (params) => fn(fetch.get(Api.MY_FOLLOW, params)); | 93 | export const myFollowAPI = (params) => fn(fetch.get(Api.MY_FOLLOW, params)); |
| 94 | + | ||
| 95 | +/** | ||
| 96 | + * @description: 我的作品 | ||
| 97 | + * @returns | ||
| 98 | + */ | ||
| 99 | +export const myProdAPI = (params) => fn(fetch.get(Api.MY_PROD, params)); | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div class="book-video-list"> | 2 | <div class="book-video-list"> |
| 3 | - <template v-for="item in prodList" :key="item" style="height: 3rem;"> | 3 | + <van-list |
| 4 | + v-model:loading="loading" | ||
| 5 | + :finished="finished" | ||
| 6 | + :finished-text="finishedTextStatus ? '没有更多了' : ''" | ||
| 7 | + @load="onLoad" | ||
| 8 | + > | ||
| 9 | + <template v-for="item in prodList" :key="item" style="height: 3rem"> | ||
| 10 | + <audit-video-card :item="item"></audit-video-card> | ||
| 11 | + </template> | ||
| 12 | + </van-list> | ||
| 13 | + <!-- <template v-for="item in prodList" :key="item" style="height: 3rem"> | ||
| 4 | <audit-video-card :item="item"></audit-video-card> | 14 | <audit-video-card :item="item"></audit-video-card> |
| 5 | - </template> | 15 | + </template> --> |
| 6 | - <div style="height: 2rem;"></div> | 16 | + <div style="height: 2rem"></div> |
| 7 | </div> | 17 | </div> |
| 8 | - <van-empty v-if="emptyStatus" | 18 | + <van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无作品" /> |
| 9 | - class="custom-image" | ||
| 10 | - :image="no_image" | ||
| 11 | - description="暂无作品" | ||
| 12 | - /> | ||
| 13 | </template> | 19 | </template> |
| 14 | 20 | ||
| 15 | <script setup> | 21 | <script setup> |
| 16 | -import no_image from '@images/que-shuju@2x.png' | 22 | + import no_image from '@images/que-shuju@2x.png'; |
| 17 | -import AuditVideoCard from '@/components/AuditVideoCard/index.vue' | 23 | + import AuditVideoCard from '@/components/AuditVideoCard/index.vue'; |
| 24 | + import _ from 'lodash'; | ||
| 18 | 25 | ||
| 19 | -import { ref } from 'vue' | 26 | + import { myProdAPI } from '@/api/C/me.js'; |
| 20 | -import axios from '@/utils/axios'; | ||
| 21 | -import { Toast } from 'vant'; | ||
| 22 | 27 | ||
| 23 | -// 处理书籍下作品列表 | 28 | + // 处理书籍下作品列表 |
| 24 | -const prodList = ref([]) | 29 | + const prodList = ref([]); |
| 25 | -// 因为不能让空图标提前出来的写法 | 30 | + // 因为不能让空图标提前出来的写法 |
| 26 | -const emptyStatus = ref(false); | 31 | + const emptyStatus = ref(false); |
| 27 | -axios.get('/srv/?a=my_prod') | ||
| 28 | -.then(res => { | ||
| 29 | - if (res.data.code === 1) { | ||
| 30 | - res.data.data.prod.forEach(v => { | ||
| 31 | - v.status = v.status.toUpperCase(); | ||
| 32 | - v.path = 'myVideoList' | ||
| 33 | - }) | ||
| 34 | - prodList.value = res.data.data.prod; | ||
| 35 | - if (!res.data.data.prod.length) { | ||
| 36 | - emptyStatus.value = true; | ||
| 37 | - } else { | ||
| 38 | - emptyStatus.value = false; | ||
| 39 | - } | ||
| 40 | - } else { | ||
| 41 | - console.warn(res); | ||
| 42 | - if (!res.data.show) return false; | ||
| 43 | - Toast({ | ||
| 44 | - icon: 'close', | ||
| 45 | - message: res.data.msg | ||
| 46 | - }); | ||
| 47 | - } | ||
| 48 | -}) | ||
| 49 | -.catch(err => { | ||
| 50 | - console.error(err); | ||
| 51 | -}) | ||
| 52 | -</script> | ||
| 53 | 32 | ||
| 54 | -<script> | 33 | + const limit = ref(10); |
| 55 | -import mixin from 'common/mixin'; | 34 | + const offset = ref(0); |
| 56 | 35 | ||
| 57 | -export default { | 36 | + // 处理书籍下作品列表 |
| 58 | - mixins: [mixin.init], | 37 | + const loading = ref(false); |
| 59 | - data () { | 38 | + const finished = ref(false); |
| 60 | - return { | ||
| 61 | - } | ||
| 62 | - }, | ||
| 63 | - mounted () { | ||
| 64 | 39 | ||
| 65 | - }, | 40 | + // 因为不能让空图标提前出来的写法 |
| 66 | - methods: { | 41 | + const finishedTextStatus = ref(false); |
| 67 | 42 | ||
| 68 | - } | 43 | + /** |
| 69 | -} | 44 | + * 向下滚动查询数据 |
| 45 | + */ | ||
| 46 | + const onLoad = async () => { | ||
| 47 | + // 异步更新数据 | ||
| 48 | + const { data, code } = await myProdAPI({ limit: limit.value, offset: offset.value }); | ||
| 49 | + if (code === 1) { | ||
| 50 | + _.each(data.prod, (item) => { | ||
| 51 | + item.status = item.status.toUpperCase(); | ||
| 52 | + item.path = 'myVideoList'; | ||
| 53 | + }); | ||
| 54 | + prodList.value = _.concat(prodList.value, data.prod); | ||
| 55 | + // prodList.value = _.uniqBy(prodList.value, 'id'); | ||
| 56 | + offset.value = prodList.value.length; | ||
| 57 | + loading.value = false; | ||
| 58 | + // 数据全部加载完成 | ||
| 59 | + if (prodList.value.length === data.prod_num) { | ||
| 60 | + // 加载状态结束 | ||
| 61 | + finished.value = true; | ||
| 62 | + } | ||
| 63 | + // 空数据提示 | ||
| 64 | + if (!prodList.value.length) { | ||
| 65 | + finishedTextStatus.value = false; | ||
| 66 | + } | ||
| 67 | + emptyStatus.value = Object.is(prodList.value.length, 0); | ||
| 68 | + } | ||
| 69 | + }; | ||
| 70 | </script> | 70 | </script> |
| 71 | 71 | ||
| 72 | -<style lang="less" scoped> | 72 | +<script> |
| 73 | + import mixin from 'common/mixin'; | ||
| 74 | + | ||
| 75 | + export default { | ||
| 76 | + mixins: [mixin.init], | ||
| 77 | + data() { | ||
| 78 | + return {}; | ||
| 79 | + }, | ||
| 80 | + mounted() {}, | ||
| 81 | + methods: {}, | ||
| 82 | + }; | ||
| 83 | +</script> | ||
| 73 | 84 | ||
| 74 | -</style> | 85 | +<style lang="less" scoped></style> | ... | ... |
-
Please register or login to post a comment