index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="mb-5">
  3. <view class="" v-if="userData.id">
  4. <view class="header p-3">
  5. <view class="centerY">
  6. <span class="d-inline-block fs-18 text-white font-bold">个人档案</span>
  7. <span v-if="ipArr.find((item)=>item.ip==prodIp)&&ipArr.find((item)=>item.ip==prodIp).name!=='兰溪'"
  8. class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="closet">[ 退出 ]</span>
  9. </view>
  10. <view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
  11. <view class="w-15 userhead">
  12. <view class="picbox">
  13. <image v-if="userData.sex==1" src="@/static/img/defult/head1.png" mode="widthFix"
  14. class="picimg"></image>
  15. <image v-if="userData.sex==2" src="@/static/img/defult/head2.png" mode="widthFix"
  16. class="picimg"></image>
  17. </view>
  18. </view>
  19. <view class="w-85 ml-3">
  20. <view class="text-white fs-16 font-bold">
  21. {{userData.username||''}}
  22. </view>
  23. <view class="centerY" style="margin-top:10rpx;">
  24. <view
  25. :class="{'iconfont text-white fs-16 font-bold':true,' nv':userData.sex==2,'nanxing':userData.sex==1,} ">
  26. </view>
  27. <view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto"
  28. style="border-radius: 6rpx;">
  29. <view class="">
  30. 基础资料
  31. </view>
  32. <view class="iconfont youla2 fs-12 font-bold">
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="content p-3 bg-white mx-3 my-3 box-border08">
  40. <view class="" style="display:flex;flex-wrap: wrap !important;">
  41. <view class="w-100 border-box">
  42. <view class=""
  43. style="background: linear-gradient(180deg, rgb(151,220,249) 0%, rgb(110,197,246) 100%);border-radius: 16rpx;">
  44. <view class="px-3 pt-2 pb-3 ">
  45. <view class="centerY ">
  46. <view class="bule_line"></view>
  47. <text class="fs-18 ml-2 font-bold" style="color: #1C90D7;">
  48. 个人体征
  49. </text>
  50. </view>
  51. <view class="mt-2" style="color: #000;">
  52. <view class="font-bold" style="display:flex;flex-wrap: wrap !important;">
  53. <view class="w-50 border-box pr-1">
  54. <view class=" d-flex px-2 py-1"
  55. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  56. 身高<span class="ml-auto ml-1">{{physical.height}} cm</span>
  57. </view>
  58. </view>
  59. <view class="w-50 border-box pl-1">
  60. <view class=" d-flex px-2 py-1"
  61. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  62. 体重<span class="ml-auto ml-1">{{physical.waist}} kg</span>
  63. </view>
  64. </view>
  65. <view class="w-50 border-box pr-1 mt-2">
  66. <view class=" d-flex px-2 py-1"
  67. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  68. BMI
  69. <span class="ml-auto ml-1">{{physical.bmi}} kg/m^2</span>
  70. </view>
  71. </view>
  72. <view class="w-50 border-box pl-1 mt-2">
  73. <view class=" d-flex px-2 py-1"
  74. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  75. 血压<span class="ml-auto ml-1">{{physical.diastole}}/{{physical.shrink}}
  76. mmHg</span>
  77. </view>
  78. </view>
  79. <view class="w-50 border-box pr-1 mt-2">
  80. <view class=" d-flex px-2 py-1"
  81. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  82. 心率<span class="ml-auto ml-1">{{physical.pulse}} bmp</span>
  83. </view>
  84. </view>
  85. <view class="w-50 border-box pl-1 mt-2">
  86. <view class=" d-flex px-2 py-1"
  87. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  88. 腰围<span class="ml-auto ml-1">{{physical.weight}} cm</span>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="w-50 pr-2 border-box mt-3">
  97. <image @click="$mf.clickNavto('/pages/medication/medication')" src="@/static/img/index/dqyy.png"
  98. mode="widthFix" class="w-100"></image>
  99. </view>
  100. <view class="w-50 pl-2 border-box mt-3">
  101. <image @click="$mf.clickNavto('/pages/health_report/health_report')"
  102. src="@/static/img/index/jkbg.png" mode="widthFix" class="w-100"></image>
  103. </view>
  104. </view>
  105. <view class="mt-2">
  106. <image @click="$mf.clickNavto('/pages/eye_ground/eye_ground')" src="@/static/img/index/ydjc.png"
  107. mode="widthFix" class="w-100"></image>
  108. </view>
  109. <view class="mt-2">
  110. <image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')"
  111. src="@/static/img/index/jjjc.png" mode="widthFix" class="w-100"></image>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="">
  116. <uni-popup ref="popup1" type="center" :mask-click="false">
  117. <view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
  118. <view class="text-center mb-3 fs-14 font-bold py-2">
  119. 查询
  120. </view>
  121. <view class=" centerY mb-3"
  122. style="border-radius: 14rpx;border: 1px solid #007aff;overflow: hidden;">
  123. <input type="text" v-model="valueId" class="px-2 fs-12" placeholder="请输入身份证号码"
  124. placeholder-class="fs-12">
  125. <button type="primary" class="d-inline-block fs-12 px-3 ml-auto mr-0" style="padding: 4rpx ;"
  126. @click="search">搜索</button>
  127. </view>
  128. </view>
  129. </uni-popup>
  130. </view>
  131. </view>
  132. </template>
  133. <script>
  134. const ipArr = [{
  135. name: '开发',
  136. ip: 'http://192.168.1.103:10066'
  137. },
  138. {
  139. name: '测试',
  140. ip: 'http://testapi.xklr.net:8601'
  141. },
  142. {
  143. name: '正式',
  144. ip: 'http://apiv3.xklr.net'
  145. },
  146. {
  147. name: '兰溪',
  148. ip: 'http://10.50.13.200:10066'
  149. }
  150. ]
  151. let globalData = getApp().globalData
  152. export default {
  153. data() {
  154. return {
  155. userData: {},
  156. physical: {},
  157. valueId: '',
  158. prodIp: '',
  159. ipArr
  160. }
  161. },
  162. onLoad() {
  163. // console.log(this.$mf)
  164. // console.log(this.$httpApi)
  165. this.decrypt()
  166. },
  167. methods: {
  168. decrypt() {
  169. uni.showLoading({
  170. title: '加载中'
  171. })
  172. let t = this;
  173. uni.getStorage({
  174. key: 'token',
  175. success(res) {
  176. console.log(res)
  177. if (res.data !== '') {
  178. ipArr.map((item) => {
  179. console.log(globalData.configData.prodIp)
  180. let timer = setInterval(async () => {
  181. if (globalData.configData.prodIp) {
  182. t.prodIp = globalData.configData.prodIp
  183. clearInterval(timer)
  184. }
  185. if (item.ip == globalData.configData.prodIp) {
  186. //兰溪
  187. if (item.name == '兰溪') {
  188. if (!res.data.length > 10) return
  189. console.log(res)
  190. let res2 = await t.$api.decrypt({
  191. toKen: res.data
  192. });
  193. uni.setStorageSync('idCard', res2.idCard)
  194. t.getuserinfo(res2.idCard)
  195. }
  196. }
  197. }, 300)
  198. })
  199. } else {
  200. let timer = setInterval(async () => {
  201. if (globalData.configData.prodIp) {
  202. t.prodIp = globalData.configData.prodIp
  203. clearInterval(timer)
  204. }
  205. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
  206. if (!i) {
  207. if (!uni.getStorageSync('idCard')) {
  208. t.$refs.popup1.open()
  209. uni.hideLoading()
  210. } else {
  211. t.getuserinfo(uni.getStorageSync('idCard'))
  212. }
  213. }
  214. }, 300)
  215. }
  216. },
  217. fail(res) {
  218. console.log(res)
  219. let timer = setInterval(async () => {
  220. if (globalData.configData.prodIp) {
  221. t.prodIp = globalData.configData.prodIp
  222. clearInterval(timer)
  223. }
  224. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
  225. if (!i) {
  226. if (!uni.getStorageSync('idCard')) {
  227. t.$refs.popup1.open()
  228. uni.hideLoading()
  229. } else {
  230. t.getuserinfo(uni.getStorageSync('idCard'))
  231. }
  232. }
  233. }, 300)
  234. }
  235. })
  236. },
  237. closet() {
  238. uni.clearStorage('idCard')
  239. uni.clearStorage('userData')
  240. this.valueId = '';
  241. this.userData = {};
  242. this.physical = {};
  243. this.$refs.popup1.open()
  244. },
  245. search() {
  246. this.getuserinfo(this.valueId)
  247. this.valueId = '';
  248. this.userData = {};
  249. this.physical = {};
  250. },
  251. async find_physical() {
  252. uni.showLoading({
  253. title: '加载中'
  254. });
  255. let idCard = uni.getStorageSync('idCard')
  256. let {
  257. data,
  258. code
  259. } = await this.$api.find_physical({
  260. idCard
  261. })
  262. if (code == 0) {
  263. this.physical = data || {}
  264. uni.hideLoading();
  265. } else {
  266. uni.hideLoading();
  267. }
  268. uni.stopPullDownRefresh()
  269. },
  270. async getuserinfo(idCard) { //330222194512283184
  271. uni.showLoading({
  272. title: '加载中'
  273. });
  274. let {
  275. data,
  276. code
  277. } = await this.$api.getUserInfo({
  278. idCard
  279. })
  280. if (code == 0) {
  281. uni.setStorageSync('userData', data || {});
  282. uni.setStorageSync('idCard', data && data.idCard || '')
  283. this.userData = data || {}
  284. if (data && data.id) {
  285. this.$refs.popup1.close();
  286. this.find_physical()
  287. } else {
  288. uni.showToast({
  289. title: '未查询到患者',
  290. icon: 'error'
  291. })
  292. }
  293. uni.hideLoading();
  294. } else {
  295. uni.hideLoading();
  296. uni.stopPullDownRefresh()
  297. }
  298. }
  299. },
  300. onPullDownRefresh() {
  301. this.getuserinfo()
  302. }
  303. }
  304. </script>
  305. <style lang="scss">
  306. page {
  307. background: #F5F9FF;
  308. }
  309. .header {
  310. background: linear-gradient(180deg, #096DCB 0%, #6faae1 100%)
  311. }
  312. .userhead {
  313. border-radius: 50%;
  314. box-shadow: 1px 1px 10px 1px #096DCB;
  315. }
  316. .text-gry80 {
  317. color: #808080;
  318. }
  319. .box-border08 {
  320. border-radius: 16rpx;
  321. }
  322. </style>