home.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <view class="home-warp">
  3. <view class="header">
  4. <view class="headerPng" @click="gotoPath('/pagesA/my/my')">
  5. <image :src="imageUrl" mode="widthFix" />
  6. </view>
  7. <view class="title">健康雷达</view>
  8. </view>
  9. <view class="leineng">
  10. <view>
  11. <image
  12. src="http://jkld.radar-power.com//uploadFiles/framework/file/20250620/home_ln.png"
  13. mode=""
  14. />
  15. </view>
  16. <view class="right">
  17. <view
  18. class="rightItem"
  19. @click="gotoDevice('/pagesA/devices/devices')"
  20. >
  21. <view class="rightTitle">全部设备</view>
  22. <view class="rightContent"
  23. ><text>{{ devNum }}</text
  24. >台</view
  25. >
  26. </view>
  27. <view
  28. class="rightItem"
  29. @click="gotoDevice('/pagesA/devices/devices')"
  30. >
  31. <view class="rightTitle">我的家庭</view>
  32. <view class="rightContent"
  33. ><text>{{ groupNum }}</text
  34. >家</view
  35. >
  36. </view>
  37. <view class="rightItem" @click="goAbnormalInfo()">
  38. <view class="rightTitle">异常信息</view>
  39. <view class="rightContent" v-if="warnNum == 0"
  40. ><text>0</text>条</view
  41. >
  42. <view class="rightAlarm" v-else
  43. ><text>{{ warnNum }}</text
  44. >条</view
  45. >
  46. </view>
  47. </view>
  48. </view>
  49. <view class="content">
  50. <view class="card" @click="gotoPath('/pagesA/adDevice/adDevice')">
  51. <view class="contentTitle">
  52. <text>添加设备</text>
  53. <image src="../../static/rightArrow.png" />
  54. </view>
  55. <view class="contentCenter"> 家庭陪伴探测器 </view>
  56. <view class="contentImg">
  57. <image src="../../static/smalLn.png" mode="" />
  58. </view>
  59. </view>
  60. <view class="card" @click="gotoDevice('/pagesA/devices/devices')">
  61. <view class="contentTitle">
  62. <text>我的家庭</text>
  63. <image src="../../static/rightArrow.png" />
  64. </view>
  65. <view class="contentCenter"> 点击进入我的家 </view>
  66. <view class="contentImg">
  67. <image src="../../static/myHome.png" mode="" />
  68. </view>
  69. </view>
  70. </view>
  71. <view class="bottom" @click="gotoSurvey('/pagesA/survey/survey')">
  72. <image src="../../static/linkService.png" mode="" />
  73. <!-- <button>联系客服</button> -->
  74. <button open-type="contact">联系客服</button>
  75. </view>
  76. <view class="bot_version"> v3.0.7 </view>
  77. <view
  78. class="shareInfo"
  79. @click="goDeviceShare()"
  80. v-if="shareNum > 0"
  81. :style="{ top: warnNum > 0 ? '280rpx' : '210rpx' }"
  82. >
  83. <image src="../../static/ln_small.png" class="shareimage"></image>
  84. <text class="sharetitle"
  85. >您有<text class="sharenum">{{ shareNum }}</text
  86. >台设备待授权</text
  87. >
  88. <image src="../../static/arrTwo.png" class="arrimage"></image>
  89. </view>
  90. <view
  91. class="warmInfo"
  92. @click="goAbnormalInfo()"
  93. v-if="alarmRetentionLists.length > 0"
  94. >
  95. <image src="../../static/warmImage.png" class="shareImage"></image>
  96. <view class="shareTitleContainer">
  97. <view
  98. class="shareTitleList"
  99. v-if="alarmRetentionLists.length > 1"
  100. >
  101. <view
  102. class="shareTitle"
  103. v-for="item in alarmRetentionLists"
  104. :key="item.clientId"
  105. >
  106. {{ item.devName }}检测到有{{
  107. getEventTypeName(item.eventType)
  108. }}
  109. </view>
  110. <view
  111. class="shareTitle"
  112. v-for="item in alarmRetentionLists"
  113. :key="item.clientId"
  114. >
  115. {{ item.devName }}检测到有{{
  116. getEventTypeName(item.eventType)
  117. }}
  118. </view>
  119. </view>
  120. <view class="shareTitleTwo" v-else>
  121. <view class="shareTitle">
  122. {{ alarmRetentionLists[0].devName }}检测到有{{
  123. getEventTypeName(item.eventType)
  124. }}
  125. </view>
  126. </view>
  127. </view>
  128. <image src="../../static/arrFour.png" class="warmImage"></image>
  129. </view>
  130. <tenMinutes v-if="isIniTenMinutes" />
  131. <alarModel v-if="isInitAlarm" />
  132. </view>
  133. </template>
  134. <script>
  135. export default {
  136. name: "my",
  137. data() {
  138. return {
  139. notices: [],
  140. groupNum: 0,
  141. shareNum: 0,
  142. devNum: 0,
  143. warnNum: 0,
  144. imageUrl: "../../static/headerInfo.png",
  145. devDevice: "",
  146. warmNum: "",
  147. warmDetail: [],
  148. alarmRetentionLists: [],
  149. warmTypeList: [],
  150. isInitAlarm: false,
  151. isIniTenMinutes: false,
  152. };
  153. },
  154. computed: {},
  155. methods: {
  156. gotoPath(path) {
  157. if (uni.getStorageSync("userId")) {
  158. uni.navigateTo({
  159. url: path,
  160. });
  161. } else {
  162. uni.showToast({
  163. title: "暂未登录,请先登录",
  164. icon: "none",
  165. duration: 1500,
  166. });
  167. uni.reLaunch({
  168. url: "/pagesA/loginNew/loginNew",
  169. });
  170. }
  171. },
  172. gotoDevice(url) {
  173. if (uni.getStorageSync("userId")) {
  174. if (this.devDevice.length == 1) {
  175. uni.setStorageSync("devIdDetail", this.devDevice[0].devId);
  176. uni.setStorageSync(
  177. "clientIDetail",
  178. this.devDevice[0].clientId
  179. );
  180. uni.navigateTo({
  181. url:
  182. "/pagesA/deviceDetail/deviceDetail?devItem=" +
  183. JSON.stringify(this.devDevice[0]),
  184. });
  185. } else {
  186. uni.navigateTo({
  187. url: url,
  188. });
  189. }
  190. } else {
  191. uni.showToast({
  192. title: "暂未登录,请先登录",
  193. icon: "none",
  194. duration: 1500,
  195. });
  196. uni.reLaunch({
  197. url: "/pagesA/loginNew/loginNew",
  198. });
  199. }
  200. },
  201. goAbnormalInfo() {
  202. if (uni.getStorageSync("userId")) {
  203. if (this.warnNum <= 0) {
  204. uni.showToast({
  205. title: "暂无异常信息",
  206. icon: "none",
  207. duration: 1500,
  208. });
  209. return;
  210. }
  211. uni.navigateTo({
  212. url: "/pagesA/abnormalInfo/abnormalInfo",
  213. });
  214. return;
  215. }
  216. uni.reLaunch({
  217. url: "/pagesA/loginNew/loginNew",
  218. });
  219. },
  220. goDeviceShare() {
  221. uni.setStorageSync("shareStatus", "authorized");
  222. uni.navigateTo({
  223. url: "/pagesA/shareList/shareList",
  224. });
  225. },
  226. getperSonInfo() {
  227. this.$http
  228. .get("wap/home/homeInfo", {
  229. userId: uni.getStorageSync("userId"),
  230. })
  231. .then((res) => {
  232. if (res.data.data) {
  233. const { groupNum, devNum, warnNum } = res.data.data;
  234. this.groupNum = groupNum;
  235. this.devNum = devNum;
  236. this.warnNum = warnNum;
  237. this.devDevice = res.data.data.deviceList;
  238. }
  239. uni.hideLoading();
  240. });
  241. },
  242. getShareNum() {
  243. this.$http
  244. .post("wap/share/queryDevShare", {
  245. userId: uni.getStorageSync("userId"),
  246. state: 0,
  247. })
  248. .then((res) => {
  249. this.shareNum = res.data.data?.length || 0;
  250. });
  251. },
  252. // 异常信息处理
  253. getWarnList() {
  254. uni.showLoading({
  255. title: "查询中...",
  256. });
  257. this.$http
  258. .post(
  259. "wap/stats/alarmEventsQuery",
  260. {
  261. pageNo: 1,
  262. pageSize: 3,
  263. createTimeStart: this.$time(new Date()),
  264. createTimeEnd: this.$time(new Date()),
  265. },
  266. {
  267. header: {
  268. "Content-Type": "application/json;charset=UTF-8",
  269. token: uni.getStorageSync("tokenValue") || "",
  270. },
  271. }
  272. )
  273. .then((res) => {
  274. if (res.data.data) {
  275. this.alarmRetentionLists = res.data.data.rows;
  276. }
  277. uni.hideLoading();
  278. });
  279. },
  280. getwarmType() {
  281. this.$http
  282. .get("pub/dic/query", { dicType: "alarm_event_type" })
  283. .then((res) => {
  284. if (res.data.data) {
  285. this.warmTypeList = res.data.data;
  286. }
  287. });
  288. },
  289. getEventTypeName(eventType) {
  290. return (
  291. this.warmTypeList.find((item) => item.itemCode == eventType)
  292. ?.itemName || "未知"
  293. );
  294. },
  295. gotoSurvey(path) {
  296. uni.navigateTo({
  297. url: path,
  298. });
  299. },
  300. },
  301. onLoad() {},
  302. onShow() {
  303. if (uni.getStorageSync("userId")) {
  304. uni.showLoading({
  305. title: "雷能为您守护中...",
  306. });
  307. this.getperSonInfo();
  308. this.getShareNum();
  309. this.getwarmType();
  310. this.getWarnList();
  311. this.isInitAlarm = true;
  312. this.isIniTenMinutes = true;
  313. }
  314. // 配置服务器
  315. let selectedService = uni.getStorageSync("sercviceChoice");
  316. if (!selectedService) {
  317. uni.setStorageSync("sercviceChoice", "aloneServe");
  318. }
  319. },
  320. onHide() {
  321. this.isInitAlarm = false;
  322. this.isIniTenMinutes = false;
  323. },
  324. onUnload() {
  325. this.isInitAlarm = false;
  326. this.isIniTenMinutes = false;
  327. },
  328. onShareAppMessage() {
  329. return {
  330. title: "好友向您分享雷能守护",
  331. path: "/pages/home/home",
  332. };
  333. },
  334. };
  335. </script>
  336. <style lang="less" scoped>
  337. .home-warp {
  338. position: relative;
  339. height: 100vh;
  340. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  341. /* padding: 24rpx 30rpx 20rpx; */
  342. }
  343. .header {
  344. display: flex;
  345. align-items: center;
  346. justify-content: space-between;
  347. padding: 90rpx 80rpx;
  348. }
  349. .headerPng {
  350. z-index: 1;
  351. }
  352. .headerPng image {
  353. width: 70rpx;
  354. height: 70rpx;
  355. border-radius: 50%;
  356. }
  357. .title {
  358. position: absolute;
  359. left: 50%;
  360. transform: translateX(-50%);
  361. color: #111111;
  362. font-size: 32rpx;
  363. }
  364. .leineng {
  365. position: absolute;
  366. top: -100rpx;
  367. display: flex;
  368. align-items: center;
  369. justify-content: flex-end;
  370. width: 100vw;
  371. height: 100vh;
  372. }
  373. .leineng image {
  374. position: absolute;
  375. top: 10%;
  376. left: 0;
  377. width: 700rpx;
  378. height: 1200rpx;
  379. }
  380. .right {
  381. z-index: 99;
  382. padding-right: 100rpx;
  383. }
  384. .right .rightItem {
  385. margin-bottom: 80rpx;
  386. color: #666666;
  387. }
  388. .right .rightItem .rightTitle {
  389. font-size: 23.44rpx;
  390. text-align: center;
  391. }
  392. .right .rightItem .rightContent {
  393. margin-top: 17rpx;
  394. font-size: 24rpx;
  395. font-weight: bold;
  396. }
  397. .right .rightItem .rightContent text {
  398. font-weight: 700;
  399. font-size: 66rpx;
  400. }
  401. .right .rightItem .rightAlarm {
  402. margin-top: 17rpx;
  403. font-size: 24rpx;
  404. font-weight: bold;
  405. color: #f55050;
  406. }
  407. .right .rightItem .rightAlarm text {
  408. font-weight: 700;
  409. font-size: 66rpx;
  410. color: #f55050;
  411. }
  412. .content {
  413. position: absolute;
  414. bottom: 200rpx;
  415. width: 100vw;
  416. display: flex;
  417. justify-content: space-around;
  418. }
  419. .card {
  420. width: 350rpx;
  421. height: 300rpx;
  422. border: 2rpx solid #ffffff;
  423. border-radius: 37rpx;
  424. background: #ffffff;
  425. padding: 38rpx 30rpx;
  426. box-sizing: border-box;
  427. }
  428. .contentTitle {
  429. display: flex;
  430. align-items: center;
  431. font-size: 32rpx;
  432. color: #111111;
  433. }
  434. .contentTitle image {
  435. width: 28rpx;
  436. height: 28rpx;
  437. margin-left: 8rpx;
  438. }
  439. .contentCenter {
  440. margin-top: 14rpx;
  441. font-size: 24rpx;
  442. color: #999999;
  443. }
  444. .contentImg image {
  445. margin-top: 60rpx;
  446. width: 94rpx;
  447. height: 94rpx;
  448. }
  449. .bottom {
  450. position: absolute;
  451. bottom: 80rpx;
  452. left: 50%;
  453. transform: translate(-50%, -50%);
  454. display: flex;
  455. justify-content: center;
  456. align-items: center;
  457. }
  458. .bottom image {
  459. width: 28rpx;
  460. height: 28rpx;
  461. }
  462. .bottom button {
  463. all: unset;
  464. margin: 0;
  465. padding: 0;
  466. border: none;
  467. background: none;
  468. font: inherit;
  469. text-align: inherit;
  470. line-height: normal;
  471. outline: none;
  472. box-shadow: none;
  473. -webkit-appearance: none;
  474. margin-left: 6rpx;
  475. color: #a1aab4;
  476. font-size: 28rpx;
  477. }
  478. .bot_version {
  479. opacity: 0.4;
  480. position: absolute;
  481. bottom: 20rpx;
  482. left: 50%;
  483. font-size: 28rpx;
  484. transform: translate(-50%, -50%);
  485. display: flex;
  486. justify-content: center;
  487. align-items: center;
  488. }
  489. .shareInfo {
  490. width: 100%;
  491. padding: 0 16rpx;
  492. color: #ffffff;
  493. display: flex;
  494. align-items: center;
  495. font-size: 28rpx;
  496. position: absolute;
  497. // top:210rpx;
  498. // top: 400rpx;
  499. left: 50%;
  500. transform: translate(-50%, -50%);
  501. box-sizing: border-box;
  502. background: linear-gradient(
  503. to right,
  504. #6f4e37 0%,
  505. rgba(210, 180, 140, 0.3) 100%
  506. );
  507. .shareimage {
  508. width: 60rpx;
  509. height: 60rpx;
  510. border-radius: 50%;
  511. }
  512. .sharetitle {
  513. margin-left: 20rpx;
  514. font-size: 28rpx;
  515. color: #ffffff;
  516. letter-spacing: 4rpx;
  517. }
  518. .sharenum {
  519. font-weight: bold;
  520. font-size: 28rpx;
  521. color: #ffffff;
  522. }
  523. .arrimage {
  524. width: 20rpx;
  525. height: 30rpx;
  526. margin-left: auto;
  527. }
  528. }
  529. .warmInfo {
  530. width: 100%;
  531. padding: 0rpx 10rpx;
  532. color: #ffffff;
  533. display: flex;
  534. align-items: center;
  535. font-size: 28rpx;
  536. position: absolute;
  537. top: 210rpx;
  538. left: 50%;
  539. transform: translate(-50%, -50%);
  540. box-sizing: border-box;
  541. background: linear-gradient(
  542. to right,
  543. #f9e0d7 0%,
  544. #ff6262 45%,
  545. #ff6262 55%,
  546. #f9e0d7 100%
  547. );
  548. border-radius: 12rpx;
  549. }
  550. .shareImage {
  551. width: 60rpx;
  552. height: 60rpx;
  553. border-radius: 50%;
  554. }
  555. .warmImage {
  556. width: 30rpx;
  557. height: 30rpx;
  558. margin-left: auto;
  559. }
  560. .shareTitleContainer {
  561. flex: 1;
  562. overflow: hidden;
  563. height: 40rpx;
  564. margin-left: 20rpx;
  565. display: flex;
  566. align-items: center;
  567. }
  568. /* 内层列表:滚动 */
  569. .shareTitleList {
  570. display: flex;
  571. flex-direction: column;
  572. animation: scrollUp 7s linear infinite;
  573. }
  574. .shareTitleTwo {
  575. display: flex;
  576. flex-direction: column;
  577. }
  578. .shareTitle {
  579. font-size: 28rpx;
  580. color: #ffffff;
  581. letter-spacing: 4rpx;
  582. height: 40rpx;
  583. line-height: 40rpx;
  584. white-space: nowrap;
  585. }
  586. /* 无限无缝滚动 */
  587. @keyframes scrollUp {
  588. 0% {
  589. transform: translateY(0);
  590. }
  591. 100% {
  592. transform: translateY(-50%);
  593. }
  594. }
  595. </style>