index.vue
3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-11-15 16:00:23
* @FilePath: /swx/src/pages/projectManage/index.vue
* @Description: 主办方管理页面
-->
<template>
<view class="project-manage-page">
<view class="activity-title">
<view class="box">
<text class="bg-gradient" style="font-size: 1rem;">我创建的主办方</text>
</view>
</view>
<view v-if="create_list.length" class="create-box">
<view class="create-item" v-for="(item, index) in create_list" :key="index">
<van-row>
<van-col span="15">
<view>
<van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" />
<text class="name"> {{ item.name }}</text>
</view>
</van-col>
<van-col span="4">
<view class="manage-btn" @tap="onManage(item)">管理</view>
</van-col>
<van-col span="4" offset="1">
<view class="delete-btn" @tap="onDelete(item)">删除</view>
</van-col>
</van-row>
</view>
</view>
<!-- TODO: 缺省页 -->
<van-empty v-else description="暂无创建主办方" class="custom-image" :image="icon_no_create_project" />
<view style="height: 1rem;"></view>
<view class="activity-title">
<view class="box">
<text class="bg-gradient" style="font-size: 1rem;">我加入的主办方</text>
</view>
</view>
<view v-if="join_list.length" class="join-box">
<view class="join-item" v-for="(item, index) in join_list" :key="index">
<van-row>
<van-col span="24">
<view>
<van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" />
<text class="name"> {{ item.name }}</text>
</view>
</van-col>
</van-row>
</view>
<view style="height: 7rem;"></view>
</view>
<!-- TODO: 缺省页 -->
<van-empty v-else description="暂无加入主办方" class="custom-image" :image="icon_no_join_project" />
</view>
<bottom-button @on-submit="onSubmit">新建主办方</bottom-button>
<van-dialog id="van-dialog" />
</template>
<script setup>
import Taro from '@tarojs/taro'
import { ref, onMounted } from "vue";
import icon_p from '@/images/icon/zhubanfang@2x.png'
import icon_no_create_project from '@/images/icon/no-zhubanfang@2x.png'
import icon_no_join_project from '@/images/icon/no-zhubanfang@2x.png'
import bottomButton from "@/components/bottom-button";
import { deleteHostAPI, hostListAPI } from '@/api/Host/index';
import Dialog from '@/components/vant-weapp/dialog/dialog';
const onSubmit = () => {
Taro.navigateTo({
url: '../createProject/index'
})
}
const onManage = (item) => {
Taro.navigateTo({
url: '../userManage/index?host_id=' + item.id + '&name=' + decodeURIComponent(item.name)
})
}
</script>
<script>
import "./index.less";
import mixin from '@/utils/mixin';
export default {
name: "projectManagePage",
mixins: [mixin.init],
data () {
return {
create_list: [],
join_list: [],
}
},
async onShow() {
const { code, data } = await hostListAPI({ is_join: 1 });
if (code) {
this.create_list = data.my_hosts;
this.join_list = data.join_hosts;
}
},
methods: {
onDelete (item) {
Dialog.confirm({
title: '温馨提示',
message: '是否确认删除主办方?',
confirmButtonColor: '#199a74'
})
.then(async () => {
// on confirm
const { code, data } = await deleteHostAPI({ i: item.id });
if (code) {
Taro.showToast({
title: '删除成功',
icon: 'success',
duration: 2000
});
const { code, data } = await hostListAPI();
if (code) {
this.create_list = data.my_hosts;
}
}
})
.catch(() => {
// on cancel
});
}
}
};
</script>