index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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. <uni-popup ref="popup2" type="center" :mask-click="false">
  131. <view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
  132. <view class="text-center mb-3 fs-14 font-bold py-2">
  133. 查询
  134. </view>
  135. <view class=" centerY mb-3"
  136. style="border-radius: 14rpx;border: 1px solid #007aff;overflow: hidden;">
  137. <input type="text" v-model="valueId" class="px-2 fs-12" placeholder="请输入身份证号码"
  138. placeholder-class="fs-12">
  139. <button type="primary" class="d-inline-block fs-12 px-3 ml-auto mr-0" style="padding: 4rpx ;"
  140. @click="search">搜索</button>
  141. </view>
  142. </view>
  143. </uni-popup>
  144. </view>
  145. </view>
  146. </template>
  147. <script>
  148. const ipArr = [{
  149. name: '开发',
  150. ip: 'http://192.168.1.103:10066'
  151. },
  152. {
  153. name: '测试',
  154. ip: 'http://testapi.xklr.net:8601'
  155. },
  156. {
  157. name: '正式',
  158. ip: 'http://apiv3.xklr.net'
  159. },
  160. {
  161. name: '兰溪',
  162. ip: 'http://10.50.13.200:10066'
  163. }
  164. ]
  165. let globalData = getApp().globalData
  166. export default {
  167. data() {
  168. return {
  169. userData: {},
  170. physical: {},
  171. valueId: '',
  172. prodIp: '',
  173. ipArr
  174. }
  175. },
  176. onLoad() {
  177. // console.log(this.$mf)
  178. // console.log(this.$httpApi)
  179. this.decrypt()
  180. },
  181. methods: {
  182. decrypt() {
  183. uni.showLoading({
  184. title: '加载中'
  185. })
  186. let t = this;
  187. uni.getStorage({
  188. key: 'token',
  189. success(res) {
  190. console.log(res)
  191. if (res.data !== '') {
  192. ipArr.map((item) => {
  193. console.log(globalData.configData.prodIp)
  194. let timer = setInterval(async () => {
  195. if (globalData.configData.prodIp) {
  196. t.prodIp = globalData.configData.prodIp
  197. clearInterval(timer)
  198. }
  199. if (item.ip == globalData.configData.prodIp) {
  200. //兰溪
  201. if (item.name == '兰溪') {
  202. if (!res.data.length > 10) return
  203. console.log(res)
  204. let res2 = await t.$api.decrypt({
  205. toKen: res.data
  206. });
  207. uni.setStorageSync('idCard', res2.idCard)
  208. t.getuserinfo(res2.idCard)
  209. }
  210. }
  211. }, 300)
  212. })
  213. } else {
  214. let timer = setInterval(async () => {
  215. if (globalData.configData.prodIp) {
  216. t.prodIp = globalData.configData.prodIp
  217. clearInterval(timer)
  218. }
  219. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
  220. if (!i) {
  221. if (!uni.getStorageSync('idCard')) {
  222. t.$refs.popup1.open()
  223. uni.hideLoading()
  224. } else {
  225. t.getuserinfo(uni.getStorageSync('idCard'))
  226. }
  227. }
  228. }, 300)
  229. }
  230. },
  231. fail(res) {
  232. console.log(res)
  233. let timer = setInterval(async () => {
  234. if (globalData.configData.prodIp) {
  235. t.prodIp = globalData.configData.prodIp
  236. clearInterval(timer)
  237. }
  238. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp).name=='兰溪'
  239. if (!i) {
  240. if (!uni.getStorageSync('idCard')) {
  241. t.$refs.popup1.open()
  242. uni.hideLoading()
  243. } else {
  244. t.getuserinfo(uni.getStorageSync('idCard'))
  245. }
  246. }
  247. }, 300)
  248. }
  249. })
  250. },
  251. closet() {
  252. uni.clearStorage('idCard')
  253. uni.clearStorage('userData')
  254. this.valueId = '';
  255. this.userData = {};
  256. this.physical = {};
  257. this.$refs.popup1.open()
  258. },
  259. search() {
  260. this.getuserinfo(this.valueId)
  261. this.valueId = '';
  262. this.userData = {};
  263. this.physical = {};
  264. },
  265. async find_physical() {
  266. uni.showLoading({
  267. title: '加载中'
  268. });
  269. let idCard = uni.getStorageSync('idCard')
  270. let {
  271. data,
  272. code
  273. } = await this.$api.find_physical({
  274. idCard
  275. })
  276. if (code == 0) {
  277. this.physical = data || {}
  278. uni.hideLoading();
  279. } else {
  280. uni.hideLoading();
  281. }
  282. uni.stopPullDownRefresh()
  283. },
  284. async getuserinfo(idCard) { //330222194512283184
  285. uni.showLoading({
  286. title: '加载中'
  287. });
  288. let {
  289. data,
  290. code
  291. } = await this.$api.getUserInfo({
  292. idCard
  293. })
  294. if (code == 0) {
  295. uni.setStorageSync('userData', data || {});
  296. uni.setStorageSync('idCard', data && data.idCard || '')
  297. this.userData = data || {}
  298. if (data && data.id) {
  299. this.$refs.popup1.close();
  300. this.find_physical()
  301. } else {
  302. uni.showToast({
  303. title: '未查询到患者',
  304. icon: 'error'
  305. })
  306. }
  307. uni.hideLoading();
  308. } else {
  309. uni.hideLoading();
  310. uni.stopPullDownRefresh()
  311. }
  312. }
  313. },
  314. onPullDownRefresh() {
  315. this.getuserinfo()
  316. }
  317. }
  318. </script>
  319. <style lang="scss">
  320. page {
  321. background: #F5F9FF;
  322. }
  323. .header {
  324. background: linear-gradient(180deg, #096DCB 0%, #6faae1 100%)
  325. }
  326. .userhead {
  327. border-radius: 50%;
  328. box-shadow: 1px 1px 10px 1px #096DCB;
  329. }
  330. .text-gry80 {
  331. color: #808080;
  332. }
  333. .box-border08 {
  334. border-radius: 16rpx;
  335. }
  336. </style>