ソースを参照

修改对接问题

xklr/wlj 1 年間 前
コミット
22f04b33fe

+ 78 - 66
App.vue

@@ -2,84 +2,56 @@
 	import configpath from 'config/setting.config.js';
 	import api from 'api/index.js'
 	import Vue from 'vue'
+	
 	const inforeq = (cb) => {
-	  fetch('/static/.config.json')
-	    .then((res) => res.json())
-	    .then(async (res) => {
-	      let obj = {
-	        ...res,
-	        img_local_host:
-	          (process.env.NODE_ENV === 'production'
-	            ? res.prodIp || configpath.prodIp
-	            : process.env.NODE_ENV === 'test'
-	              ? res.testIp || configpath.testIp
-	              : res.devIp || configpath.devIp) + '/file/',
-	        // 请求 地址
-	        baseURL:
-	          (process.env.NODE_ENV === 'production'
-	            ? res.prodIp || configpath.prodIp
-	            : process.env.NODE_ENV === 'test'
-	              ? res.testIp || configpath.testIp
-	              : res.devIp || configpath.devIp) + '/api/h5',
-	      }
-				cb&&cb(obj)
-	    })
+		fetch('/static/.config.json')
+			.then((res) => res.json())
+			.then(async (res) => {
+				let obj = {
+					...res,
+					img_local_host: (process.env.NODE_ENV === 'production' ?
+						res.prodIp || configpath.prodIp :
+						process.env.NODE_ENV === 'test' ?
+						res.testIp || configpath.testIp :
+						res.devIp || configpath.devIp) + '/file/',
+					// 请求 地址
+					baseURL: (process.env.NODE_ENV === 'production' ?
+						res.prodIp || configpath.prodIp :
+						process.env.NODE_ENV === 'test' ?
+						res.testIp || configpath.testIp :
+						res.devIp || configpath.devIp) + '/api/h5',
+				}
+				cb && cb(obj)
+			})
 	}
 	export default {
 		globalData: {
 			SET_STATUS_BAR: 0,
 			SET_CUSTOM_BAR: 0,
 			SET_SYSTEM_INFO: {},
-			configData:{},
-			$api:{...api}
+			configData: {},
+			token:''
 		},
 		onLaunch: function(option) {
+			let token = window.location.search.split('token=')[1]
 			console.log('App Launch')
-			let t = this
-			let query = option.query || option
-			uni.setStorageSync('query', query)
+			console.log(token)
+		
+			let t = this;
 			inforeq((res)=>{
 				t.globalData.configData=res
-			})
-			uni.getSystemInfo({
-				success: (e) => {
-					let statusBar = 0
-					let customBar = 0
-
-					// #ifdef MP
-					statusBar = e.statusBarHeight
-					customBar = e.statusBarHeight + 45
-					if (e.platform === 'android') {
-						customBar = e.statusBarHeight + 50
-					}
-					// #endif
-
-					// #ifdef MP-WEIXIN
-					statusBar = e.statusBarHeight
-					const custom = wx.getMenuButtonBoundingClientRect()
-					customBar = custom.bottom + custom.top - e.statusBarHeight
-					// #endif
-
-					// #ifdef MP-ALIPAY
-					statusBar = e.statusBarHeight
-					customBar = e.statusBarHeight + e.titleBarHeight
-					// #endif
-
-					// #ifdef APP-PLUS
-					console.log('app-plus', e)
-					statusBar = e.statusBarHeight
-					customBar = e.statusBarHeight + 45
-					// #endif
-
-					// #ifdef H5
-					statusBar = 0
-					customBar = e.statusBarHeight + 45
-					// #endif
-
-					this.globalData.SET_SYSTEM_INFO = e
-					this.globalData.SET_CUSTOM_BAR = customBar
-					this.globalData.SET_STATUS_BAR = statusBar
+				if(token&&token.length>0){
+					console.log(token)
+					uni.setStorage({
+						key: 'token',
+						data: token,
+						success: function () {
+							console.log('success');
+						}
+					});
+					t.globalData.token = token
 				}
+				
 			})
 		},
 		onShow: function() {
@@ -87,9 +59,49 @@
 		},
 		onHide: function() {
 			console.log('App Hide')
-		}
+		},
 	}
 </script>
+uni.getSystemInfo({
+success: (e) => {
+let statusBar = 0
+let customBar = 0
+
+// #ifdef MP
+statusBar = e.statusBarHeight
+customBar = e.statusBarHeight + 45
+if (e.platform === 'android') {
+customBar = e.statusBarHeight + 50
+}
+// #endif
+
+// #ifdef MP-WEIXIN
+statusBar = e.statusBarHeight
+const custom = wx.getMenuButtonBoundingClientRect()
+customBar = custom.bottom + custom.top - e.statusBarHeight
+// #endif
+
+// #ifdef MP-ALIPAY
+statusBar = e.statusBarHeight
+customBar = e.statusBarHeight + e.titleBarHeight
+// #endif
+
+// #ifdef APP-PLUS
+console.log('app-plus', e)
+statusBar = e.statusBarHeight
+customBar = e.statusBarHeight + 45
+// #endif
+
+// #ifdef H5
+statusBar = 0
+customBar = e.statusBarHeight + 45
+// #endif
+
+this.globalData.SET_SYSTEM_INFO = e
+this.globalData.SET_CUSTOM_BAR = customBar
+this.globalData.SET_STATUS_BAR = statusBar
+}
+})
 
 <style>
 	/*每个页面公共css */

+ 11 - 0
api/userinfo.js

@@ -1,6 +1,17 @@
 import request from './request.js';
 
 export default {
+	//获取token
+	decrypt: function(data) {
+		return request({
+			url: '/decrypt',
+			method: 'post',
+			headers:{
+				'Content-type':'multipart/form-data;charset=UTF-8'
+			},
+			data
+		})
+	},
 	//获取用户信息
 	getUserInfo: function(data) {
 		return request({

+ 1 - 1
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "patient_h5",
+    "name" : "慢病报告",
     "appid" : "__UNI__DBAF99A",
     "description" : "用于患者查看自己慢病就诊随访记录,和检查记录",
     "versionName" : "1.0.0",

+ 5 - 0
package-lock.json

@@ -2,6 +2,11 @@
   "requires": true,
   "lockfileVersion": 1,
   "dependencies": {
+    "crypto-js": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
+      "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
+    },
     "echarts": {
       "version": "5.4.0",
       "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.0.tgz",

+ 2 - 1
package.json

@@ -1,6 +1,7 @@
 {
   "dependencies": {
-    "axios": "^1.2.0",
+    "axios": "^1.2.1",
+    "crypto-js": "^4.1.1",
     "echarts": "^5.4.0",
     "moment": "^2.29.4"
   }

+ 2 - 0
pages.json

@@ -4,6 +4,7 @@
 			"path": "pages/index/index",
 			"style": {
 				"navigationBarTitleText": "首页"
+				
 			}
 		}, {
 			"path": "pages/userinfo/userinfo",
@@ -44,6 +45,7 @@
 		}
 	],
 	"globalStyle": {
+		"navigationStyle": "custom",
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "慢病报告",
 		"navigationBarBackgroundColor": "#F8F8F8",

+ 2 - 2
pages/eye_ground/eye_ground.vue

@@ -73,13 +73,13 @@
 										<image @click="pic(	item.rightImg || item.localRightImg
 										  ? img_host +
 										    (accessType == 1
-										      ? item.ightImg
+										      ? item.rightImg
 										      : item.localRightImg)
 										  : '@/static/img/other/you.png')" class="w-100" style="height: 100%;" :src="
 										item.rightImg || item.localRightImg
 										  ? img_host +
 										    (accessType == 1
-										      ? item.ightImg
+										      ? item.rightImg
 										      : item.localRightImg)
 										  : '@/static/img/other/you.png'" mode="scaleToFill"></image>
 									</view>

+ 6 - 2
pages/health_report/component/annual_inspection_plan.vue

@@ -25,7 +25,7 @@
 						</view>
 					</view>
 					<view class="px-3 pb-3 mt-n2" v-if="yearCheck.length==0">
-						<Empty title="没有随眼底检查" class="py-5" />
+						<Empty title="没有检查计划" class="py-5" />
 					</view>
 				</view>
 			</view>
@@ -69,7 +69,11 @@
 		methods: {
 			async getyearCheck(res) {
 				// this.yearCheck = data
-				let data = res.yearCheck ? res.yearCheck : []
+				let data = res.yearCheck ? res.yearCheck : [];
+				if(data.length==0){
+					this.yearCheck = [];
+					return
+				}
 				let data1 = []
 				data.map((item) => {
 					let str = ''

+ 6 - 6
pages/health_report/component/report.vue

@@ -139,11 +139,11 @@
 				</view>
 			</view>
 			<!-- 身体特征 -->
-			<view class="centerY mt-3">
+			<view class="centerY mt-3" v-if="propData.physical&&propData.physical.length>0">
 				<view class="bule_line"></view>
 				<text class="font-bold text-dark ml-2 fs-16 line-height1">体征</text>
 			</view>
-			<view class="card mb-2 fs-14 mt-3 p-3" style="color: #818181;">
+			<view class="card mb-2 fs-14 mt-3 p-3" style="color: #818181;"  v-if="propData.physical&&propData.physical.length>0">
 				<view class=" p-3" style="background-color: #F5F9FF;border-radius: 16rpx;">
 					<view id="echarts1" class="echarts"></view>
 					<view id="echarts2" class="echarts"></view>
@@ -162,7 +162,7 @@
 					</view>
 				</view>
 			</view>
-			<view class="centerY mt-3" v-if="propData.check">
+			<view class="centerY mt-3" v-if="propData.check&&propData.check.length>0">
 				<view class="bule_line"></view>
 				<text class="font-bold text-dark ml-2 fs-16 line-height1">实验检查</text>
 			</view>
@@ -346,13 +346,13 @@
 											<image @click="pic(	propData.eye.rightImg || propData.eye.localRightImg
 											  ? img_host +
 											    (accessType == 1
-											      ? propData.eye.ightImg
+											      ? propData.eye.rightImg
 											      : propData.eye.localRightImg)
 											  : '@/static/img/other/you.png')" class="w-100" style="height: 100%;" :src="
 											propData.eye.rightImg || propData.eye.localRightImg
 											  ? img_host +
 											    (accessType == 1
-											      ? propData.eye.ightImg
+											      ? propData.eye.rightImg
 											      : propData.eye.localRightImg)
 											  : '@/static/img/other/you.png'" mode="scaleToFill"></image>
 										</view>
@@ -398,7 +398,7 @@
 				<text class="font-bold text-dark ml-2 fs-16 line-height1">用药情况</text> <span
 					class="text-gry">(最近随访用药)</span>
 			</view>
-			<view class="card mb-2 fs-14 mt-3 p-3" style="color: #818181;">
+			<view class="card mb-2 fs-14 mt-3 p-3" style="color: #818181;"  v-if="propData.medicinal&&propData.medicinal.length>0">
 				<view class="">
 					<view class="mtable-title centerY bg-primary text-white fs-12">
 						<view class="text-left" style="width: 23%;">

+ 1 - 1
pages/home_monitoring/home_monitoring.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="m-3 mb-5" ref="ccc">
+	<view class="mb-5" ref="ccc">
 		<view class="position-relative bghead" style="margin-top: -80rpx;">
 			<image src="@/static/img/other/tou.png" mode="widthFix" class="w-100"></image>
 		</view>

+ 100 - 16
pages/index/index.vue

@@ -4,7 +4,8 @@
 			<view class="header p-3">
 				<view class="centerY">
 					<span class="d-inline-block fs-18 text-white font-bold">个人档案</span>
-					<span 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="closet">[ 退出 ]</span>
 				</view>
 				<view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
 					<view class="w-15 userhead">
@@ -111,19 +112,18 @@
 						src="@/static/img/index/jjjc.png" mode="widthFix" class="w-100"></image>
 				</view>
 			</view>
-
 		</view>
-
 		<view class="">
 			<uni-popup ref="popup1" type="center" :mask-click="false">
 				<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;">
-						<input type="text" v-model="valueId" class="p-1 px-2 fs-12" placeholder="请输入身份证号码"
+					<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 py-0 ml-auto mr-0"
+						<button type="primary" class="d-inline-block fs-12 px-3 ml-auto mr-0" style="padding: 4rpx ;"
 							@click="search">搜索</button>
 					</view>
 				</view>
@@ -133,26 +133,111 @@
 </template>
 
 <script>
+	const ipArr = [{
+			name: '开发',
+			ip: 'http://192.168.1.103:10066'
+		},
+		{
+			name: '测试',
+			ip: 'http://testapi.xklr.net:8601'
+		},
+		{
+			name: '正式',
+			ip: 'http://apiv3.xklr.net'
+		},
+		{
+			name: '兰溪',
+			ip: 'http://10.50.13.200:10066'
+		}
+	]
+	let globalData = getApp().globalData
 	export default {
 		data() {
 			return {
 				userData: {},
 				physical: {},
-				valueId: '330222194512283184'
+				valueId: '',
+				prodIp: '',
+				ipArr
 			}
 		},
-		mounted() {
+		onLoad() {
 			// console.log(this.$mf)
 			// console.log(this.$httpApi)
-
-			if (!uni.getStorageSync('idCard')) {
-				console.log(this.$refs)
-				this.$refs.popup1.open()
-			} else {
-				this.getuserinfo(uni.getStorageSync('idCard'))
-			}
+			this.decrypt()
 		},
 		methods: {
+			decrypt() {
+				uni.showLoading({
+					title: '加载中'
+				})
+				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
+											});
+											uni.setStorageSync('idCard', res2.idCard)
+											t.getuserinfo(res2.idCard)
+										}
+									}
+								}, 300)
+
+							})
+						} 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)
+						}
+
+					},
+					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)
+					}
+				})
+			},
 			closet() {
 				uni.clearStorage('idCard')
 				uni.clearStorage('userData')
@@ -200,7 +285,6 @@
 					uni.setStorageSync('userData', data || {});
 					uni.setStorageSync('idCard', data && data.idCard || '')
 					this.userData = data || {}
-					console.log(this.userData)
 					if (data && data.id) {
 						this.$refs.popup1.close();
 						this.find_physical()

+ 1 - 1
static/.config.json

@@ -1,7 +1,7 @@
 {
 	"prodIp": "http://apiv3.xklr.net",
 	"img_prod_host": "http://img.xklr.net/",
-	"devIp": "http://192.168.3.78:10066",
+	"devIp": "http://apiv3.xklr.net",
 	"testIp": "http://testapi.xklr.net:8601",
 	"appConfig": {
 		"jj_service_url": "http://118.31.70.1:8601",

BIN
static/img/index/grtz.png


+ 13 - 13
static/style/color.css

@@ -70,43 +70,43 @@
 
 /* 字体 */
 .fs-8 {
-	font-size: 8px !important;
+	font-size: 16rpx !important;
 }
 .fs-10 {
-	font-size: 10px !important;
+	font-size: 20rpx !important;
 }
 .fs-12 {
-	font-size: 12px !important;
+	font-size: 24rpx !important;
 }
 .fs-14 {
-	font-size: 14px !important;
+	font-size: 28rpx !important;
 }
 .fs-16 {
-	font-size: 16px !important;
+	font-size: 32rpx !important;
 }
 .fs-18 {
-	font-size: 18px !important;
+	font-size: 36rpx !important;
 }
 .fs-20 {
-	font-size: 20px !important;
+	font-size: 40rpx !important;
 }
 .fs-22 {
-	font-size: 22px !important;
+	font-size: 44rpx !important;
 }
 .fs-24 {
-	font-size: 24px !important;
+	font-size: 48rpx !important;
 }
 .fs-26 {
-	font-size: 26px !important;
+	font-size: 52rpx !important;
 }
 .fs-28 {
-	font-size: 28px !important;
+	font-size: 56rpx !important;
 }
 .fs-30 {
-	font-size: 30px !important;
+	font-size: 60px !important;
 }
 .fs-40 {
-	font-size: 40px !important;
+	font-size: 80px !important;
 }
 
 /* border */

+ 9 - 4
yarn.lock

@@ -7,10 +7,10 @@ asynckit@^0.4.0:
   resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
   integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
 
-axios@^1.2.0:
-  version "1.2.0"
-  resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.0.tgz#1cb65bd75162c70e9f8d118a905126c4a201d383"
-  integrity sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw==
+axios@^1.2.1:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.1.tgz#44cf04a3c9f0c2252ebd85975361c026cb9f864a"
+  integrity sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==
   dependencies:
     follow-redirects "^1.15.0"
     form-data "^4.0.0"
@@ -23,6 +23,11 @@ combined-stream@^1.0.8:
   dependencies:
     delayed-stream "~1.0.0"
 
+crypto-js@^4.1.1:
+  version "4.1.1"
+  resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
+  integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
+
 delayed-stream@~1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"