device.vue 7.0 KB

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