deviceSetting.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. </view>
  61. </template>
  62. <script>
  63. export default {
  64. data() {
  65. return {
  66. devInfo: "",
  67. devName: "",
  68. position: "",
  69. };
  70. },
  71. methods: {
  72. getPosition(val) {
  73. if (val == "Toilet") {
  74. this.position = "卫生间";
  75. } else if (val == "LivingRoom") {
  76. this.position = "客厅";
  77. } else if (val == "Restaurant") {
  78. this.position = "餐厅";
  79. } else if (val == "Bedroom") {
  80. this.position = " 卧室";
  81. }
  82. console.log(this.position, 9999);
  83. return this.installPosition;
  84. },
  85. unbindDevice() {
  86. uni.showModal({
  87. title: "提示",
  88. content: "确定要解绑该设备吗?",
  89. success: (res) => {
  90. if (res.confirm) {
  91. this.$http
  92. .get("wap/device/deviceUnBind", {
  93. userId: uni.getStorageSync("userId"),
  94. devId: this.devInfo.devId,
  95. })
  96. .then((res) => {
  97. if (res.data.code == 200) {
  98. uni.showToast({
  99. title: "解绑成功",
  100. icon: "success",
  101. duration: 1500,
  102. });
  103. setTimeout(() => {
  104. uni.reLaunch({
  105. url: "/pagesA/devices/devices",
  106. });
  107. }, 2000);
  108. } else {
  109. uni.showToast({
  110. title: "解绑失败",
  111. icon: "none",
  112. duration: 1500,
  113. });
  114. }
  115. });
  116. }
  117. },
  118. });
  119. },
  120. goMoreSetting() {
  121. uni.navigateTo({
  122. url:
  123. "/pagesA/adDevice/adDevice?devInfo=" +
  124. JSON.stringify(this.devInfo),
  125. });
  126. },
  127. goFailDetail() {
  128. uni.navigateTo({
  129. url:
  130. "/pagesA/failDetail/failDetail?devInfo=" +
  131. JSON.stringify(this.devInfo),
  132. });
  133. },
  134. goShareCount() {
  135. uni.navigateTo({
  136. url:
  137. "/pagesA/shareCountList/shareCountList?devInfo=" +
  138. JSON.stringify(this.devInfo),
  139. });
  140. },
  141. },
  142. onLoad(options) {
  143. this.devInfo = JSON.parse(options.devInfo);
  144. },
  145. onShow() {
  146. this.getPosition(this.devInfo.installPosition);
  147. },
  148. onUnload() {},
  149. onHide() {},
  150. };
  151. </script>
  152. <style lang="less">
  153. .setting-warp {
  154. position: relative;
  155. padding-top: 40rpx;
  156. height: 100vh;
  157. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  158. .clientInfo {
  159. width: 700rpx;
  160. // height: 140px;
  161. margin: 0 auto 0 auto;
  162. background: #ffffff;
  163. border-radius: 38rpx;
  164. box-sizing: border-box;
  165. padding: 0 30rpx 20rpx 30rpx;
  166. .wifItem {
  167. width: 640rpx;
  168. display: flex;
  169. align-content: center;
  170. justify-content: space-between;
  171. border-bottom: 2rpx solid #ebeff5;
  172. padding-top: 30rpx;
  173. padding-bottom: 20rpx;
  174. image {
  175. width: 40rpx;
  176. height: 40rpx;
  177. }
  178. input {
  179. margin-left: auto;
  180. text-align: right;
  181. }
  182. }
  183. }
  184. .box {
  185. position: fixed;
  186. bottom: 0;
  187. left: 0;
  188. width: 100vw;
  189. height: 168rpx;
  190. padding: 0 37rpx;
  191. background: #ffffff;
  192. box-sizing: border-box;
  193. .handle-btn {
  194. margin-top: 40rpx;
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. .btn1 {
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. width: 700rpx;
  203. height: 94rpx;
  204. background: #7d5346;
  205. border-radius: 28rpx;
  206. font-weight: 500;
  207. color: #ffffff;
  208. font-size: 32rpx;
  209. text-align: center;
  210. }
  211. }
  212. }
  213. }
  214. </style>