home.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791
  1. <template>
  2. <view class="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 page">
  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 justify-center items-center home_add_devive space-x-10" @click="addBindDevice">
  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智能UU睡眠仪</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="home-btns flex-row self-center">
  74. <view @click="handleShareClick" class="btn-home-btns btn-home-btns1 items-center">
  75. <image class="shrink-0 image_btn" src="@/static/home/homeIconHeart.png" />
  76. <text class="btn-home-text">远程关爱</text>
  77. </view>
  78. </view>
  79. <view class="flex-row items-center home_blank_alert space-x-16">
  80. <image
  81. class="image_8"
  82. src="@/static/home/homeIconGift.png"
  83. />
  84. <view class="flex-col items-start flex-auto space-y-4">
  85. <text class="font_5">昨晚您的睡眠质量很好</text>
  86. <text class="font_5">暂时没有预警信息</text>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- device added -->
  92. <view v-if="deviceAdded" class="flex-col">
  93. <view class="flex-col items-start home-header space-y-10">
  94. <text class="home-header-title">欢迎回来!</text>
  95. <text class="font_3 text_3 home-header-subtitle">我是小U,您的健康智慧管家。</text>
  96. </view>
  97. <!-- home device -->
  98. <view class="flex-col home-device space-y-15">
  99. <view class="flex-row home-device-header">
  100. <view class="flex-row justify-between flex-auto equal-division">
  101. <view class="flex-row equal-division-item space-x-4">
  102. <text class="font_3 text_5">当前设备</text>
  103. <text class="font_3">{{ homeFrom.nowDevice }}</text>
  104. </view>
  105. <view class="flex-row equal-division-item space-x-14">
  106. <view class="flex-row space-x-4 margin-left-xl">
  107. <image class="shrink-0 image_6" src="@/static/home/homeIconWifi.png" />
  108. <text class="font_3">{{ homeFrom.status }}</text>
  109. </view>
  110. <!-- <view class="flex-row items-center space-x-6">-->
  111. <!-- <text class="font_3 text_6">45%</text>-->
  112. <!-- <image class="shrink-0 image_7" src="@/static/home/homeIconPower.png" />-->
  113. <!-- </view>-->
  114. </view>
  115. </view>
  116. <view class="flex-row items-center section_5 space-x-4" @click="modalName = true">
  117. <image class="shrink-0 image_8" src="@/static/home/homeIconChange.png"/>
  118. <text class="font_3">切换</text>
  119. </view>
  120. </view>
  121. <view class="flex-row justify-center self-center home-device-status space-x-8">
  122. <text class="font_4 text_7">当前状态</text>
  123. <text class="font_4">{{ sleepStatus }}</text>
  124. </view>
  125. <!-- <view>-->
  126. <!--&lt;!&ndash; <view class="cu-steps">&ndash;&gt;-->
  127. <!--&lt;!&ndash; <view class="cu-item" :class="index>basics?'':'text-orange'" v-for="(item, index) in list1" :key="index">&ndash;&gt;-->
  128. <!--&lt;!&ndash; <text :class="index>basics ?'cuIcon-title':'cuIcon-radioboxfill'"></text> {{item.name}}&ndash;&gt;-->
  129. <!--&lt;!&ndash; </view>&ndash;&gt;-->
  130. <!--&lt;!&ndash; </view>&ndash;&gt;-->
  131. <!-- <uni-steps :options="list1" :active="active" />-->
  132. <!-- </view>-->
  133. <!-- <view class="flex-row self-center items-center home-device-setting">-->
  134. <!-- <image-->
  135. <!-- class="shrink-0 image_8"-->
  136. <!-- src="@/static/home/homeIconSet.png"-->
  137. <!-- />-->
  138. <!-- <text>设置目标</text>-->
  139. <!-- </view>-->
  140. </view>
  141. <!-- <view class="home-report flex-col group_5 space-y-40">-->
  142. <!-- <view class="flex-col home-header space-y-6">-->
  143. <!-- <view class="flex-row items-center space-x-8">-->
  144. <!-- <text class="font_4 text_8">睡眠报告</text>-->
  145. <!-- <view class="flex-row items-center section_7">-->
  146. <!-- <text class="font_5 text_9">去看看</text>-->
  147. <!-- <image-->
  148. <!-- class="shrink-0 image_9"-->
  149. <!-- src="@/static/home/homeIconGO.png"-->
  150. <!-- />-->
  151. <!-- </view>-->
  152. <!-- </view>-->
  153. <!-- <view class="flex-row items-center space-x-10">-->
  154. <!-- <text class="font_5 text_3 text_10">小U已为您生成最后一份睡眠报告</text>-->
  155. <!-- <text class="font_5 text_3 text_11">2021-08-24</text>-->
  156. <!-- </view>-->
  157. <!-- </view>-->
  158. <!-- </view>-->
  159. <view class="flex-row home-data space-x-6">
  160. <view class="flex-col flex-auto home-data-left">
  161. <view class="flex-row space-x-4 home-data-left-title">
  162. <image
  163. class="shrink-0 image_10"
  164. src="@/static/home/homeIconHeart.png"
  165. />
  166. <view class="font_1 text_14">心率</view>
  167. </view>
  168. <text class="self-start font_5 text_15">{{ pjxl }}</text>
  169. <text class="self-start font_6 text_16">次/分</text>
  170. </view>
  171. <view class="flex-col flex-auto justify-start shrink-0 relative home-data-chart content">
  172. <view class="echarts-wrap" :hidden="modalName">
  173. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-1" ref="xinlvRefChart" @onInit="onInit1"></mpvue-echarts>
  174. </view>
  175. </view>
  176. </view>
  177. <view class="flex-row home-data space-x-6">
  178. <view class="flex-col flex-auto home-data-left">
  179. <view class="flex-row space-x-4 home-data-left-title">
  180. <image
  181. class="shrink-0 image_10"
  182. src="@/static/home/homeIconBreath.png"
  183. />
  184. <text class="font_1 text_14">呼吸</text>
  185. </view>
  186. <text class="self-start font_5 text_15">{{ pjhx }}</text>
  187. <text class="self-start font_6 text_16">次/分</text>
  188. </view>
  189. <view class="flex-col flex-auto justify-start shrink-0 relative home-data-chart content">
  190. <view class="echarts-wrap" :hidden="modalName">
  191. <mpvue-echarts class="ec-canvas" canvasId="canvasChart-2" ref="huxiRefChart" @onInit="onInit2"></mpvue-echarts>
  192. </view>
  193. </view>
  194. </view>
  195. <view class="home-btns flex-row self-center">
  196. <view @click="handleShareClick" class="btn-home-btns btn-home-btns1 items-center">
  197. <image class="shrink-0 image_btn" src="@/static/home/homeIconHeart.png" />
  198. <text class="btn-home-text">远程关爱</text>
  199. </view>
  200. <view @click="handleAlertSetting" class="btn-home-btns btn-home-btns2 items-center">
  201. <image class="shrink-0 image_btn" src="@/static/mine/myIconAlert.png" />
  202. <text class="btn-home-text">报警设置</text>
  203. </view>
  204. </view>
  205. <view class="flex-col home-alert space-y-4">
  206. <view class="flex-row items-center space-x-4 home-alert-header">
  207. <image
  208. class="image_10"
  209. src="@/static/home/homeIconHeart.png"
  210. />
  211. <text class="font_1">实时预警</text>
  212. </view>
  213. <view v-if="list_alerts.length === 0" class="flex-row items-center home_blank_alert space-x-16" @click="goWarnLogPage">
  214. <image class="image_8" src="@/static/home/homeIconGift.png"/>
  215. <view class="flex-col items-start flex-auto space-y-4">
  216. <text class="font_5">昨晚您的睡眠质量很好</text>
  217. <text class="font_5">暂时没有预警信息</text>
  218. </view>
  219. </view>
  220. <view v-else class="flex-col home-alert-list">
  221. <view class="flex-row justify-between items-center list-item" :key="i" v-for="(item, i) in list_alerts" @click="goWarnLogPage">
  222. <view class="flex-row items-center space-x-6">
  223. <image
  224. class="shrink-0 image_11"
  225. src="@/static/home/homeIconAlert.png"
  226. />
  227. <text class="font_8">{{ formatSosType(item.warn_type) }}</text>
  228. <text class="font_9 text_16">{{ formatSosTime(item.warn_time) }}</text>
  229. </view>
  230. <view class="flex-row items-baseline space-x-4">
  231. <text class="font_10">{{ item.warn_desc }}</text>
  232. </view>
  233. </view>
  234. </view>
  235. </view>
  236. </view>
  237. </view>
  238. <view class="cu-modal" :class="bindShow?'show':''">
  239. <view class="cu-dialog">
  240. <view class="cu-bar bg-white justify-end">
  241. <view style="color: black" class="content">设备绑定</view>
  242. <view class="action" @tap="bindShow=false">
  243. <text class="cuIcon-close text-red"></text>
  244. </view>
  245. </view>
  246. <view class="">
  247. <form>
  248. <view class="cu-form-group solid-bottom">
  249. <view class="title">扫描二维码</view>
  250. <input type="text" v-model="bindSn" placeholder="输入或扫描IMEI" class="text-left"/>
  251. <text class="cuIcon-scan text-xxl text-green" style="font-size: 50rpx;"
  252. @click="scan"></text>
  253. </view>
  254. </form>
  255. </view>
  256. <view class="cu-bar bg-white justify-end">
  257. <!-- <view class="action">-->
  258. <!-- <button class="cu-btn bg-cyan" @tap="goBuy">去购买</button>-->
  259. <!-- </view>-->
  260. <view class="action">
  261. <button class="cu-btn bg-green margin-left" @tap="bindDevice">确定</button>
  262. </view>
  263. </view>
  264. </view>
  265. </view>
  266. <view style="z-index: 9999999" class="cu-modal" :class="modalName ?'show':''" @tap="hideModal">
  267. <view style="background-image: linear-gradient(45deg, #4d9efa, #156fce);z-index: 9999999" class="cu-dialog" @tap.stop="">
  268. <view class="cu-bar justify-end">
  269. <view class="content">设备切换</view>
  270. </view>
  271. <radio-group class="block" @change="RadioChange">
  272. <view class="cu-list menu text-left">
  273. <view style="background-image: linear-gradient(45deg, #4d9efa, #156fce)" class="cu-item" v-for="(item, index) in deviceList" :key="index">
  274. <label class="flex justify-between align-center flex-sub">
  275. <view class="flex-sub text-white">{{ item.imei }}</view>
  276. <radio class="round" :class="homeFrom.nowDevice===item.imei?'checked':''" :checked="homeFrom.nowDevice === item.imei"
  277. :value="item.imei"></radio>
  278. </label>
  279. </view>
  280. </view>
  281. </radio-group>
  282. </view>
  283. </view>
  284. <!-- <tab-bar currentPage="home" /> -->
  285. </view>
  286. </template>
  287. <script>
  288. import echarts from '@/static/echarts.min.js'
  289. import mpvueEcharts from '@/components/mpvue-echarts/src/echarts.vue'
  290. import { API } from '@/utils/request'
  291. import Storage from '@/utils/storage'
  292. import * as Foundation from '@/ui-utils/Foundation'
  293. import * as API_deviceMemberBind from '@/api/device_member_bind'
  294. import * as API_HOME from '@/api/home'
  295. import { addByShare } from '@/api/vitalSignsLook'
  296. import * as deviceDtypeEnum from '@/utils/enum/DeviceDTypeEnum'
  297. export default {
  298. components: {
  299. mpvueEcharts
  300. },
  301. data() {
  302. return {
  303. deviceAdded: false,
  304. list_alerts: [],
  305. active: 4,
  306. list1: [{
  307. title: '昨日就寝 11:24PM'
  308. }, {
  309. title: '就寝目标 11:00PM'
  310. }, {
  311. title: '起床目标 7:00AM'
  312. }, {
  313. title: '今日起床 7:14AM'
  314. }],
  315. chartObj1: null, // 心率图表
  316. chartObj2: null, // 呼吸图表
  317. myData1: [], // 心率数据
  318. myData2: [], // 呼吸数据
  319. myCount1: 0, // 心率x轴数字
  320. myCount2: 0, // 呼吸x轴数字
  321. pjxl: 0, // 平均心率
  322. pjhx: 0, // 平均呼吸
  323. sleepStatus: '离床',
  324. connecting: false,
  325. connected: false,
  326. mySocketTask: null,
  327. homeFrom: {
  328. nowDevice: '', // 当前设备
  329. status: '离线'
  330. },
  331. deviceList: [], // 设备列表
  332. lastMsgTime: 0, // 最后一次设备消息时间
  333. memberId: '',
  334. bindSn: '',
  335. bindShow: false,
  336. modalName: false,
  337. activeBreak: false,
  338. isConnect: false,
  339. mySns: '',
  340. closed: false
  341. };
  342. },
  343. // onLoad() {
  344. // this.memberId = 50289
  345. // this.API_getDeviceList()
  346. // },
  347. onLoad() {
  348. const memberId = Storage.getItem('uid')
  349. if (memberId) {
  350. this.memberId = memberId
  351. console.log('this.memberId===', this.memberId)
  352. this.API_getDeviceList()
  353. const _this = this
  354. setTimeout(() => {
  355. console.log('_this.connected====', _this.connected)
  356. if (!_this.connected) {
  357. console.log('我要登录过...')
  358. _this.API_getDeviceList()
  359. }
  360. // 解析二维码的内容
  361. _this.handleQRCodeMsg()
  362. // 获取提醒数据
  363. _this.GET_Reminds()
  364. }, 1500)
  365. } else {
  366. this.checkHasLogin()
  367. const _this = this
  368. let initTimer = setInterval(function () {
  369. const memberId = Storage.getItem('uid')
  370. if (memberId) {
  371. _this.memberId = memberId
  372. clearInterval(initTimer)
  373. _this.API_getDeviceList()
  374. // 解析二维码的内容
  375. _this.handleQRCodeMsg()
  376. // 获取提醒数据
  377. _this.GET_Reminds()
  378. }
  379. }, 500)
  380. }
  381. },
  382. beforeDestroy() {
  383. this.activeBreak = true
  384. this.closeWebsocket()
  385. },
  386. onShow() {
  387. const imei = Storage.getItem('nowChangeDevice')
  388. if (imei) {
  389. this.homeFrom.nowDevice = imei
  390. this.deviceAdded = true
  391. } else {
  392. this.deviceAdded = false
  393. }
  394. if (this.memberId) {
  395. this.API_getDeviceList()
  396. if (this.connected) {
  397. console.log('发送确认在线消息...')
  398. this.mySocketTask.send({data: '1'})
  399. const _this = this
  400. this.isConnect = false
  401. setTimeout(() => {
  402. if (_this.isConnect === false) {
  403. console.log('没有正常返回...')
  404. if (_this.myChart1) {
  405. _this.connect()
  406. } else {
  407. _this.init()
  408. }
  409. }
  410. }, 1000)
  411. } else {
  412. if (this.deviceList.length > 0) {
  413. console.log('重新连接...')
  414. this.connect()
  415. }
  416. }
  417. }
  418. },
  419. methods: {
  420. API_getDeviceList() {
  421. const _this = this
  422. API_deviceMemberBind.getDeviceByDtypeAndMemberId({dtype: deviceDtypeEnum.DEVICE_TYPE.SMCD, memberId: this.memberId}).then(res => {
  423. if (res) {
  424. _this.deviceList = res
  425. if (res.length === 0) {
  426. _this.deviceAdded = false
  427. if (this.homeFrom.nowDevice) {
  428. _this.homeFrom.nowDevice = ''
  429. _this.sendSns()
  430. }
  431. Storage.removeItem("nowChangeDevice")
  432. Storage.removeItem("myBindDevices")
  433. } else {
  434. _this.deviceAdded = true
  435. _this.sendSns()
  436. let nowDevice = Storage.getItem("nowChangeDevice")
  437. if (!nowDevice) {
  438. Storage.setItem("nowChangeDevice", res[0].imei)
  439. _this.homeFrom.nowDevice = res[0].imei
  440. } else {
  441. _this.homeFrom.nowDevice = nowDevice
  442. }
  443. Storage.setItem("myBindDevices", res)
  444. _this.init()
  445. }
  446. } else {
  447. console.log('获取床垫错误...')
  448. }
  449. })
  450. },
  451. init() {
  452. const _this = this
  453. setTimeout(() => {
  454. _this.nowChart1()
  455. _this.nowChart2()
  456. _this.connect()
  457. }, 800)
  458. },
  459. connect() {
  460. let _this = this
  461. if (this.connected || this.connecting) {
  462. console.log('webSocket已连接或者正在连接')
  463. return
  464. }
  465. this.connecting = true
  466. let wsUrl = API.base.replace('http', 'ws')
  467. const time = Math.round(new Date()) + "" + Math.round(Math.random()*100000)
  468. this.mySocketTask = uni.connectSocket({
  469. // url: wsUrl + '/sleep_report/monitor/' + time + '/' + this.memberId,
  470. url: wsUrl + '/sleep_report/monitor/' + time ,
  471. success(res) {
  472. // 这里是接口调用成功的回调,不是连接成功的回调,请注意
  473. },
  474. fail(err) {
  475. // 这里是接口调用失败的回调,不是连接失败的回调,请注意
  476. }
  477. })
  478. this.mySocketTask.onOpen(res => {
  479. this.connecting = false
  480. this.connected = true
  481. uni.hideLoading()
  482. let _this = this
  483. this.timer = setInterval(function () { //每隔5秒钟发送一次心跳,避免websocket连接因超时而自动断开
  484. if (Date.parse(new Date()) - _this.lastMsgTime > 5000) { // 5秒没有收到新消息,则判断为离线
  485. _this.homeFrom.status = '离线'
  486. _this.sleepStatus = '离线'
  487. _this.pjxl = '--'
  488. _this.pjhx = '--'
  489. }
  490. _this.mySocketTask.send({data: 'ping'})
  491. }, 60000) // 60秒的心跳包
  492. this.sendSns()
  493. })
  494. this.mySocketTask.onError(err => {
  495. this.connecting = false
  496. this.connected = false
  497. uni.hideLoading()
  498. console.log('连接失败,可能是websocket服务不可用,请稍后再试!')
  499. // uni.showModal({
  500. // content: '连接失败,可能是websocket服务不可用,请稍后再试',
  501. // showCancel: false
  502. // })
  503. console.log('onError', err)
  504. })
  505. this.mySocketTask.onMessage(res => {
  506. let msg = res.data
  507. // console.log('收到消息:', msg)
  508. switch (msg.length) {
  509. case 1:
  510. // 判断是否连接
  511. this.isConnect = true
  512. break
  513. case 234:
  514. // 实时睡眠数据
  515. if (this.homeFrom.nowDevice !== msg.substring(2, 14)) {
  516. return
  517. }
  518. this.homeFrom.status = '在线'
  519. this.lastMsgTime = Date.parse(new Date())
  520. this.getValue(msg)
  521. switch (msg.substring(26, 28)) {
  522. case "03":
  523. this.sleepStatus = '在床'
  524. break;
  525. case "04":
  526. this.sleepStatus = '离床'
  527. break;
  528. case "05":
  529. this.sleepStatus = '打鼾'
  530. break;
  531. case "06":
  532. this.sleepStatus = '体动'
  533. break;
  534. default:
  535. break;
  536. }
  537. break
  538. case 7: // REFRESH 有新的睡眠报告了
  539. Storage.setItem('refreshSleepReport', true)
  540. break
  541. case 13: // REMOVE_DEVICE 有其他人绑定了这台设备
  542. _this.API_getDeviceList()
  543. break
  544. default: // 报警信息
  545. const data = JSON.parse(res.data)
  546. console.log('收到消息为:', data)
  547. if (data.sn && this.homeFrom.nowDevice === data.sn) {
  548. this.list_alerts.push(data)
  549. }
  550. break
  551. }
  552. })
  553. this.mySocketTask.onClose(res => {
  554. console.log('webSocket关闭了...')
  555. this.connected = false
  556. this.closed = true
  557. clearInterval(this.timer)
  558. })
  559. },
  560. sendSns() {
  561. if (this.connected) {
  562. if (this.deviceList.length > 0) {
  563. let sns = []
  564. this.deviceList.forEach(item => {
  565. sns.push(item.imei)
  566. })
  567. const data = sns.join(',')
  568. if (!this.mySns) {
  569. this.mySns = data
  570. } else {
  571. if (data === this.mySns && !this.closed) {
  572. return
  573. } else {
  574. this.closed = false
  575. this.mySns = data
  576. }
  577. }
  578. console.log('发送imei给服务器...')
  579. this.mySocketTask.send({data: data})
  580. } else {
  581. this.mySns = ''
  582. this.mySocketTask.send({data: ''})
  583. }
  584. }
  585. },
  586. nowChart1() {
  587. this.onInit1(this.chartObj1)
  588. let canvas = this.$refs.xinlvRefChart.canvas
  589. echarts.setCanvasCreator(() => canvas)
  590. this.myChart1 = echarts.init(canvas, 'halloween', {
  591. width: this.chartObj1.width,
  592. height: this.chartObj1.height
  593. })
  594. this.options1 = Object.assign(this.getOptions('#FFFFFF', 800), {})
  595. this.options1.series.forEach((item) => {
  596. item.data = this.myData1
  597. })
  598. this.myChart1.setOption(this.options1)
  599. },
  600. nowChart2() {
  601. this.onInit2(this.chartObj2);
  602. let canvas = this.$refs.huxiRefChart.canvas;
  603. echarts.setCanvasCreator(() => canvas);
  604. this.myChart2 = echarts.init(canvas, 'halloween', {
  605. width: this.chartObj2.width,
  606. height: this.chartObj2.height
  607. });
  608. this.options2 = Object.assign(this.getOptions('#06f5d2', 400), {})
  609. this.options2.series.forEach((item) => {
  610. item.data = this.myData2
  611. })
  612. this.myChart2.setOption(this.options2)
  613. },
  614. onInit1(e) {
  615. this.chartObj1 = e
  616. },
  617. onInit2(e) {
  618. this.chartObj2 = e
  619. },
  620. getOptions(color, xMax) {
  621. return {
  622. visualMap: [
  623. {
  624. show: false,
  625. type: 'continuous',
  626. seriesIndex: 0,
  627. min: 0,
  628. max: 300,
  629. },
  630. ],
  631. color: color,
  632. title: {
  633. left: 'left',
  634. // text: title,
  635. },
  636. tooltip: {
  637. trigger: 'axis',
  638. axisPointer: {
  639. animation: false,
  640. },
  641. extraCssText: 'z-index: 2'
  642. },
  643. grid: {
  644. top: '15%',
  645. bottom: '10%',
  646. },
  647. xAxis: {
  648. type: 'category',
  649. boundaryGap: [0, '100%'],
  650. show: false, // 不显示x轴
  651. splitLine: {
  652. show: false,
  653. },
  654. triggerEvent: true
  655. },
  656. yAxis: {
  657. type: 'value',
  658. boundaryGap: [0, '100%'],
  659. min: function (value) {
  660. if (value === 0) {
  661. return 0
  662. } else {
  663. return value.min - 20
  664. }
  665. },
  666. max: function (value) {
  667. return value.max + 30
  668. },
  669. // min: 0,
  670. // min: 'dataMin', // 取数据在该轴上的最大值作为最小刻度
  671. // max: xMax,
  672. // max: 'dataMax', // 取数据在该轴上的最大值作为最大刻度
  673. splitLine: {
  674. show: true, // 是否显示分隔线
  675. lineStyle: {
  676. color: "rgba(168,162,162,0.6)",
  677. width: 1,
  678. type: 'dotted'
  679. }
  680. },
  681. axisLine: {
  682. show: false, // 是否显示坐标轴轴线
  683. lineStyle:{
  684. color:'#FFFFFF',
  685. width:1, //x轴线的宽度
  686. }
  687. },
  688. axisLabel: {
  689. fontSize: 8
  690. }
  691. },
  692. series: [
  693. {
  694. type: 'line',
  695. lineStyle: {
  696. width: 0.8
  697. },
  698. smooth: true, // 折线曲线
  699. showSymbol: false,
  700. hoverAnimation: false,
  701. data: [],
  702. },
  703. ]
  704. }
  705. },
  706. getValue(msg) {
  707. this.pjxl = parseInt(msg.substring(22, 24), 16)
  708. this.pjhx = parseInt(msg.substring(24, 26), 16)
  709. const bx = msg.substring(34, msg.length);
  710. const size = bx.length / 4
  711. const ii = size / 2;
  712. if (this.myData1.length > 100) {
  713. this.myData1.splice(0, ii)
  714. }
  715. if (this.myData2.length > 100) {
  716. this.myData2.splice(0, ii)
  717. }
  718. if (this.myCount1 > 300) {
  719. this.myCount1 = 0
  720. }
  721. if (this.myCount2 > 300) {
  722. this.myCount2 = 0
  723. }
  724. for (let i = 0; i < size; i++) {
  725. const j = i * 4
  726. const s1 = bx.substring(j, j + 2)
  727. const s2 = bx.substring(j + 2, j + 4)
  728. let value = parseInt(s2 + s1 , 16)
  729. if (i % 2 === 0) {
  730. this.myCount1 ++
  731. this.myData1.push([this.myCount1, value])
  732. } else {
  733. this.myCount2 ++
  734. this.myData2.push([this.myCount2, value])
  735. }
  736. }
  737. this.myChart1.setOption(this.options1)
  738. this.myChart2.setOption(this.options2)
  739. },
  740. handleAlertSetting() {
  741. uni.navigateTo({
  742. url: "/pages/user/alertSetting/index?imei=" + this.homeFrom.nowDevice
  743. });
  744. },
  745. formatSosType(value) {
  746. switch (value) {
  747. case 1:
  748. return '心率过速'
  749. case 2:
  750. return '心率过缓'
  751. case 3:
  752. return '呼吸过速'
  753. case 4:
  754. return '呼吸过缓'
  755. case 5:
  756. return '离床预警'
  757. case 6:
  758. return '一键预警'
  759. case 7:
  760. return '离线预警'
  761. default:
  762. break;
  763. }
  764. },
  765. formatSosTime(value) {
  766. return value.substring(10, value.length - 3)
  767. },
  768. // 扫描条码
  769. scan() {
  770. let _this = this
  771. uni.scanCode({
  772. success: function (res) {
  773. console.log(res, res.result.length)
  774. if (res.result.length > 20) {
  775. if (res.scanType === 'QR_CODE') {
  776. const urlStr = res.result
  777. const qs = Foundation.getQueryObject(urlStr)
  778. if (qs.mac && qs.type === 'MATTRESS') {
  779. _this.bindSn = qs.mac
  780. } else {
  781. uni.showToast({
  782. title: '请扫码正确的睡眠床垫二维码',
  783. icon: 'none',
  784. duration: 5000
  785. })
  786. }
  787. } else {
  788. _this.bindSn = res.result
  789. }
  790. } else {
  791. let str = res.result.split(':')
  792. if (str.length > 1) {
  793. _this.bindSn = str[1]
  794. } else {
  795. _this.bindSn = res.result
  796. }
  797. }
  798. },
  799. fail: (err) => {
  800. console.log(err)
  801. // #ifdef MP
  802. uni.getSetting({
  803. success: (res) => {
  804. let authStatus = res.authSetting['scope.camera'];
  805. if (!authStatus) {
  806. uni.showModal({
  807. title: '授权失败',
  808. content: 'app需要使用您的相机,请在设置界面打开相关权限',
  809. success: (res) => {
  810. if (res.confirm) {
  811. uni.openSetting()
  812. }
  813. }
  814. })
  815. }
  816. }
  817. })
  818. // #endif
  819. }
  820. })
  821. },
  822. bindDevice() {
  823. if (!this.bindSn) {
  824. uni.showToast({
  825. title: '请输入或绑定正确的二维码',
  826. icon: 'none',
  827. duration: 5000
  828. })
  829. return
  830. }
  831. const params = {
  832. imei: this.bindSn,
  833. memberId: this.memberId,
  834. dtype: deviceDtypeEnum.DEVICE_TYPE.SMCD
  835. }
  836. this.bindShow = false
  837. let _this = this
  838. API_deviceMemberBind.bindDeviceByDtype(params).then(res => {
  839. if (res.success) {
  840. _this.bindSn = ''
  841. uni.showToast({
  842. title: '绑定成功',
  843. })
  844. _this.API_getDeviceList()
  845. } else {
  846. uni.showModal({
  847. content: res.message,
  848. showCancel: false
  849. })
  850. }
  851. })
  852. },
  853. addBindDevice() {
  854. if (this.memberId) {
  855. this.bindShow = 'show'
  856. } else {
  857. uni.showModal({
  858. title: '提示',
  859. content: "您还没有登录,是否前往登录?",
  860. confirmText: "确定",
  861. showCancel: true,
  862. success: function(res) {
  863. if (res.confirm) {
  864. uni.reLaunch({
  865. url:'/pages/login/auth'
  866. })
  867. }
  868. }
  869. })
  870. }
  871. },
  872. closeWebsocket() {
  873. if (this.mySocketTask) {
  874. this.mySocketTask.close({
  875. success(res) {
  876. this.connected = false
  877. clearInterval(this.timer)
  878. console.log("关闭成功", res)
  879. },
  880. fail(err) {
  881. console.log("关闭失败", err)
  882. }
  883. })
  884. }
  885. },
  886. hideModal(e) {
  887. this.modalName = false
  888. },
  889. RadioChange(e) {
  890. this.homeFrom.nowDevice = e.detail.value
  891. Storage.setItem("nowChangeDevice", e.detail.value)
  892. this.homeFrom.status = '离线'
  893. this.sleepStatus = '离线'
  894. },
  895. handleShareClick() {
  896. if (!this.memberId) {
  897. uni.showModal({
  898. title: '提示',
  899. content: "您还没有登录,是否前往登录?",
  900. confirmText: "确定",
  901. showCancel: true,
  902. success: function(res) {
  903. if (res.confirm) {
  904. uni.reLaunch({
  905. url:'/pages/login/auth'
  906. })
  907. }
  908. }
  909. })
  910. return
  911. }
  912. // this.closeWebsocket()
  913. uni.navigateTo({
  914. url: '/pages/user/shareUser/index'
  915. })
  916. },
  917. goWarnLogPage() {
  918. const userInfo = Storage.getItem('userInfo')
  919. uni.navigateTo({
  920. url: '/pages/log/warn/index?unionId=' + userInfo.union_id
  921. })
  922. },
  923. // 绑定守护之影套包
  924. bindUUSH() {
  925. const params = {
  926. imei: this.bindSn,
  927. memberId: this.memberId
  928. }
  929. const _this = this
  930. API_deviceMemberBind.bindUUSH(params).then(res => {
  931. if (res.success) {
  932. _this.bindSn = ''
  933. uni.showToast({
  934. title: '绑定成功',
  935. })
  936. _this.API_getDeviceList()
  937. } else {
  938. uni.showModal({
  939. content: res.message,
  940. showCancel: false
  941. })
  942. }
  943. })
  944. },
  945. // 处理二维码或分享内容
  946. async handleQRCodeMsg() {
  947. const codeMsg = Storage.getItem('codeMsg')
  948. if (codeMsg) {
  949. Storage.removeItem('codeMsg')
  950. let params
  951. switch (codeMsg.type) {
  952. case 'VITAL_SHARE': // 亲友体征绑定
  953. uni.showModal({
  954. title: '提示',
  955. content: '是否同意该亲友的请求分享?',
  956. confirmText: "同意",
  957. showCancel: true,
  958. success: function(res) {
  959. if (res.confirm) {
  960. let memberId = Number(codeMsg.no)
  961. params = {
  962. memberId: memberId,
  963. type: codeMsg.lx,
  964. bool_sms: 1,
  965. bool_voice: 1
  966. }
  967. addByShare(params)
  968. }
  969. }
  970. })
  971. break
  972. case 'BROADCAST': // 播报设备
  973. params = {
  974. imei: codeMsg.mac,
  975. memberId: this.memberId,
  976. dtype: deviceDtypeEnum.DEVICE_TYPE.ZNYLB
  977. }
  978. await API_deviceMemberBind.bindDeviceByDtype(params)
  979. break
  980. case 'MATTRESS': // 床垫
  981. this.bindSn = codeMsg.mac
  982. this.init()
  983. this.bindDevice()
  984. break
  985. case 'UUSH': // 总包
  986. this.bindSn = codeMsg.mac
  987. this.init()
  988. this.bindUUSH()
  989. break
  990. default:
  991. break
  992. }
  993. }
  994. },
  995. // 获取需要提醒购买套餐
  996. async GET_Reminds() {
  997. if (API.base === 'http://192.168.1.199:7000') {
  998. return
  999. }
  1000. if (this.deviceList.length > 0) {
  1001. const userInfo = Storage.getItem('userInfo')
  1002. // 获取提醒购买
  1003. API_HOME.getRemindPackages({memberId: this.memberId, unionId: userInfo.union_id}).then(res => {
  1004. if (res.iotLinks) {
  1005. const nowData = Math.round(new Date() / 1000)
  1006. res.iotLinks.forEach(item => {
  1007. let date = item.expires_time - nowData
  1008. let str = ''
  1009. if (date < 0) {
  1010. str = '已经到期'
  1011. } else {
  1012. str = '还有【' + Math.ceil(date / 86400) + '天】过期'
  1013. }
  1014. uni.showModal({
  1015. title: '提示',
  1016. content: "您的【" + item.device_name + '】' + str +'是否前往续费?',
  1017. confirmText: "确定",
  1018. showCancel: true,
  1019. success: function(res) {
  1020. if (res.confirm) {
  1021. uni.navigateTo({
  1022. url: '/pages/log/iot/iot-package/index?operators=' + item.operators + '&iccid=' + item.iccid + '&dtype=' + item.device_name
  1023. })
  1024. }
  1025. }
  1026. })
  1027. })
  1028. }
  1029. if (res.warnSwitch) {
  1030. if ((res.warnSwitch.sms_qty + res.warnSwitch.voice_qty) < 5) {
  1031. uni.showModal({
  1032. title: '提示',
  1033. content: "您的短信、语音剩余额度即将不总,是否前往购买?",
  1034. confirmText: "确定",
  1035. showCancel: true,
  1036. success: function(res) {
  1037. if (res.confirm) {
  1038. uni.navigateTo({
  1039. url: '/pages/log/smsVoice/package?unionId=' + userInfo.union_id
  1040. })
  1041. }
  1042. }
  1043. })
  1044. }
  1045. }
  1046. })
  1047. // 获取卡的激活时间
  1048. await API_HOME.getAllActivationTime(this.memberId)
  1049. }
  1050. }
  1051. }
  1052. };
  1053. </script>
  1054. <style lang="scss" scoped>
  1055. .page {
  1056. background-color: #000000;
  1057. width: 100%;
  1058. overflow-y: auto;
  1059. overflow-x: hidden;
  1060. height: 100%;
  1061. }
  1062. .echarts-wrap {
  1063. width: 100%;
  1064. height: 80px;
  1065. /*padding: 10upx;*/
  1066. margin-bottom: 0.3rem
  1067. }
  1068. .chartsBgColor{
  1069. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  1070. }
  1071. .equal-division {
  1072. .equal-division-item {
  1073. padding: 0.25rem 0.38rem 0;
  1074. flex: 1 1 10.81rem;
  1075. }
  1076. }
  1077. .home_add_devive {
  1078. margin-right: 1.25rem;
  1079. margin: 1rem;
  1080. padding: 3.75rem 0;
  1081. background-color: #0233c699;
  1082. border-radius: 1rem;
  1083. backdrop-filter: blur(0.63rem);
  1084. .image_4 {
  1085. width: 1.5rem;
  1086. height: 1.5rem;
  1087. }
  1088. .text_5 {
  1089. color: #ffffff;
  1090. font-size: 1.5rem;
  1091. font-family: PingFangSC;
  1092. line-height: 1.38rem;
  1093. }
  1094. }
  1095. .space-x-10 {
  1096. & > view:not(:first-child),
  1097. & > text:not(:first-child),
  1098. & > image:not(:first-child) {
  1099. margin-left: 0.63rem;
  1100. }
  1101. }
  1102. .space-x-6 {
  1103. & > view:not(:first-child),
  1104. & > text:not(:first-child),
  1105. & > image:not(:first-child) {
  1106. margin-left: 0.38rem;
  1107. }
  1108. }
  1109. .group_5 {
  1110. padding-left: 1rem;
  1111. padding-right: 1rem;
  1112. .font_2 {
  1113. font-size: 0.69rem;
  1114. font-family: PingFangSC;
  1115. line-height: 0.63rem;
  1116. color: #ffffff;
  1117. }
  1118. .text_8 {
  1119. font-size: 0.63rem;
  1120. line-height: 0.59rem;
  1121. opacity: 0.6;
  1122. }
  1123. .home_blank_heart {
  1124. margin-top: 1rem;
  1125. opacity: 1;
  1126. border-radius: 16px;
  1127. background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
  1128. backdrop-filter: blur(20px);
  1129. padding:1rem 0rem 2rem 1rem;
  1130. .group_7 {
  1131. padding-bottom: 1.13rem;
  1132. .image_6 {
  1133. width: 1.13rem;
  1134. height: 0.88rem;
  1135. }
  1136. .text_9 {
  1137. line-height: 1.03rem;
  1138. }
  1139. }
  1140. .view {
  1141. margin-right: -20.13rem;
  1142. }
  1143. .text_10 {
  1144. margin-right: 18.75rem;
  1145. margin-top: 1rem;
  1146. }
  1147. }
  1148. .home_blank_breath {
  1149. margin-top: 1rem;
  1150. opacity: 1;
  1151. border-radius: 16px;
  1152. background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
  1153. backdrop-filter: blur(20px);
  1154. padding:1rem 0rem 2rem 1rem;
  1155. .group_10 {
  1156. padding-bottom: 1.25rem;
  1157. .image_7 {
  1158. width: 1.13rem;
  1159. height: 1.06rem;
  1160. }
  1161. .text_12 {
  1162. line-height: 1rem;
  1163. }
  1164. }
  1165. .view_2 {
  1166. margin-right: -20rem;
  1167. }
  1168. .text_13 {
  1169. margin-right: 18.63rem;
  1170. margin-top: 1rem;
  1171. }
  1172. }
  1173. .space-x-4 {
  1174. & > view:not(:first-child),
  1175. & > text:not(:first-child),
  1176. & > image:not(:first-child) {
  1177. margin-left: 0.25rem;
  1178. }
  1179. }
  1180. .font_1 {
  1181. font-size: 1.13rem;
  1182. font-family: PingFangSC;
  1183. line-height: 1.06rem;
  1184. color: #ffffff;
  1185. }
  1186. .section_5 {
  1187. background-color: #ffffff1a;
  1188. width: 15.94rem;
  1189. height: 0.063rem;
  1190. }
  1191. .font_3 {
  1192. font-size: 2.5rem;
  1193. font-family: PingFangSC;
  1194. line-height: 0.19rem;
  1195. color: #ffffff;
  1196. }
  1197. .group_8 {
  1198. margin-top: 1.38rem;
  1199. padding-left: 0.63rem;
  1200. .font_4 {
  1201. font-size: 0.69rem;
  1202. font-family: PingFangSC;
  1203. line-height: 0.63rem;
  1204. color: #ffffff80;
  1205. }
  1206. .text_11 {
  1207. font-size: 0.75rem;
  1208. line-height: 0.69rem;
  1209. }
  1210. }
  1211. }
  1212. .home_blank_alert {
  1213. margin: 1rem 1.25rem 0;
  1214. padding: 0.94rem;
  1215. background-color: #02299ecc;
  1216. border-radius: 1rem;
  1217. .image_8 {
  1218. width: 7.06rem;
  1219. height: 4.94rem;
  1220. }
  1221. .space-y-4 {
  1222. & > view:not(:first-child),
  1223. & > text:not(:first-child),
  1224. & > image:not(:first-child) {
  1225. margin-top: 0.25rem;
  1226. }
  1227. .font_5 {
  1228. font-size: 0.88rem;
  1229. font-family: PingFangSC;
  1230. line-height: 1.06rem;
  1231. color: #167df2;
  1232. }
  1233. }
  1234. }
  1235. .space-x-16 {
  1236. & > view:not(:first-child),
  1237. & > text:not(:first-child),
  1238. & > image:not(:first-child) {
  1239. margin-left: 1rem;
  1240. }
  1241. }
  1242. .container-bg {
  1243. position: fixed;
  1244. left: -130px;
  1245. top: -130px;
  1246. width: 480px;
  1247. height: 344px;
  1248. opacity: 1;
  1249. overflow: hidden;
  1250. border-radius: 63px;
  1251. -webkit-transform: rotate(-315deg);
  1252. transform: rotate(-315deg);
  1253. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  1254. }
  1255. .home-container {
  1256. padding-bottom: 2rem;
  1257. background-color: #000000;
  1258. width: 100%;
  1259. .home-module {
  1260. padding: 1.75rem 0 3.38rem;
  1261. overflow-y: auto;
  1262. z-index: 100;
  1263. .home-header {
  1264. padding: 0 1.25rem;
  1265. .home-header-title {
  1266. color: #ffffff;
  1267. font-size: 1.25rem;
  1268. font-family: PingFangSC;
  1269. line-height: 1.16rem;
  1270. }
  1271. .text_8 {
  1272. color: #ffffff;
  1273. opacity: 1;
  1274. }
  1275. .text_3 {
  1276. opacity: 0.6;
  1277. }
  1278. .home-header-subtitle {
  1279. line-height: 0.72rem;
  1280. }
  1281. .space-x-10 {
  1282. & > view:not(:first-child),
  1283. & > text:not(:first-child),
  1284. & > image:not(:first-child) {
  1285. margin-left: 0.63rem;
  1286. }
  1287. .text_10 {
  1288. line-height: 0.59rem;
  1289. }
  1290. .text_11 {
  1291. line-height: 0.47rem;
  1292. }
  1293. }
  1294. }
  1295. .space-y-10 {
  1296. & > view:not(:first-child),
  1297. & > text:not(:first-child),
  1298. & > image:not(:first-child) {
  1299. margin-top: 0.63rem;
  1300. }
  1301. }
  1302. .home-device {
  1303. margin: 1rem 1.25rem;
  1304. padding-bottom: 1rem;
  1305. //padding-bottom: 2rem;
  1306. background-color: #0233c699;
  1307. border-radius: 1rem;
  1308. backdrop-filter: blur(0.63rem);
  1309. .home-device-setting {
  1310. width: 70px;
  1311. height: 20px;
  1312. opacity: 1;
  1313. border-radius: 7px;
  1314. background: linear-gradient(90deg, rgba(255, 35, 247, 1) 0%, rgba(91, 30, 154, 1) 100%);
  1315. .image_8 {
  1316. width: 10px;
  1317. height: 10px;
  1318. }
  1319. font-size: 10px;
  1320. font-weight: 400;
  1321. line-height: 10px;
  1322. color: rgba(255, 255, 255, 1);
  1323. padding: 0.3rem;
  1324. }
  1325. .home-device-header {
  1326. background-color: #ffffff33;
  1327. border-radius: 1rem 1rem 0px 0px;
  1328. .equal-division {
  1329. padding: 0 1rem;
  1330. .equal-division-item {
  1331. padding: 0.38rem 0;
  1332. .text_5 {
  1333. opacity: 0.5;
  1334. }
  1335. }
  1336. .space-x-14 {
  1337. & > view:not(:first-child),
  1338. & > text:not(:first-child),
  1339. & > image:not(:first-child) {
  1340. margin-left: 0.88rem;
  1341. }
  1342. }
  1343. }
  1344. .section_5 {
  1345. padding: 0.38rem 0.5rem;
  1346. background-image: linear-gradient(90deg, #2c25f799 0%, #061599 100%);
  1347. border-radius: 0px 1rem 0px 0px;
  1348. height: 1.5rem;
  1349. .image_8 {
  1350. width: 0.75rem;
  1351. height: 0.75rem;
  1352. }
  1353. }
  1354. }
  1355. .home-device-status {
  1356. padding: 0.25rem 0 0.25rem 0.25rem;
  1357. background-color: #ffffff33;
  1358. border-radius: 0.75rem;
  1359. width: 7.88rem;
  1360. .text_7 {
  1361. opacity: 0.4;
  1362. }
  1363. }
  1364. }
  1365. .space-y-15 {
  1366. & > view:not(:first-child),
  1367. & > text:not(:first-child),
  1368. & > image:not(:first-child) {
  1369. margin-top: 0.94rem;
  1370. }
  1371. }
  1372. .font_3 {
  1373. font-size: 0.75rem;
  1374. font-family: PingFangSC;
  1375. line-height: 0.69rem;
  1376. color: #ffffff;
  1377. }
  1378. .home-report {
  1379. margin: 0 1.25rem;
  1380. padding: 1rem 0;
  1381. background-image: url("http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/050F95EFCA914FD6A72537F41ACEFC33.png");
  1382. background-size: contain;
  1383. background-repeat: no-repeat;
  1384. .space-y-6 {
  1385. & > view:not(:first-child),
  1386. & > text:not(:first-child),
  1387. & > image:not(:first-child) {
  1388. margin-top: 0.38rem;
  1389. }
  1390. }
  1391. }
  1392. .home-ad {
  1393. margin: 0 1.25rem;
  1394. padding: 1rem 0;
  1395. background-image: url("http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/602647C38F5E4168B4F16AFFFE2270CA.png");
  1396. background-size: contain;
  1397. background-repeat: no-repeat;
  1398. .space-y-6 {
  1399. & > view:not(:first-child),
  1400. & > text:not(:first-child),
  1401. & > image:not(:first-child) {
  1402. margin-top: 0.38rem;
  1403. }
  1404. }
  1405. }
  1406. .home-data {
  1407. background: linear-gradient(90deg, rgba(86, 17, 247, 0.5) 0%, #4d9efa 100%);
  1408. margin: 0rem 1.25rem;
  1409. padding: 1rem 0rem;
  1410. border-radius: 1rem;
  1411. padding: 1rem;
  1412. margin-top: 1rem;
  1413. z-index: 1000;
  1414. .home-data-item {
  1415. padding: 1rem 0rem;
  1416. margin: 0 0.3rem;
  1417. opacity: 1;
  1418. border-radius: 16px;
  1419. background: linear-gradient(180deg, rgba(52, 26, 75, 0.65) 0%, rgba(22, 125, 242, 1) 100%);
  1420. backdrop-filter: blur(20px);
  1421. }
  1422. }
  1423. .group_6 {
  1424. overflow-x: hidden;
  1425. width: 100%;
  1426. .group_7 {
  1427. overflow-x: hidden;
  1428. width: 10rem;
  1429. .group_9 {
  1430. margin-left: 2.25rem;
  1431. }
  1432. .text_14 {
  1433. margin-top: 3.5rem;
  1434. }
  1435. }
  1436. .group_8 {
  1437. width: 10rem;
  1438. .text_15 {
  1439. margin-top: 3.63rem;
  1440. }
  1441. }
  1442. .font_6 {
  1443. font-size: 3rem;
  1444. font-family: PingFangSC;
  1445. line-height: 2.19rem;
  1446. color: #ffffff;
  1447. }
  1448. .font_7 {
  1449. font-size: 0.75rem;
  1450. font-family: PingFangSC;
  1451. line-height: 0.69rem;
  1452. color: #ffffff80;
  1453. }
  1454. }
  1455. .space-y-40 {
  1456. & > view:not(:first-child),
  1457. & > text:not(:first-child),
  1458. & > image:not(:first-child) {
  1459. margin-top: 2.5rem;
  1460. }
  1461. }
  1462. .space-x-8 {
  1463. & > view:not(:first-child),
  1464. & > text:not(:first-child),
  1465. & > image:not(:first-child) {
  1466. margin-left: 0.5rem;
  1467. }
  1468. .text_8 {
  1469. padding: 0.13rem 0;
  1470. }
  1471. .section_7 {
  1472. padding: 0.13rem 0.38rem;
  1473. background-image: linear-gradient(90deg, #ff23f7 0%, #5b1e9a 100%);
  1474. border-radius: 0.44rem;
  1475. height: 0.88rem;
  1476. .text_9 {
  1477. line-height: 0.56rem;
  1478. }
  1479. .image_9 {
  1480. width: 0.19rem;
  1481. height: 0.31rem;
  1482. }
  1483. }
  1484. }
  1485. .font_4 {
  1486. font-size: 1rem;
  1487. font-family: PingFangSC;
  1488. line-height: 0.94rem;
  1489. color: #ffffff;
  1490. }
  1491. .font_5 {
  1492. font-size: 0.63rem;
  1493. font-family: PingFangSC;
  1494. color: #ffffff;
  1495. }
  1496. .space-x-6 {
  1497. & > view:not(:first-child),
  1498. & > text:not(:first-child),
  1499. & > image:not(:first-child) {
  1500. margin-left: 0.38rem;
  1501. }
  1502. .text_6 {
  1503. line-height: 0.56rem;
  1504. }
  1505. .image_7 {
  1506. width: 1.31rem;
  1507. height: 0.69rem;
  1508. }
  1509. .image_11 {
  1510. width: 1.13rem;
  1511. height: 0.94rem;
  1512. }
  1513. .font_9 {
  1514. font-size: 0.88rem;
  1515. font-family: PingFangSC;
  1516. line-height: 0.69rem;
  1517. color: #ced5dc;
  1518. }
  1519. .text_16 {
  1520. line-height: 0.63rem;
  1521. }
  1522. }
  1523. .space-x-4 {
  1524. & > view:not(:first-child),
  1525. & > text:not(:first-child),
  1526. & > image:not(:first-child) {
  1527. margin-left: 0.25rem;
  1528. }
  1529. .image_6 {
  1530. width: 0.94rem;
  1531. height: 0.75rem;
  1532. }
  1533. .image_10 {
  1534. width: 1.13rem;
  1535. height: 0.88rem;
  1536. }
  1537. .font_1 {
  1538. font-size: 1.13rem;
  1539. font-family: PingFangSC;
  1540. line-height: 1.03rem;
  1541. color: #ffffff;
  1542. }
  1543. .image_4 {
  1544. width: 1.13rem;
  1545. height: 1.06rem;
  1546. }
  1547. .text_12 {
  1548. line-height: 1rem;
  1549. }
  1550. .font_10 {
  1551. font-size: 1.13rem;
  1552. font-family: PingFangSC;
  1553. line-height: 0.81rem;
  1554. color: #ff465a;
  1555. }
  1556. }
  1557. .home-alert {
  1558. margin: 0rem 1.25rem 0 1.25rem;
  1559. padding: 1rem 0.88rem 0.13rem;
  1560. background-color: #0233c6cc;
  1561. border-radius: 1rem;
  1562. .home-alert-header {
  1563. }
  1564. .home-alert-list {
  1565. .list-item {
  1566. padding: 0.88rem 0;
  1567. border-bottom: solid 0.063rem #ffffff1a;
  1568. }
  1569. }
  1570. }
  1571. .space-y-4 {
  1572. & > view:not(:first-child),
  1573. & > text:not(:first-child),
  1574. & > image:not(:first-child) {
  1575. margin-top: 0.25rem;
  1576. }
  1577. }
  1578. .font_8 {
  1579. font-size: 0.88rem;
  1580. font-family: PingFangSC;
  1581. line-height: 0.81rem;
  1582. color: #ffffff;
  1583. }
  1584. }
  1585. .space-y-20 {
  1586. & > view:not(:first-child),
  1587. & > text:not(:first-child),
  1588. & > image:not(:first-child) {
  1589. margin-top: 1.25rem;
  1590. }
  1591. .text_13 {
  1592. line-height: 2.16rem;
  1593. }
  1594. }
  1595. }
  1596. .home-data {
  1597. margin-top: 3.5rem;
  1598. overflow-x: hidden;
  1599. .home-data-left {
  1600. .space-x-4 {
  1601. & > view:not(:first-child),
  1602. & > text:not(:first-child),
  1603. & > image:not(:first-child) {
  1604. margin-left: 0.25rem;
  1605. }
  1606. .image_10 {
  1607. width: 1.13rem;
  1608. height: 1.06rem;
  1609. }
  1610. .font_1 {
  1611. font-size: 1.13rem;
  1612. font-family: PingFangSC;
  1613. line-height: 1.03rem;
  1614. color: #ffffff;
  1615. }
  1616. .text_14 {
  1617. line-height: 1rem;
  1618. }
  1619. }
  1620. .home-data-left-title {
  1621. width: max-content;
  1622. }
  1623. .font_5 {
  1624. font-size: 2.5rem;
  1625. font-family: PingFangSC;
  1626. line-height: 1.81rem;
  1627. color: #ffffff;
  1628. }
  1629. .text_15 {
  1630. margin-top: 1.25rem;
  1631. }
  1632. .font_6 {
  1633. font-size: 0.75rem;
  1634. font-family: PingFangSC;
  1635. line-height: 0.69rem;
  1636. color: #ffffff80;
  1637. }
  1638. .text_16 {
  1639. margin-top: 0.75rem;
  1640. }
  1641. }
  1642. .home-data-chart {
  1643. overflow-x: hidden;
  1644. width: 85%;
  1645. .group_10 {
  1646. padding-left: 2.06rem;
  1647. padding-bottom: 2.25rem;
  1648. overflow-x: hidden;
  1649. .image_11 {
  1650. width: 8.75rem;
  1651. height: 3.44rem;
  1652. }
  1653. .image_12 {
  1654. width: 7.06rem;
  1655. height: 3.38rem;
  1656. }
  1657. .image_13 {
  1658. width: 10rem;
  1659. height: 3.44rem;
  1660. }
  1661. .pos_8 {
  1662. position: absolute;
  1663. left: 0;
  1664. bottom: 0.063rem;
  1665. }
  1666. .image_14 {
  1667. width: 6.06rem;
  1668. height: 3.44rem;
  1669. }
  1670. .pos_10 {
  1671. position: absolute;
  1672. right: 1.25rem;
  1673. bottom: 0;
  1674. }
  1675. .pos_9 {
  1676. position: absolute;
  1677. left: 0;
  1678. top: 2.31rem;
  1679. }
  1680. }
  1681. .section_9 {
  1682. background-color: #ffffff1a;
  1683. width: 15.94rem;
  1684. height: 0.063rem;
  1685. }
  1686. .pos_11 {
  1687. position: absolute;
  1688. left: 0;
  1689. top: 5.5rem;
  1690. }
  1691. }
  1692. }
  1693. .space-x-6 {
  1694. & > view:not(:first-child),
  1695. & > text:not(:first-child),
  1696. & > image:not(:first-child) {
  1697. margin-left: 0.38rem;
  1698. }
  1699. }
  1700. .home-btns {
  1701. .btn-home-btns2 {
  1702. background: linear-gradient(90deg, rgba(5, 96, 232, 1) 0%, rgba(100, 158, 245, 1) 100%);
  1703. }
  1704. .btn-home-btns1 {
  1705. background: linear-gradient(90deg, rgba(44, 37, 247, 0.6) 0%, rgba(6, 21, 153, 1) 100%);
  1706. }
  1707. .btn-home-btns {
  1708. border-radius: 1.3rem;
  1709. width: 8rem;
  1710. height: 2.6rem;
  1711. margin: 1rem 0.5rem;
  1712. text-align: center;
  1713. font-size: 1.1rem;
  1714. font-weight: 500;
  1715. letter-spacing: 0px;
  1716. line-height: 2.6rem;
  1717. .image_btn {
  1718. width: 1.4rem;
  1719. height: 1.4rem;
  1720. vertical-align: middle;
  1721. margin-right: 0.2rem;
  1722. }
  1723. .btn-home-text {
  1724. color: #ffffff;
  1725. }
  1726. }
  1727. }
  1728. </style>