examPointApply.vue
8.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<template>
<view class="container">
<!-- 考官选择类型 -->
<view class="radio-section">
<radio-group @change="onSelfSelectChange" class="radio-group">
<label class="radio-item">
<radio value="1" :checked="form.selfSelect == '1'" class="custom-radio" />
<text class="radio-text">自行录入考官(级位考官)</text>
</label>
<label class="radio-item">
<radio value="0" :checked="form.selfSelect == '0'" class="custom-radio" />
<text class="radio-text">省跆协指派考官</text>
</label>
</radio-group>
</view>
<view class="section">
<!-- 自行录入考官区域 -->
<view class="section examiner-section" v-if="showExamine">
<button class="add-btn" @click="handelAddExamine">+ 添加考官</button>
</view>
<view class="examiner-list" v-if="showExamine">
<view class="examiner-item" v-for="(item, index) in list" :key="item.id">
<view class="info">
<text class="name">{{ item.perName }} {{ item.perCode }}</text>
<text class="idc">证件号码:{{ item.perIdcCode }}</text>
<text class="reg">注册地:{{ item.memName }}</text>
</view>
<button class="del-btn" @click="handleDel(item)">删除</button>
</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-area">
<button class="submit-btn" @click="handelSubmit">确定提交</button>
</view>
<!-- 自定义考点申请弹窗(替换原uni.showModal) -->
<uni-popup ref="applyPopup" type="center" background-color="rgba(0,0,0,0.5)">
<view class="custom-modal">
<view class="modal-title">考点申请</view>
<view class="modal-btns">
<button class="btn-cancel" @click="closeApplyPopup()">暂不申请</button>
<button class="btn-confirm" @click="confirmApply()">立即申请</button>
</view>
<view class="modal-tip">友情提示:非考点无法申请级位考试</view>
</view>
</uni-popup>
<!-- 自定义删除确认弹窗 -->
<uni-popup ref="delPopup" type="center" background-color="rgba(0,0,0,0.5)">
<view class="custom-modal">
<view class="modal-title">提示</view>
<view class="modal-content">确定删除该考官吗?</view>
<view class="modal-btns">
<button class="btn-cancel" @click="closeDelPopup()">取消</button>
<button class="btn-confirm" @click="confirmDel()">确定</button>
</view>
</view>
</uni-popup>
<!-- 自定义省跆协指派提示弹窗 -->
<uni-popup ref="assignPopup" type="center" background-color="rgba(0,0,0,0.5)">
<view class="custom-modal">
<view class="modal-title">温馨提示</view>
<view class="modal-content">关于考官指派,请联系河北省跆协,联系电话:XXXX</view>
<view class="modal-btns">
<button class="btn-confirm single-btn" @click="closeAssignPopup()">我知道了</button>
</view>
</view>
</uni-popup>
<!-- 自定义提交成功弹窗 -->
<uni-popup ref="successPopup" type="center" background-color="rgba(0,0,0,0.5)">
<view class="custom-modal">
<view class="modal-title">成功</view>
<view class="modal-content">提交成功,请等待审核</view>
<view class="modal-btns">
<button class="btn-confirm single-btn" @click="confirmSuccess()">确定</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { ref, } from 'vue'
import { onLoad,onShow } from '@dcloudio/uni-app'
import * as api from '@/common/api.js'
const form = ref({
selfSelect: '1' // 1:自行录入 0:省跆协指派
})
const showExamine = ref(true)
const loading = ref(false)
const list = ref([])
const memId = ref(null)
// 弹窗引用
const applyPopup = ref(null)
const delPopup = ref(null)
const assignPopup = ref(null)
const successPopup = ref(null)
let currentDelItem = ref(null)
onLoad((option) => {
memId.value = option.memId
getExaminer()
})
onShow(() => {
if (memId.value) {
getExaminer()
}
})
async function getExaminer() {
loading.value = true
const res = await api.listApi({ memId: memId.value })
list.value = res.rows
loading.value = false
}
// 删除考官:打开自定义弹窗
function handleDel(row) {
currentDelItem.value = row
delPopup.value.open()
}
// 确认删除
async function confirmDel() {
await api.examinerDel(currentDelItem.value.id)
uni.showToast({ title: '删除成功', icon: 'success' })
getExaminer()
closeDelPopup()
}
function closeDelPopup() {
delPopup.value.close()
}
// 切换考官类型:打开自定义提示弹窗
function onSelfSelectChange(e) {
form.value.selfSelect = e.detail.value
showExamine.value = e.detail.value == '1'
if (e.detail.value == '2') {
assignPopup.value.open()
}
}
function closeAssignPopup() {
assignPopup.value.close()
}
function handelAddExamine() {
const chosenStr = JSON.stringify(list.value)
uni.navigateTo({
url: `/myCenter/chooseExaminer?memId=${memId.value}&isValidity=0&chosen=${chosenStr}`
})
}
// 提交申请:打开自定义成功弹窗
async function handelSubmit() {
if (!form.value.selfSelect) {
return uni.showToast({ title: '请选择考官类型', icon: 'none' })
}
if (form.value.selfSelect == '1' && list.value.length == 0) {
return uni.showToast({ title: '请添加考官', icon: 'none' })
}
try {
await api.commitExamPointApply(form.value)
successPopup.value.open()
} catch (err) {
uni.showToast({ title: err.data.msg, icon: 'none' })
}
}
function confirmSuccess() {
successPopup.value.close()
uni.navigateBack()
}
// 考点申请弹窗(如需调用可在合适位置打开)
function openApplyPopup() {
applyPopup.value.open()
}
function closeApplyPopup() {
applyPopup.value.close()
}
function confirmApply() {
applyPopup.value.close()
// 此处添加考点申请逻辑
}
</script>
<style scoped>
/* 全局容器 */
.container {
min-height: 100vh;
}
.section{
padding:15rpx 20rpx;
}
/* 单选框区域 */
.radio-section {
background: #fff;
padding: 20rpx 15rpx;
margin-bottom: 10rpx;
border: none;
border-radius: 0;
}
.radio-group {
display: flex;
align-items: center;
gap: 30rpx;
}
.radio-item {
display: flex;
align-items: center;
margin: 0;
}
::v-deep .custom-radio .wx-radio-input {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
}
::v-deep .custom-radio .wx-radio-input.wx-radio-input-checked {
border-color: #C4121B !important;
background: #C4121B !important;
}
.radio-text {
font-size: 14px;
color: #333;
margin-left: 8rpx;
}
/* 考官区域 */
.examiner-section {
background: #fff;
padding: 15rpx;
margin-bottom: 20rpx;
border: none;
border-radius: 0;
}
.add-btn {
background: #fff;
color: #C4121B;
border: 1rpx solid #C4121B;
border-radius: 10rpx;
padding: 10rpx 0;
width: 100%;
font-size: 14px;
}
.examiner-list {
padding: 0 10rpx;
background-color: #fff;
margin-bottom: 20rpx;
overflow-y: auto;
margin-bottom: 70px;
}
.examiner-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 20rpx;
border-bottom: 1rpx solid #eee;
align-items: center;
}
.info {
flex: 1;
}
.name {
font-size: 14px;
font-weight: 500;
color: #333;
display: block;
margin-bottom: 5rpx;
}
.idc, .reg {
font-size: 12px;
color: #666;
display: block;
margin: 10rpx 0;
}
.del-btn {
color: #C4121B;
font-size: 12px;
border: 1rpx solid #C4121B;
border-radius: 50rpx;
padding: 10rpx 25rpx;
line-height: 1.2;
background: #fff;
}
/* 提交按钮 */
.submit-area {
padding: 20rpx 0;
background-color: #fff;
width: 100%;
position: fixed;
bottom: 0;
}
.submit-btn {
width: 80%;
height: 88rpx;
border-radius: 44rpx;
margin: 0 auto;
line-height: 88rpx;
background: #C4121B;
color: #fff;
text-align: center;
font-size: 16px;
border: none;
}
/* 自定义弹窗样式(核心) */
.custom-modal {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
padding: 40rpx 30rpx;
box-sizing: border-box;
text-align: center;
}
.modal-title {
font-size: 36rpx;
font-weight: 600;
color: #333;
margin-bottom: 30rpx;
}
.modal-content {
font-size: 30rpx;
color: #666;
line-height: 1.6;
margin-bottom: 30rpx;
}
.modal-tip {
font-size: 28rpx;
color: #FF7A00;
margin-top: 20rpx;
}
.modal-btns {
display: flex;
justify-content: space-between;
gap: 20rpx;
}
.btn-cancel {
flex: 1;
height: 80rpx;
line-height: 80rpx;
background: #f5f5f5;
color: #999;
border-radius: 40rpx;
font-size: 32rpx;
border: none;
}
.btn-confirm {
flex: 1;
height: 80rpx;
line-height: 80rpx;
background: #C4121B;
color: #fff;
border-radius: 40rpx;
font-size: 32rpx;
border: none;
}
.single-btn {
flex: 1;
}
.btn-cancel::after, .btn-confirm::after {
border: none;
}
</style>