Showing
1 changed file
with
33 additions
and
36 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-21 14:51:44 | 2 | * @Date: 2022-09-21 14:51:44 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-31 19:06:46 | 4 | + * @LastEditTime: 2022-11-01 13:44:31 |
| 5 | * @FilePath: /swx/src/pages/my/index.vue | 5 | * @FilePath: /swx/src/pages/my/index.vue |
| 6 | * @Description: 我的页面 | 6 | * @Description: 我的页面 |
| 7 | --> | 7 | --> |
| ... | @@ -83,47 +83,12 @@ import activityCard from '@/components/activity-card.vue' | ... | @@ -83,47 +83,12 @@ import activityCard from '@/components/activity-card.vue' |
| 83 | import { hostListAPI } from '@/api/Host/index' | 83 | import { hostListAPI } from '@/api/Host/index' |
| 84 | import Toast from '@/components/vant-weapp/toast/toast'; | 84 | import Toast from '@/components/vant-weapp/toast/toast'; |
| 85 | 85 | ||
| 86 | -const host_id = ref(''); | ||
| 87 | -const join_hosts = ref([]) | ||
| 88 | -onMounted(async () => { | ||
| 89 | - // 获取主办方列表信息 | ||
| 90 | - const { code, data } = await hostListAPI({ is_join: 1 }); | ||
| 91 | - if (code) { | ||
| 92 | - if (data.my_hosts.length) { | ||
| 93 | - host_id.value = data.my_hosts[0]?.id | ||
| 94 | - } | ||
| 95 | - if (data.join_hosts.length) { | ||
| 96 | - join_hosts.value = data.join_hosts | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | -}) | ||
| 100 | - | ||
| 101 | // 参加的活动 | 86 | // 参加的活动 |
| 102 | const joinActivity = () => { | 87 | const joinActivity = () => { |
| 103 | Taro.navigateTo({ | 88 | Taro.navigateTo({ |
| 104 | url: '../myActivityList/index' | 89 | url: '../myActivityList/index' |
| 105 | }) | 90 | }) |
| 106 | } | 91 | } |
| 107 | -// 创建的活动 | ||
| 108 | -const createActivity = () => { | ||
| 109 | - if (!host_id.value) { | ||
| 110 | - Toast('您还未创建过主办方'); | ||
| 111 | - return false; | ||
| 112 | - } | ||
| 113 | - Taro.navigateTo({ | ||
| 114 | - url: '../myCreateActivity/index?host_id=' + host_id.value | ||
| 115 | - }) | ||
| 116 | -} | ||
| 117 | -// 陪伴的用户 | ||
| 118 | -const followUser = async () => { | ||
| 119 | - if (join_hosts.value.length) { | ||
| 120 | - Taro.navigateTo({ | ||
| 121 | - url: '../myFollowUser/index?host_id=' + join_hosts.value[0]['id'] | ||
| 122 | - }) | ||
| 123 | - } else { | ||
| 124 | - Toast('您还未加入过义工') | ||
| 125 | - } | ||
| 126 | -} | ||
| 127 | 92 | ||
| 128 | // 我的主办方 | 93 | // 我的主办方 |
| 129 | const myProject = () => { | 94 | const myProject = () => { |
| ... | @@ -155,6 +120,8 @@ export default { | ... | @@ -155,6 +120,8 @@ export default { |
| 155 | nickname: '', | 120 | nickname: '', |
| 156 | avatar: '', | 121 | avatar: '', |
| 157 | activity_list: [], | 122 | activity_list: [], |
| 123 | + host_id: '', | ||
| 124 | + join_hosts: '', | ||
| 158 | } | 125 | } |
| 159 | }, | 126 | }, |
| 160 | async onShow () { | 127 | async onShow () { |
| ... | @@ -172,11 +139,41 @@ export default { | ... | @@ -172,11 +139,41 @@ export default { |
| 172 | this.nickname = data.user.nickname; | 139 | this.nickname = data.user.nickname; |
| 173 | this.avatar = data.user.avatar ? data.user.avatar : 'http://gyzs.onwall.cn/tou%402x.png'; | 140 | this.avatar = data.user.avatar ? data.user.avatar : 'http://gyzs.onwall.cn/tou%402x.png'; |
| 174 | } | 141 | } |
| 142 | + // 获取主办方列表信息 | ||
| 143 | + const host = await hostListAPI({ is_join: 1 }); | ||
| 144 | + if (host.code) { | ||
| 145 | + if (host.data.my_hosts.length) { | ||
| 146 | + this.host_id = host.data.my_hosts[0]?.id | ||
| 147 | + } | ||
| 148 | + if (host.data.join_hosts.length) { | ||
| 149 | + this.join_hosts = host.data.join_hosts | ||
| 150 | + } | ||
| 151 | + } | ||
| 175 | }, | 152 | }, |
| 176 | methods: { | 153 | methods: { |
| 177 | formatDate (date) { | 154 | formatDate (date) { |
| 178 | return moment(date).format('YYYY-MM-DD HH:mm') | 155 | return moment(date).format('YYYY-MM-DD HH:mm') |
| 179 | }, | 156 | }, |
| 157 | + // 创建的活动 | ||
| 158 | + createActivity () { | ||
| 159 | + if (!this.host_id) { | ||
| 160 | + Toast('您还未创建过主办方'); | ||
| 161 | + return false; | ||
| 162 | + } | ||
| 163 | + Taro.navigateTo({ | ||
| 164 | + url: '../myCreateActivity/index?host_id=' + this.host_id | ||
| 165 | + }) | ||
| 166 | + }, | ||
| 167 | + // 陪伴的用户 | ||
| 168 | + async followUser () { | ||
| 169 | + if (this.join_hosts.length) { | ||
| 170 | + Taro.navigateTo({ | ||
| 171 | + url: '../myFollowUser/index?host_id=' + this.join_hosts[0]['id'] | ||
| 172 | + }) | ||
| 173 | + } else { | ||
| 174 | + Toast('您还未加入过义工') | ||
| 175 | + } | ||
| 176 | + } | ||
| 180 | } | 177 | } |
| 181 | }; | 178 | }; |
| 182 | </script> | 179 | </script> | ... | ... |
-
Please register or login to post a comment