index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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. <span v-if="ipArr.find((item)=>item.ip==prodIp)&&ipArr.find((item)=>item.ip==prodIp).name=='兰溪'"
  10. class="d-inline-block py-1 d-inline-block ml-auto text-white1" @click="operation">[ 切换 ]</span>
  11. </view>
  12. <view class="centerY mt-2" @click="$mf.clickNavto('/pages/userinfo/userinfo')">
  13. <view class="w-15 userhead">
  14. <view class="picbox">
  15. <image v-if="userData.sex==1" src="@/static/img/defult/head1.png" mode="widthFix"
  16. class="picimg"></image>
  17. <image v-if="userData.sex==2" src="@/static/img/defult/head2.png" mode="widthFix"
  18. class="picimg"></image>
  19. </view>
  20. </view>
  21. <view class="w-85 ml-3">
  22. <view class="text-white fs-16 font-bold">
  23. {{userData.username||''}}
  24. </view>
  25. <view class="centerY" style="margin-top:10rpx;">
  26. <view
  27. :class="{'iconfont text-white fs-16 font-bold':true,' nv':userData.sex==2,'nanxing':userData.sex==1,} ">
  28. </view>
  29. <view class="py-1 pl-2 text-center centerY text-gry80 bg-white ml-auto"
  30. style="border-radius: 6rpx;">
  31. <view class="">
  32. 基础资料
  33. </view>
  34. <view class="iconfont youla2 fs-12 font-bold">
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="content p-3 bg-white mx-3 my-3 box-border08">
  42. <view class="" style="display:flex;flex-wrap: wrap !important;">
  43. <view class="w-100 border-box">
  44. <view class=""
  45. style="background: linear-gradient(180deg, rgb(151,220,249) 0%, rgb(110,197,246) 100%);border-radius: 16rpx;">
  46. <view class="px-3 pt-2 pb-3 ">
  47. <view class="centerY ">
  48. <view class="bule_line"></view>
  49. <text class="fs-18 ml-2 font-bold" style="color: #1C90D7;">
  50. 个人体征
  51. </text>
  52. </view>
  53. <view class="mt-2" style="color: #000;">
  54. <view class="font-bold" style="display:flex;flex-wrap: wrap !important;">
  55. <view class="w-50 border-box pr-1">
  56. <view class=" d-flex px-2 py-1"
  57. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  58. 身高<span class="ml-auto ml-1">{{physical.height}} cm</span>
  59. </view>
  60. </view>
  61. <view class="w-50 border-box pl-1">
  62. <view class=" d-flex px-2 py-1"
  63. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  64. 体重<span class="ml-auto ml-1">{{physical.waist}} kg</span>
  65. </view>
  66. </view>
  67. <view class="w-50 border-box pr-1 mt-2">
  68. <view class=" d-flex px-2 py-1"
  69. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  70. BMI
  71. <span class="ml-auto ml-1">{{physical.bmi}} kg/m^2</span>
  72. </view>
  73. </view>
  74. <view class="w-50 border-box pl-1 mt-2">
  75. <view class=" d-flex px-2 py-1"
  76. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  77. 血压<span class="ml-auto ml-1">{{physical.diastole}}/{{physical.shrink}}
  78. mmHg</span>
  79. </view>
  80. </view>
  81. <view class="w-50 border-box pr-1 mt-2">
  82. <view class=" d-flex px-2 py-1"
  83. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  84. 心率<span class="ml-auto ml-1">{{physical.pulse}} bmp</span>
  85. </view>
  86. </view>
  87. <view class="w-50 border-box pl-1 mt-2">
  88. <view class=" d-flex px-2 py-1"
  89. style="color: #55afdf;border-radius: 10rpx;background-color: rgba(255,255,255)">
  90. 腰围<span class="ml-auto ml-1">{{physical.weight}} cm</span>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="w-50 pr-2 border-box mt-3">
  99. <image @click="$mf.clickNavto('/pages/medication/medication')" src="@/static/img/index/dqyy.png"
  100. mode="widthFix" class="w-100"></image>
  101. </view>
  102. <view class="w-50 pl-2 border-box mt-3">
  103. <image @click="$mf.clickNavto('/pages/health_report/health_report')"
  104. src="@/static/img/index/jkbg.png" mode="widthFix" class="w-100"></image>
  105. </view>
  106. </view>
  107. <view class="mt-2">
  108. <image @click="$mf.clickNavto('/pages/eye_ground/eye_ground')" src="@/static/img/index/ydjc.png"
  109. mode="widthFix" class="w-100"></image>
  110. </view>
  111. <view class="mt-2">
  112. <image @click="$mf.clickNavto('/pages/home_monitoring/home_monitoring')"
  113. src="@/static/img/index/jjjc.png" mode="widthFix" class="w-100"></image>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="">
  118. <uni-popup ref="popup1" type="center" :mask-click="false" class="w-100">
  119. <view class="bg-white p-3 w-100" style="border-radius: 16rpx;">
  120. <view class="text-center mb-3 fs-14 font-bold py-2">
  121. 查询
  122. </view>
  123. <view class=" centerY mb-3"
  124. style="border-radius: 14rpx;border: 1px solid #007aff;overflow: hidden;">
  125. <input type="text" v-model="valueId" class="px-2 fs-12 w-70" placeholder="请输入身份证号码"
  126. placeholder-class="fs-12">
  127. <button type="primary" class="d-inline-block fs-12 px-2 ml-auto w-30" style="padding: 4rpx ;"
  128. @click="search">搜索</button>
  129. </view>
  130. </view>
  131. </uni-popup>
  132. <uni-popup ref="popup2" type="center" :mask-click="false" class="w-100">
  133. <view class="bg-white p-3 w-80 text-center" style="border-radius: 16rpx;min-width: 400rpx;">
  134. <view class="text-center mb-3 fs-14 font-bold py-2">
  135. 患者列表
  136. </view>
  137. <view class="text-left centerY mb-3" style="border-radius: 14rpx;border: 1px solid #007aff;">
  138. <uni-data-select v-model="userIndex" :localdata="userArr" @change="bindPickerChange"
  139. placeholder="请选择身份">
  140. </uni-data-select>
  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. userArr: [],
  175. userIndex: null,
  176. }
  177. },
  178. onLoad() {
  179. this.decrypt()
  180. },
  181. methods: {
  182. //切换
  183. operation() {
  184. uni.clearStorage('idCard')
  185. uni.clearStorage('userData')
  186. this.valueId = '';
  187. this.userData = {};
  188. this.physical = {};
  189. this.$refs.popup2.open()
  190. },
  191. bindPickerChange(e) {
  192. if (this.userArr[e] && this.userArr[e].text) {
  193. this.getuserinfo(this.userArr[e].text)
  194. }
  195. },
  196. decrypt() {
  197. uni.showLoading({
  198. title: '加载中'
  199. })
  200. let t = this;
  201. uni.getStorage({
  202. key: 'token',
  203. success(res) {
  204. console.log(res)
  205. if (res.data !== '') {
  206. ipArr.map((item) => {
  207. console.log(globalData.configData.prodIp)
  208. let timer = setInterval(async () => {
  209. if (globalData.configData.prodIp) {
  210. t.prodIp = globalData.configData.prodIp
  211. clearInterval(timer)
  212. }
  213. if (item.ip == globalData.configData.prodIp) {
  214. //兰溪
  215. if (item.name == '开发') {
  216. if (!res.data.length > 10) return
  217. console.log(res)
  218. let res2 = await t.$api.decrypt({
  219. toKen: res.data
  220. });
  221. if (res2.code !== -1) {
  222. if (res2.data.users && res2.data.users.length >
  223. 0) {
  224. t.$refs.popup2.open()
  225. t.userArr = []
  226. res2.data.users.map((item, index) => {
  227. t.userArr.push({
  228. value: index,
  229. text: item.idcard
  230. })
  231. })
  232. console.log(t.userArr)
  233. uni.hideLoading()
  234. }
  235. } else {
  236. console.log(1)
  237. if (!uni.getStorageSync('idCard')) {
  238. t.$refs.popup1.open()
  239. uni.hideLoading()
  240. } else {
  241. t.getuserinfo(uni.getStorageSync('idCard'))
  242. }
  243. }
  244. }
  245. }
  246. }, 300)
  247. })
  248. } else {
  249. let timer = setInterval(async () => {
  250. if (globalData.configData.prodIp) {
  251. t.prodIp = globalData.configData.prodIp
  252. clearInterval(timer)
  253. }
  254. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
  255. .name == '兰溪'
  256. if (!i) {
  257. if (!uni.getStorageSync('idCard')) {
  258. t.$refs.popup1.open()
  259. uni.hideLoading()
  260. } else {
  261. t.getuserinfo(uni.getStorageSync('idCard'))
  262. }
  263. }
  264. }, 300)
  265. }
  266. },
  267. fail(res) {
  268. console.log(res)
  269. let timer = setInterval(async () => {
  270. if (globalData.configData.prodIp) {
  271. t.prodIp = globalData.configData.prodIp
  272. clearInterval(timer)
  273. }
  274. let i = ipArr.find((item) => item.ip == globalData.configData.prodIp)
  275. .name == '兰溪'
  276. if (!i) {
  277. if (!uni.getStorageSync('idCard')) {
  278. t.$refs.popup1.open()
  279. uni.hideLoading()
  280. } else {
  281. t.getuserinfo(uni.getStorageSync('idCard'))
  282. }
  283. }
  284. }, 300)
  285. }
  286. })
  287. },
  288. closet() {
  289. uni.clearStorage('idCard')
  290. uni.clearStorage('userData')
  291. this.valueId = '';
  292. this.userData = {};
  293. this.physical = {};
  294. this.$refs.popup1.open()
  295. },
  296. search() {
  297. this.getuserinfo(this.valueId)
  298. this.valueId = '';
  299. this.userData = {};
  300. this.physical = {};
  301. },
  302. async find_physical() {
  303. uni.showLoading({
  304. title: '加载中'
  305. });
  306. let idCard = uni.getStorageSync('idCard')
  307. let {
  308. data,
  309. code
  310. } = await this.$api.find_physical({
  311. idCard
  312. })
  313. if (code == 0) {
  314. this.physical = data || {}
  315. uni.hideLoading();
  316. } else {
  317. uni.hideLoading();
  318. }
  319. uni.stopPullDownRefresh()
  320. },
  321. async getuserinfo(idCard) { //330222194512283184
  322. uni.showLoading({
  323. title: '加载中'
  324. });
  325. let {
  326. data,
  327. code
  328. } = await this.$api.getUserInfo({
  329. idCard
  330. })
  331. if (code == 0) {
  332. uni.setStorageSync('userData', data || {});
  333. uni.setStorageSync('idCard', data && data.idCard || '')
  334. this.userData = data || {}
  335. if (data && data.id) {
  336. this.$refs.popup1.close();
  337. this.find_physical()
  338. this.$refs.popup2.close();
  339. } else {
  340. uni.showToast({
  341. title: '未查询到患者',
  342. icon: 'error'
  343. })
  344. }
  345. uni.hideLoading();
  346. } else {
  347. uni.hideLoading();
  348. uni.stopPullDownRefresh()
  349. }
  350. }
  351. },
  352. onPullDownRefresh() {
  353. this.getuserinfo()
  354. }
  355. }
  356. </script>
  357. <style lang="scss">
  358. page {
  359. background: #F5F9FF;
  360. }
  361. .header {
  362. background: linear-gradient(180deg, #096DCB 0%, #6faae1 100%)
  363. }
  364. .userhead {
  365. border-radius: 50%;
  366. box-shadow: 1px 1px 10px 1px #096DCB;
  367. }
  368. .text-gry80 {
  369. color: #808080;
  370. }
  371. .box-border08 {
  372. border-radius: 16rpx;
  373. }
  374. </style>