xklr/wlj 1 ano atrás
pai
commit
c7b72fd233
2 arquivos alterados com 65 adições e 27 exclusões
  1. 5 4
      api/userinfo.js
  2. 60 23
      pages/index/index.vue

+ 5 - 4
api/userinfo.js

@@ -6,10 +6,11 @@ export default {
 		return request({
 			url: '/decrypt',
 			method: 'post',
-			headers:{
-				'Content-type':'multipart/form-data;charset=UTF-8'
+			headers: {
+				'Content-type': 'multipart/form-data;charset=UTF-8'
 			},
-			data
+			data,
+			isDataAll: true
 		})
 	},
 	//获取用户信息
@@ -76,5 +77,5 @@ export default {
 			data
 		})
 	},
-	
+
 }

+ 60 - 23
pages/index/index.vue

@@ -6,6 +6,8 @@
 					<span class="d-inline-block fs-18 text-white font-bold">个人档案</span>
 					<span v-if="ipArr.find((item)=>item.ip==prodIp)&&ipArr.find((item)=>item.ip==prodIp).name!=='兰溪'"
 						class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="closet">[ 退出 ]</span>
+					<span v-if="ipArr.find((item)=>item.ip==prodIp)&&ipArr.find((item)=>item.ip==prodIp).name=='兰溪'"
+						class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="operation">[ 切换 ]</span>
 				</view>
 				<view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
 					<view class="w-15 userhead">
@@ -114,32 +116,30 @@
 			</view>
 		</view>
 		<view class="">
-			<uni-popup ref="popup1" type="center" :mask-click="false">
+			<uni-popup ref="popup1" type="center" :mask-click="false" class="w-100">
 				<view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
 					<view class="text-center mb-3 fs-14 font-bold py-2">
 						查询
 					</view>
 					<view class=" centerY mb-3"
 						style="border-radius: 14rpx;border: 1px solid #007aff;overflow: hidden;">
-						<input type="text" v-model="valueId" class="px-2 fs-12" placeholder="请输入身份证号码"
+						<input type="text" v-model="valueId" class="px-2 fs-12 w-70" placeholder="请输入身份证号码"
 							placeholder-class="fs-12">
-						<button type="primary" class="d-inline-block fs-12 px-3 ml-auto mr-0" style="padding: 4rpx ;"
+						<button type="primary" class="d-inline-block fs-12 px-2 ml-auto w-30" style="padding: 4rpx ;"
 							@click="search">搜索</button>
 					</view>
 				</view>
 			</uni-popup>
-			
-			<uni-popup ref="popup2" type="center" :mask-click="false">
-				<view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
+
+			<uni-popup ref="popup2" type="center" :mask-click="false" class="w-100">
+				<view class="bg-white p-3 w-80 text-center" style="border-radius: 16rpx;min-width: 400rpx;">
 					<view class="text-center mb-3 fs-14 font-bold py-2">
-						查询
+						患者列表
 					</view>
-					<view class=" centerY mb-3"
-						style="border-radius: 14rpx;border: 1px solid #007aff;overflow: hidden;">
-						<input type="text" v-model="valueId" class="px-2 fs-12" placeholder="请输入身份证号码"
-							placeholder-class="fs-12">
-						<button type="primary" class="d-inline-block fs-12 px-3 ml-auto mr-0" style="padding: 4rpx ;"
-							@click="search">搜索</button>
+					<view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 1px solid #007aff;">
+						<uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
+							placeholder="请选择身份">
+						</uni-data-select>
 					</view>
 				</view>
 			</uni-popup>
@@ -173,15 +173,29 @@
 				physical: {},
 				valueId: '',
 				prodIp: '',
-				ipArr
+				ipArr,
+				userArr: [],
+				userIndex: null,
 			}
 		},
 		onLoad() {
-			// console.log(this.$mf)
-			// console.log(this.$httpApi)
 			this.decrypt()
 		},
 		methods: {
+			//切换
+			operation() {
+				uni.clearStorage('idCard')
+				uni.clearStorage('userData')
+				this.valueId = '';
+				this.userData = {};
+				this.physical = {};
+				this.$refs.popup2.open()
+			},
+			bindPickerChange(e) {
+				if (this.userArr[e] && this.userArr[e].text) {
+					this.getuserinfo(this.userArr[e].text)
+				}
+			},
 			decrypt() {
 				uni.showLoading({
 					title: '加载中'
@@ -201,14 +215,36 @@
 									}
 									if (item.ip == globalData.configData.prodIp) {
 										//兰溪
-										if (item.name == '兰溪') {
+										if (item.name == '开发') {
 											if (!res.data.length > 10) return
 											console.log(res)
 											let res2 = await t.$api.decrypt({
 												toKen: res.data
 											});
-											uni.setStorageSync('idCard', res2.idCard)
-											t.getuserinfo(res2.idCard)
+											if (res2.code !== -1) {
+												if (res2.data.users && res2.data.users.length >
+													0) {
+													t.$refs.popup2.open()
+													t.userArr = []
+													res2.data.users.map((item, index) => {
+														t.userArr.push({
+															value: index,
+															text: item.idcard
+														})
+
+													})
+													console.log(t.userArr)
+													uni.hideLoading()
+												}
+											} else {
+												console.log(1)
+												if (!uni.getStorageSync('idCard')) {
+													t.$refs.popup1.open()
+													uni.hideLoading()
+												} else {
+													t.getuserinfo(uni.getStorageSync('idCard'))
+												}
+											}
 										}
 									}
 								}, 300)
@@ -220,7 +256,8 @@
 									t.prodIp = globalData.configData.prodIp
 									clearInterval(timer)
 								}
-								let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
+								let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
+									.name == '兰溪'
 								if (!i) {
 									if (!uni.getStorageSync('idCard')) {
 										t.$refs.popup1.open()
@@ -240,7 +277,8 @@
 								t.prodIp = globalData.configData.prodIp
 								clearInterval(timer)
 							}
-							let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
+							let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
+								.name == '兰溪'
 							if (!i) {
 								if (!uni.getStorageSync('idCard')) {
 									t.$refs.popup1.open()
@@ -303,14 +341,13 @@
 					if (data && data.id) {
 						this.$refs.popup1.close();
 						this.find_physical()
-
+						this.$refs.popup2.close();
 					} else {
 						uni.showToast({
 							title: '未查询到患者',
 							icon: 'error'
 						})
 					}
-
 					uni.hideLoading();
 				} else {
 					uni.hideLoading();