hookehuyr

fix 义工报名修改逻辑修改

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-27 18:41:46 4 + * @LastEditTime: 2022-10-28 13:42:48
5 * @FilePath: /swx/src/pages/joinVolunteer/index.vue 5 * @FilePath: /swx/src/pages/joinVolunteer/index.vue
6 * @Description: 义工报名 6 * @Description: 义工报名
7 --> 7 -->
...@@ -141,16 +141,31 @@ const onSubmit = async () => { ...@@ -141,16 +141,31 @@ const onSubmit = async () => {
141 gender: user_sex.value, 141 gender: user_sex.value,
142 post: post_status.value 142 post: post_status.value
143 } 143 }
144 - const { code } = await addRegAPI(params); 144 + if (getCurrentPageParam().type === 'edit') {
145 - if (code) { 145 + params.i = getCurrentPageParam().reg_id;
146 - Taro.showToast({ 146 + const { code } = await editRegAPI(params);
147 - title: '报名成功', 147 + if (code) {
148 - icon: 'success', 148 + Taro.showToast({
149 - duration: 3000, 149 + title: '修改成功',
150 - success: function () { 150 + icon: 'success',
151 - Taro.navigateBack() 151 + duration: 3000,
152 - } 152 + success: function () {
153 - }); 153 + Taro.navigateBack()
154 + }
155 + });
156 + }
157 + } else {
158 + const { code } = await addRegAPI(params);
159 + if (code) {
160 + Taro.showToast({
161 + title: '报名成功',
162 + icon: 'success',
163 + duration: 3000,
164 + success: function () {
165 + Taro.navigateBack()
166 + }
167 + });
168 + }
154 } 169 }
155 } 170 }
156 } 171 }
...@@ -161,7 +176,7 @@ const onSubmit = async () => { ...@@ -161,7 +176,7 @@ const onSubmit = async () => {
161 import "./index.less"; 176 import "./index.less";
162 import { activityInfoAPI } from '@/api/Host/index'; 177 import { activityInfoAPI } from '@/api/Host/index';
163 import { getCurrentPageParam } from "@/utils/weapp"; 178 import { getCurrentPageParam } from "@/utils/weapp";
164 -import { addRegAPI } from '@/api/Reg/index'; 179 +import { addRegAPI, editRegAPI } from '@/api/Reg/index';
165 import Toast from '@/components/vant-weapp/toast/toast'; 180 import Toast from '@/components/vant-weapp/toast/toast';
166 181
167 export default { 182 export default {
......