Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-11-01 13:46:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c25a79f25019361f37f895b47e7c8af05d495e56
c25a79f2
1 parent
eeec4e09
fix
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
36 deletions
src/pages/my/index.vue
src/pages/my/index.vue
View file @
c25a79f
<!--
* @Date: 2022-09-21 14:51:44
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-1
0-31 19:06:46
* @LastEditTime: 2022-1
1-01 13:44:31
* @FilePath: /swx/src/pages/my/index.vue
* @Description: 我的页面
-->
...
...
@@ -83,47 +83,12 @@ import activityCard from '@/components/activity-card.vue'
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({ 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
}
}
})
// 参加的活动
const joinActivity = () => {
Taro.navigateTo({
url: '../myActivityList/index'
})
}
// 创建的活动
const createActivity = () => {
if (!host_id.value) {
Toast('您还未创建过主办方');
return false;
}
Taro.navigateTo({
url: '../myCreateActivity/index?host_id=' + host_id.value
})
}
// 陪伴的用户
const followUser = async () => {
if (join_hosts.value.length) {
Taro.navigateTo({
url: '../myFollowUser/index?host_id=' + join_hosts.value[0]['id']
})
} else {
Toast('您还未加入过义工')
}
}
// 我的主办方
const myProject = () => {
...
...
@@ -155,6 +120,8 @@ export default {
nickname: '',
avatar: '',
activity_list: [],
host_id: '',
join_hosts: '',
}
},
async onShow () {
...
...
@@ -172,11 +139,41 @@ export default {
this.nickname = data.user.nickname;
this.avatar = data.user.avatar ? data.user.avatar : 'http://gyzs.onwall.cn/tou%402x.png';
}
// 获取主办方列表信息
const host = await hostListAPI({ is_join: 1 });
if (host.code) {
if (host.data.my_hosts.length) {
this.host_id = host.data.my_hosts[0]?.id
}
if (host.data.join_hosts.length) {
this.join_hosts = host.data.join_hosts
}
}
},
methods: {
formatDate (date) {
return moment(date).format('YYYY-MM-DD HH:mm')
},
// 创建的活动
createActivity () {
if (!this.host_id) {
Toast('您还未创建过主办方');
return false;
}
Taro.navigateTo({
url: '../myCreateActivity/index?host_id=' + this.host_id
})
},
// 陪伴的用户
async followUser () {
if (this.join_hosts.length) {
Taro.navigateTo({
url: '../myFollowUser/index?host_id=' + this.join_hosts[0]['id']
})
} else {
Toast('您还未加入过义工')
}
}
}
};
</script>
...
...
Please
register
or
login
to post a comment