index.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399
  1. <template>
  2. <view class="flex-col justify-start home-container">
  3. <view class="container-bg"></view>
  4. <cu-custom bgColor="#fff"><view slot="content" style="color: #FFFFFF">UU睡眠</view></cu-custom>
  5. <view class="flex-col home-module space-y-20">
  6. <!-- no device added -->
  7. <view v-if="!deviceAdded">
  8. <view class="flex-col items-start home-header space-y-10">
  9. <text class="home-header-title">欢迎回来!</text>
  10. <text class="font_3 text_3 home-header-subtitle">我是小U,您的健康智慧管家。</text>
  11. </view>
  12. <view class="flex-row items-center home_add_devive space-x-10">
  13. <image
  14. class="image_4"
  15. src="../../static/home/homeIconAdd.png"
  16. />
  17. <text class="text_5">添加设备</text>
  18. </view>
  19. <view class="home-ad flex-col group_5 space-y-40">
  20. <view class="flex-col home-header space-y-6">
  21. <view class="flex-row items-center space-x-8">
  22. <text class="font_4 text_8">UU AI智能睡眠监测仪</text>
  23. <view class="flex-row items-center section_7">
  24. <text class="font_5 text_9">去看看</text>
  25. <image
  26. class="shrink-0 image_9"
  27. src="../../static/home/homeIconGO.png"
  28. />
  29. </view>
  30. </view>
  31. <view class="flex-row items-center space-x-10">
  32. <text class="font_5 text_3 text_10">AI时代,全家人的睡眠健康顾问</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="flex-col">
  37. <view class="flex-col group_5">
  38. <view class="flex-col home_blank_heart">
  39. <view class="flex-row items-center group_7 space-x-4">
  40. <image
  41. class="image_6"
  42. src="../../static/home/homeIconHeart.png"
  43. />
  44. <text class="font_1 text_9">心率</text>
  45. </view>
  46. <view class="flex-row justify-end items-start">
  47. <view class="section_5 view"></view>
  48. <text class="font_3 text_10">--</text>
  49. </view>
  50. <view class="flex-col group_8">
  51. <text class="self-start font_4 text_11">次/分</text>
  52. <view class="shrink-0 self-end section_5"></view>
  53. </view>
  54. </view>
  55. <view class="flex-col home_blank_breath">
  56. <view class="flex-row items-center group_10 space-x-4">
  57. <image
  58. class="image_7"
  59. src="../../static/home/homeIconBreath.png"
  60. />
  61. <text class="font_1 text_12">呼吸</text>
  62. </view>
  63. <view class="flex-row justify-end items-start">
  64. <view class="section_5 view_2"></view>
  65. <text class="font_3 text_13">--</text>
  66. </view>
  67. <view class="flex-col group_8">
  68. <text class="self-start font_4 text_11">次/分</text>
  69. <view class="shrink-0 self-end section_5"></view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="flex-row items-center home_blank_alert space-x-16">
  74. <image
  75. class="image_8"
  76. src="../../static/home/homeIconGift.png"
  77. />
  78. <view class="flex-col items-start flex-auto space-y-4">
  79. <text class="font_5">昨晚您的睡眠质量很好</text>
  80. <text class="font_5">暂时没有预警信息</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- device added -->
  86. <view v-if="deviceAdded" class="flex-col">
  87. <view class="flex-col items-start home-header space-y-10">
  88. <text class="home-header-title">欢迎回来!</text>
  89. <text class="font_3 text_3 home-header-subtitle">我是小U,您的健康智慧管家。</text>
  90. </view>
  91. <!-- home device -->
  92. <view class="flex-col home-device space-y-15">
  93. <view class="flex-row home-device-header">
  94. <view class="flex-row justify-between flex-auto equal-division">
  95. <view class="flex-row equal-division-item space-x-4">
  96. <text class="font_3 text_5">当前设备</text>
  97. <text class="font_3">{{ homeFrom.nowDevice }}</text>
  98. </view>
  99. <view class="flex-row equal-division-item space-x-14">
  100. <view class="flex-row space-x-4 margin-left-xl">
  101. <image class="shrink-0 image_6" src="../../static/home/homeIconWifi.png" />
  102. <text class="font_3">{{ homeFrom.status }}</text>
  103. </view>
  104. <!-- <view class="flex-row items-center space-x-6">-->
  105. <!-- <text class="font_3 text_6">45%</text>-->
  106. <!-- <image class="shrink-0 image_7" src="../../static/home/homeIconPower.png" />-->
  107. <!-- </view>-->
  108. </view>
  109. </view>
  110. <view class="flex-row items-center section_5 space-x-4">
  111. <image class="shrink-0 image_8" src="../../static/home/homeIconChange.png"/>
  112. <text class="font_3">切换</text>
  113. </view>
  114. </view>
  115. <view class="flex-row justify-center self-center home-device-status space-x-8">
  116. <text class="font_4 text_7">当前状态</text>
  117. <text class="font_4">{{ sleepStatus }}</text>
  118. </view>
  119. <!-- <view>-->
  120. <!-- <uni-steps :options="list1" :active="active" />-->
  121. <!-- </view>-->
  122. <!-- <view class="flex-row self-center items-center home-device-setting">-->
  123. <!-- <image-->
  124. <!-- class="shrink-0 image_8"-->
  125. <!-- src="../../static/home/homeIconSet.png"-->
  126. <!-- />-->
  127. <!-- <text>设置目标</text>-->
  128. <!-- </view>-->
  129. </view>
  130. <view class="home-report flex-col group_5 space-y-40">
  131. <view class="flex-col home-header space-y-6">
  132. <view class="flex-row items-center space-x-8">
  133. <text class="font_4 text_8">睡眠报告</text>
  134. <view class="flex-row items-center section_7">
  135. <text class="font_5 text_9">去看看</text>
  136. <image
  137. class="shrink-0 image_9"
  138. src="../../static/home/homeIconGO.png"
  139. />
  140. </view>
  141. </view>
  142. <view class="flex-row items-center space-x-10">
  143. <text class="font_5 text_3 text_10">小U已为您生成最后一份睡眠报告</text>
  144. <text class="font_5 text_3 text_11">2021-08-24</text>
  145. </view>
  146. </view>
  147. </view>
  148. <!-- <view class="flex-col space-y-40 home-data">
  149. <view class="flex-row group_6 equal-division">
  150. <view class="flex-row group_7 space-x-6 home-data-item equal-division-item">
  151. <view class="flex-col shrink-0 self-stretch group_9 space-y-20">
  152. <view class="flex-row items-center space-x-4">
  153. <image
  154. class="shrink-0 image_10"
  155. src="../../static/home/homeIconHeart.png"
  156. />
  157. <text class="font_1">心率</text>
  158. </view>
  159. <text class="self-center font_6">73</text>
  160. </view>
  161. <text class="self-start font_7 text_14">次/分</text>
  162. </view>
  163. <view class="flex-row justify-center group_8 space-x-6 home-data-item equal-division-item">
  164. <view class="flex-col space-y-20">
  165. <view class="flex-row space-x-4">
  166. <image
  167. class="shrink-0 image_4"
  168. src="../../static/home/homeIconBreath.png"
  169. />
  170. <text class="font_1 text_12">呼吸</text>
  171. </view>
  172. <text class="self-center font_6 text_13">24</text>
  173. </view>
  174. <text class="self-start font_7 text_15">次/分</text>
  175. </view>
  176. </view>
  177. </view> -->
  178. <view class="flex-row home-data space-x-6">
  179. <view class="flex-col flex-auto home-data-left">
  180. <view class="flex-row space-x-4 home-data-left-title">
  181. <image
  182. class="shrink-0 image_10"
  183. src="../../static/home/homeIconHeart.png"
  184. />
  185. <text class="font_1 text_14">心率</text>
  186. </view>
  187. <text class="self-start font_5 text_15">{{ pjxl }}</text>
  188. <text class="self-start font_6 text_16">次/分</text>
  189. </view>
  190. <view class="flex-col justify-start shrink-0 relative home-data-chart content">
  191. <view class="echarts-wrap">
  192. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-1" ref="xinlvRefChart" @onInit="onInit1"></mpvue-echarts>
  193. </view>
  194. </view>
  195. </view>
  196. <view class="flex-row home-data space-x-6">
  197. <view class="flex-col flex-auto home-data-left">
  198. <view class="flex-row space-x-4 home-data-left-title">
  199. <image
  200. class="shrink-0 image_10"
  201. src="../../static/home/homeIconBreath.png"
  202. />
  203. <text class="font_1 text_14">呼吸</text>
  204. </view>
  205. <text class="self-start font_5 text_15">{{ pjhx }}</text>
  206. <text class="self-start font_6 text_16">次/分</text>
  207. </view>
  208. <view class="flex-col justify-start shrink-0 relative home-data-chart content">
  209. <view class="echarts-wrap">
  210. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-2" ref="huxiRefChart" @onInit="onInit2"></mpvue-echarts>
  211. </view>
  212. </view>
  213. </view>
  214. <!-- <view class="cu-card article">
  215. <view class="cu-item shadow chartsBgColor">
  216. <view class="title"><view class="text-cut text-lg text-gray">心率 <text class="text-green margin-left">{{ pjxl }} 分钟/次</text></view></view>
  217. <view class="content">
  218. <view class="echarts-wrap">
  219. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-1" ref="xinlvRefChart" @onInit="onInit1"></mpvue-echarts>
  220. </view>
  221. </view>
  222. </view>
  223. </view>
  224. <view class="cu-card article">
  225. <view class="cu-item shadow chartsBgColor">
  226. <view class="title"><view class="text-cut text-lg text-white">呼吸<text class="text-orange margin-left">{{ pjhx }} 分钟/次</text></view></view>
  227. <view class="content">
  228. <view class="echarts-wrap">
  229. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-2" ref="huxiRefChart" @onInit="onInit2"></mpvue-echarts>
  230. </view>
  231. </view>
  232. </view>
  233. </view> -->
  234. <view class="home-btns flex-row self-center">
  235. <view @click="handleShareClick" class="btn-home-btns btn-home-btns1 items-center">
  236. <image class="shrink-0 image_btn" src="../../static/home/homeIconHeart.png" />
  237. <text class="btn-home-text">远程关爱</text>
  238. </view>
  239. <view @click="handleJumpSettings" class="btn-home-btns btn-home-btns2 items-center">
  240. <image class="shrink-0 image_btn" src="../../static/mine/myIconAlert.png" />
  241. <text class="btn-home-text">报警设置</text>
  242. </view>
  243. </view>
  244. <view class="flex-col home-alert space-y-4">
  245. <view class="flex-row items-center space-x-4 home-alert-header">
  246. <image
  247. class="image_10"
  248. src="../../static/home/homeIconHeart.png"
  249. />
  250. <text class="font_1">实时预警</text>
  251. </view>
  252. <view v-if="list_alerts.length === 0" @click="handleAlertSetting" class="flex-row items-center home_blank_alert space-x-16">
  253. <image
  254. class="image_8"
  255. src="../../static/home/homeIconGift.png"
  256. />
  257. <view class="flex-col items-start flex-auto space-y-4">
  258. <text class="font_5">昨晚您的睡眠质量很好</text>
  259. <text class="font_5">暂时没有预警信息</text>
  260. </view>
  261. </view>
  262. <view v-else @click="handleAlertSetting" class="flex-col home-alert-list">
  263. <view class="flex-row justify-between items-center list-item" :key="i" v-for="(item, i) in list_alerts">
  264. <view class="flex-row items-center space-x-6">
  265. <image
  266. class="shrink-0 image_11"
  267. src="../../static/home/homeIconAlert.png"
  268. />
  269. <text class="font_8">{{ formatSosType(item.warn_type) }}</text>
  270. <text class="font_9 text_16">{{ formatSosTime(item.warn_time) }}</text>
  271. </view>
  272. <view class="flex-row items-baseline space-x-4">
  273. <text class="font_10">{{ item.warn_desc }}</text>
  274. </view>
  275. </view>
  276. </view>
  277. </view>
  278. </view>
  279. </view>
  280. <!-- <tab-bar currentPage="home" /> -->
  281. </view>
  282. </template>
  283. <script>
  284. import echarts from '@/static/echarts.min.js'
  285. import mpvueEcharts from '@/components/mpvue-echarts/src/echarts.vue'
  286. import Storage from '@/utils/storage'
  287. import * as API_deviceMemberBind from '@/api/device_member_bind'
  288. export default {
  289. components: {
  290. mpvueEcharts
  291. },
  292. data() {
  293. return {
  294. deviceAdded: false,
  295. list_alerts: [],
  296. active: 4,
  297. list1: [{
  298. title: '昨日就寝 11:24PM'
  299. }, {
  300. title: '就寝目标 11:00PM'
  301. }, {
  302. title: '起床目标 7:00AM'
  303. }, {
  304. title: '今日起床 7:14AM'
  305. }],
  306. chartObj1: null, // 心率图表
  307. chartObj2: null, // 呼吸图表
  308. myData1: [], // 心率数据
  309. myData2: [], // 呼吸数据
  310. myCount1: 0, // 心率x轴数字
  311. myCount2: 0, // 呼吸x轴数字
  312. allXl: 0, // 总心率
  313. pjxl: 0, // 平均心率
  314. allHx: 0, // 总呼吸
  315. pjhx: 0, // 平均呼吸
  316. sleepStatus: '离床',
  317. connecting: false,
  318. connected: false,
  319. mySocketTask: null,
  320. homeFrom: {
  321. nowDevice: '', // 当前设备
  322. status: '离线'
  323. },
  324. deviceList: [], // 设备列表
  325. lastMsgTime: 0, // 最后一次设备消息时间
  326. memberId: 50289 // 先写死
  327. };
  328. },
  329. onLoad() {
  330. this.API_getDeviceList()
  331. },
  332. onUnload() {
  333. this.mySocketTask.onClose(res => {
  334. this.connected = false
  335. clearInterval(this.timer)
  336. })
  337. },
  338. onShow() {
  339. const imei = Storage.getItem('nowChangeDevice')
  340. if (imei) {
  341. this.homeFrom.nowDevice = imei
  342. }
  343. },
  344. methods: {
  345. handleShareClick() {
  346. uni.navigateTo({
  347. url: '/pages/shareUser/shareUser'
  348. })
  349. },
  350. handleJumpSettings() {
  351. uni.navigateTo({
  352. url: '/pages/alertSetting/alertSetting'
  353. })
  354. },
  355. API_getDeviceList() {
  356. const _this = this
  357. API_deviceMemberBind.getDeviceByDtypeAndMemberId({dtype: '睡眠床垫', memberId: this.memberId}).then(res => {
  358. if (res.length === 0) {
  359. _this.deviceAdded = false
  360. } else {
  361. _this.deviceAdded = true
  362. _this.deviceList = res
  363. _this.homeFrom.nowDevice = res[0].imei
  364. Storage.setItem("nowChangeDevice", _this.homeFrom.nowDevice)
  365. Storage.setItem("myBindDevices", res)
  366. _this.init()
  367. }
  368. })
  369. },
  370. init() {
  371. const _this = this
  372. setTimeout(() => {
  373. _this.nowChart1()
  374. _this.nowChart2()
  375. _this.connect()
  376. }, 800)
  377. },
  378. connect() {
  379. let _this = this
  380. if (this.connected || this.connecting) {
  381. uni.showModal({
  382. content: '正在连接或者已经连接,请勿重复连接!',
  383. showCancel: false
  384. });
  385. return false
  386. }
  387. this.connecting = true
  388. // let wsUrl = api.base.replace('http', 'ws')
  389. this.mySocketTask = uni.connectSocket({
  390. url: 'ws://wdkl.natapp1.cc/sleep_report/monitor/' + this.memberId,
  391. success(res) {
  392. // 这里是接口调用成功的回调,不是连接成功的回调,请注意
  393. },
  394. fail(err) {
  395. // 这里是接口调用失败的回调,不是连接失败的回调,请注意
  396. }
  397. })
  398. this.mySocketTask.onOpen(res => {
  399. this.connecting = false
  400. this.connected = true
  401. uni.hideLoading()
  402. let _this = this
  403. this.timer = setInterval(function () { //每隔5秒钟发送一次心跳,避免websocket连接因超时而自动断开
  404. if (Date.parse(new Date()) - _this.lastMsgTime > 5000) { // 5秒没有收到新消息,则判断为离线
  405. _this.homeFrom.status = '离线'
  406. _this.sleepStatus = '离线'
  407. _this.pjxl = '--'
  408. _this.pjhx = '--'
  409. }
  410. _this.mySocketTask.send({data: 'ping'})
  411. }, 30000) // 30秒的心跳包
  412. })
  413. this.mySocketTask.onError(err => {
  414. this.connecting = false
  415. this.connected = false
  416. uni.hideLoading()
  417. uni.showModal({
  418. content: '连接失败,可能是websocket服务不可用,请稍后再试',
  419. showCancel: false
  420. })
  421. console.log('onError', err)
  422. })
  423. this.mySocketTask.onMessage(res => {
  424. let msg = res.data
  425. // console.log('收到消息:', msg)
  426. if (msg.length === 30) {
  427. if (this.homeFrom.nowDevice !== msg.substring(2, 14)) {
  428. return
  429. }
  430. this.homeFrom.status = '在线'
  431. this.lastMsgTime = Date.parse(new Date())
  432. this.getValue1(parseInt(msg.substring(22, 24), 16))
  433. this.getValue2(parseInt(msg.substring(24, 26), 16))
  434. switch (msg.substring(26, 28)) {
  435. case "03":
  436. this.sleepStatus = '在床'
  437. break;
  438. case "04":
  439. this.sleepStatus = '离床'
  440. break;
  441. case "05":
  442. this.sleepStatus = '打鼾'
  443. break;
  444. case "06":
  445. this.sleepStatus = '体动'
  446. break;
  447. default:
  448. break;
  449. }
  450. } else {
  451. const data = JSON.parse(res.data)
  452. console.log('收到消息为:', data)
  453. if (data.sn && this.homeFrom.nowDevice === data.sn) {
  454. this.list_alerts.push(data)
  455. }
  456. }
  457. })
  458. this.mySocketTask.onClose(res => {
  459. this.connected = false
  460. this.msg = false
  461. clearInterval(this.timer)
  462. })
  463. },
  464. nowChart1() {
  465. this.onInit1(this.chartObj1)
  466. let canvas = this.$refs.xinlvRefChart.canvas
  467. echarts.setCanvasCreator(() => canvas)
  468. this.myChart1 = echarts.init(canvas, 'halloween', {
  469. width: this.chartObj1.width,
  470. height: this.chartObj1.height
  471. })
  472. this.options1 = Object.assign(this.getOptions('#FFFFFF', 800), {})
  473. this.options1.series.forEach((item) => {
  474. item.data = this.myData1
  475. })
  476. this.myChart1.setOption(this.options1)
  477. },
  478. nowChart2() {
  479. this.onInit2(this.chartObj2);
  480. let canvas = this.$refs.huxiRefChart.canvas;
  481. echarts.setCanvasCreator(() => canvas);
  482. this.myChart2 = echarts.init(canvas, 'halloween', {
  483. width: this.chartObj2.width,
  484. height: this.chartObj2.height
  485. });
  486. this.options2 = Object.assign(this.getOptions('#06f5d2', 400), {})
  487. this.options2.series.forEach((item) => {
  488. item.data = this.myData2
  489. })
  490. this.myChart2.setOption(this.options2)
  491. },
  492. onInit1(e) {
  493. this.chartObj1 = e
  494. },
  495. onInit2(e) {
  496. this.chartObj2 = e
  497. },
  498. getOptions(color, xMax) {
  499. return {
  500. visualMap: [
  501. {
  502. show: false,
  503. type: 'continuous',
  504. seriesIndex: 0,
  505. min: 0,
  506. max: 300,
  507. },
  508. ],
  509. color: color,
  510. title: {
  511. left: 'left',
  512. // text: title,
  513. },
  514. tooltip: {
  515. trigger: 'axis',
  516. axisPointer: {
  517. animation: false,
  518. },
  519. },
  520. grid: {
  521. top: '15%',
  522. bottom: '10%',
  523. },
  524. xAxis: {
  525. type: 'category',
  526. boundaryGap: [0, '100%'],
  527. show: false, // 不显示x轴
  528. splitLine: {
  529. show: false,
  530. },
  531. triggerEvent: true
  532. },
  533. yAxis: {
  534. type: 'value',
  535. boundaryGap: [0, '100%'],
  536. min: 0,
  537. max: xMax,
  538. // max: 'dataMax', // 取数据在该轴上的最大值作为最大刻度
  539. splitLine: {
  540. show: false, // 是否显示分隔线
  541. },
  542. axisLine: {
  543. show: false, // 是否显示坐标轴轴线
  544. lineStyle:{
  545. color:'#FFFFFF',
  546. width:1, //x轴线的宽度
  547. }
  548. },
  549. },
  550. series: [
  551. {
  552. type: 'line',
  553. showSymbol: false,
  554. hoverAnimation: false,
  555. data: [],
  556. },
  557. ]
  558. }
  559. },
  560. getValue1(value) {
  561. // console.log("心率是", value)
  562. this.pjxl = value
  563. if (this.myData1.length > 60) {
  564. this.myData1.splice(0,5)
  565. }
  566. if (value !== 0) {
  567. for (let i = 0; i < 5; i++) {
  568. this.myCount1 ++;
  569. value = parseInt(Math.random(100) * 500 + 300)
  570. this.myData1.push([this.myCount1, value])
  571. }
  572. } else {
  573. for (let i = 0; i < 5; i++) {
  574. this.myCount1 ++;
  575. value = 410 + parseInt(Math.random() * 50 - 30)
  576. this.myData1.push([this.myCount1, value])
  577. }
  578. }
  579. this.myChart1.setOption(this.options1)
  580. },
  581. getValue2(value) {
  582. // console.log("呼吸值是", value)
  583. this.pjhx = value
  584. if (this.myData2.length > 60) {
  585. this.myData2.splice(0,5)
  586. }
  587. if (value === 0) {
  588. for (let i = 0; i < 5; i++) {
  589. this.myCount2 ++;
  590. value = 220 + parseInt(Math.random() * 10 - 5)
  591. this.myData2.push([this.myCount2, value])
  592. }
  593. } else {
  594. value = parseInt((Math.random(10) * 300 + 100))
  595. for (let i = 0; i < 5; i++) {
  596. this.myCount2 ++;
  597. value += parseInt(Math.random() * 10 - 5)
  598. this.myData2.push([this.myCount2, value])
  599. }
  600. }
  601. this.myChart2.setOption(this.options2)
  602. },
  603. handleAlertSetting() {
  604. uni.navigateTo({
  605. url: "/pages/alertSetting/alertSetting?imei=" + this.homeFrom.nowDevice
  606. });
  607. },
  608. formatSosType(value) {
  609. switch (value) {
  610. case 1:
  611. return '心率过速'
  612. case 2:
  613. return '心率过缓'
  614. case 3:
  615. return '呼吸过速'
  616. case 4:
  617. return '呼吸过缓'
  618. case 5:
  619. return '离床预警'
  620. case 6:
  621. return '一键预警'
  622. case 7:
  623. return '离线预警'
  624. default:
  625. break;
  626. }
  627. },
  628. formatSosTime(value) {
  629. return value.substring(10, value.length - 3)
  630. }
  631. }
  632. };
  633. </script>
  634. <style lang="scss" scoped>
  635. .echarts-wrap {
  636. width: 100%;
  637. height: 80px;
  638. /*padding: 10upx;*/
  639. margin-bottom: 0.3rem
  640. }
  641. .chartsBgColor{
  642. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  643. }
  644. .equal-division {
  645. .equal-division-item {
  646. padding: 0.25rem 0.38rem 0;
  647. flex: 1 1 10.81rem;
  648. }
  649. }
  650. .home_add_devive {
  651. margin-right: 1.25rem;
  652. margin: 1rem;
  653. padding: 3.75rem 0;
  654. background-color: #0233c699;
  655. border-radius: 1rem;
  656. backdrop-filter: blur(0.63rem);
  657. width: 20.94rem;
  658. .image_4 {
  659. margin-left: 6.38rem;
  660. width: 1.5rem;
  661. height: 1.5rem;
  662. }
  663. .text_5 {
  664. color: #ffffff;
  665. font-size: 1.5rem;
  666. font-family: PingFangSC;
  667. line-height: 1.38rem;
  668. }
  669. }
  670. .space-x-10 {
  671. & > view:not(:first-child),
  672. & > text:not(:first-child),
  673. & > image:not(:first-child) {
  674. margin-left: 0.63rem;
  675. }
  676. }
  677. .home_ad {
  678. margin-left: 2.25rem;
  679. background: url(../../static/home/homeBg2.png);
  680. background-repeat: no-repeat;
  681. background-size: contain;
  682. .text_6 {
  683. padding: 0.13rem 0;
  684. color: #ffffff;
  685. font-size: 1rem;
  686. font-family: PingFangSC;
  687. line-height: 0.94rem;
  688. }
  689. .section_4 {
  690. padding: 0.13rem 0.38rem;
  691. background-image: linear-gradient(90deg, #2c25f799 0%, #061599 100%);
  692. border-radius: 0.44rem;
  693. width: 2.88rem;
  694. height: 0.88rem;
  695. .font_2 {
  696. font-size: 0.69rem;
  697. font-family: PingFangSC;
  698. line-height: 0.63rem;
  699. color: #ffffff;
  700. }
  701. .text_7 {
  702. font-size: 0.63rem;
  703. line-height: 0.56rem;
  704. }
  705. .image_5 {
  706. width: 0.19rem;
  707. height: 0.31rem;
  708. }
  709. }
  710. }
  711. .space-x-6 {
  712. & > view:not(:first-child),
  713. & > text:not(:first-child),
  714. & > image:not(:first-child) {
  715. margin-left: 0.38rem;
  716. }
  717. }
  718. .group_5 {
  719. padding-left: 1rem;
  720. padding-right: 1rem;
  721. .font_2 {
  722. font-size: 0.69rem;
  723. font-family: PingFangSC;
  724. line-height: 0.63rem;
  725. color: #ffffff;
  726. }
  727. .text_8 {
  728. font-size: 0.63rem;
  729. line-height: 0.59rem;
  730. opacity: 0.6;
  731. }
  732. .home_blank_heart {
  733. margin-top: 1rem;
  734. opacity: 1;
  735. border-radius: 16px;
  736. background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
  737. backdrop-filter: blur(20px);
  738. padding:1rem 0rem 2rem 1rem;
  739. .group_7 {
  740. padding-bottom: 1.13rem;
  741. .image_6 {
  742. width: 1.13rem;
  743. height: 0.88rem;
  744. }
  745. .text_9 {
  746. line-height: 1.03rem;
  747. }
  748. }
  749. .view {
  750. margin-right: -20.13rem;
  751. }
  752. .text_10 {
  753. margin-right: 18.75rem;
  754. margin-top: 1rem;
  755. }
  756. }
  757. .home_blank_breath {
  758. margin-top: 1rem;
  759. opacity: 1;
  760. border-radius: 16px;
  761. background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
  762. backdrop-filter: blur(20px);
  763. padding:1rem 0rem 2rem 1rem;
  764. .group_10 {
  765. padding-bottom: 1.25rem;
  766. .image_7 {
  767. width: 1.13rem;
  768. height: 1.06rem;
  769. }
  770. .text_12 {
  771. line-height: 1rem;
  772. }
  773. }
  774. .view_2 {
  775. margin-right: -20rem;
  776. }
  777. .text_13 {
  778. margin-right: 18.63rem;
  779. margin-top: 1rem;
  780. }
  781. }
  782. .space-x-4 {
  783. & > view:not(:first-child),
  784. & > text:not(:first-child),
  785. & > image:not(:first-child) {
  786. margin-left: 0.25rem;
  787. }
  788. }
  789. .font_1 {
  790. font-size: 1.13rem;
  791. font-family: PingFangSC;
  792. line-height: 1.06rem;
  793. color: #ffffff;
  794. }
  795. .section_5 {
  796. background-color: #ffffff1a;
  797. width: 15.94rem;
  798. height: 0.063rem;
  799. }
  800. .font_3 {
  801. font-size: 2.5rem;
  802. font-family: PingFangSC;
  803. line-height: 0.19rem;
  804. color: #ffffff;
  805. }
  806. .group_8 {
  807. margin-top: 1.38rem;
  808. padding-left: 0.63rem;
  809. .font_4 {
  810. font-size: 0.69rem;
  811. font-family: PingFangSC;
  812. line-height: 0.63rem;
  813. color: #ffffff80;
  814. }
  815. .text_11 {
  816. font-size: 0.75rem;
  817. line-height: 0.69rem;
  818. }
  819. }
  820. }
  821. .home_blank_alert {
  822. margin: 1rem 1.25rem 0;
  823. padding: 0.94rem;
  824. background-color: #02299ecc;
  825. border-radius: 1rem;
  826. .image_8 {
  827. width: 7.06rem;
  828. height: 4.94rem;
  829. }
  830. .space-y-4 {
  831. & > view:not(:first-child),
  832. & > text:not(:first-child),
  833. & > image:not(:first-child) {
  834. margin-top: 0.25rem;
  835. }
  836. .font_5 {
  837. font-size: 0.88rem;
  838. font-family: PingFangSC;
  839. line-height: 1.06rem;
  840. color: #167df2;
  841. }
  842. }
  843. }
  844. .space-x-16 {
  845. & > view:not(:first-child),
  846. & > text:not(:first-child),
  847. & > image:not(:first-child) {
  848. margin-left: 1rem;
  849. }
  850. }
  851. .container-bg {
  852. position: fixed;
  853. left: -130px;
  854. top: -130px;
  855. width: 480px;
  856. height: 344px;
  857. opacity: 1;
  858. overflow: hidden;
  859. border-radius: 63px;
  860. -webkit-transform: rotate(-315deg);
  861. transform: rotate(-315deg);
  862. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  863. }
  864. .home-container {
  865. padding-bottom: 2rem;
  866. background-color: #000000;
  867. width: 100%;
  868. overflow-y: auto;
  869. overflow-x: hidden;
  870. height: 100%;
  871. .home-module {
  872. padding: 1.75rem 0 3.38rem;
  873. overflow-y: auto;
  874. z-index: 100;
  875. .home-header {
  876. padding: 0 1.25rem;
  877. .home-header-title {
  878. color: #ffffff;
  879. font-size: 1.25rem;
  880. font-family: PingFangSC;
  881. line-height: 1.16rem;
  882. }
  883. .text_8 {
  884. color: #ffffff;
  885. opacity: 1;
  886. }
  887. .text_3 {
  888. opacity: 0.6;
  889. }
  890. .home-header-subtitle {
  891. line-height: 0.72rem;
  892. }
  893. .space-x-10 {
  894. & > view:not(:first-child),
  895. & > text:not(:first-child),
  896. & > image:not(:first-child) {
  897. margin-left: 0.63rem;
  898. }
  899. .text_10 {
  900. line-height: 0.59rem;
  901. }
  902. .text_11 {
  903. line-height: 0.47rem;
  904. }
  905. }
  906. }
  907. .space-y-10 {
  908. & > view:not(:first-child),
  909. & > text:not(:first-child),
  910. & > image:not(:first-child) {
  911. margin-top: 0.63rem;
  912. }
  913. }
  914. .home-device {
  915. margin: 1rem 1.25rem;
  916. padding-bottom: 2rem;
  917. background-color: #0233c699;
  918. border-radius: 1rem;
  919. backdrop-filter: blur(0.63rem);
  920. .home-device-setting {
  921. width: 70px;
  922. height: 20px;
  923. opacity: 1;
  924. border-radius: 7px;
  925. background: linear-gradient(90deg, rgba(255, 35, 247, 1) 0%, rgba(91, 30, 154, 1) 100%);
  926. .image_8 {
  927. width: 10px;
  928. height: 10px;
  929. }
  930. font-size: 10px;
  931. font-weight: 400;
  932. line-height: 10px;
  933. color: rgba(255, 255, 255, 1);
  934. padding: 0.3rem;
  935. }
  936. .home-device-header {
  937. background-color: #ffffff33;
  938. border-radius: 1rem 1rem 0px 0px;
  939. .equal-division {
  940. padding: 0 1rem;
  941. .equal-division-item {
  942. padding: 0.38rem 0;
  943. .text_5 {
  944. opacity: 0.5;
  945. }
  946. }
  947. .space-x-14 {
  948. & > view:not(:first-child),
  949. & > text:not(:first-child),
  950. & > image:not(:first-child) {
  951. margin-left: 0.88rem;
  952. }
  953. }
  954. }
  955. .section_5 {
  956. padding: 0.38rem 0.5rem;
  957. background-image: linear-gradient(90deg, #2c25f799 0%, #061599 100%);
  958. border-radius: 0px 1rem 0px 0px;
  959. height: 1.5rem;
  960. .image_8 {
  961. width: 0.75rem;
  962. height: 0.75rem;
  963. }
  964. }
  965. }
  966. .home-device-status {
  967. padding: 0.25rem 0 0.25rem 0.25rem;
  968. background-color: #ffffff33;
  969. border-radius: 0.75rem;
  970. width: 7.88rem;
  971. .text_7 {
  972. opacity: 0.4;
  973. }
  974. }
  975. }
  976. .space-y-15 {
  977. & > view:not(:first-child),
  978. & > text:not(:first-child),
  979. & > image:not(:first-child) {
  980. margin-top: 0.94rem;
  981. }
  982. }
  983. .font_3 {
  984. font-size: 0.75rem;
  985. font-family: PingFangSC;
  986. line-height: 0.69rem;
  987. color: #ffffff;
  988. }
  989. .home-report {
  990. margin: 0 1.25rem;
  991. padding: 1rem 0;
  992. background-image: url(../../static/home/homeReportBg.png);
  993. background-size: contain;
  994. background-repeat: no-repeat;
  995. .space-y-6 {
  996. & > view:not(:first-child),
  997. & > text:not(:first-child),
  998. & > image:not(:first-child) {
  999. margin-top: 0.38rem;
  1000. }
  1001. }
  1002. }
  1003. .home-ad {
  1004. margin: 0 1.25rem;
  1005. padding: 1rem 0;
  1006. background-image: url(../../static/home/homeBg2.png);
  1007. background-size: contain;
  1008. background-repeat: no-repeat;
  1009. .space-y-6 {
  1010. & > view:not(:first-child),
  1011. & > text:not(:first-child),
  1012. & > image:not(:first-child) {
  1013. margin-top: 0.38rem;
  1014. }
  1015. }
  1016. }
  1017. .home-data {
  1018. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  1019. margin: 0rem 1.25rem;
  1020. padding: 1rem 0rem;
  1021. border-radius: 1rem;
  1022. padding: 1rem;
  1023. margin-top: 1rem;
  1024. .home-data-item {
  1025. padding: 1rem 0rem;
  1026. margin: 0 0.3rem;
  1027. opacity: 1;
  1028. border-radius: 16px;
  1029. background: linear-gradient(180deg, rgba(52, 26, 75, 0.65) 0%, rgba(22, 125, 242, 1) 100%);
  1030. backdrop-filter: blur(20px);
  1031. }
  1032. }
  1033. .group_6 {
  1034. overflow-x: hidden;
  1035. width: 100%;
  1036. .group_7 {
  1037. overflow-x: hidden;
  1038. width: 10rem;
  1039. .group_9 {
  1040. margin-left: 2.25rem;
  1041. }
  1042. .text_14 {
  1043. margin-top: 3.5rem;
  1044. }
  1045. }
  1046. .group_8 {
  1047. width: 10rem;
  1048. .text_15 {
  1049. margin-top: 3.63rem;
  1050. }
  1051. }
  1052. .font_6 {
  1053. font-size: 3rem;
  1054. font-family: PingFangSC;
  1055. line-height: 2.19rem;
  1056. color: #ffffff;
  1057. }
  1058. .font_7 {
  1059. font-size: 0.75rem;
  1060. font-family: PingFangSC;
  1061. line-height: 0.69rem;
  1062. color: #ffffff80;
  1063. }
  1064. }
  1065. .space-y-40 {
  1066. & > view:not(:first-child),
  1067. & > text:not(:first-child),
  1068. & > image:not(:first-child) {
  1069. margin-top: 2.5rem;
  1070. }
  1071. }
  1072. .space-x-8 {
  1073. & > view:not(:first-child),
  1074. & > text:not(:first-child),
  1075. & > image:not(:first-child) {
  1076. margin-left: 0.5rem;
  1077. }
  1078. .text_8 {
  1079. padding: 0.13rem 0;
  1080. }
  1081. .section_7 {
  1082. padding: 0.13rem 0.38rem;
  1083. background-image: linear-gradient(90deg, #ff23f7 0%, #5b1e9a 100%);
  1084. border-radius: 0.44rem;
  1085. height: 0.88rem;
  1086. .text_9 {
  1087. line-height: 0.56rem;
  1088. }
  1089. .image_9 {
  1090. width: 0.19rem;
  1091. height: 0.31rem;
  1092. }
  1093. }
  1094. }
  1095. .font_4 {
  1096. font-size: 1rem;
  1097. font-family: PingFangSC;
  1098. line-height: 0.94rem;
  1099. color: #ffffff;
  1100. }
  1101. .font_5 {
  1102. font-size: 0.63rem;
  1103. font-family: PingFangSC;
  1104. color: #ffffff;
  1105. }
  1106. .space-x-6 {
  1107. & > view:not(:first-child),
  1108. & > text:not(:first-child),
  1109. & > image:not(:first-child) {
  1110. margin-left: 0.38rem;
  1111. }
  1112. .text_6 {
  1113. line-height: 0.56rem;
  1114. }
  1115. .image_7 {
  1116. width: 1.31rem;
  1117. height: 0.69rem;
  1118. }
  1119. .image_11 {
  1120. width: 1.13rem;
  1121. height: 0.94rem;
  1122. }
  1123. .font_9 {
  1124. font-size: 0.88rem;
  1125. font-family: PingFangSC;
  1126. line-height: 0.69rem;
  1127. color: #ced5dc;
  1128. }
  1129. .text_16 {
  1130. line-height: 0.63rem;
  1131. }
  1132. }
  1133. .space-x-4 {
  1134. & > view:not(:first-child),
  1135. & > text:not(:first-child),
  1136. & > image:not(:first-child) {
  1137. margin-left: 0.25rem;
  1138. }
  1139. .image_6 {
  1140. width: 0.94rem;
  1141. height: 0.75rem;
  1142. }
  1143. .image_10 {
  1144. width: 1.13rem;
  1145. height: 0.88rem;
  1146. }
  1147. .font_1 {
  1148. font-size: 1.13rem;
  1149. font-family: PingFangSC;
  1150. line-height: 1.03rem;
  1151. color: #ffffff;
  1152. }
  1153. .image_4 {
  1154. width: 1.13rem;
  1155. height: 1.06rem;
  1156. }
  1157. .text_12 {
  1158. line-height: 1rem;
  1159. }
  1160. .font_10 {
  1161. font-size: 1.13rem;
  1162. font-family: PingFangSC;
  1163. line-height: 0.81rem;
  1164. color: #ff465a;
  1165. }
  1166. }
  1167. .home-alert {
  1168. margin: 0rem 1.25rem 0 1.25rem;
  1169. padding: 1rem 0.88rem 0.13rem;
  1170. background-color: #0233c6cc;
  1171. border-radius: 1rem;
  1172. .home-alert-header {
  1173. }
  1174. .home-alert-list {
  1175. .list-item {
  1176. padding: 0.88rem 0;
  1177. border-bottom: solid 0.063rem #ffffff1a;
  1178. }
  1179. }
  1180. }
  1181. .space-y-4 {
  1182. & > view:not(:first-child),
  1183. & > text:not(:first-child),
  1184. & > image:not(:first-child) {
  1185. margin-top: 0.25rem;
  1186. }
  1187. }
  1188. .font_8 {
  1189. font-size: 0.88rem;
  1190. font-family: PingFangSC;
  1191. line-height: 0.81rem;
  1192. color: #ffffff;
  1193. }
  1194. }
  1195. .space-y-20 {
  1196. & > view:not(:first-child),
  1197. & > text:not(:first-child),
  1198. & > image:not(:first-child) {
  1199. margin-top: 1.25rem;
  1200. }
  1201. .text_13 {
  1202. line-height: 2.16rem;
  1203. }
  1204. }
  1205. }
  1206. .home-data {
  1207. margin-top: 3.5rem;
  1208. overflow-x: hidden;
  1209. .home-data-left {
  1210. .space-x-4 {
  1211. & > view:not(:first-child),
  1212. & > text:not(:first-child),
  1213. & > image:not(:first-child) {
  1214. margin-left: 0.25rem;
  1215. }
  1216. .image_10 {
  1217. width: 1.13rem;
  1218. height: 1.06rem;
  1219. }
  1220. .font_1 {
  1221. font-size: 1.13rem;
  1222. font-family: PingFangSC;
  1223. line-height: 1.03rem;
  1224. color: #ffffff;
  1225. }
  1226. .text_14 {
  1227. line-height: 1rem;
  1228. }
  1229. }
  1230. .home-data-left-title {
  1231. }
  1232. .font_5 {
  1233. font-size: 2.5rem;
  1234. font-family: PingFangSC;
  1235. line-height: 1.81rem;
  1236. color: #ffffff;
  1237. }
  1238. .text_15 {
  1239. margin-top: 1.25rem;
  1240. }
  1241. .font_6 {
  1242. font-size: 0.75rem;
  1243. font-family: PingFangSC;
  1244. line-height: 0.69rem;
  1245. color: #ffffff80;
  1246. }
  1247. .text_16 {
  1248. margin-top: 0.75rem;
  1249. }
  1250. }
  1251. .home-data-chart {
  1252. overflow-x: hidden;
  1253. width: 17.19rem;
  1254. .group_10 {
  1255. padding-left: 2.06rem;
  1256. padding-bottom: 2.25rem;
  1257. overflow-x: hidden;
  1258. .image_11 {
  1259. width: 8.75rem;
  1260. height: 3.44rem;
  1261. }
  1262. .image_12 {
  1263. width: 7.06rem;
  1264. height: 3.38rem;
  1265. }
  1266. .image_13 {
  1267. width: 10rem;
  1268. height: 3.44rem;
  1269. }
  1270. .pos_8 {
  1271. position: absolute;
  1272. left: 0;
  1273. bottom: 0.063rem;
  1274. }
  1275. .image_14 {
  1276. width: 6.06rem;
  1277. height: 3.44rem;
  1278. }
  1279. .pos_10 {
  1280. position: absolute;
  1281. right: 1.25rem;
  1282. bottom: 0;
  1283. }
  1284. .pos_9 {
  1285. position: absolute;
  1286. left: 0;
  1287. top: 2.31rem;
  1288. }
  1289. }
  1290. .section_9 {
  1291. background-color: #ffffff1a;
  1292. width: 15.94rem;
  1293. height: 0.063rem;
  1294. }
  1295. .pos_11 {
  1296. position: absolute;
  1297. left: 0;
  1298. top: 5.5rem;
  1299. }
  1300. }
  1301. }
  1302. .space-x-6 {
  1303. & > view:not(:first-child),
  1304. & > text:not(:first-child),
  1305. & > image:not(:first-child) {
  1306. margin-left: 0.38rem;
  1307. }
  1308. }
  1309. .home-btns {
  1310. .btn-home-btns2 {
  1311. background: linear-gradient(90deg, rgba(5, 96, 232, 1) 0%, rgba(100, 158, 245, 1) 100%);
  1312. }
  1313. .btn-home-btns1 {
  1314. background: linear-gradient(90deg, rgba(44, 37, 247, 0.6) 0%, rgba(6, 21, 153, 1) 100%);
  1315. }
  1316. .btn-home-btns {
  1317. border-radius: 1.3rem;
  1318. width: 8rem;
  1319. height: 2.6rem;
  1320. margin: 1rem 0.5rem;
  1321. text-align: center;
  1322. font-size: 1.1rem;
  1323. font-weight: 500;
  1324. letter-spacing: 0px;
  1325. line-height: 2.6rem;
  1326. .image_btn {
  1327. width: 1.4rem;
  1328. height: 1.4rem;
  1329. vertical-align: middle;
  1330. margin-right: 0.2rem;
  1331. }
  1332. .btn-home-text {
  1333. color: #ffffff;
  1334. }
  1335. }
  1336. }
  1337. </style>