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-10-28 15:32:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9096a915c691cea856bb04749ce6b99e95799a76
9096a915
1 parent
c4956be7
✨ feat: 处理创建的活动/陪伴的用户页面选中主办方之后数据缓存问题
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
11 deletions
config/index.js
src/pages/myCreateActivity/index.vue
src/pages/myFollowUser/index.vue
src/stores/host.js
config/index.js
View file @
9096a91
...
...
@@ -67,6 +67,7 @@ const config = {
"@/assets": path.resolve(__dirname, "../src/assets"),
"@/composables": path.resolve(__dirname, "../src/composables"),
"@/api": path.resolve(__dirname, "../src/api"),
"@/stores": path.resolve(__dirname, "../src/stores"),
},
sourceRoot: 'src',
outputRoot: 'dist',
...
...
src/pages/myCreateActivity/index.vue
View file @
9096a91
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-2
6 17:29:34
* @LastEditTime: 2022-10-2
8 15:29:50
* @FilePath: /swx/src/pages/myCreateActivity/index.vue
* @Description: 创建的活动页面
-->
...
...
@@ -79,6 +79,7 @@
<!-- 切换主办方弹出框 -->
<van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
<van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns"
:default-index="defaultHostIndex"
toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" />
</van-popup>
<!-- 切换时间弹出框 -->
...
...
@@ -119,18 +120,28 @@ import { getCurrentPageParam } from "@/utils/weapp";
import { hostListAPI } from '@/api/Host/index'
import * as dayjs from 'dayjs'
import { addListAPI, endActivityAPI, delActivityAPI, copyActivityAPI } from '@/api/Activity/index';
import { hostStore } from '@/stores/host'
export default {
name: "myCreateActivityPage",
mixins: [mixin.init],
async onShow () {
// 先看一下有没有缓存过主办方ID
const id = hostStore().id;
let host_id = '';
if (id) {
host_id = id;
} else {
host_id = getCurrentPageParam().host_id;
}
// 获取主办方列表信息
const host = await hostListAPI();
if (host.code) {
host.data.my_hosts.forEach(
item
=> {
if (item.id ==
getCurrentPageParam().
host_id) {
host.data.my_hosts.forEach(
(item,index)
=> {
if (item.id == host_id) {
this.host_id = item.id;
this.host_name = item.name;
this.defaultHostIndex = index;
}
item.text = item.name;
item.key = item.id;
...
...
@@ -138,7 +149,7 @@ export default {
this.host_columns = host.data.my_hosts;
}
const params = {
host_id:
getCurrentPageParam()
.host_id,
host_id:
this
.host_id,
time_begin: this.time_begin,
time_end: this.time_end,
status: this.status,
...
...
@@ -186,6 +197,7 @@ export default {
status_type: '',
status_type_columns: ['全部', '一个月之内', '三个月之内', '一年之内'],
show_host_popup: false,
defaultHostIndex: 0,
host_columns: [],
time_begin: '',
time_end: '',
...
...
@@ -283,7 +295,8 @@ export default {
this.host_id = value.key;
this.host_name = value.text;
// 缓存主办方ID
// wx.setStorageSync('chang_host_id', value.key);
const store = hostStore();
store.add(value.key);
// 查询数据
this.activity_list = [];
this.flag = true;
...
...
src/pages/myFollowUser/index.vue
View file @
9096a91
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-2
6 15:49:57
* @LastEditTime: 2022-10-2
8 15:22:02
* @FilePath: /swx/src/pages/myFollowUser/index.vue
* @Description: 陪伴的用户页面
-->
...
...
@@ -101,6 +101,7 @@
<!-- 切换主办方弹出框 -->
<van-popup :show="show_host_popup" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
<van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="host_columns"
:default-index="defaultHostIndex"
toolbar-class="picker-toolbar" @confirm="onHostConfirm" @cancel="onHostCancel" />
</van-popup>
...
...
@@ -122,6 +123,7 @@ import mixin from '@/utils/mixin';
import { getCurrentPageParam } from "@/utils/weapp";
import { hostListAPI } from '@/api/Host/index'
import * as dayjs from 'dayjs'
const formatDate = (date) => {
return dayjs(date).format('YYYY-MM-DD HH:mm')
}
...
...
@@ -142,18 +144,29 @@ const goToUserInfo = (member_id) => {
<script>
import "./index.less";
import { traceMemberAPI } from '@/api/Member/index'
import { hostStore } from '@/stores/host'
export default {
name: "myFollowUserPage",
mixins: [mixin.init],
async onShow () {
// 先看一下有没有缓存过参加主办方ID
const id = hostStore().join_id;
console.warn(id);
let host_id = '';
if (id) {
host_id = id;
} else {
host_id = getCurrentPageParam().host_id;
}
// 获取主办方列表信息
const host = await hostListAPI({ is_join: 1 });
if (host.code) {
host.data.join_hosts.forEach(
item
=> {
if (item.id ==
getCurrentPageParam().
host_id) {
host.data.join_hosts.forEach(
(item, index)
=> {
if (item.id == host_id) {
this.host_id = item.id;
this.host_name = item.name;
this.defaultHostIndex = index;
}
item.text = item.name;
item.key = item.id;
...
...
@@ -162,7 +175,7 @@ export default {
}
// 获取我陪伴的用户列表
const params = {
host_id:
getCurrentPageParam()
.host_id,
host_id:
this
.host_id,
is_partner_note: this.activated === 1 ? '' : 0,
search: this.search,
page: this.page,
...
...
@@ -208,6 +221,7 @@ export default {
member_count: 0,
note_count: 0,
show_host_popup: false,
defaultHostIndex: 0,
host_columns: [],
host_id: '',
host_name: '',
...
...
@@ -244,6 +258,10 @@ export default {
this.page = this.page + 1;
this.flag = true;
} else {
this.new_count = data.new_count;
this.no_partner_note_count = data.no_partner_note_count;
this.member_count = data.member_count;
this.note_count = data.note_count;
Toast('没有数据')
}
}
...
...
@@ -253,8 +271,9 @@ export default {
this.show_host_popup = false;
this.host_id = value.key;
this.host_name = value.text;
// 缓存主办方ID
// wx.setStorageSync('chang_host_id', value.key);
// 缓存参加主办方ID
const store = hostStore();
store.addJoin(value.key);
// 查询数据
this.member_list = [];
this.flag = true;
...
...
src/stores/host.js
0 → 100755
View file @
9096a91
/*
* @Date: 2022-10-28 14:34:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-28 15:12:55
* @FilePath: /swx/src/stores/host.js
* @Description: 缓存主办方ID
*/
import
{
defineStore
}
from
'pinia'
export
const
hostStore
=
defineStore
(
'host'
,
{
state
:
()
=>
{
return
{
id
:
''
,
join_id
:
''
}
},
actions
:
{
add
(
id
)
{
this
.
id
=
id
},
addJoin
(
id
)
{
this
.
join_id
=
id
},
},
})
Please
register
or
login
to post a comment