hookehuyr

✨ feat: 陪伴用户页面API联调

<!--
* @Date: 2022-09-21 14:51:44
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-25 18:29:15
* @LastEditTime: 2022-10-26 15:52:42
* @FilePath: /swx/src/pages/my/index.vue
* @Description: 我的页面
-->
......@@ -84,13 +84,17 @@ import { hostListAPI } from '@/api/Host/index'
import Toast from '@/components/vant-weapp/toast/toast';
const host_id = ref('');
const join_hosts = ref([])
onMounted(async () => {
// 获取主办方列表信息
const { code, data } = await hostListAPI();
const { code, data } = await hostListAPI({ is_join: 1 });
if (code) {
if (data.my_hosts.length) {
host_id.value = data.my_hosts[0]?.id
}
if (data.join_hosts.length) {
join_hosts.value = data.join_hosts
}
}
})
......@@ -111,11 +115,16 @@ const createActivity = () => {
})
}
// 陪伴的用户
const followUser = () => {
Taro.navigateTo({
url: '../myFollowUser/index'
})
const followUser = async () => {
if (join_hosts.value.length) {
Taro.navigateTo({
url: '../myFollowUser/index?host_id=' + join_hosts.value[0]['id']
})
} else {
Toast('您还加入过义工')
}
}
// 我的主办方
const myProject = () => {
Taro.navigateTo({
......@@ -154,13 +163,13 @@ export default {
})
this.activity_list = data.activity_list;
this.nickname = data.user.nickname;
this.avatar = data.user.avatar ? data.user.avatar : 'https://jdc.jd.com/img/200';
this.avatar = data.user.avatar ? data.user.avatar : 'http://gyzs.onwall.cn/tou%402x.png';
}
},
methods: {
formatDate (date) {
return dayjs(date).format('YYYY-MM-DD HH:mm')
}
},
}
};
</script>
......
This diff is collapsed. Click to expand it.