Ver código fonte

修改一些细节

xklr/wlj 1 ano atrás
pai
commit
f008cd6b7e
7 arquivos alterados com 233 adições e 176 exclusões
  1. 3 4
      App.vue
  2. 18 10
      main.js
  3. 4 4
      pages.json
  4. 5 1
      pages/health_report/health_report.vue
  5. 176 130
      pages/index/index.vue
  6. 3 3
      static/.config.json
  7. 24 24
      static/js/public.js

+ 3 - 4
App.vue

@@ -35,13 +35,11 @@
 		onLaunch: function(option) {
 			let token = window.location.search.split('token=')[1]
 			console.log('App Launch')
-			console.log(token)
-
+			// console.log(token)
 			let t = this;
 			inforeq((res) => {
 				t.globalData.configData = res
 				if (token && token.length > 0) {
-					console.log(token)
 					uni.setStorage({
 						key: 'token',
 						data: token,
@@ -51,7 +49,6 @@
 					});
 					t.globalData.token = token
 				}
-
 			})
 		},
 		onShow: function() {
@@ -124,6 +121,8 @@ this.globalData.SET_STATUS_BAR = statusBar
 		border-radius: 0px !important;
 		transform: initial;
 		background-color: transparent;
+		width: 100%;
+		height: 100%;
 	}
 
 	.bule_line {

+ 18 - 10
main.js

@@ -1,28 +1,36 @@
 import App from './App'
 import mf from '@/static/js/mf.js';
 import api from 'api/index.js'
-import {md, //
+import {
+	md, //
 	regExp, //验证规则
 	ipurl, //ip
-	_try_} from '@/static/js/public.js'
+	_try_
+} from '@/static/js/public.js'
 // #ifndef VUE3
 import Vue from 'vue'
 Vue.config.productionTip = false
 App.mpType = 'app'
 const app = new Vue({
-    ...App
+	...App
 })
 app.$mount()
-Vue.prototype.$mf = { ...mf,...md}
+Vue.prototype.$mf = {
+	...mf,
+	...md,
+	...regExp
+}
 Vue.prototype.$api = api
 // #endif
 
 // #ifdef VUE3
-import { createSSRApp } from 'vue'
+import {
+	createSSRApp
+} from 'vue'
 export function createApp() {
-  const app = createSSRApp(App)
-  return {
-    app
-  }
+	const app = createSSRApp(App)
+	return {
+		app
+	}
 }
-// #endif
+// #endif

+ 4 - 4
pages.json

@@ -3,8 +3,8 @@
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "首页"
-				
+				"navigationBarTitleText": "慢病管理",
+				"enablePullDownRefresh": true
 			}
 		}, {
 			"path": "pages/userinfo/userinfo",
@@ -40,14 +40,14 @@
 			"path": "pages/health_report/health_report",
 			"style": {
 				"navigationBarTitleText": "健康报告",
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": true
 			}
 		}
 	],
 	"globalStyle": {
 		"navigationStyle": "custom",
 		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "慢病报告",
+		"navigationBarTitleText": "慢病管理",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"backgroundColor": "#F8F8F8",
 		"backgroundColorTop": "000"

+ 5 - 1
pages/health_report/health_report.vue

@@ -61,6 +61,9 @@
 		onLoad() {
 			this.find_health_report()
 		},
+		onPullDownRefresh() {
+			this.find_health_report()
+		},
 		methods: {
 			async find_health_report() {
 				let idCard = uni.getStorageSync('idCard')
@@ -74,9 +77,10 @@
 					idCard
 				})
 				if (code == 0) {
-					console.log(data)
+					// console.log(data)
 					this.dataAll = data || {}
 					uni.hideLoading();
+					uni.stopPullDownRefresh()
 				} else {
 					uni.hideLoading();
 					uni.stopPullDownRefresh()

+ 176 - 130
pages/index/index.vue

@@ -116,32 +116,39 @@
 			</view>
 		</view>
 		<view class="">
-			<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 w-100 border-box" style="overflow: hidden; ">
-						<input type="text" v-model="valueId" class="px-2 m-0 fs-12 w-70"
-							style="line-height: 62rpx;height: 62rpx;border: 2px solid #007aff;border-top-left-radius: 2rpx;border-bottom-left-radius: 2rpx;"
-							placeholder="请输入身份证号码" placeholder-class="fs-12" />
-						<uni-button type="primary" class="my-button fs-12 ml-auto border-box w-30"
-							style="line-height: 70rpx;height: 70rpx;padding: 0 ;border-top-right-radius: 12rpx;border-bottom-right-radius: 12rpx;"
-							@click="search">搜索
-						</uni-button>
+			<uni-popup ref="popup1" type="top" :mask-click="false">
+				<view class=" w-80 mx-auto" style="margin-top: 30vh;">
+					<view class="bg-white p-3 w-100 border-box" style="border-radius: 16rpx;">
+						<view class="text-center mb-3 fs-14 font-bold py-2">
+							查询
+						</view>
+						<view class=" centerY mb-3 w-100 border-box" style="overflow: hidden; ">
+							<input type="text" v-model="valueId" class="px-2 m-0 fs-12 w-75  border-box"
+								style="height: 70rpx;border: 2px solid #007aff;border-top-left-radius: 4rpx;border-bottom-left-radius: 4rpx;"
+								placeholder="请输入身份证号码" placeholder-class="fs-12" />
+							<uni-button type="primary" class="my-button fs-12 ml-auto border-box w-25"
+								style="height: 70rpx;line-height: 70rpx; padding: 0 ;border-top-right-radius: 12rpx;border-bottom-right-radius: 12rpx;"
+								@click="search">搜索
+							</uni-button>
+						</view>
 					</view>
 				</view>
 			</uni-popup>
 
-			<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="text-left centerY mb-3" style="border-radius: 14rpx;border: 2px solid #007aff;">
-						<uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
-							placeholder="请选择身份">
-						</uni-data-select>
+			<uni-popup ref="popup2" type="top" :mask-click="false">
+				<view class=" w-80 mx-auto" style="margin-top: 30vh;">
+					<view class="bg-white p-3 w-100 text-center border-box" style="border-radius: 16rpx;">
+						<view class="text-center mb-3 fs-14 font-bold py-2">
+							患者列表
+						</view>
+						<view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 2px solid #007aff;">
+							<uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
+								placeholder="请选择身份">
+							</uni-data-select>
+						</view>
+						<view class="" v-if="userArr.length==0">
+							<empty title="还未绑定患者" />
+						</view>
 					</view>
 				</view>
 			</uni-popup>
@@ -164,11 +171,15 @@
 		},
 		{
 			name: '兰溪',
-			ip: 'http://10.50.13.200:10066'
+			ip: 'https://lxh5api.xklr.net'
 		}
 	]
-	let globalData = getApp().globalData
+	let globalData = getApp().globalData;
+	import Empty from '@/component/empty/empty.vue'
 	export default {
+		components: {
+			Empty
+		},
 		data() {
 			return {
 				userData: {},
@@ -184,121 +195,134 @@
 			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)
+			//正式
+			async zhengshi() {
+				let t = this
+				if (!uni.getStorageSync('idCard')) {
+					t.$refs.popup1.open()
+					uni.hideLoading()
+				} else {
+					t.getuserinfo(uni.getStorageSync('idCard'))
 				}
 			},
-			decrypt() {
-				uni.showLoading({
-					title: '加载中'
-				})
+			//兰溪
+			lanxi() {
 				let t = this;
 				uni.getStorage({
 					key: 'token',
-					success(res) {
-						console.log(res)
-						if (res.data !== '') {
-							ipArr.map((item) => {
-								console.log(globalData.configData.prodIp)
-								let timer = setInterval(async () => {
-									if (globalData.configData.prodIp) {
-										t.prodIp = globalData.configData.prodIp
-										clearInterval(timer)
-									}
-									if (item.ip == globalData.configData.prodIp) {
-										//兰溪
-										if (item.name == '兰溪') {
-											if (!res.data.length > 10) return
-											console.log(res)
-											let res2 = await t.$api.decrypt({
-												toKen: res.data
-											});
-											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'))
-												}
-											}
-										}
-									} else {
-										if (!uni.getStorageSync('idCard')) {
-											t.$refs.popup1.open()
-											uni.hideLoading()
-										} else {
-											t.getuserinfo(uni.getStorageSync('idCard'))
+					async success(res) {
+						if (!res.data) return
+						let res2 = await t.$api.decrypt({
+							toKen: res.data
+						});
+						if (res2.code !== -1) {
+							if (!res2.data.uuid) {
+								uni.showModal({
+									title: '提示',
+									content: '您还未登录请先去登录!',
+									showCancel: false,
+									success: function(res3) {
+										if (res3.confirm) {
+											console.log('用户点击确定');
+											uni.navigateBack({
+												delta: 1, //返回层数,2则上上页
+											})
 										}
 									}
-								}, 300)
+								});
+								return
+							}
+							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
+									})
+								})
+								uni.hideLoading()
+							} else {
+								t.$refs.popup2.open()
+								t.userArr = []
+								res2.data.users.map((item, index) => {
+									t.userArr.push({
+										value: index,
+										text: item.idcard
+									})
+								})
+								uni.hideLoading()
+							}
 
-							})
 						} else {
-							let timer = setInterval(async () => {
-								if (globalData.configData.prodIp) {
-									t.prodIp = globalData.configData.prodIp
-									clearInterval(timer)
-								}
-								let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
-									.name == '兰溪'
-								if (!i) {
-									if (!uni.getStorageSync('idCard')) {
-										t.$refs.popup1.open()
-										uni.hideLoading()
-									} else {
-										t.getuserinfo(uni.getStorageSync('idCard'))
-									}
-								}
-							}, 300)
+							//返回数据出错
+							errordata()
 						}
-
 					},
-					fail(res) {
-						console.log(res)
-						let timer = setInterval(async () => {
-							if (globalData.configData.prodIp) {
-								t.prodIp = globalData.configData.prodIp
-								clearInterval(timer)
-							}
-							let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
-								.name == '兰溪'
-							if (!i) {
-								if (!uni.getStorageSync('idCard')) {
-									t.$refs.popup1.open()
-									uni.hideLoading()
-								} else {
-									t.getuserinfo(uni.getStorageSync('idCard'))
-								}
-							}
-						}, 300)
+					fail(error) { //未获取到token或者出错
+						errordata()
 					}
 				})
+
+				function errordata() {
+					if (!uni.getStorageSync('idCard')) {
+						t.$refs.popup1.open()
+						uni.hideLoading()
+					} else {
+						t.getuserinfo(uni.getStorageSync('idCard'))
+					}
+				}
+
+			},
+			decrypt() { //token解码
+				uni.showLoading({
+					title: '加载中'
+				})
+				let t = this;
+				let timer = setInterval(() => { //等待获取ip
+					if (globalData.configData.prodIp) {
+						t.prodIp = globalData.configData.prodIp
+						clearInterval(timer)
+					}
+					ipArr.map(async item => {
+						if (item.ip == globalData.configData.prodIp && item.name ==
+							'兰溪') {
+							t.lanxi()
+							return
+						}
+						if (item.ip == globalData.configData.prodIp && item.name ==
+							'正式') {
+							t.zhengshi()
+							return
+						}
+						if (item.ip == globalData.configData.prodIp && item.name ==
+							'测试') {
+							t.zhengshi()
+							return
+						}
+						if (item.ip == globalData.configData.prodIp && item.name ==
+							'开发') {
+							t.zhengshi()
+							return
+						}
+					})
+				}, 300)
+			},
+			//切换
+			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)
+				}
 			},
 			closet() {
 				uni.clearStorage('idCard')
@@ -309,10 +333,18 @@
 				this.$refs.popup1.open()
 			},
 			search() {
-				this.getuserinfo(this.valueId)
-				this.valueId = '';
+				if (!this.$mf.isCardID(this.valueId)) {
+					uni.showToast({
+						title: '请输入正确的身份证号',
+						icon: 'error',
+						duration: 2000,
+						mask: true
+					});
+					return
+				}
 				this.userData = {};
 				this.physical = {};
+				this.getuserinfo(this.valueId)
 			},
 			async find_physical() {
 				uni.showLoading({
@@ -334,6 +366,7 @@
 				uni.stopPullDownRefresh()
 			},
 			async getuserinfo(idCard) { //330222194512283184
+				idCard = idCard || uni.getStorageSync('idCard')
 				uni.showLoading({
 					title: '加载中'
 				});
@@ -344,12 +377,13 @@
 					idCard
 				})
 				if (code == 0) {
+					this.valueId = '';
 					uni.setStorageSync('userData', data || {});
 					uni.setStorageSync('idCard', data && data.idCard || '')
 					this.userData = data || {}
 					if (data && data.id) {
-						this.$refs.popup1.close();
 						this.find_physical()
+						this.$refs.popup1.close();
 						this.$refs.popup2.close();
 					} else {
 						uni.showToast({
@@ -358,14 +392,26 @@
 						})
 					}
 					uni.hideLoading();
+					uni.stopPullDownRefresh()
 				} else {
+					this.valueId = '';
 					uni.hideLoading();
 					uni.stopPullDownRefresh()
 				}
 			}
 		},
 		onPullDownRefresh() {
-			this.getuserinfo()
+			if (this.userData &&
+				this.physical) {
+				if (uni.getStorageSync('idCard')) {
+					this.find_physical()
+				} else {
+					uni.stopPullDownRefresh()
+				}
+			} else {
+				uni.stopPullDownRefresh()
+			}
+
 		}
 	}
 </script>

+ 3 - 3
static/.config.json

@@ -1,7 +1,7 @@
 {
-	"prodIp": "http://apiv3.xklr.net",
+	"prodIp": "http://192.168.1.103:10066",
 	"img_prod_host": "http://img.xklr.net/",
-	"devIp": "http://apiv3.xklr.net",
+	"devIp": "http://192.168.1.103:10066",
 	"testIp": "http://testapi.xklr.net:8601",
 	"appConfig": {
 		"jj_service_url": "http://118.31.70.1:8601",
@@ -13,7 +13,7 @@
 	},
 	"notes": {
 		"devIp1": "http://192.168.3.77:10066",
-		"prodIp": "正式ip/线下图片地址",
+		"prodIp": "正式ip/线下图片地址 http://apiv3.xklr.net",
 		"testIp": "正式测试服ip",
 		"devIp/devip1": "开发ip",
 		"img_prod_host": "线上图片地址"

+ 24 - 24
static/js/public.js

@@ -1,36 +1,36 @@
 const md = {
-	
-	empty:(val)=>{
-		if(val.length==0||val.replace(/\s/g, "").length==0||!val){
+
+	empty: (val) => {
+		if (val.length == 0 || val.replace(/\s/g, "").length == 0 || !val) {
 			return true
 		}
 		// if(isNull(val)||typeof val=='object'&&Object.keys(val).length === 0|| typeof val != "undefined" ){
-			
+
 		// }
 	},
 	isEmpty(str) {
-	  if (str == null || typeof str == null || str == "" || str == "undefined") {
-	    return true;
-	  } else {
-	    return false;
-	  }
+		if (str == null || typeof str == null || str == "" || str == "undefined") {
+			return true;
+		} else {
+			return false;
+		}
 	},
 	/**
 	 * @removeSpace 检查图片是否存在
 	 * imgUrl 图片链接
 	 */
 	checkImg: (imgUrl) => {
-			if(imgUrl.length<0){
-				return false
-			}
-			var ImgObj = new Image();
-			ImgObj.src = imgUrl;
-				console.log(ImgObj,(ImgObj.width > 0 && ImgObj.height > 0))
-			if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
-				return true;
-			} else {
-				return false;
-			}
+		if (imgUrl.length < 0) {
+			return false
+		}
+		var ImgObj = new Image();
+		ImgObj.src = imgUrl;
+		console.log(ImgObj, (ImgObj.width > 0 && ImgObj.height > 0))
+		if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
+			return true;
+		} else {
+			return false;
+		}
 	},
 	/**
 	 * @removeSpace 去空格
@@ -820,7 +820,7 @@ const regExp = {
 			91: "国外"
 		};
 		if (!aCity[parseInt(sId.substr(0, 2))]) {
-			console.log('你的身份证地区非法')
+			// console.log('你的身份证地区非法')
 			return false
 		}
 		// 出生日期验证
@@ -829,7 +829,7 @@ const regExp = {
 				"/"),
 			d = new Date(sBirthday)
 		if (sBirthday != (d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate())) {
-			console.log('身份证上的出生日期非法')
+			// console.log('身份证上的出生日期非法')
 			return false
 		}
 		// 身份证号码校验
@@ -842,7 +842,7 @@ const regExp = {
 		var last = codes[sum % 11]; //计算出来的最后一位身份证号码
 		// console.log(last)
 		if (sId[sId.length - 1] != last) {
-			console.log('你输入的身份证号非法')
+			// console.log('你输入的身份证号非法')
 			return false
 		}
 		return true
@@ -859,7 +859,7 @@ const _try_ = (callback) => {
 	}
 };
 
-export{
+export {
 	md, //
 	regExp, //验证规则
 	ipurl, //ip