deviceSetting.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="setting-warp">
  3. <view class="clientInfo">
  4. <view class="wifItem">
  5. <text>设备序列号</text>
  6. <text>{{ devInfo.clientId }}</text>
  7. </view>
  8. <view class="wifItem">
  9. <text>设备ID</text>
  10. <text>{{ devInfo.devId }}</text>
  11. </view>
  12. <!-- <view class="wifItem">
  13. <text>设备分组</text>
  14. <text>{{}}</text>
  15. </view> -->
  16. <view class="wifItem">
  17. <text>安装位置</text>
  18. <text>{{ position }}</text>
  19. </view>
  20. </view>
  21. <view class="clientInfo" style="margin-top: 40rpx">
  22. <view class="wifItem" @click="goShareCount">
  23. <text>分享账户</text>
  24. <image
  25. src="../../static/rightArrow.png"
  26. style="width: 40rpx; height: 40rpx"
  27. ></image>
  28. </view>
  29. <!-- <view class="wifItem">
  30. <text>紧急联系人</text>
  31. <text>{{}}</text>
  32. </view> -->
  33. <!-- <view class="wifItem">
  34. <text>撤销分享</text>
  35. <image
  36. src="../../static/rightArrow.png"
  37. style="width: 40rpx; height: 40rpx"
  38. ></image>
  39. </view> -->
  40. <view class="wifItem" @click="goFailDetail">
  41. <text>跌倒事件</text>
  42. <image
  43. src="../../static/rightArrow.png"
  44. style="width: 30rpx; height: 30rpx"
  45. ></image>
  46. </view>
  47. <view class="wifItem" @click="unbindDevice">
  48. <text>解绑设备</text>
  49. <image
  50. src="../../static/rightArrow.png"
  51. style="width: 30rpx; height: 30rpx"
  52. ></image>
  53. </view>
  54. </view>
  55. <view class="box">
  56. <view class="handle-btn">
  57. <view class="btn1" @click="goMoreSetting">更多设置</view>
  58. </view>
  59. </view>
  60. <alarModel v-if="isInitAlarm" />
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. devInfo: "",
  68. devName: "",
  69. position: "",
  70. isInitAlarm: "",
  71. };
  72. },
  73. methods: {
  74. getPosition(val) {
  75. if (val == "Toilet") {
  76. this.position = "卫生间";
  77. } else if (val == "LivingRoom") {
  78. this.position = "客厅";
  79. } else if (val == "Restaurant") {
  80. this.position = "餐厅";
  81. } else if (val == "Bedroom") {
  82. this.position = " 卧室";
  83. }
  84. console.log(this.position, 9999);
  85. return this.installPosition;
  86. },
  87. unbindDevice() {
  88. uni.showModal({
  89. title: "提示",
  90. content: "确定要解绑该设备吗?",
  91. success: (res) => {
  92. if (res.confirm) {
  93. this.$http
  94. .get("wap/device/deviceUnBind", {
  95. userId: uni.getStorageSync("userId"),
  96. devId: this.devInfo.devId,
  97. })
  98. .then((res) => {
  99. if (res.data.code == 200) {
  100. uni.showToast({
  101. title: "解绑成功",
  102. icon: "success",
  103. duration: 1500,
  104. });
  105. setTimeout(() => {
  106. uni.reLaunch({
  107. url: "/pagesA/devices/devices",
  108. });
  109. }, 2000);
  110. } else {
  111. uni.showToast({
  112. title: "解绑失败",
  113. icon: "none",
  114. duration: 1500,
  115. });
  116. }
  117. });
  118. }
  119. },
  120. });
  121. },
  122. goMoreSetting() {
  123. uni.navigateTo({
  124. url:
  125. "/pagesA/adDevice/adDevice?devInfo=" +
  126. JSON.stringify(this.devInfo),
  127. });
  128. },
  129. goFailDetail() {
  130. uni.navigateTo({
  131. url:
  132. "/pagesA/failDetail/failDetail?devInfo=" +
  133. JSON.stringify(this.devInfo),
  134. });
  135. },
  136. goShareCount() {
  137. uni.navigateTo({
  138. url:
  139. "/pagesA/shareCountList/shareCountList?devInfo=" +
  140. JSON.stringify(this.devInfo),
  141. });
  142. },
  143. },
  144. onLoad(options) {
  145. this.devInfo = JSON.parse(options.devInfo);
  146. this.isInitAlarm = true;
  147. },
  148. onShow() {
  149. this.isInitAlarm = true;
  150. this.getPosition(this.devInfo.installPosition);
  151. },
  152. onUnload() {
  153. this.isInitAlarm = false;
  154. },
  155. onHide() {
  156. this.isInitAlarm = false;
  157. },
  158. };
  159. </script>
  160. <style lang="less">
  161. .setting-warp {
  162. position: relative;
  163. padding-top: 40rpx;
  164. height: 100vh;
  165. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  166. .clientInfo {
  167. width: 700rpx;
  168. // height: 140px;
  169. margin: 0 auto 0 auto;
  170. background: #ffffff;
  171. border-radius: 38rpx;
  172. box-sizing: border-box;
  173. padding: 0 30rpx 20rpx 30rpx;
  174. .wifItem {
  175. width: 640rpx;
  176. display: flex;
  177. align-content: center;
  178. justify-content: space-between;
  179. border-bottom: 2rpx solid #ebeff5;
  180. padding-top: 30rpx;
  181. padding-bottom: 20rpx;
  182. image {
  183. width: 40rpx;
  184. height: 40rpx;
  185. }
  186. input {
  187. margin-left: auto;
  188. text-align: right;
  189. }
  190. }
  191. }
  192. .box {
  193. position: fixed;
  194. bottom: 0;
  195. left: 0;
  196. width: 100vw;
  197. height: 168rpx;
  198. padding: 0 37rpx;
  199. background: #ffffff;
  200. box-sizing: border-box;
  201. .handle-btn {
  202. margin-top: 40rpx;
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. .btn1 {
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. width: 700rpx;
  211. height: 94rpx;
  212. background: #7d5346;
  213. border-radius: 28rpx;
  214. font-weight: 500;
  215. color: #ffffff;
  216. font-size: 32rpx;
  217. text-align: center;
  218. }
  219. }
  220. }
  221. }
  222. </style>