Showing
4 changed files
with
69 additions
and
11 deletions
| ... | @@ -67,6 +67,7 @@ const config = { | ... | @@ -67,6 +67,7 @@ const config = { |
| 67 | "@/assets": path.resolve(__dirname, "../src/assets"), | 67 | "@/assets": path.resolve(__dirname, "../src/assets"), |
| 68 | "@/composables": path.resolve(__dirname, "../src/composables"), | 68 | "@/composables": path.resolve(__dirname, "../src/composables"), |
| 69 | "@/api": path.resolve(__dirname, "../src/api"), | 69 | "@/api": path.resolve(__dirname, "../src/api"), |
| 70 | + "@/stores": path.resolve(__dirname, "../src/stores"), | ||
| 70 | }, | 71 | }, |
| 71 | sourceRoot: 'src', | 72 | sourceRoot: 'src', |
| 72 | outputRoot: 'dist', | 73 | outputRoot: 'dist', | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-26 17:29:34 | 4 | + * @LastEditTime: 2022-10-28 15:29:50 |
| 5 | * @FilePath: /swx/src/pages/myCreateActivity/index.vue | 5 | * @FilePath: /swx/src/pages/myCreateActivity/index.vue |
| 6 | * @Description: 创建的活动页面 | 6 | * @Description: 创建的活动页面 |
| 7 | --> | 7 | --> |
| ... | @@ -79,6 +79,7 @@ | ... | @@ -79,6 +79,7 @@ |
| 79 | <!-- 切换主办方弹出框 --> | 79 | <!-- 切换主办方弹出框 --> |
| 80 | <van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true"> | 80 | <van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true"> |
| 81 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns" | 81 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns" |
| 82 | + :default-index="defaultHostIndex" | ||
| 82 | toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" /> | 83 | toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" /> |
| 83 | </van-popup> | 84 | </van-popup> |
| 84 | <!-- 切换时间弹出框 --> | 85 | <!-- 切换时间弹出框 --> |
| ... | @@ -119,18 +120,28 @@ import { getCurrentPageParam } from "@/utils/weapp"; | ... | @@ -119,18 +120,28 @@ import { getCurrentPageParam } from "@/utils/weapp"; |
| 119 | import { hostListAPI } from '@/api/Host/index' | 120 | import { hostListAPI } from '@/api/Host/index' |
| 120 | import * as dayjs from 'dayjs' | 121 | import * as dayjs from 'dayjs' |
| 121 | import { addListAPI, endActivityAPI, delActivityAPI, copyActivityAPI } from '@/api/Activity/index'; | 122 | import { addListAPI, endActivityAPI, delActivityAPI, copyActivityAPI } from '@/api/Activity/index'; |
| 123 | +import { hostStore } from '@/stores/host' | ||
| 122 | 124 | ||
| 123 | export default { | 125 | export default { |
| 124 | name: "myCreateActivityPage", | 126 | name: "myCreateActivityPage", |
| 125 | mixins: [mixin.init], | 127 | mixins: [mixin.init], |
| 126 | async onShow () { | 128 | async onShow () { |
| 129 | + // 先看一下有没有缓存过主办方ID | ||
| 130 | + const id = hostStore().id; | ||
| 131 | + let host_id = ''; | ||
| 132 | + if (id) { | ||
| 133 | + host_id = id; | ||
| 134 | + } else { | ||
| 135 | + host_id = getCurrentPageParam().host_id; | ||
| 136 | + } | ||
| 127 | // 获取主办方列表信息 | 137 | // 获取主办方列表信息 |
| 128 | const host = await hostListAPI(); | 138 | const host = await hostListAPI(); |
| 129 | if (host.code) { | 139 | if (host.code) { |
| 130 | - host.data.my_hosts.forEach(item => { | 140 | + host.data.my_hosts.forEach((item,index) => { |
| 131 | - if (item.id == getCurrentPageParam().host_id) { | 141 | + if (item.id == host_id) { |
| 132 | this.host_id = item.id; | 142 | this.host_id = item.id; |
| 133 | this.host_name = item.name; | 143 | this.host_name = item.name; |
| 144 | + this.defaultHostIndex = index; | ||
| 134 | } | 145 | } |
| 135 | item.text = item.name; | 146 | item.text = item.name; |
| 136 | item.key = item.id; | 147 | item.key = item.id; |
| ... | @@ -138,7 +149,7 @@ export default { | ... | @@ -138,7 +149,7 @@ export default { |
| 138 | this.host_columns = host.data.my_hosts; | 149 | this.host_columns = host.data.my_hosts; |
| 139 | } | 150 | } |
| 140 | const params = { | 151 | const params = { |
| 141 | - host_id: getCurrentPageParam().host_id, | 152 | + host_id: this.host_id, |
| 142 | time_begin: this.time_begin, | 153 | time_begin: this.time_begin, |
| 143 | time_end: this.time_end, | 154 | time_end: this.time_end, |
| 144 | status: this.status, | 155 | status: this.status, |
| ... | @@ -186,6 +197,7 @@ export default { | ... | @@ -186,6 +197,7 @@ export default { |
| 186 | status_type: '', | 197 | status_type: '', |
| 187 | status_type_columns: ['全部', '一个月之内', '三个月之内', '一年之内'], | 198 | status_type_columns: ['全部', '一个月之内', '三个月之内', '一年之内'], |
| 188 | show_host_popup: false, | 199 | show_host_popup: false, |
| 200 | + defaultHostIndex: 0, | ||
| 189 | host_columns: [], | 201 | host_columns: [], |
| 190 | time_begin: '', | 202 | time_begin: '', |
| 191 | time_end: '', | 203 | time_end: '', |
| ... | @@ -283,7 +295,8 @@ export default { | ... | @@ -283,7 +295,8 @@ export default { |
| 283 | this.host_id = value.key; | 295 | this.host_id = value.key; |
| 284 | this.host_name = value.text; | 296 | this.host_name = value.text; |
| 285 | // 缓存主办方ID | 297 | // 缓存主办方ID |
| 286 | - // wx.setStorageSync('chang_host_id', value.key); | 298 | + const store = hostStore(); |
| 299 | + store.add(value.key); | ||
| 287 | // 查询数据 | 300 | // 查询数据 |
| 288 | this.activity_list = []; | 301 | this.activity_list = []; |
| 289 | this.flag = true; | 302 | this.flag = true; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-26 15:49:57 | 4 | + * @LastEditTime: 2022-10-28 15:22:02 |
| 5 | * @FilePath: /swx/src/pages/myFollowUser/index.vue | 5 | * @FilePath: /swx/src/pages/myFollowUser/index.vue |
| 6 | * @Description: 陪伴的用户页面 | 6 | * @Description: 陪伴的用户页面 |
| 7 | --> | 7 | --> |
| ... | @@ -101,6 +101,7 @@ | ... | @@ -101,6 +101,7 @@ |
| 101 | <!-- 切换主办方弹出框 --> | 101 | <!-- 切换主办方弹出框 --> |
| 102 | <van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true"> | 102 | <van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true"> |
| 103 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns" | 103 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns" |
| 104 | + :default-index="defaultHostIndex" | ||
| 104 | toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" /> | 105 | toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" /> |
| 105 | </van-popup> | 106 | </van-popup> |
| 106 | 107 | ||
| ... | @@ -122,6 +123,7 @@ import mixin from '@/utils/mixin'; | ... | @@ -122,6 +123,7 @@ import mixin from '@/utils/mixin'; |
| 122 | import { getCurrentPageParam } from "@/utils/weapp"; | 123 | import { getCurrentPageParam } from "@/utils/weapp"; |
| 123 | import { hostListAPI } from '@/api/Host/index' | 124 | import { hostListAPI } from '@/api/Host/index' |
| 124 | import * as dayjs from 'dayjs' | 125 | import * as dayjs from 'dayjs' |
| 126 | + | ||
| 125 | const formatDate = (date) => { | 127 | const formatDate = (date) => { |
| 126 | return dayjs(date).format('YYYY-MM-DD HH:mm') | 128 | return dayjs(date).format('YYYY-MM-DD HH:mm') |
| 127 | } | 129 | } |
| ... | @@ -142,18 +144,29 @@ const goToUserInfo = (member_id) => { | ... | @@ -142,18 +144,29 @@ const goToUserInfo = (member_id) => { |
| 142 | <script> | 144 | <script> |
| 143 | import "./index.less"; | 145 | import "./index.less"; |
| 144 | import { traceMemberAPI } from '@/api/Member/index' | 146 | import { traceMemberAPI } from '@/api/Member/index' |
| 147 | +import { hostStore } from '@/stores/host' | ||
| 145 | 148 | ||
| 146 | export default { | 149 | export default { |
| 147 | name: "myFollowUserPage", | 150 | name: "myFollowUserPage", |
| 148 | mixins: [mixin.init], | 151 | mixins: [mixin.init], |
| 149 | async onShow () { | 152 | async onShow () { |
| 153 | + // 先看一下有没有缓存过参加主办方ID | ||
| 154 | + const id = hostStore().join_id; | ||
| 155 | + console.warn(id); | ||
| 156 | + let host_id = ''; | ||
| 157 | + if (id) { | ||
| 158 | + host_id = id; | ||
| 159 | + } else { | ||
| 160 | + host_id = getCurrentPageParam().host_id; | ||
| 161 | + } | ||
| 150 | // 获取主办方列表信息 | 162 | // 获取主办方列表信息 |
| 151 | const host = await hostListAPI({ is_join: 1 }); | 163 | const host = await hostListAPI({ is_join: 1 }); |
| 152 | if (host.code) { | 164 | if (host.code) { |
| 153 | - host.data.join_hosts.forEach(item => { | 165 | + host.data.join_hosts.forEach((item, index) => { |
| 154 | - if (item.id == getCurrentPageParam().host_id) { | 166 | + if (item.id == host_id) { |
| 155 | this.host_id = item.id; | 167 | this.host_id = item.id; |
| 156 | this.host_name = item.name; | 168 | this.host_name = item.name; |
| 169 | + this.defaultHostIndex = index; | ||
| 157 | } | 170 | } |
| 158 | item.text = item.name; | 171 | item.text = item.name; |
| 159 | item.key = item.id; | 172 | item.key = item.id; |
| ... | @@ -162,7 +175,7 @@ export default { | ... | @@ -162,7 +175,7 @@ export default { |
| 162 | } | 175 | } |
| 163 | // 获取我陪伴的用户列表 | 176 | // 获取我陪伴的用户列表 |
| 164 | const params = { | 177 | const params = { |
| 165 | - host_id: getCurrentPageParam().host_id, | 178 | + host_id: this.host_id, |
| 166 | is_partner_note: this.activated === 1 ? '' : 0, | 179 | is_partner_note: this.activated === 1 ? '' : 0, |
| 167 | search: this.search, | 180 | search: this.search, |
| 168 | page: this.page, | 181 | page: this.page, |
| ... | @@ -208,6 +221,7 @@ export default { | ... | @@ -208,6 +221,7 @@ export default { |
| 208 | member_count: 0, | 221 | member_count: 0, |
| 209 | note_count: 0, | 222 | note_count: 0, |
| 210 | show_host_popup: false, | 223 | show_host_popup: false, |
| 224 | + defaultHostIndex: 0, | ||
| 211 | host_columns: [], | 225 | host_columns: [], |
| 212 | host_id: '', | 226 | host_id: '', |
| 213 | host_name: '', | 227 | host_name: '', |
| ... | @@ -244,6 +258,10 @@ export default { | ... | @@ -244,6 +258,10 @@ export default { |
| 244 | this.page = this.page + 1; | 258 | this.page = this.page + 1; |
| 245 | this.flag = true; | 259 | this.flag = true; |
| 246 | } else { | 260 | } else { |
| 261 | + this.new_count = data.new_count; | ||
| 262 | + this.no_partner_note_count = data.no_partner_note_count; | ||
| 263 | + this.member_count = data.member_count; | ||
| 264 | + this.note_count = data.note_count; | ||
| 247 | Toast('没有数据') | 265 | Toast('没有数据') |
| 248 | } | 266 | } |
| 249 | } | 267 | } |
| ... | @@ -253,8 +271,9 @@ export default { | ... | @@ -253,8 +271,9 @@ export default { |
| 253 | this.show_host_popup = false; | 271 | this.show_host_popup = false; |
| 254 | this.host_id = value.key; | 272 | this.host_id = value.key; |
| 255 | this.host_name = value.text; | 273 | this.host_name = value.text; |
| 256 | - // 缓存主办方ID | 274 | + // 缓存参加主办方ID |
| 257 | - // wx.setStorageSync('chang_host_id', value.key); | 275 | + const store = hostStore(); |
| 276 | + store.addJoin(value.key); | ||
| 258 | // 查询数据 | 277 | // 查询数据 |
| 259 | this.member_list = []; | 278 | this.member_list = []; |
| 260 | this.flag = true; | 279 | this.flag = true; | ... | ... |
src/stores/host.js
0 → 100755
| 1 | +/* | ||
| 2 | + * @Date: 2022-10-28 14:34:22 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-10-28 15:12:55 | ||
| 5 | + * @FilePath: /swx/src/stores/host.js | ||
| 6 | + * @Description: 缓存主办方ID | ||
| 7 | + */ | ||
| 8 | +import { defineStore } from 'pinia' | ||
| 9 | + | ||
| 10 | +export const hostStore = defineStore('host', { | ||
| 11 | + state: () => { | ||
| 12 | + return { | ||
| 13 | + id: '', | ||
| 14 | + join_id: '' | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + actions: { | ||
| 18 | + add (id) { | ||
| 19 | + this.id = id | ||
| 20 | + }, | ||
| 21 | + addJoin (id) { | ||
| 22 | + this.join_id = id | ||
| 23 | + }, | ||
| 24 | + }, | ||
| 25 | +}) |
-
Please register or login to post a comment