hookehuyr

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

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-31 13:13:21 4 + * @LastEditTime: 2022-11-01 11:06:35
5 * @FilePath: /swx/src/pages/projectManage/index.vue 5 * @FilePath: /swx/src/pages/projectManage/index.vue
6 * @Description: 主办方管理页面 6 * @Description: 主办方管理页面
7 --> 7 -->
...@@ -63,17 +63,6 @@ import bottomButton from "@/components/bottom-button"; ...@@ -63,17 +63,6 @@ import bottomButton from "@/components/bottom-button";
63 import { deleteHostAPI, hostListAPI } from '@/api/Host/index'; 63 import { deleteHostAPI, hostListAPI } from '@/api/Host/index';
64 import Dialog from '@/components/vant-weapp/dialog/dialog'; 64 import Dialog from '@/components/vant-weapp/dialog/dialog';
65 65
66 -const create_list = ref([]);
67 -const join_list = ref([]);
68 -
69 -onMounted(async () => {
70 - const { code, data } = await hostListAPI({ is_join: 1 });
71 - if (code) {
72 - create_list.value = data.my_hosts;
73 - join_list.value = data.join_hosts;
74 - }
75 -})
76 -
77 const onSubmit = () => { 66 const onSubmit = () => {
78 Taro.navigateTo({ 67 Taro.navigateTo({
79 url: '../createProject/index' 68 url: '../createProject/index'
...@@ -85,31 +74,6 @@ const onManage = (item) => { ...@@ -85,31 +74,6 @@ const onManage = (item) => {
85 url: '../userManage/index?host_id=' + item.id + '&name=' + decodeURIComponent(item.name) 74 url: '../userManage/index?host_id=' + item.id + '&name=' + decodeURIComponent(item.name)
86 }) 75 })
87 } 76 }
88 -const onDelete = (item) => {
89 - Dialog.confirm({
90 - title: '温馨提示',
91 - message: '是否确认删除主办方?',
92 - confirmButtonColor: '#199a74'
93 - })
94 - .then(async () => {
95 - // on confirm
96 - const { code, data } = await deleteHostAPI({ i: item.id });
97 - if (code) {
98 - Taro.showToast({
99 - title: '删除成功',
100 - icon: 'success',
101 - duration: 2000
102 - });
103 - const { code, data } = await hostListAPI();
104 - if (code) {
105 - create_list.value = data.my_hosts;
106 - }
107 - }
108 - })
109 - .catch(() => {
110 - // on cancel
111 - });
112 -}
113 </script> 77 </script>
114 78
115 <script> 79 <script>
...@@ -121,9 +85,43 @@ export default { ...@@ -121,9 +85,43 @@ export default {
121 mixins: [mixin.init], 85 mixins: [mixin.init],
122 data () { 86 data () {
123 return { 87 return {
88 + create_list: [],
89 + join_list: [],
124 } 90 }
125 }, 91 },
126 - onShow() { 92 + async onShow() {
93 + const { code, data } = await hostListAPI({ is_join: 1 });
94 + if (code) {
95 + this.create_list = data.my_hosts;
96 + this.join_list = data.join_hosts;
97 + }
127 }, 98 },
99 + methods: {
100 + onDelete (item) {
101 + Dialog.confirm({
102 + title: '温馨提示',
103 + message: '是否确认删除主办方?',
104 + confirmButtonColor: '#199a74'
105 + })
106 + .then(async () => {
107 + // on confirm
108 + const { code, data } = await deleteHostAPI({ i: item.id });
109 + if (code) {
110 + Taro.showToast({
111 + title: '删除成功',
112 + icon: 'success',
113 + duration: 2000
114 + });
115 + const { code, data } = await hostListAPI();
116 + if (code) {
117 + this.create_list = data.my_hosts;
118 + }
119 + }
120 + })
121 + .catch(() => {
122 + // on cancel
123 + });
124 + }
125 + }
128 }; 126 };
129 </script> 127 </script>
......