hookehuyr

🦄 refactor: 写法优化

......@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-18 22:16:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-24 21:34:23
* @LastEditTime: 2022-06-24 22:18:36
* @FilePath: /tswj/src/api/C/me.js
* @Description: 我的页面接口操作
*/
......@@ -18,6 +18,7 @@ const Api = {
MY_ATME: '/srv/?a=my_atme',
DEL_COMMENT: '/srv/?a=del_comment',
MY_SUBSCRIBE: '/srv/?a=my_subscribe',
MY_FOLLOW: '/srv/?a=my_follow',
}
/**
......@@ -83,3 +84,9 @@ export const myAtmeAPI = (params) => fn(fetch.get(Api.MY_ATME, params));
* @returns
*/
export const mySubscribeAPI = (params) => fn(fetch.get(Api.MY_SUBSCRIBE, params));
/**
* @description: 我的关注
* @returns
*/
export const myFollowAPI = (params) => fn(fetch.get(Api.MY_FOLLOW, params));
......
<!--
* @Date: 2022-04-28 18:37:45
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-24 22:23:24
* @FilePath: /tswj/src/views/me/followList.vue
* @Description: 文件描述
-->
<template>
<div class="follow-list-page">
<template v-for="(item, key) in followList" :key="key">
<div @click="getUserInfo(item)" class="info van-hairline--bottom">
<template v-for="(item) in followList" :key="item.id">
<div class="info van-hairline--bottom"
@click="go('/client/personIndex', { perf_id: item.id, type: 'read-only' })">
<van-row>
<van-col>
<van-image v-if="item.avatar" round width="50" height="50" :src="item.avatar" style="padding-right: 1rem;" />
<van-image v-else round width="50" height="50" :src="icon_avatar" style="padding-right: 1rem;" />
<van-image round width="50" height="50" :src="item.avatar ? item.avatar : icon_avatar"
style="padding-right: 1rem;" />
</van-col>
<van-col class="text-wrapper" span="18">
<div>
<div class="user-wrapper">
<div class="username">{{ item.name }}</div>
<div class="user-status">已关注</div>
</div>
......@@ -17,81 +25,28 @@
</van-row>
</div>
</template>
<van-empty v-if="emptyStatus"
class="custom-image"
:image="no_image"
description="暂无关注"
/>
<van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无关注" />
</div>
<div style="height: 2rem;"></div>
<div style="height: 2rem;" />
</template>
<script setup>
import no_image from '@images/que-shuju@2x.png'
import { ref, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { ref, onMounted } from 'vue'
import icon_avatar from '@images/que-touxiang@2x.png'
import { myFollowAPI } from '@/api/C/me'
import { useGo } from '@/hooks/useGo'
const $router = useRouter();
// 因为不能让空图标提前出来的写法
const go = useGo()
const emptyStatus = ref(false);
// 关注列表联调
const followList = ref([])
axios.get('/srv/?a=my_follow')
.then(res => {
if (res.data.code === 1) {
followList.value = res.data.data;
if (!res.data.data.length) {
emptyStatus.value = true;
} else {
emptyStatus.value = false;
}
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
onMounted(async () => {
const { code, data } = await myFollowAPI()
if (code) {
followList.value = data;
emptyStatus.value = data.length ? false : true;
}
})
.catch(err => {
console.error(err);
});
const getUserInfo = (v) => {
// 从个人头像进入的,不能再往下级进入
$router.push({
path: '/client/personIndex',
query: {
perf_id: v.id,
type: 'read-only'
}
})
}
</script>
<script>
import mixin from 'common/mixin';
export default {
mixins: [mixin.init],
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style lang="less" scoped>
......
......@@ -2,16 +2,16 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-09 16:13:33
* @LastEditTime: 2022-06-24 22:12:20
* @FilePath: /tswj/src/views/me/like.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="book-video-list">
<template v-for="item in prodList" :key="item" style="height: 3rem;">
<video-card :item="item"></video-card>
<template v-for="item in prodList" :key="item">
<video-card :item="item" />
</template>
<div style="height: 2rem;"></div>
<div style="height: 2rem;" />
</div>
<van-empty v-if="emptyStatus"
class="custom-image"
......