device.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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/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/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.showToast({
  145. title:"待开发",
  146. icon:"none"
  147. })
  148. },
  149. addDevice(){
  150. this.subsectionCurrent=1
  151. this.swiperCurrent=1
  152. },
  153. subsectionChange(index){
  154. this.subsectionCurrent=index
  155. },
  156. swiperChange(e) {
  157. uni.pageScrollTo({
  158. scrollTop: 0,
  159. duration: 0
  160. });
  161. this.subsectionCurrent = e.detail.current
  162. },
  163. animationfinish({detail: { current }}) {
  164. this.swiperCurrent = current;
  165. this.subsectionCurrent = current;
  166. },
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .container {
  172. height: calc(100vh);
  173. background-color: #F6F6F6;
  174. padding: 90rpx 0rpx 0rpx;
  175. .tabs {
  176. height: 90rpx;
  177. position: fixed;
  178. top: 0rpx;
  179. left: 0;
  180. right: 0;
  181. width: 100%;
  182. z-index: 3;
  183. }
  184. }
  185. .text-checked{
  186. font-weight: 800;
  187. background-color: #FFFFFF;
  188. color: #2f7ff5;
  189. font-size: 800;
  190. }
  191. view{
  192. box-sizing: border-box;
  193. }
  194. .scroll-view {
  195. height: 150rpx;
  196. white-space: nowrap;
  197. width: 100%;
  198. position: relative;
  199. top: -30rpx;
  200. }
  201. .scroll-view-item {
  202. color: #FFFFFF;
  203. background-image: linear-gradient(to right, #2f7ff5, #2f7ff5);
  204. display: inline-block;
  205. text-align: left;
  206. padding: 20rpx 40rpx;
  207. margin:0 8rpx;
  208. width:24%;
  209. border-radius: 12rpx;
  210. }
  211. .scroll-view-item:first-child{
  212. margin-left: 30rpx;
  213. }
  214. .scroll-view-item:last-child{
  215. margin-right: 30rpx;
  216. }
  217. .content{
  218. image{
  219. height: 210rpx;
  220. width: 210rpx;
  221. border-radius: 12rpx;
  222. margin: 20rpx 0;
  223. }
  224. }
  225. .goods-data {
  226. width: 100%;
  227. .goods-list {
  228. border-radius: 6rpx;
  229. overflow: hidden;
  230. // 列表
  231. .list-li {
  232. display: flex;
  233. align-items: center;
  234. width: 100%;
  235. height: 230rpx;
  236. background-color: #ffffff;
  237. .thumb {
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. width: 30%;
  242. height: 100%;
  243. image {
  244. width: 178rpx;
  245. height: 200rpx;
  246. border-radius: 6rpx;
  247. }
  248. }
  249. .item {
  250. display: flex;
  251. flex-direction: column;
  252. justify-content: center;
  253. width: 70%;
  254. height: 100%;
  255. border-bottom: 2rpx solid #f6f6f6;
  256. .name {
  257. padding:0 20rpx 20rpx 20rpx;
  258. text {
  259. width: 100%;
  260. color: #212121;
  261. font-size: 28rpx;
  262. }
  263. }
  264. .intro{
  265. display: flex;
  266. justify-content: space-between;
  267. margin-top: 30rpx;
  268. margin-left: 8rpx;
  269. .left{
  270. font-size: 26rpx;
  271. .study{
  272. padding-top: 10rpx;
  273. }
  274. }
  275. .right{
  276. padding-right: 30rpx;
  277. }
  278. }
  279. }
  280. }
  281. }
  282. }
  283. </style>