device.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="container">
  3. <view class="tabs">
  4. <scroll-view scroll-x class="nav" style="background-color: #efefef;color: #5b5b5b;">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==subsectionCurrent?'text-checked':''" v-for="(item,index) in subsectionList" :key="index" @tap="subsectionChange(index)" >
  7. {{item.name}}
  8. </view>
  9. </view>
  10. </scroll-view>
  11. <view class="" style="height: 20rpx;"></view>
  12. </view>
  13. <view style="height: 100%;">
  14. <swiper style="height: 100%;" :current="subsectionCurrent" @change="swiperChange"
  15. @animationfinish="animationfinish">
  16. <swiper-item >
  17. <scroll-view scroll-y style="height: 100%;">
  18. <view class="margin-20 bg-white" style="height: 390rpx;border-radius: 12rpx;padding: 20rpx;">
  19. <view @click="addDevice" style="padding:6rpx 10rpx 10rpx;box-sizing: border-box;" class="flex justify-between">
  20. <text class="text-bold text-lg">我的设备</text>
  21. <view class="cu-btn line-red sm padding-right-40">
  22. <text class="cuIcon-add padding-right-10"></text>
  23. 添加设备
  24. </view>
  25. </view>
  26. <view class="text-left flex justify-around content">
  27. <view class="" @click="add">
  28. <image src="/static/myhome/del/yangan.jpg" ></image>
  29. <text>智能烟感</text>
  30. </view>
  31. <view class="" @click="add">
  32. <image src="http://139.9.103.171:1888/miniofile/app/baojing.jpg" ></image>
  33. <text>一键报警</text>
  34. </view>
  35. <view class="" @click="add">
  36. <image src="http://139.9.103.171:1888/miniofile/app/ranqi.jpg" ></image>
  37. <text>燃气监控</text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="footer-fixed">
  42. <view class="margin">
  43. <u-button type="primary" shape="circle" @click="subscribeMessage">订阅设备告警通知</u-button>
  44. </view>
  45. </view>
  46. </scroll-view>
  47. </swiper-item>
  48. <swiper-item >
  49. <scroll-view scroll-y style="height: 100%;">
  50. <view class="goods-data margin-top-20">
  51. <view class="goods-list">
  52. <view class="list-li" style="margin-bottom: 4rpx;" v-for="(item,index) in goodsList" :key="index">
  53. <view class="thumb" >
  54. <image :src="item.image" mode="scaleToFill"></image>
  55. </view>
  56. <view class="item">
  57. <view class="name">
  58. <text class="text-cut-2">{{item.name}}</text>
  59. </view>
  60. <view class="intro">
  61. <view class="left">
  62. <view class="cu-tag sm bg-red radius" v-if="index==0" >
  63. <text >家庭必备</text>
  64. </view>
  65. <view class="study text-red">
  66. ¥ {{item.price}}元
  67. </view>
  68. </view>
  69. <view @click="add" class="right line-blue cu-btn sm round" style="margin-right: 20rpx;">
  70. <text class="cuIcon-add"></text>
  71. 立即添加
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view style="height: 80rpx;">
  78. <u-divider bgColor="#f6f6f6" height="60">没有更多了</u-divider>
  79. </view>
  80. </view>
  81. </scroll-view>
  82. </swiper-item>
  83. </swiper>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. export default {
  89. components:{
  90. },
  91. data() {
  92. return {
  93. goodsList:[
  94. {
  95. image:'http://139.9.103.171:1888/miniofile/app/del/3.png',
  96. name:'面积80M²以下 千兆路由器1台 上门安装调测1次',
  97. price:'269'
  98. },
  99. {
  100. image:'http://139.9.103.171:1888/miniofile/app/del/4.png',
  101. name:'路由器/电力猫 代装服务',
  102. price:'100'
  103. },
  104. {
  105. image:'http://139.9.103.171:1888/miniofile/app/del/1172ba52446aeaa027e2442a7aadac8.jpg',
  106. name:'中国电信天翼看家TP-LINK云摄像云存储回看专业师傅上门安装',
  107. price:'347'
  108. },
  109. {
  110. image:'http://139.9.103.171:1888/miniofile/app/del/2.png',
  111. name:'面积80-140M² 分布式路由器1对 上门安装调测1次',
  112. price:'289.9'
  113. },
  114. {
  115. image:'http://139.9.103.171:1888/miniofile/app/del/e77500992d0740707b142ef237aabb4.jpg',
  116. name:'全屋wifi 千兆路由器',
  117. price:'289.9'
  118. },
  119. {
  120. image:'/static/myhome/del/yangan.jpg',
  121. name:'烟雾报警器家用',
  122. price:'254'
  123. },
  124. {
  125. image:'http://139.9.103.171:1888/miniofile/app/ad3d6aa4bbd5b98bb27395f7220b7de.jpg',
  126. name:'家用燃气传感器',
  127. price:'299'
  128. },
  129. {
  130. image:'http://139.9.103.171:1888/miniofile/app/f890a65d984b9bb2d84617c25781d32.jpg',
  131. name:'一键报警器',
  132. price:'356'
  133. },
  134. ],
  135. subsectionCurrent:0,
  136. swiperCurrent:0,
  137. subsectionList:[
  138. {
  139. name: '设备'
  140. },
  141. {
  142. name: '应用'
  143. }
  144. ]
  145. }
  146. },
  147. methods: {
  148. add(){
  149. uni.navigateTo({
  150. url:"../develop/develop"
  151. })
  152. },
  153. addDevice(){
  154. this.subsectionCurrent=1
  155. this.swiperCurrent=1
  156. },
  157. subsectionChange(index){
  158. this.subsectionCurrent=index
  159. },
  160. swiperChange(e) {
  161. uni.pageScrollTo({
  162. scrollTop: 0,
  163. duration: 0
  164. });
  165. this.subsectionCurrent = e.detail.current
  166. },
  167. animationfinish({detail: { current }}) {
  168. this.swiperCurrent = current;
  169. this.subsectionCurrent = current;
  170. },
  171. //订阅消息通知
  172. subscribeMessage() {
  173. console.log("订阅消息")
  174. this.$util.subscribe(["nSBYQTAe7wtQFPyHLXkacYF3IxwkYKjzWxsiVMzx-xM"]);
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss">
  180. .container {
  181. height: calc(100vh);
  182. background-color: #F6F6F6;
  183. padding: 90rpx 0rpx 0rpx;
  184. .tabs {
  185. height: 90rpx;
  186. position: fixed;
  187. top: 0rpx;
  188. left: 0;
  189. right: 0;
  190. width: 100%;
  191. z-index: 3;
  192. }
  193. }
  194. .text-checked{
  195. font-weight: 800;
  196. background-color: #FFFFFF;
  197. color: #2f7ff5;
  198. font-size: 800;
  199. }
  200. view{
  201. box-sizing: border-box;
  202. }
  203. .scroll-view {
  204. height: 150rpx;
  205. white-space: nowrap;
  206. width: 100%;
  207. position: relative;
  208. top: -30rpx;
  209. }
  210. .scroll-view-item {
  211. color: #FFFFFF;
  212. background-image: linear-gradient(to right, #2f7ff5, #2f7ff5);
  213. display: inline-block;
  214. text-align: left;
  215. padding: 20rpx 40rpx;
  216. margin:0 8rpx;
  217. width:24%;
  218. border-radius: 12rpx;
  219. }
  220. .scroll-view-item:first-child{
  221. margin-left: 30rpx;
  222. }
  223. .scroll-view-item:last-child{
  224. margin-right: 30rpx;
  225. }
  226. .content{
  227. image{
  228. height: 210rpx;
  229. width: 210rpx;
  230. border-radius: 12rpx;
  231. margin: 20rpx 0;
  232. }
  233. }
  234. .goods-data {
  235. width: 100%;
  236. .goods-list {
  237. border-radius: 6rpx;
  238. overflow: hidden;
  239. // 列表
  240. .list-li {
  241. display: flex;
  242. align-items: center;
  243. width: 100%;
  244. height: 230rpx;
  245. background-color: #ffffff;
  246. .thumb {
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. width: 30%;
  251. height: 100%;
  252. image {
  253. width: 178rpx;
  254. height: 200rpx;
  255. border-radius: 6rpx;
  256. }
  257. }
  258. .item {
  259. display: flex;
  260. flex-direction: column;
  261. justify-content: center;
  262. width: 70%;
  263. height: 100%;
  264. border-bottom: 2rpx solid #f6f6f6;
  265. .name {
  266. padding:0 20rpx 20rpx 20rpx;
  267. text {
  268. width: 100%;
  269. color: #212121;
  270. font-size: 28rpx;
  271. }
  272. }
  273. .intro{
  274. display: flex;
  275. justify-content: space-between;
  276. margin-top: 30rpx;
  277. margin-left: 8rpx;
  278. .left{
  279. font-size: 26rpx;
  280. .study{
  281. padding-top: 10rpx;
  282. }
  283. }
  284. .right{
  285. padding-right: 30rpx;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. }
  292. </style>