Showing
2 changed files
with
70 additions
and
18 deletions
| ... | @@ -32,6 +32,13 @@ | ... | @@ -32,6 +32,13 @@ |
| 32 | text-align: center; | 32 | text-align: center; |
| 33 | margin-top: 0.5rem; | 33 | margin-top: 0.5rem; |
| 34 | } | 34 | } |
| 35 | + .delete-btn { | ||
| 36 | + color: #E32525; | ||
| 37 | + border: 1px solid #E32525; | ||
| 38 | + border-radius: 2rem; | ||
| 39 | + text-align: center; | ||
| 40 | + margin-top: 0.5rem; | ||
| 41 | + } | ||
| 35 | } | 42 | } |
| 36 | } | 43 | } |
| 37 | .join-box { | 44 | .join-box { | ... | ... |
| 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-10 14:12:13 | 4 | + * @LastEditTime: 2022-10-24 16:56:16 |
| 5 | * @FilePath: /swx/src/pages/projectManage/index.vue | 5 | * @FilePath: /swx/src/pages/projectManage/index.vue |
| 6 | * @Description: 主办方管理页面 | 6 | * @Description: 主办方管理页面 |
| 7 | --> | 7 | --> |
| ... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
| 15 | <view class="create-box"> | 15 | <view class="create-box"> |
| 16 | <view class="create-item" v-for="(item, index) in create_list" :key="index"> | 16 | <view class="create-item" v-for="(item, index) in create_list" :key="index"> |
| 17 | <van-row> | 17 | <van-row> |
| 18 | - <van-col span="20"> | 18 | + <van-col span="15"> |
| 19 | <view> | 19 | <view> |
| 20 | <van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" /> | 20 | <van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" /> |
| 21 | <text class="name"> {{ item.name }}</text> | 21 | <text class="name"> {{ item.name }}</text> |
| ... | @@ -24,6 +24,9 @@ | ... | @@ -24,6 +24,9 @@ |
| 24 | <van-col span="4"> | 24 | <van-col span="4"> |
| 25 | <view class="manage-btn" @tap="onManage(item)">管理</view> | 25 | <view class="manage-btn" @tap="onManage(item)">管理</view> |
| 26 | </van-col> | 26 | </van-col> |
| 27 | + <van-col span="4" offset="1"> | ||
| 28 | + <view class="delete-btn" @tap="onDelete(item)">删除</view> | ||
| 29 | + </van-col> | ||
| 27 | </van-row> | 30 | </van-row> |
| 28 | </view> | 31 | </view> |
| 29 | </view> | 32 | </view> |
| ... | @@ -47,13 +50,28 @@ | ... | @@ -47,13 +50,28 @@ |
| 47 | </view> | 50 | </view> |
| 48 | </view> | 51 | </view> |
| 49 | <bottom-button @on-submit="onSubmit">新建主办方</bottom-button> | 52 | <bottom-button @on-submit="onSubmit">新建主办方</bottom-button> |
| 53 | + <van-dialog id="van-dialog" /> | ||
| 54 | + | ||
| 50 | </template> | 55 | </template> |
| 51 | 56 | ||
| 52 | <script setup> | 57 | <script setup> |
| 53 | import Taro from '@tarojs/taro' | 58 | import Taro from '@tarojs/taro' |
| 54 | -import { ref } from "vue"; | 59 | +import { ref, onMounted } from "vue"; |
| 55 | import icon_p from '@/images/icon/zhubanfang@2x.png' | 60 | import icon_p from '@/images/icon/zhubanfang@2x.png' |
| 56 | import bottomButton from "@/components/bottom-button"; | 61 | import bottomButton from "@/components/bottom-button"; |
| 62 | +import { deleteHostAPI, hostListAPI } from '@/api/Host/index'; | ||
| 63 | +import Dialog from '@/components/vant-weapp/dialog/dialog'; | ||
| 64 | + | ||
| 65 | +const create_list = ref([]); | ||
| 66 | +const join_list = ref([]); | ||
| 67 | + | ||
| 68 | +onMounted(async () => { | ||
| 69 | + const { code, data } = await hostListAPI(); | ||
| 70 | + if (code) { | ||
| 71 | + create_list.value = data.my_hosts; | ||
| 72 | + join_list.value = data.join_hosts; | ||
| 73 | + } | ||
| 74 | +}) | ||
| 57 | 75 | ||
| 58 | const onSubmit = () => { | 76 | const onSubmit = () => { |
| 59 | Taro.navigateTo({ | 77 | Taro.navigateTo({ |
| ... | @@ -66,34 +84,61 @@ const onManage = (item) => { | ... | @@ -66,34 +84,61 @@ const onManage = (item) => { |
| 66 | url: '../userManage/index?id=' + item.id + '&name=' + decodeURIComponent(item.name) | 84 | url: '../userManage/index?id=' + item.id + '&name=' + decodeURIComponent(item.name) |
| 67 | }) | 85 | }) |
| 68 | } | 86 | } |
| 87 | +const onDelete = (item) => { | ||
| 88 | + Dialog.confirm({ | ||
| 89 | + title: '温馨提示', | ||
| 90 | + message: '是否确认删除主办方?', | ||
| 91 | + confirmButtonColor: '#199a74' | ||
| 92 | + }) | ||
| 93 | + .then(async () => { | ||
| 94 | + // on confirm | ||
| 95 | + const { code, data } = await deleteHostAPI({ i: item.id }); | ||
| 96 | + if (code) { | ||
| 97 | + Taro.showToast({ | ||
| 98 | + title: '删除成功', | ||
| 99 | + icon: 'success', | ||
| 100 | + duration: 2000 | ||
| 101 | + }); | ||
| 102 | + const { code, data } = await hostListAPI(); | ||
| 103 | + if (code) { | ||
| 104 | + create_list.value = data.my_hosts; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + }) | ||
| 108 | + .catch(() => { | ||
| 109 | + // on cancel | ||
| 110 | + }); | ||
| 111 | +} | ||
| 69 | </script> | 112 | </script> |
| 70 | 113 | ||
| 71 | <script> | 114 | <script> |
| 72 | import "./index.less"; | 115 | import "./index.less"; |
| 73 | -import request from '../../utils/request'; | 116 | +// import request from '../../utils/request'; |
| 117 | +import mixin from '@/utils/mixin'; | ||
| 74 | 118 | ||
| 75 | export default { | 119 | export default { |
| 76 | name: "projectManagePage", | 120 | name: "projectManagePage", |
| 121 | + mixins: [mixin.init], | ||
| 77 | data () { | 122 | data () { |
| 78 | return { | 123 | return { |
| 79 | - create_list: [], | 124 | + // create_list: [], |
| 80 | - join_list: [], | 125 | + // join_list: [], |
| 81 | } | 126 | } |
| 82 | }, | 127 | }, |
| 83 | onShow() { | 128 | onShow() { |
| 84 | // 保存主办方信息 | 129 | // 保存主办方信息 |
| 85 | - request.get('/srv/?a=host_list') | 130 | + // request.get('/srv/?a=host_list') |
| 86 | - .then(res => { | 131 | + // .then(res => { |
| 87 | - if (res.data.code) { | 132 | + // if (res.data.code) { |
| 88 | - this.create_list = res.data.data.my_hosts; | 133 | + // this.create_list = res.data.data.my_hosts; |
| 89 | - this.join_list = res.data.data.join_hosts; | 134 | + // this.join_list = res.data.data.join_hosts; |
| 90 | - } else { | 135 | + // } else { |
| 91 | - console.warn(res.data.msg); | 136 | + // console.warn(res.data.msg); |
| 92 | - } | 137 | + // } |
| 93 | - }) | 138 | + // }) |
| 94 | - .catch(err => { | 139 | + // .catch(err => { |
| 95 | - console.error(err); | 140 | + // console.error(err); |
| 96 | - }); | 141 | + // }); |
| 97 | }, | 142 | }, |
| 98 | }; | 143 | }; |
| 99 | </script> | 144 | </script> | ... | ... |
-
Please register or login to post a comment