Showing
3 changed files
with
38 additions
and
8 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-10-20 13:15:00 | 2 | * @Date: 2022-10-20 13:15:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-20 13:38:30 | 4 | + * @LastEditTime: 2022-10-20 21:42:18 |
| 5 | * @FilePath: /swx/src/api/Reg/index.js | 5 | * @FilePath: /swx/src/api/Reg/index.js |
| 6 | * @Description: 报名信息 | 6 | * @Description: 报名信息 |
| 7 | */ | 7 | */ |
| ... | @@ -11,6 +11,7 @@ const Api = { | ... | @@ -11,6 +11,7 @@ const Api = { |
| 11 | MY_INFO: '/srv/?a=reg_my_info', | 11 | MY_INFO: '/srv/?a=reg_my_info', |
| 12 | REG_ADD: '/srv/?a=reg_add', | 12 | REG_ADD: '/srv/?a=reg_add', |
| 13 | REG_EDIT: '/srv/?a=reg_edit', | 13 | REG_EDIT: '/srv/?a=reg_edit', |
| 14 | + REG_CANCEL: '/srv/?a=reg_cancel', | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| ... | @@ -30,3 +31,9 @@ export const addRegAPI = (params) => fn(fetch.post(Api.REG_ADD, params)); | ... | @@ -30,3 +31,9 @@ export const addRegAPI = (params) => fn(fetch.post(Api.REG_ADD, params)); |
| 30 | * @returns | 31 | * @returns |
| 31 | */ | 32 | */ |
| 32 | export const editRegAPI = (params) => fn(fetch.post(Api.REG_EDIT, params)); | 33 | export const editRegAPI = (params) => fn(fetch.post(Api.REG_EDIT, params)); |
| 34 | + | ||
| 35 | +/** | ||
| 36 | + * @description: 取消活动报名 | ||
| 37 | + * @returns | ||
| 38 | + */ | ||
| 39 | +export const cancelRegAPI = (params) => fn(fetch.post(Api.REG_CANCEL, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-27 17:13:05 | 2 | * @Date: 2022-09-27 17:13:05 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-20 18:40:43 | 4 | + * @LastEditTime: 2022-10-20 21:56:24 |
| 5 | * @FilePath: /swx/src/pages/joinActivity/index.vue | 5 | * @FilePath: /swx/src/pages/joinActivity/index.vue |
| 6 | * @Description: 活动报名 | 6 | * @Description: 活动报名 |
| 7 | --> | 7 | --> |
| ... | @@ -213,15 +213,20 @@ const onSubmit = async (val) => { | ... | @@ -213,15 +213,20 @@ const onSubmit = async (val) => { |
| 213 | params.i = getCurrentPageParam().reg_id; | 213 | params.i = getCurrentPageParam().reg_id; |
| 214 | const { code } = await editRegAPI(params); | 214 | const { code } = await editRegAPI(params); |
| 215 | if (code) { | 215 | if (code) { |
| 216 | - Taro.redirectTo({ | 216 | + Taro.showToast({ |
| 217 | - url: '../joinSuccess/index' | 217 | + title: '修改成功', |
| 218 | - }) | 218 | + icon: 'success', |
| 219 | + duration: 3000, | ||
| 220 | + success: function () { | ||
| 221 | + Taro.navigateBack() | ||
| 222 | + } | ||
| 223 | + }); | ||
| 219 | } | 224 | } |
| 220 | } else { | 225 | } else { |
| 221 | const { code } = await addRegAPI(params); | 226 | const { code } = await addRegAPI(params); |
| 222 | if (code) { | 227 | if (code) { |
| 223 | Taro.redirectTo({ | 228 | Taro.redirectTo({ |
| 224 | - url: '../joinSuccess/index' | 229 | + url: '../joinSuccess/index?id=' + getCurrentPageParam().id |
| 225 | }) | 230 | }) |
| 226 | } | 231 | } |
| 227 | } | 232 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-27 17:13:05 | 2 | * @Date: 2022-09-27 17:13:05 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-20 18:50:36 | 4 | + * @LastEditTime: 2022-10-20 21:43:14 |
| 5 | * @FilePath: /swx/src/pages/joinInfo/index.vue | 5 | * @FilePath: /swx/src/pages/joinInfo/index.vue |
| 6 | * @Description: 活动报名 | 6 | * @Description: 活动报名 |
| 7 | --> | 7 | --> |
| ... | @@ -54,21 +54,39 @@ | ... | @@ -54,21 +54,39 @@ |
| 54 | <view @tap="editJoin" class="button">确认修改报名</view> | 54 | <view @tap="editJoin" class="button">确认修改报名</view> |
| 55 | </view> | 55 | </view> |
| 56 | </view> | 56 | </view> |
| 57 | + | ||
| 58 | + <van-dialog id="van-dialog" /> | ||
| 57 | </template> | 59 | </template> |
| 58 | 60 | ||
| 59 | <script setup> | 61 | <script setup> |
| 60 | import { ref, onMounted } from "vue"; | 62 | import { ref, onMounted } from "vue"; |
| 61 | import "taro-ui-vue3/dist/style/components/input.scss"; | 63 | import "taro-ui-vue3/dist/style/components/input.scss"; |
| 62 | import Taro from '@tarojs/taro' | 64 | import Taro from '@tarojs/taro' |
| 63 | -import { myInfoAPI } from '@/api/Reg/index'; | 65 | +import { myInfoAPI, cancelRegAPI } from '@/api/Reg/index'; |
| 64 | import { getCurrentPageParam } from "@/utils/weapp"; | 66 | import { getCurrentPageParam } from "@/utils/weapp"; |
| 67 | +import Dialog from '@/components/vant-weapp/dialog/dialog'; | ||
| 65 | 68 | ||
| 66 | const cancelJoin = (val) => { | 69 | const cancelJoin = (val) => { |
| 70 | + Dialog.confirm({ | ||
| 71 | + title: '标题', | ||
| 72 | + message: '弹窗内容', | ||
| 73 | + confirmButtonColor: '#199a74' | ||
| 74 | + }) | ||
| 75 | + .then(async () => { | ||
| 76 | + // on confirm | ||
| 77 | + const { code, data } = await cancelRegAPI({ i: getCurrentPageParam().reg_id }); | ||
| 78 | + if (code) { | ||
| 67 | Taro.showToast({ | 79 | Taro.showToast({ |
| 68 | title: '取消成功', | 80 | title: '取消成功', |
| 69 | icon: 'success', | 81 | icon: 'success', |
| 70 | duration: 2000 | 82 | duration: 2000 |
| 71 | }); | 83 | }); |
| 84 | + Taro.navigateBack() | ||
| 85 | + } | ||
| 86 | + }) | ||
| 87 | + .catch(() => { | ||
| 88 | + // on cancel | ||
| 89 | + }); | ||
| 72 | } | 90 | } |
| 73 | 91 | ||
| 74 | const editJoin = (val) => { | 92 | const editJoin = (val) => { | ... | ... |
-
Please register or login to post a comment