d923ac96 by lttnew

添加考官

1 parent bebae732
1 // dev 1 // dev
2 const baseUrl_api = 'http://192.168.1.137:8787' 2 // const baseUrl_api = 'http://192.168.1.137:8787'
3 // const baseUrl_api = 'http://tk001.wxjylt.com/stage-api' 3 const baseUrl_api = 'http://tk001.wxjylt.com/stage-api'
4 const loginImage_api = 'http://tk001.wxjylt.com/stage-api' 4 const loginImage_api = 'http://tk001.wxjylt.com/stage-api'
5 const payUrl = 'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do' 5 const payUrl = 'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do'
6 6
......
...@@ -354,14 +354,14 @@ ...@@ -354,14 +354,14 @@
354 if (dayjs(form.value.startTime).valueOf() < dayjs(form.value.applyTime).valueOf()) { 354 if (dayjs(form.value.startTime).valueOf() < dayjs(form.value.applyTime).valueOf()) {
355 uni.showToast({ 355 uni.showToast({
356 title: `考试开始时间应大于申请日期`, 356 title: `考试开始时间应大于申请日期`,
357 icon: 'error' 357 icon: 'none'
358 }) 358 })
359 return 359 return
360 } 360 }
361 if (dayjs(form.value.endTime).valueOf() <= dayjs(form.value.startTime).valueOf()) { 361 if (dayjs(form.value.endTime).valueOf() <= dayjs(form.value.startTime).valueOf()) {
362 uni.showToast({ 362 uni.showToast({
363 title: `考试结束时间应大于考试开始时间`, 363 title: `考试结束时间应大于考试开始时间`,
364 icon: 'error' 364 icon: 'none'
365 }) 365 })
366 return 366 return
367 } 367 }
......
1 <template> 1 <template>
2 <view> 2 <view>
3 <view class="nolineform"> 3 <!-- 顶部添加考官按钮 -->
4 <uni-form @submit="getList"> 4 <view class="add-btn-box">
5 <uni-forms-item label="考官姓名"> 5 <button class="btn-red-kx mini" @click="openAddExaminer">
6 <uni-easyinput :placeholderStyle="placeholderStyle" 6 <uni-icons type="personadd" size="14" color="#AD181F"></uni-icons>
7 :input-border="false" 7 添加考官
8 v-model="query.name" placeholder="考官姓名"> 8 </button>
9 </uni-easyinput>
10 </uni-forms-item>
11 <uni-forms-item label="考官编号">
12 <uni-easyinput :placeholderStyle="placeholderStyle"
13 :input-border="false"
14 v-model="query.certCode" placeholder="考官编号">
15 </uni-easyinput>
16 </uni-forms-item>
17 </uni-form>
18 <view class="button-group">
19 <button size="mini" @click="resetQuery">重置</button>
20 <button type="primary" size="mini" @click="getList">查询</button>
21 </view>
22 </view> 9 </view>
10
23 <view class="indexboxre"> 11 <view class="indexboxre">
24 <view class="userlist"> 12 <view class="userlist">
25 <view class="item" v-for="(n,index) in list" :key="index"> 13 <view class="item" v-for="(n,index) in list" :key="index">
26 <!-- <view class="photobox">
27 <image class="photo" v-if="n.photo" :src="n.photo" mode='aspectFill'></image>
28 <view class="colorful" v-else>{{n.name.slice(1,2)}}</view>
29 </view> -->
30 <view> 14 <view>
31 <view class="name">{{n.name}}</view> 15 <view class="name">{{n.perName}}</view>
32 <view class="date">会员号:{{n.perCode||'-'}}</view> 16 <view class="date">会员号:{{n.perCode||'-'}}</view>
33 <view class="date">证件号码:{{n.idcCode||'-'}}</view> 17 <view class="date">有效日期:{{n.roleInfo && n.roleInfo.validTime ? n.roleInfo.validTime : '-'}}</view>
34 <view class="date">注册地:{{n.memName||'-'}}</view> 18 <view class="date">注册地:{{n.memName||'-'}}</view>
19 <view class="date" :class="{'text-danger': n.canChoose != 1}">
20 状态:{{ n.canChoose == 1 ? '正常' : '资质已过期' }}
21 </view>
35 </view> 22 </view>
36 <view class="status"> 23 <view class="status">
37 <text v-if="n.disabled">已选</text> 24 <text v-if="isChosen(n)" class="text-gray">已选</text>
38 <text v-else class="text-primary" @click="handleChoose(n)">选择</text> 25 <text v-else class="text-primary" @click="handleChoose(n)">选择</text>
39
40 </view> 26 </view>
41 </view> 27 </view>
42 </view> 28 </view>
43 <view class="nodata" v-if="list.length==0"> 29 <view class="nodata" v-if="list.length==0 && !loading">
44 <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> 30 <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image>
45 <text>请输入考官姓名和编号精确查找</text> 31 <text>暂无考官数据</text>
46 </view> 32 </view>
47 </view> 33 </view>
48 34
35 <!-- 添加考官弹窗 -->
36 <uni-popup ref="addPopup" type="bottom" background-color="#fff" animation>
37 <view class="popBody">
38 <view class="h3 text-center">添加考官</view>
39 <view class="form-item">
40 <text class="label">考官姓名</text>
41 <uni-easyinput v-model="addForm.name" placeholder="请输入考官姓名" />
42 </view>
43 <view class="form-item" v-if="addForm.type == 1">
44 <text class="label">考官编号</text>
45 <uni-easyinput v-model="addForm.certCode" placeholder="请输入考官编号" />
46 </view>
47 <view class="btn-group">
48 <button class="btn-cancel" @click="addPopup.close()">取消</button>
49 <button class="btn-confirm" @click="searchAndAdd">查询</button>
50 </view>
51
52 <!-- 搜索结果 -->
53 <view v-if="searchResult" class="search-result">
54 <view class="result-item">
55 <view class="info">
56 <view class="name">{{searchResult.perName}}</view>
57 <view class="date">会员号:{{searchResult.perCode||'-'}}</view>
58 <view class="date">证件号码:{{searchResult.idcCode||'-'}}</view>
59 <view class="date">注册地:{{searchResult.memName||'-'}}</view>
60 </view>
61 <view class="action">
62 <text v-if="searchResult.added" class="text-gray">已添加</text>
63 <text v-else class="text-primary" @click="doAddExaminer(searchResult)">添加</text>
64 </view>
65 </view>
66 </view>
67 <view v-if="searchNoData" class="no-data">
68 <text>未查询到考官信息</text>
69 </view>
70 </view>
71 </uni-popup>
49 </view> 72 </view>
50 </template> 73 </template>
51 74
...@@ -53,103 +76,144 @@ ...@@ -53,103 +76,144 @@
53 import * as api from '@/common/api.js' 76 import * as api from '@/common/api.js'
54 import config from '@/config.js' 77 import config from '@/config.js'
55 import { 78 import {
56 ref, 79 ref
57 getCurrentInstance
58 } from 'vue' 80 } from 'vue'
59 import { 81 import {
60 onLoad 82 onLoad
61 } from '@dcloudio/uni-app' 83 } from '@dcloudio/uni-app'
62 import _ from 'underscore'
63 const {
64 proxy
65 } = getCurrentInstance()
66 const app = getApp(); 84 const app = getApp();
67 const query = ref({
68
69 })
70 const placeholderStyle = ref('text-align: right;font-size:30rpx')
71 const list = ref([]) 85 const list = ref([])
72 const total = ref(0) 86 const loading = ref(false)
73 const userType = ref('')
74 let chosen = [] 87 let chosen = []
75 let ec = null 88 let ec = null
89
90 const addPopup = ref(null)
91 const addForm = ref({
92 type: 1,
93 name: '',
94 certCode: ''
95 })
96 const searchResult = ref(null)
97 const searchNoData = ref(false)
98
76 onLoad((option) => { 99 onLoad((option) => {
77 query.value.type = option.type 100 chosen = JSON.parse(decodeURIComponent(option.chosen || '[]'))
78 chosen = JSON.parse(decodeURIComponent(option.chosen)) || []
79 ec = option.ec 101 ec = option.ec
80 console.log(chosen) 102 getList()
81 }) 103 })
82 function resetQuery() { 104
83 query.value = {}
84 list.value = []
85 }
86 function getList() { 105 function getList() {
87 if (!query.value.name) { 106 loading.value = true
88 return 107 uni.showLoading({ title: '加载中' })
89 } 108 api.listApi({ memId: app.globalData.memberInfo.memId }).then(res => {
90 if (!query.value.certCode) { 109 list.value = res.rows || []
91 return 110 for (let l of list.value) {
92 } 111 if (l.roleInfo) {
93 uni.showLoading({ 112 try {
94 title: `查找中` 113 l.roleInfo = typeof l.roleInfo === 'string' ? JSON.parse(l.roleInfo) : l.roleInfo
95 }) 114 } catch (e) {}
96 api.getCoachList(query.value).then(res => {
97 if (res.rows.length == 0) {
98 uni.showToast({
99 title: '未查询到考官信息',
100 icon: "error"
101 })
102 list.value = []
103 return
104 } 115 }
105 list.value = res.rows 116 // 检查是否已选
106 for(var l of list.value){ 117 for (let t of chosen) {
107 // if(l.photo&&l.photo.indexOf('http')==-1){ 118 if (t.perId == l.perId) {
108 // l.photo = config.baseUrl_api + l.photo
109 // }
110 for(var t of chosen){
111 if(t.perId == l.perId){
112 l.disabled = true 119 l.disabled = true
113 } 120 }
114 } 121 }
115 } 122 }
116 uni.hideLoading() 123 uni.hideLoading()
124 loading.value = false
125 }).catch(() => {
126 uni.hideLoading()
127 loading.value = false
117 }) 128 })
118 } 129 }
119 130
120 function checkChosen(n) { 131 function isChosen(n) {
121 return _.some(chosen, (c) => { 132 return chosen.some(c => c.perId == n.perId)
122 return c.perId == n.perId
123 })
124 } 133 }
125 134
126 function handleChoose(row) { 135 function handleChoose(row) {
127 if (row.canChoose != 1){ 136 if (row.canChoose != 1) {
128 uni.showToast({ 137 uni.showToast({
129 title: '该考官资质已过期!', 138 title: '该考官资质已过期!',
130 icon: "error" 139 icon: 'error'
131 }) 140 })
132 return 141 return
133 } 142 }
134 143
135 var pages = getCurrentPages()
136 var prevPage = pages[pages.length - 2]
137 var obj = { 144 var obj = {
138 perId: row.perId, 145 perId: row.perId,
139 name: row.name, 146 name: row.perName,
140 } 147 }
141 148
142 // prevPage.onShow(obj) 149 uni.$emit('chosen', {
143 uni.$emit('chosen',{ 150 obj: obj,
144 obj:obj,
145 ec 151 ec
146 }) 152 })
147 uni.navigateBack({delta:1}) 153 uni.navigateBack({ delta: 1 })
154 }
155
156 // 打开添加考官弹窗
157 function openAddExaminer() {
158 addForm.value.name = ''
159 addForm.value.certCode = ''
160 searchResult.value = null
161 searchNoData.value = false
162 addPopup.value.open()
163 }
164
165 // 搜索并添加考官
166 function searchAndAdd() {
167 if (!addForm.value.name) {
168 uni.showToast({ title: '请输入考官姓名', icon: 'none' })
169 return
170 }
171 if (addForm.value.type == 1 && !addForm.value.certCode) {
172 uni.showToast({ title: '请输入考官编号', icon: 'none' })
173 return
148 } 174 }
149 175
150 function handleInfo(n) { 176 uni.showLoading({ title: '查询中' })
151 uni.navigateTo({ 177 api.getCoachList(addForm.value).then(res => {
152 url: `/personalVip/detail?perId=${n.perId}` 178 uni.hideLoading()
179 if (res.rows && res.rows.length > 0) {
180 searchResult.value = res.rows[0]
181 // 检查是否已添加
182 const isAdded = list.value.some(l => l.perId === searchResult.value.perId)
183 if (isAdded) {
184 searchResult.value.added = true
185 }
186 } else {
187 searchResult.value = null
188 searchNoData.value = true
189 }
190 }).catch(() => {
191 uni.hideLoading()
192 searchResult.value = null
193 searchNoData.value = true
194 })
195 }
196
197 // 执行添加考官
198 function doAddExaminer(row) {
199 uni.showModal({
200 title: '提示',
201 content: `确定添加 "${row.name}" 为考官吗?`,
202 success: (res) => {
203 if (res.confirm) {
204 uni.showLoading({ title: '添加中' })
205 api.selfAdd(app.globalData.memberInfo.memId, row.perId).then(() => {
206 uni.hideLoading()
207 uni.showToast({ title: '添加成功', icon: 'success' })
208 addPopup.value.close()
209 // 刷新列表
210 getList()
211 }).catch(() => {
212 uni.hideLoading()
213 uni.showToast({ title: '添加失败', icon: 'error' })
214 })
215 }
216 }
153 }) 217 })
154 } 218 }
155 </script> 219 </script>
...@@ -157,38 +221,156 @@ ...@@ -157,38 +221,156 @@
157 <style scoped lang="scss"> 221 <style scoped lang="scss">
158 .indexboxre { 222 .indexboxre {
159 padding: 0 30rpx; 223 padding: 0 30rpx;
160
161 .tt {
162 font-size: 30rpx;
163 margin: 0 0 30rpx;
164 color: #4C5359;
165 } 224 }
166 225
167 position: relative; 226 .add-btn-box {
168 height: calc(100vh - 300rpx); 227 padding: 20rpx 30rpx;
228
229 .btn-red-kx {
230 width: 100%;
231 display: inline-flex;
232 align-items: center;
233 background: #fff;
234 border: 1px solid #AD181F;
235 color: #AD181F;
236 text-align: center;
237 font-size: 26rpx;
238 padding: 10rpx 20rpx;
239 height: 60rpx;
240 line-height: 60rpx;
241 justify-content: center;
242 }
169 } 243 }
170 244
171 .searchbar { 245 .userlist {
246 .item {
172 display: flex; 247 display: flex;
248 justify-content: space-between;
173 align-items: center; 249 align-items: center;
174 padding: 25rpx; 250 padding: 30rpx;
175 box-sizing: border-box; 251 margin-bottom: 20rpx;
252 background: #fff;
253 border-radius: 10rpx;
176 254
177 :deep(.uni-easyinput .uni-easyinput__content) { 255 .name {
178 border-radius: 35rpx; 256 font-size: 32rpx;
179 border: none; 257 font-weight: bold;
180 height: 70rpx; 258 margin-bottom: 10rpx;
181 } 259 }
182 260
183 :deep(.uni-easyinput__content-input) { 261 .date {
184 font-size: 26rpx; 262 font-size: 26rpx;
263 color: #666;
264 margin-top: 6rpx;
265 }
266
267 .status {
268 text {
269 padding: 10rpx 20rpx;
270 font-size: 28rpx;
271 }
272 }
273 }
274 }
275
276 .text-primary {
277 color: #007aff;
278 }
279
280 .text-gray {
281 color: #999;
282 }
283
284 .text-danger {
285 color: #dd524d;
286 }
287
288 .popBody {
289 padding: 40rpx 30rpx;
290
291 .h3 {
292 font-size: 32rpx;
293 font-weight: bold;
294 margin-bottom: 30rpx;
295 }
296
297 .form-item {
298 margin-bottom: 20rpx;
299
300 .label {
301 display: block;
302 font-size: 28rpx;
303 color: #333;
304 margin-bottom: 10rpx;
185 } 305 }
186 } 306 }
187 .button-group {
188 text-align: right;
189 307
190 button { 308 .btn-group {
191 margin-left: 30rpx; 309 display: flex;
310 justify-content: center;
311 gap: 40rpx;
312 margin-top: 30rpx;
313
314 .btn-cancel,
315 .btn-confirm {
316 width: 200rpx;
317 height: 70rpx;
318 line-height: 70rpx;
319 font-size: 28rpx;
320 border-radius: 35rpx;
192 } 321 }
322
323 .btn-cancel {
324 background: #fff;
325 color: #AD181F;
326 border: 1px solid #AD181F;
327 }
328
329 .btn-confirm {
330 background: #AD181F;
331 color: #fff;
332 }
333 }
334 }
335
336 .search-result {
337 margin-top: 30rpx;
338 border-top: 1px solid #eee;
339 padding-top: 20rpx;
340
341 .result-item {
342 display: flex;
343 justify-content: space-between;
344 align-items: center;
345 padding: 20rpx;
346 background: #f9f9f9;
347 border-radius: 8rpx;
348
349 .name {
350 font-size: 30rpx;
351 font-weight: bold;
352 margin-bottom: 8rpx;
353 }
354
355 .date {
356 font-size: 24rpx;
357 color: #666;
358 margin-top: 4rpx;
359 }
360
361 .action {
362 text {
363 padding: 10rpx 20rpx;
364 font-size: 28rpx;
365 }
366 }
367 }
368 }
369
370 .no-data {
371 text-align: center;
372 padding: 40rpx;
373 color: #999;
374 font-size: 28rpx;
193 } 375 }
194 </style> 376 </style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!