hookehuyr

🐞 fix: 主办方新增后回到主办方管理列表更新优化

<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-31 13:13:21
* @LastEditTime: 2022-11-01 11:06:35
* @FilePath: /swx/src/pages/projectManage/index.vue
* @Description: 主办方管理页面
-->
......@@ -63,17 +63,6 @@ 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({ is_join: 1 });
if (code) {
create_list.value = data.my_hosts;
join_list.value = data.join_hosts;
}
})
const onSubmit = () => {
Taro.navigateTo({
url: '../createProject/index'
......@@ -85,31 +74,6 @@ const onManage = (item) => {
url: '../userManage/index?host_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>
......@@ -121,9 +85,43 @@ export default {
mixins: [mixin.init],
data () {
return {
create_list: [],
join_list: [],
}
},
onShow() {
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>
......