hookehuyr

✨ feat: 联调取消活动API

/*
* @Date: 2022-10-20 13:15:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-20 13:38:30
* @LastEditTime: 2022-10-20 21:42:18
* @FilePath: /swx/src/api/Reg/index.js
* @Description: 报名信息
*/
......@@ -11,6 +11,7 @@ const Api = {
MY_INFO: '/srv/?a=reg_my_info',
REG_ADD: '/srv/?a=reg_add',
REG_EDIT: '/srv/?a=reg_edit',
REG_CANCEL: '/srv/?a=reg_cancel',
}
/**
......@@ -30,3 +31,9 @@ export const addRegAPI = (params) => fn(fetch.post(Api.REG_ADD, params));
* @returns
*/
export const editRegAPI = (params) => fn(fetch.post(Api.REG_EDIT, params));
/**
* @description: 取消活动报名
* @returns
*/
export const cancelRegAPI = (params) => fn(fetch.post(Api.REG_CANCEL, params));
......
<!--
* @Date: 2022-09-27 17:13:05
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-20 18:40:43
* @LastEditTime: 2022-10-20 21:56:24
* @FilePath: /swx/src/pages/joinActivity/index.vue
* @Description: 活动报名
-->
......@@ -213,15 +213,20 @@ const onSubmit = async (val) => {
params.i = getCurrentPageParam().reg_id;
const { code } = await editRegAPI(params);
if (code) {
Taro.redirectTo({
url: '../joinSuccess/index'
})
Taro.showToast({
title: '修改成功',
icon: 'success',
duration: 3000,
success: function () {
Taro.navigateBack()
}
});
}
} else {
const { code } = await addRegAPI(params);
if (code) {
Taro.redirectTo({
url: '../joinSuccess/index'
url: '../joinSuccess/index?id=' + getCurrentPageParam().id
})
}
}
......
<!--
* @Date: 2022-09-27 17:13:05
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-20 18:50:36
* @LastEditTime: 2022-10-20 21:43:14
* @FilePath: /swx/src/pages/joinInfo/index.vue
* @Description: 活动报名
-->
......@@ -54,21 +54,39 @@
<view @tap="editJoin" class="button">确认修改报名</view>
</view>
</view>
<van-dialog id="van-dialog" />
</template>
<script setup>
import { ref, onMounted } from "vue";
import "taro-ui-vue3/dist/style/components/input.scss";
import Taro from '@tarojs/taro'
import { myInfoAPI } from '@/api/Reg/index';
import { myInfoAPI, cancelRegAPI } from '@/api/Reg/index';
import { getCurrentPageParam } from "@/utils/weapp";
import Dialog from '@/components/vant-weapp/dialog/dialog';
const cancelJoin = (val) => {
Dialog.confirm({
title: '标题',
message: '弹窗内容',
confirmButtonColor: '#199a74'
})
.then(async () => {
// on confirm
const { code, data } = await cancelRegAPI({ i: getCurrentPageParam().reg_id });
if (code) {
Taro.showToast({
title: '取消成功',
icon: 'success',
duration: 2000
});
Taro.navigateBack()
}
})
.catch(() => {
// on cancel
});
}
const editJoin = (val) => {
......