hookehuyr

✨ feat(我的订阅): API联调

1 <template> 1 <template>
2 <div class="follow-list-page"> 2 <div class="follow-list-page">
3 + <template v-for="(item, key) in followList" :key="key">
3 <div class="info van-hairline--bottom"> 4 <div class="info van-hairline--bottom">
4 <van-row> 5 <van-row>
5 <van-col> 6 <van-col>
6 - <van-image round width="50" height="50" src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg" 7 + <van-image round width="50" height="50" :src="item.avatar" style="padding-right: 1rem;" />
7 - style="padding-right: 1rem;" />
8 </van-col> 8 </van-col>
9 <van-col class="text-wrapper" span="18"> 9 <van-col class="text-wrapper" span="18">
10 <div> 10 <div>
11 - <div class="username">瑟日古娜</div> 11 + <div class="username">{{ item.name }}</div>
12 <div class="user-status">已关注</div> 12 <div class="user-status">已关注</div>
13 </div> 13 </div>
14 - <div class="address">呼和浩特市新城区蒙古族幼儿园</div> 14 + <div class="address">{{ item.kg_name }}</div>
15 - </van-col>
16 - </van-row>
17 - </div>
18 - <div class="info van-hairline--bottom">
19 - <van-row>
20 - <van-col>
21 - <van-image round width="50" height="50" src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg"
22 - style="padding-right: 1rem;" />
23 - </van-col>
24 - <van-col class="text-wrapper" span="18">
25 - <div>
26 - <div class="username">瑟日古娜</div>
27 - <div class="user-status">已关注</div>
28 - </div>
29 - <div class="address">呼和浩特市新城区蒙古族幼儿园</div>
30 </van-col> 15 </van-col>
31 </van-row> 16 </van-row>
32 </div> 17 </div>
18 + </template>
33 </div> 19 </div>
20 + <div style="height: 2rem;"></div>
34 </template> 21 </template>
35 22
36 <script setup> 23 <script setup>
37 import { ref, reactive, onMounted } from 'vue' 24 import { ref, reactive, onMounted } from 'vue'
38 import { useRoute, useRouter } from 'vue-router' 25 import { useRoute, useRouter } from 'vue-router'
39 import axios from '@/utils/axios'; 26 import axios from '@/utils/axios';
40 -import $ from 'jquery'
41 import { Toast } from 'vant'; 27 import { Toast } from 'vant';
42 -const $route = useRoute();
43 -const $router = useRouter();
44 -
45 - onMounted(() => {
46 28
47 - }) 29 +// 关注列表联调
30 +const followList = ref([])
31 +axios.get('/srv/?a=my_follow')
32 +.then(res => {
33 + if (res.data.code === 1) {
34 + followList.value = res.data.data;
35 + } else {
36 + console.warn(res);
37 + Toast({
38 + icon: 'close',
39 + message: res.data.msg
40 + });
41 + }
42 +})
43 +.catch(err => {
44 + console.error(err);
45 +})
48 </script> 46 </script>
49 47
50 <script> 48 <script>
......