index.vue
3.85 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
134
135
136
137
138
139
140
141
142
143
144
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-24 16:56:16
* @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 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>
<view style="height: 1rem;"></view>
<view class="activity-title">
<view class="box">
<text class="bg-gradient" style="font-size: 1rem;">我加入的主办方</text>
</view>
</view>
<view 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>
</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 bottomButton from "@/components/bottom-button";
import { deleteHostAPI, hostListAPI } from '@/api/Host/index';
import Dialog from '@/components/vant-weapp/dialog/dialog';
const create_list = ref([]);
const join_list = ref([]);
onMounted(async () => {
const { code, data } = await hostListAPI();
if (code) {
create_list.value = data.my_hosts;
join_list.value = data.join_hosts;
}
})
const onSubmit = () => {
Taro.navigateTo({
url: '../createProject/index'
})
}
const onManage = (item) => {
Taro.navigateTo({
url: '../userManage/index?id=' + item.id + '&name=' + decodeURIComponent(item.name)
})
}
const 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) {
create_list.value = data.my_hosts;
}
}
})
.catch(() => {
// on cancel
});
}
</script>
<script>
import "./index.less";
// import request from '../../utils/request';
import mixin from '@/utils/mixin';
export default {
name: "projectManagePage",
mixins: [mixin.init],
data () {
return {
// create_list: [],
// join_list: [],
}
},
onShow() {
// 保存主办方信息
// request.get('/srv/?a=host_list')
// .then(res => {
// if (res.data.code) {
// this.create_list = res.data.data.my_hosts;
// this.join_list = res.data.data.join_hosts;
// } else {
// console.warn(res.data.msg);
// }
// })
// .catch(err => {
// console.error(err);
// });
},
};
</script>