a9508795 by lttnew

级位申请优化

1 parent f120f0ea
1 // dev 1 // dev
2 const baseUrl_api = 'http://192.168.1.222:8787' 2 // const baseUrl_api = 'http://192.168.1.222:8787'
3 // const baseUrl_api = 'http://47.98.186.233:8787' 3 // const baseUrl_api = 'http://47.98.186.233:8787'
4 // const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/' 4 const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
5 const loginImage_api = 'https://tk001.wxjylt.com/stage-api' 5 const loginImage_api = 'https://tk001.wxjylt.com/stage-api'
6 const payUrl = 'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do' 6 const payUrl = 'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do'
7 7
......
1 <template> 1 <template>
2 <view class="add-apply-page"> 2 <view :class="{ 'dropdown-open-page': activeSelectKey }" class="add-apply-page" @click="closeLevelDropdown">
3 <view v-if="activeSelectKey" class="level-dropdown-mask" @click="closeLevelDropdown"></view>
4 <!-- 顶部步骤条 --> 3 <!-- 顶部步骤条 -->
5 <view class="steps-bar"> 4 <view class="steps-bar">
6 <view :class="{ active: active >= 0, current: active == 0 }" class="step-item"> 5 <view :class="{ active: active >= 0, current: active == 0 }" class="step-item">
...@@ -106,7 +105,7 @@ ...@@ -106,7 +105,7 @@
106 <view 105 <view
107 v-for="(n,index) in infoList" 106 v-for="(n,index) in infoList"
108 :key="n.id || n.perId || n.idcCode || index" 107 :key="n.id || n.perId || n.idcCode || index"
109 :class="{ 'select-open': activeSelectKey === getRowKey(n, index) }" 108 :class="{ 'select-open': isRowDropdownOpen(n, index) }"
110 class="student-card" 109 class="student-card"
111 > 110 >
112 <!-- 左侧:头像+考生信息 --> 111 <!-- 左侧:头像+考生信息 -->
...@@ -135,32 +134,57 @@ ...@@ -135,32 +134,57 @@
135 <view class="level-item"> 134 <view class="level-item">
136 <text class="level-label">考试级别</text> 135 <text class="level-label">考试级别</text>
137 <view class="select-wrapper exam-level-select"> 136 <view class="select-wrapper exam-level-select">
138 <view class="exam-level-trigger" @click="toggleLevelDropdown(n, index)"> 137 <view
138 :class="`level-trigger-${index}`"
139 class="exam-level-trigger"
140 @click.stop="toggleLevelDropdown(n, index)"
141 >
139 <text>{{ getLevelText(n.levelNew) || '请选择' }}</text> 142 <text>{{ getLevelText(n.levelNew) || '请选择' }}</text>
140 <uni-icons color="#999" size="14" type="top"></uni-icons> 143 <uni-icons color="#999" size="14" type="top"></uni-icons>
141 </view> 144 </view>
142 <view 145 <scroll-view
143 v-if="activeSelectKey === getRowKey(n, index)" 146 v-if="isLevelDropdownOpen(n, index)"
144 class="level-dropdown-up" 147 class="level-dropdown-local"
148 :scroll-y="true"
149 @click.stop
145 > 150 >
146 <view class="level-dropdown-inner"> 151 <view
147 <view 152 v-for="item in getLevelOptions(n)"
148 v-for="item in getLevelOptions(n)" 153 :key="item.value"
149 :key="item.value" 154 :class="{ active: n.levelNew === item.value }"
150 :class="{ active: n.levelNew === item.value }" 155 class="level-dropdown-item"
151 class="level-dropdown-item" 156 @click.stop="chooseLevel(n, item)"
152 @click.stop="chooseLevel(n, item)" 157 >
153 > 158 {{ item.text }}
154 {{ item.text }}
155 </view>
156 </view> 159 </view>
157 </view> 160 </scroll-view>
158 </view> 161 </view>
159 </view> 162 </view>
160 <view class="level-item"> 163 <view class="level-item">
161 <text class="level-label">是否通过</text> 164 <text class="level-label">是否通过</text>
162 <view class="select-wrapper"> 165 <view class="select-wrapper pass-select">
163 <uni-data-select v-model="n.isPass" :clear="false" :localdata="range"/> 166 <view
167 class="exam-level-trigger"
168 @click.stop="togglePassDropdown(n, index)"
169 >
170 <text>{{ getPassText(n.isPass) }}</text>
171 <uni-icons color="#999" size="14" type="top"></uni-icons>
172 </view>
173 <view
174 v-if="isPassDropdownOpen(n, index)"
175 class="level-dropdown-local pass-dropdown-local"
176 @click.stop
177 >
178 <view
179 v-for="item in range"
180 :key="item.value"
181 :class="{ active: n.isPass === item.value }"
182 class="level-dropdown-item"
183 @click.stop="choosePass(n, item)"
184 >
185 {{ item.text }}
186 </view>
187 </view>
164 </view> 188 </view>
165 </view> 189 </view>
166 </view> 190 </view>
...@@ -192,7 +216,7 @@ ...@@ -192,7 +216,7 @@
192 </view> 216 </view>
193 217
194 <!-- 添加考生弹框 --> 218 <!-- 添加考生弹框 -->
195 <uni-popup ref="addPopup" type="center" :mask-click="false" style="z-index: 99999"> 219 <uni-popup ref="addPopup" class="add-student-popup" type="center" :mask-click="false" style="z-index: 1001">
196 <view class="add-popup"> 220 <view class="add-popup">
197 <view class="popup-title">添加考生</view> 221 <view class="popup-title">添加考生</view>
198 <view class="popup-content"> 222 <view class="popup-content">
...@@ -225,7 +249,7 @@ ...@@ -225,7 +249,7 @@
225 </uni-popup> 249 </uni-popup>
226 250
227 <!-- 调动确认弹框 --> 251 <!-- 调动确认弹框 -->
228 <uni-popup ref="transferPopup" type="center" :mask-click="false" style="z-index: 999999"> 252 <uni-popup ref="transferPopup" class="add-student-popup" type="center" :mask-click="false" style="z-index: 1001">
229 <view class="add-popup"> 253 <view class="add-popup">
230 <view class="popup-title">系统提示</view> 254 <view class="popup-title">系统提示</view>
231 <view class="popup-content"> 255 <view class="popup-content">
...@@ -380,6 +404,23 @@ function getRowKey(row, index = 0) { ...@@ -380,6 +404,23 @@ function getRowKey(row, index = 0) {
380 return String(row.id || row.perId || row.personId || row.idcCode || index) 404 return String(row.id || row.perId || row.personId || row.idcCode || index)
381 } 405 }
382 406
407 function getDropdownKey(type, row, index = 0) {
408 return `${type}-${getRowKey(row, index)}`
409 }
410
411 function isRowDropdownOpen(row, index = 0) {
412 const rowKey = getRowKey(row, index)
413 return activeSelectKey.value === `level-${rowKey}` || activeSelectKey.value === `pass-${rowKey}`
414 }
415
416 function isLevelDropdownOpen(row, index = 0) {
417 return activeSelectKey.value === getDropdownKey('level', row, index)
418 }
419
420 function isPassDropdownOpen(row, index = 0) {
421 return activeSelectKey.value === getDropdownKey('pass', row, index)
422 }
423
383 function cloneLevelOptions(list = defaultLevelArr) { 424 function cloneLevelOptions(list = defaultLevelArr) {
384 return list.map(item => ({ ...item })) 425 return list.map(item => ({ ...item }))
385 } 426 }
...@@ -422,6 +463,11 @@ function getLevelText(value) { ...@@ -422,6 +463,11 @@ function getLevelText(value) {
422 return option?.text || `${szToHz(value)}级` 463 return option?.text || `${szToHz(value)}级`
423 } 464 }
424 465
466 function getPassText(value) {
467 const option = _.find(range.value, item => item.value === value)
468 return option?.text || '请选择'
469 }
470
425 function setDefaultLevel(row) { 471 function setDefaultLevel(row) {
426 row.levelOld = row.levelOld ? String(row.levelOld) : '' 472 row.levelOld = row.levelOld ? String(row.levelOld) : ''
427 row.levelNew = row.levelNew ? String(row.levelNew) : '' 473 row.levelNew = row.levelNew ? String(row.levelNew) : ''
...@@ -434,11 +480,9 @@ function setDefaultLevel(row) { ...@@ -434,11 +480,9 @@ function setDefaultLevel(row) {
434 row.levelRecommend = '9' 480 row.levelRecommend = '9'
435 } 481 }
436 482
437 // 原级别是一级时不能默认推荐,其他情况按推荐级别回填,保证二次添加后列表能显示考试级别。 483 // 按推荐级别回填;原级别为一级时推荐级别也是一级,和 PC 默认展示保持一致。
438 if (row.levelOld === '1') { 484 if (!row.levelNew) {
439 row.levelNew = '' 485 row.levelNew = row.levelOld === '1' ? '1' : row.levelRecommend
440 } else if (!row.levelNew) {
441 row.levelNew = row.levelRecommend
442 } 486 }
443 487
444 if (!row.isPass) { 488 if (!row.isPass) {
...@@ -626,12 +670,18 @@ function prev() { ...@@ -626,12 +670,18 @@ function prev() {
626 670
627 function goChooseStudent() { 671 function goChooseStudent() {
628 uni.navigateTo({ 672 uni.navigateTo({
629 url: `/level/chooseStudent?examId=${form.value.examId}&memId=${memberInfo.memId}&examType=${form.value.type}` 673 url: `/level/chooseStudent?examId=${form.value.examId}&memId=${memberInfo.memId}&examType=${form.value.type}`,
674 events: {
675 studentSelected: () => {
676 getChosedStudentList()
677 }
678 }
630 }) 679 })
631 } 680 }
632 681
633 // 打开添加弹框 682 // 打开添加弹框
634 function handleAdd() { 683 function handleAdd() {
684 closeLevelDropdown()
635 addForm.value = { 685 addForm.value = {
636 name: '', 686 name: '',
637 idcType: '0', 687 idcType: '0',
...@@ -690,6 +740,7 @@ async function confirmAdd() { ...@@ -690,6 +740,7 @@ async function confirmAdd() {
690 await handelAddPerson() 740 await handelAddPerson()
691 } else { 741 } else {
692 // 人员不在本机构,显示自定义确认弹框(不关闭添加弹框,保留表单数据) 742 // 人员不在本机构,显示自定义确认弹框(不关闭添加弹框,保留表单数据)
743 closeLevelDropdown()
693 transferPopup.value?.open() 744 transferPopup.value?.open()
694 } 745 }
695 } catch (err) { 746 } catch (err) {
...@@ -776,7 +827,7 @@ function szToHz(num) { ...@@ -776,7 +827,7 @@ function szToHz(num) {
776 let nowRow 827 let nowRow
777 828
778 function toggleLevelDropdown(row, index = 0) { 829 function toggleLevelDropdown(row, index = 0) {
779 const rowKey = getRowKey(row, index) 830 const rowKey = getDropdownKey('level', row, index)
780 if (activeSelectKey.value === rowKey) { 831 if (activeSelectKey.value === rowKey) {
781 closeLevelDropdown() 832 closeLevelDropdown()
782 return 833 return
...@@ -784,37 +835,12 @@ function toggleLevelDropdown(row, index = 0) { ...@@ -784,37 +835,12 @@ function toggleLevelDropdown(row, index = 0) {
784 nowRow = row 835 nowRow = row
785 activeSelectKey.value = rowKey 836 activeSelectKey.value = rowKey
786 getLevelOptions(row) 837 getLevelOptions(row)
787 changeLevelfather(row, index)
788 } 838 }
789 839
790 function closeLevelDropdown() { 840 function closeLevelDropdown() {
791 activeSelectKey.value = '' 841 activeSelectKey.value = ''
792 } 842 }
793 843
794 function changeLevelfather(row, index = 0, flag = 0) {
795 nowRow = row
796 activeSelectKey.value = getRowKey(row, index)
797 const data = _.map(infoList.value, (d) => {
798 return {
799 id: d.id,
800 levelNew: d.levelNew,
801 // score: d.score,
802 isPass: d.isPass
803 }
804 })
805 api.editLevel({
806 examId: form.value.examId,
807 personInfo: JSON.stringify(data),
808 transcript: form.value.transcript,
809 // perId: row.perId,
810 status: flag
811 }).then(res => {
812 const options = normalizeLevelOptions(res.data)
813 row.levelOptions = options
814 levelArr.value = options
815 })
816 }
817
818 function chooseLevel(row, item) { 844 function chooseLevel(row, item) {
819 if (!row) return 845 if (!row) return
820 const oldLevel = row.levelNew 846 const oldLevel = row.levelNew
...@@ -822,6 +848,21 @@ function chooseLevel(row, item) { ...@@ -822,6 +848,21 @@ function chooseLevel(row, item) {
822 changeLevel(row, oldLevel) 848 changeLevel(row, oldLevel)
823 } 849 }
824 850
851 function togglePassDropdown(row, index = 0) {
852 const rowKey = getDropdownKey('pass', row, index)
853 if (activeSelectKey.value === rowKey) {
854 closeLevelDropdown()
855 return
856 }
857 activeSelectKey.value = rowKey
858 }
859
860 function choosePass(row, item) {
861 if (!row) return
862 row.isPass = item.value
863 closeLevelDropdown()
864 }
865
825 function changeLevel(row, oldLevel) { 866 function changeLevel(row, oldLevel) {
826 nowRow = row || nowRow 867 nowRow = row || nowRow
827 openConfirmModal({ 868 openConfirmModal({
...@@ -924,17 +965,36 @@ function handleDelete(row) { ...@@ -924,17 +965,36 @@ function handleDelete(row) {
924 .add-apply-page { 965 .add-apply-page {
925 min-height: 100vh; 966 min-height: 100vh;
926 background: #f5f5f5; 967 background: #f5f5f5;
927 padding-bottom: 120rpx; 968 padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
969 box-sizing: border-box;
970
971 &.dropdown-open-page {
972 padding-bottom: calc(520rpx + env(safe-area-inset-bottom));
973 }
928 } 974 }
929 975
930 .level-dropdown-mask { 976 :deep(.add-student-popup) {
931 position: fixed; 977 z-index: 1001 !important;
932 top: 0; 978 }
933 left: 0; 979
934 right: 0; 980 :deep(.add-student-popup .uni-popup) {
935 bottom: 0; 981 z-index: 1001 !important;
936 z-index: 90; 982 }
937 background: transparent; 983
984 .level-dropdown-item {
985 height: 72rpx;
986 line-height: 72rpx;
987 padding: 0 24rpx;
988 font-size: 28rpx;
989 color: #333;
990 text-align: left;
991 box-sizing: border-box;
992
993 &.active {
994 color: #AD181F;
995 font-weight: 600;
996 background: #FFF5F5;
997 }
938 } 998 }
939 999
940 /* 顶部步骤条 */ 1000 /* 顶部步骤条 */
...@@ -1079,6 +1139,7 @@ function handleDelete(row) { ...@@ -1079,6 +1139,7 @@ function handleDelete(row) {
1079 .stat-total { 1139 .stat-total {
1080 font-size: 28rpx; 1140 font-size: 28rpx;
1081 font-weight: 600; 1141 font-weight: 600;
1142 width: 120rpx;
1082 color: #333; 1143 color: #333;
1083 } 1144 }
1084 1145
...@@ -1250,12 +1311,13 @@ function handleDelete(row) { ...@@ -1250,12 +1311,13 @@ function handleDelete(row) {
1250 .select-wrapper { 1311 .select-wrapper {
1251 width: 160rpx; 1312 width: 160rpx;
1252 position: relative; 1313 position: relative;
1253 z-index: 2; 1314 z-index: 200;
1254 overflow: visible; 1315 overflow: visible;
1255 } 1316 }
1256 1317
1257 .exam-level-select { 1318 .exam-level-select,
1258 z-index: 130; 1319 .pass-select {
1320 z-index: 200;
1259 1321
1260 .exam-level-trigger { 1322 .exam-level-trigger {
1261 display: flex; 1323 display: flex;
...@@ -1271,43 +1333,23 @@ function handleDelete(row) { ...@@ -1271,43 +1333,23 @@ function handleDelete(row) {
1271 color: #333; 1333 color: #333;
1272 } 1334 }
1273 1335
1274 .level-dropdown-up { 1336 .level-dropdown-local {
1275 position: absolute; 1337 position: absolute;
1276 left: 0; 1338 left: 0;
1277 bottom: 78rpx; 1339 bottom: 78rpx;
1278 width: 180rpx; 1340 width: 180rpx;
1341 height: 360rpx;
1279 background: #fff; 1342 background: #fff;
1280 border-radius: 12rpx; 1343 border-radius: 12rpx;
1281 box-shadow: 0 8rpx 28rpx rgba(0, 0, 0, 0.14); 1344 box-shadow: 0 8rpx 28rpx rgba(0, 0, 0, 0.14);
1282 z-index: 180; 1345 z-index: 200;
1283 padding: 8rpx 0; 1346 overflow: hidden;
1284 box-sizing: border-box;
1285
1286 } 1347 }
1287 1348
1288 .level-dropdown-inner { 1349 .pass-dropdown-local {
1289 height: auto; 1350 height: auto;
1290 } 1351 }
1291 1352
1292 .level-dropdown-item {
1293 height: 68rpx;
1294 line-height: 68rpx;
1295 padding: 0 24rpx;
1296 font-size: 28rpx;
1297 color: #333;
1298 text-align: left;
1299
1300 &.active {
1301 color: #AD181F;
1302 font-weight: 600;
1303 background: #FFF5F5;
1304 }
1305
1306 &.disabled {
1307 color: #c8c9cc;
1308 background: #fafafa;
1309 }
1310 }
1311 } 1353 }
1312 } 1354 }
1313 } 1355 }
...@@ -1379,10 +1421,11 @@ function handleDelete(row) { ...@@ -1379,10 +1421,11 @@ function handleDelete(row) {
1379 display: flex; 1421 display: flex;
1380 justify-content: space-around; 1422 justify-content: space-around;
1381 align-items: center; 1423 align-items: center;
1382 padding: 20rpx 0; 1424 padding-top: 60rpx;
1425 padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
1383 background: #fff; 1426 background: #fff;
1384 border-top: 1rpx solid #f0f0f0; 1427 border-top: 1rpx solid #f0f0f0;
1385 z-index: 98; 1428 z-index:999;
1386 1429
1387 .btn-red { 1430 .btn-red {
1388 background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%); 1431 background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%);
......
...@@ -124,7 +124,9 @@ ...@@ -124,7 +124,9 @@
124 memId: memId, 124 memId: memId,
125 examId: examId, 125 examId: examId,
126 examType: examType, 126 examType: examType,
127 name: searchName.value 127 name: searchName.value,
128 pageNum: pageNum.value,
129 pageSize: pageSize
128 }).then(res => { 130 }).then(res => {
129 const rows = res.rows || [] 131 const rows = res.rows || []
130 rows.forEach(item => { 132 rows.forEach(item => {
...@@ -203,6 +205,7 @@ ...@@ -203,6 +205,7 @@
203 }).then(() => { 205 }).then(() => {
204 uni.hideLoading() 206 uni.hideLoading()
205 uni.showToast({ title: '添加成功', icon: 'success' }) 207 uni.showToast({ title: '添加成功', icon: 'success' })
208 emitStudentSelected()
206 setTimeout(() => { 209 setTimeout(() => {
207 uni.navigateBack() 210 uni.navigateBack()
208 }, 1500) 211 }, 1500)
...@@ -211,6 +214,13 @@ ...@@ -211,6 +214,13 @@
211 }) 214 })
212 } 215 }
213 216
217 function emitStudentSelected() {
218 const pages = getCurrentPages()
219 const currentPage = pages[pages.length - 1]
220 const eventChannel = currentPage?.getOpenerEventChannel?.()
221 eventChannel?.emit('studentSelected')
222 }
223
214 function goBack() { 224 function goBack() {
215 uni.navigateBack() 225 uni.navigateBack()
216 } 226 }
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
26 26
27 <view class="bottom-area"> 27 <view class="bottom-area">
28 <view class="selected-tip" v-if="selectedIds.length > 0">已选择 {{ selectedIds.length }} 位考官</view> 28 <view class="selected-tip" v-if="selectedIds.length > 0">已选择 {{ selectedIds.length }} 位考官</view>
29 <view> <button class="add-btn" :disabled="selectedIds.length === 0" @click="handleAdd">添加</button></view> 29 <view class="add-btn-wrap">
30 <button class="add-btn" :disabled="selectedIds.length === 0" @click="handleAdd">添加</button>
31 </view>
30 32
31 </view> 33 </view>
32 </view> 34 </view>
...@@ -194,12 +196,17 @@ function handleAdd() { ...@@ -194,12 +196,17 @@ function handleAdd() {
194 border-top: 1rpx solid #eee; 196 border-top: 1rpx solid #eee;
195 display: flex; 197 display: flex;
196 align-items: center; 198 align-items: center;
197 justify-content: space-between; 199 justify-content: flex-end;
198 } 200 }
199 201
200 .selected-tip { 202 .selected-tip {
201 font-size: 26rpx; 203 font-size: 26rpx;
202 color: #666; 204 color: #666;
205 margin-right: auto;
206 }
207
208 .add-btn-wrap {
209 margin-left: auto;
203 } 210 }
204 211
205 .add-btn { 212 .add-btn {
......
...@@ -304,7 +304,9 @@ async function onModalConfirm() { ...@@ -304,7 +304,9 @@ async function onModalConfirm() {
304 uni.showToast({title: err.data?.msg || '提交失败', icon: 'none'}) 304 uni.showToast({title: err.data?.msg || '提交失败', icon: 'none'})
305 } 305 }
306 } else if (modalAction === 'submitSuccess') { 306 } else if (modalAction === 'submitSuccess') {
307 uni.navigateBack() 307 uni.redirectTo({
308 url: '/myCenter/examPointApplyList'
309 })
308 } 310 }
309 // modalAction = '' 311 // modalAction = ''
310 } 312 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!