Showing
2 changed files
with
23 additions
and
54 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-10 11:29:45 | 5 | + * @LastEditTime: 2022-06-24 21:34:23 |
| 6 | * @FilePath: /tswj/src/api/C/me.js | 6 | * @FilePath: /tswj/src/api/C/me.js |
| 7 | * @Description: 我的页面接口操作 | 7 | * @Description: 我的页面接口操作 |
| 8 | */ | 8 | */ |
| ... | @@ -17,6 +17,7 @@ const Api = { | ... | @@ -17,6 +17,7 @@ const Api = { |
| 17 | MY_COMMENT: '/srv/?a=my_comment', | 17 | MY_COMMENT: '/srv/?a=my_comment', |
| 18 | MY_ATME: '/srv/?a=my_atme', | 18 | MY_ATME: '/srv/?a=my_atme', |
| 19 | DEL_COMMENT: '/srv/?a=del_comment', | 19 | DEL_COMMENT: '/srv/?a=del_comment', |
| 20 | + MY_SUBSCRIBE: '/srv/?a=my_subscribe', | ||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| ... | @@ -76,3 +77,9 @@ export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)) | ... | @@ -76,3 +77,9 @@ export const delCommentAPI = (params) => fn(fetch.post(Api.DEL_COMMENT, params)) |
| 76 | * @returns | 77 | * @returns |
| 77 | */ | 78 | */ |
| 78 | export const myAtmeAPI = (params) => fn(fetch.get(Api.MY_ATME, params)); | 79 | export const myAtmeAPI = (params) => fn(fetch.get(Api.MY_ATME, params)); |
| 80 | + | ||
| 81 | +/** | ||
| 82 | + * @description: 我的订阅 | ||
| 83 | + * @returns | ||
| 84 | + */ | ||
| 85 | +export const mySubscribeAPI = (params) => fn(fetch.get(Api.MY_SUBSCRIBE, params)); | ... | ... |
| ... | @@ -2,75 +2,37 @@ | ... | @@ -2,75 +2,37 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-04-28 11:37:47 | 3 | * @Date: 2022-04-28 11:37:47 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-09 16:13:47 | 5 | + * @LastEditTime: 2022-06-24 22:03:38 |
| 6 | * @FilePath: /tswj/src/views/me/subscribe.vue | 6 | * @FilePath: /tswj/src/views/me/subscribe.vue |
| 7 | - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | 7 | + * @Description: |
| 8 | --> | 8 | --> |
| 9 | <template> | 9 | <template> |
| 10 | - <div class="book-list"> | 10 | + <div class="subscribe-list"> |
| 11 | - <template v-for="(item, key) in items" :key="key"> | 11 | + <template v-for="(item) in items" :key="item.id"> |
| 12 | - <book-card type="C" :item="item" @on-click="go('/client/bookDetail', { id: item.id })"></book-card> | 12 | + <book-card :type="USER_ROLE.CLIENT" :item="item" @on-click="go('/client/bookDetail', { id: item.id })" /> |
| 13 | </template> | 13 | </template> |
| 14 | </div> | 14 | </div> |
| 15 | - <van-empty v-if="emptyStatus" | 15 | + <van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无订阅" /> |
| 16 | - class="custom-image" | ||
| 17 | - :image="no_image" | ||
| 18 | - description="暂无订阅" | ||
| 19 | - /> | ||
| 20 | </template> | 16 | </template> |
| 21 | 17 | ||
| 22 | <script setup> | 18 | <script setup> |
| 23 | import no_image from '@images/que-shuju@2x.png' | 19 | import no_image from '@images/que-shuju@2x.png' |
| 24 | import BookCard from '@/components/BookCard/index.vue' | 20 | import BookCard from '@/components/BookCard/index.vue' |
| 25 | -import { ref } from 'vue' | 21 | +import { ref, onMounted } from 'vue' |
| 26 | -import axios from '@/utils/axios'; | ||
| 27 | import { useGo } from '@/hooks/useGo' | 22 | import { useGo } from '@/hooks/useGo' |
| 23 | +import { mySubscribeAPI } from '@/api/C/me' | ||
| 24 | +import { USER_ROLE } from '@/constant' | ||
| 28 | 25 | ||
| 29 | const go = useGo() | 26 | const go = useGo() |
| 30 | -// 因为不能让空图标提前出来的写法 | ||
| 31 | const emptyStatus = ref(false); | 27 | const emptyStatus = ref(false); |
| 32 | - | ||
| 33 | const items = ref([]); | 28 | const items = ref([]); |
| 34 | -axios.get('/srv/?a=my_subscribe') | 29 | +onMounted(async () => { |
| 35 | - .then(res => { | 30 | + const { data, code } = await mySubscribeAPI() |
| 36 | - if (res.data.code === 1) { | 31 | + if (code) { |
| 37 | - items.value = res.data.data; | 32 | + items.value = data; |
| 38 | - if (!res.data.data.length) { | 33 | + emptyStatus.value = data.length ? false : true; |
| 39 | - emptyStatus.value = true; | ||
| 40 | - } else { | ||
| 41 | - emptyStatus.value = false; | ||
| 42 | - } | ||
| 43 | - } else { | ||
| 44 | - console.warn(res); | ||
| 45 | - if (!res.data.show) return false; | ||
| 46 | - Toast({ | ||
| 47 | - icon: 'close', | ||
| 48 | - message: res.data.msg | ||
| 49 | - }); | ||
| 50 | - } | ||
| 51 | - }) | ||
| 52 | - .catch(err => { | ||
| 53 | - console.error(err); | ||
| 54 | - }); | ||
| 55 | -</script> | ||
| 56 | - | ||
| 57 | -<script> | ||
| 58 | -import mixin from 'common/mixin'; | ||
| 59 | - | ||
| 60 | -export default { | ||
| 61 | - mixins: [mixin.init], | ||
| 62 | - data() { | ||
| 63 | - return { | ||
| 64 | - | ||
| 65 | - } | ||
| 66 | - }, | ||
| 67 | - mounted() { | ||
| 68 | - | ||
| 69 | - }, | ||
| 70 | - methods: { | ||
| 71 | - | ||
| 72 | } | 34 | } |
| 73 | -} | 35 | +}) |
| 74 | </script> | 36 | </script> |
| 75 | 37 | ||
| 76 | <style lang="less" scoped> | 38 | <style lang="less" scoped> | ... | ... |
-
Please register or login to post a comment