Kaynağa Gözat

Merge branch '2025北京诚祥' of https://gogs.mtavip.com/wangguoyu/uniProject into 2025北京诚祥

tanxue 2 ay önce
ebeveyn
işleme
aecbfbfc03
3 değiştirilmiş dosya ile 168 ekleme ve 52 silme
  1. 12 0
      api/jiazheng.js
  2. 147 48
      pages/admin/Jiazheng/gerenZiliao.vue
  3. 9 4
      pages/client/Kaoshi/exam.vue

+ 12 - 0
api/jiazheng.js

@@ -155,3 +155,15 @@ export function getJiazhengShuxiang(data = {}) {
     timeout: 20000
   })
 }
+
+export function getJiazhengJiguan(data = {}) {
+  return request({
+    url: '/app/user/jiazheng/tree/city',
+    headers: {
+      isToken: false
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 147 - 48
pages/admin/Jiazheng/gerenZiliao.vue

@@ -31,9 +31,11 @@
 
 		<view class="form-label-input">
 			<view class="phone-form-label"><text class="form-label-require">*</text>籍贯</view>
-			<uni-data-picker v-model="formData.hometown" placeholder="请选择籍贯" :localdata="hometownData">
-				{{formData.hometown}}
-			</uni-data-picker>
+			<picker mode="multiSelector" :range="pickerData" :range-key="'label'" @change="onPickerChange">
+				<view class="picker">
+					当前选择:{{ selectedProvince }} - {{ selectedCity }}
+				</view>
+			</picker>
 		</view>
 		<view class="form-label-input">
 			<view class="phone-form-label"><text class="form-label-require">*</text>身份证地址</view>
@@ -63,17 +65,17 @@
 			<dataChecked :list="xueliList" mode="single" :showAdd="false" @change="selectChangeXueliList" />
 		</view>
 		<view class="form-label-radio flex-start-row">
-			<view class="phone-form-label"><text class="form-label-require"></text>婚姻 </view>
+			<view class="phone-form-label"><text></text>婚姻 </view>
 			<dataChecked :list="hunyinList" mode="single" :showAdd="false" @change="selectChangeHunyinList" />
 		</view>
 
 		<view class="form-label-input form-top-margin flex-start-row">
-			<view class="phone-form-label"><text class="form-label-require">*</text>通讯地址</view>
+			<view class="phone-form-label"><text></text>通讯地址</view>
 			<textarea v-model="formData.juzhuDizhi" placeholder="请输入通讯地址" class="form-textarea-box" />
 		</view>
 
 		<view class="form-label-select">
-			<view class="phone-form-label"><text class="form-label-require"></text>星座</view>
+			<view class="phone-form-label"><text></text>星座</view>
 			<picker :range="xingzuoList" mode='selector' :value="formData.xingzuoIndex" range-key="name"
 				@change="xingzuoChange" @cancel="xingzuoCancel">
 				<view class="form-radio-select">
@@ -83,7 +85,7 @@
 			</picker>
 		</view>
 		<view class="form-label-select">
-			<view class="phone-form-label"><text class="form-label-require"></text>属相</view>
+			<view class="phone-form-label"><text></text>属相</view>
 			<picker :range="shuxiangList" mode='selector' :value="formData.shuxiangIndex" range-key="name"
 				@change="shuxiangChange" @cancel="shuxiangCancel">
 				<view class="form-radio-select">
@@ -96,7 +98,8 @@
 		<view class="form-label-switch">
 			<view class="phone-form-label"> <text class="form-label-require"></text>星座属相展示到简历 </view>
 			<view>展示
-				<switch @change="switchXingzuoChange"  :checked="formData.xingzuoFlag"  color="#3fd2a1" style="transform:scale(0.7)" />
+				<switch @change="switchXingzuoChange" :checked="formData.xingzuoFlag" color="#3fd2a1"
+					style="transform:scale(0.7)" />
 			</view>
 		</view>
 		<view class="agree-section-box form-top-margin">
@@ -119,7 +122,8 @@
 		getJiazhengHunyin,
 		getJiazhengMinzu,
 		getJiazhengShuxiang,
-		getJiazhengXingzuo
+		getJiazhengXingzuo,
+		getJiazhengJiguan
 	} from "@/api/jiazheng.js";
 	export default {
 		components: {
@@ -146,7 +150,7 @@
 					xingzuoIndex: 0,
 					minzuIndex: 0,
 					shuxiangIndex: 0,
-					xingzuoFlag:false
+					xingzuoFlag: false
 
 				},
 				xueliList: [],
@@ -154,24 +158,10 @@
 				shuxiangList: [],
 				xingzuoList: [],
 				minzuList: [],
-
-
-				hometownData: [{
-						text: '辽宁省',
-						value: '210000',
-						children: [{
-							text: '大连市',
-							value: '210200',
-							children: [{
-									text: '西岗区',
-									value: '210203'
-								},
-								// 其他区县...
-							]
-						}]
-					}
-					// 其他省份...
-				],
+				//	areaTree: [],
+				pickerData: [],
+				selectedProvince: '',
+				selectedCity: ''
 
 			}
 		},
@@ -181,25 +171,133 @@
 			this.getMinzu()
 			this.getXingzuo()
 			this.getShuxiang()
+			this.getJiguan()
 
 		},
 		methods: {
-			 validate() {
-			      return new Promise((resolve) => {
-			        // 实际验证逻辑
-			        const isValid = this.formData.realName 
-			        if (!isValid) {
-			          this.showError = true
-			          resolve(false)
-			        } else {
-			          resolve(true)
-			        }
-			      })
-			    },
+
+			formatData(data) {
+				const provinces = data.map(province => {
+					return {
+						label: province.lable,
+						value: province.id,
+						children: province.children.map(city => {
+							return {
+								label: city.lable,
+								value: city.id
+							};
+						})
+					};
+				});
+
+				return provinces;
+			},
+			onPickerChange(e) {
+				const [provinceIndex, cityIndex] = e.detail.value;
+				const selectedProvince = this.pickerData[provinceIndex];
+				const selectedCity = selectedProvince.children[cityIndex];
+
+				this.selectedProvince = selectedProvince.label;
+				this.selectedCity = selectedCity.label;
+			},
+
+
+
+			checkAllFields() {
+				const requiredFields = [{
+						key: 'userName',
+						name: '手机号'
+					},
+					{
+						key: 'realName',
+						name: '姓名'
+					},
+					{
+						key: 'idCard',
+						name: '身份证号'
+					},
+					{
+						key: 'birthday',
+						name: '生日'
+					},
+					// {
+					// 	key: 'hometown',
+					// 	name: '家乡',
+					// 	type: 'array'
+					// },
+					{
+						key: 'hujiDizhi',
+						name: '身份证地址'
+					},
+					{
+						key: 'gender',
+						name: '性别'
+					},
+					{
+						key: 'juzhuDizhi',
+						name: '通讯地址'
+					},
+					{
+						key: 'minzu',
+						name: '民族',
+						type: 'object'
+					},
+					{
+						key: 'shuxiang',
+						name: '属相',
+						type: 'object'
+					},
+					{
+						key: 'xingzuo',
+						name: '星座',
+						type: 'object'
+					},
+				]
+
+				for (const field of requiredFields) {
+					const value = this.formData[field.key]
+
+					// 根据不同类型进行存在验证
+					if (field.type === 'array' && !value?.length) {
+						this.showAlert(field.name)
+						return false
+					}
+					if (field.type === 'object' && !Object.keys(value).length) {
+						this.showAlert(field.name)
+						return false
+					}
+					if (field.type === 'boolean' && value !== true) {
+						this.showAlert(field.name)
+						return false
+					}
+					if (!field.type && !value?.toString().trim()) {
+						this.showAlert(field.name)
+						return false
+					}
+				}
+				return true
+			},
+			showAlert(fieldName) {
+				uni.showToast({
+					title: `${fieldName}不能为空`,
+					icon: 'none',
+					duration: 2000
+				})
+			},
+			getJiguan() {
+				getJiazhengJiguan({}).then(res => {
+					//	this.areaTree = res.data
+					this.pickerData = this.formatData(res.data);
+					
+					console.log('this.pickerData',this.pickerData);
+				}).catch(error => {
+					console.error('获取技能类型失败:', error);
+				});
+			},
 			getXueli() {
 				getJiazhengXueli({}).then(res => {
 					this.xueliList = res.data
-				//	console.log('xueliList', this.xueliList);
+					//	console.log('xueliList', this.xueliList);
 				}).catch(error => {
 					console.error('获取技能类型失败:', error);
 				});
@@ -207,7 +305,7 @@
 			getXingzuo() {
 				getJiazhengXingzuo({}).then(res => {
 					this.xingzuoList = res.data
-		//			console.log('xingzuoList', this.xingzuoList);
+					//			console.log('xingzuoList', this.xingzuoList);
 				}).catch(error => {
 					console.error('获取技能类型失败:', error);
 				});
@@ -215,7 +313,7 @@
 			getShuxiang() {
 				getJiazhengShuxiang({}).then(res => {
 					this.shuxiangList = res.data
-			//		console.log('shuxiangList', this.shuxiangList);
+					//		console.log('shuxiangList', this.shuxiangList);
 				}).catch(error => {
 					console.error('获取技能类型失败:', error);
 				});
@@ -223,7 +321,7 @@
 			getHunyin() {
 				getJiazhengHunyin({}).then(res => {
 					this.hunyinList = res.data
-				//	console.log('hunyinList', this.hunyinList);
+					//	console.log('hunyinList', this.hunyinList);
 				}).catch(error => {
 					console.error('获取技能类型失败:', error);
 				});
@@ -231,7 +329,7 @@
 			getMinzu() {
 				getJiazhengMinzu({}).then(res => {
 					this.minzuList = res.data
-			//		console.log('minzuList', this.minzuList);
+					//		console.log('minzuList', this.minzuList);
 				}).catch(error => {
 					console.error('获取技能类型失败:', error);
 				});
@@ -252,7 +350,7 @@
 			xingzuoChange(e) {
 				const index = e.detail.value
 				this.formData.xingzuo = this.xingzuoList[index]
-			//	console.log('this.formData.xingzuo', this.formData.xingzuo);
+				//	console.log('this.formData.xingzuo', this.formData.xingzuo);
 
 			},
 			xingzuoCancel() {
@@ -277,11 +375,12 @@
 				this.formData.hunyin = data
 			},
 			switchXingzuoChange(e) {
-				this.formData.xingzuoFlag  =  e.detail.value
+				this.formData.xingzuoFlag = e.detail.value
 			},
 			goNext() {
 				console.log('formData', this.formData);
-				//this.$emit('goNext',0);
+				if (!this.checkAllFields()) return
+				this.$emit('goNext', 0);
 			},
 
 			handleAgree(e) {

+ 9 - 4
pages/client/Kaoshi/exam.vue

@@ -93,6 +93,9 @@
 		<answerQueren ref="answerQrRef" @confirm="handleQuerenConfirm"></answerQueren>
 		<!-- 考试得分 -->
 		<submitScoreVue ref="subScoreRef" @confirm="handleScoreConfirm" @close="handleScoreClose"></submitScoreVue>
+		
+		<!-- 切屏确认弹窗 -->
+		<qiepingDlVue ref="qiepingDlRef" :content="messageContent" title="注意" okBtn="知道了"></qiepingDlVue>
 	</view>
 </template>
 
@@ -123,6 +126,7 @@
 	import {
 		useKaoShiCache
 	} from "./examTools"
+	import qiepingDlVue from "@/components/dialog/qiepingDl.vue";
 
 	const {
 		checkDanxuanReply,
@@ -158,7 +162,9 @@
 	const zhuapaiConfirmRef = ref(null)
 	const answerQrRef = ref(null);
 	const startCountDown = ref(false);
-	const subScoreRef = ref(null)
+	const subScoreRef = ref(null);
+	const messageContent = ref('');
+	const qiepingDlRef = ref(null);
 	
 	const timer1 = ref(null);
 
@@ -378,9 +384,8 @@
 
 	// 切屏功能 start
 	function qiepingToast(count) {
-		uni.showToast({
-			title: '请在考试界面操作,注意考试纪律!'
-		})
+		messageContent.value = `已离开${count}次。${data.toggleScreenFlag}次将自动交卷!`
+		qiepingDlRef.value.handleShow()
 	}
 
 	function forceSubmit() {