index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="content">
  3. <view class="banner">
  4. <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
  5. <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
  6. <swiper-item v-for="(item, index) in data" :key="index">
  7. <view class="swiper-item" @click="clickBannerItem(item)">
  8. <image :src="imgUrl+item.image" mode="aspectFill" :draggable="false" />
  9. </view>
  10. </swiper-item>
  11. </swiper>
  12. </uni-swiper-dot>
  13. </view>
  14. <view class="container">
  15. <view class="item" @click="buleTeeth">
  16. <image :src = "imgUrl+'/index/bluetooth.png'"/>
  17. </view>
  18. <view class="item" @click="scan">
  19. <image :src = "imgUrl+'/index/scan.png'"/>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import { getDeviceInfoFromQrcode } from '@/api/device/device.js'
  26. export default {
  27. data:function(){
  28. return {
  29. current: 0,
  30. swiperDotIndex: 0,
  31. data: [{
  32. image: '/index/banner-index.png'
  33. }
  34. ]
  35. }
  36. },
  37. computed: {
  38. imgUrl() {
  39. return getApp().globalData.config.imgUrl;
  40. }
  41. },
  42. onLoad: function() {
  43. },
  44. onShow(){
  45. },
  46. methods:{
  47. buleTeeth(){
  48. this.$modal.showToast('功能开发中~')
  49. },
  50. scan(){
  51. if(window.location.href.indexOf("localhost") != -1){
  52. this.scan2();
  53. }else{
  54. uni.navigateTo({
  55. url: '/pages/weitiandi/device/scan'
  56. });
  57. }
  58. // uni.scanCode({
  59. // success: function (res) {
  60. // console.log('条码类型:' + res.scanType);
  61. // console.log('条码内容:' + res.result);
  62. // getDeviceInfoFromQrcode(res.result).then(res=>{
  63. // if(res.data != null){
  64. // let imei = res.data.imei;
  65. // let ccid = res.data.ccid;
  66. // uni.navigateTo({
  67. // url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
  68. // });
  69. // }
  70. // });
  71. // }
  72. // });
  73. },
  74. scan2(){
  75. getDeviceInfoFromQrcode("http://wetiandi.com/app/index.php?i=1&j=1&c=entry&m=wdl_shopping&do=wepay&sn=GD1B342399").then(res=>{
  76. if(res.data != null){
  77. let imei = res.data.imei;
  78. let ccid = res.data.ccid;
  79. let qrcode = res.data.qrcode;
  80. uni.navigateTo({
  81. url: '/pages/weitiandi/device/index?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  82. });
  83. }
  84. });
  85. }
  86. }
  87. }
  88. </script>
  89. <style>
  90. .content {
  91. background: rgb(249, 252, 255);
  92. inset: 0;
  93. position: absolute;
  94. }
  95. .swiper {
  96. height: 22vh;
  97. }
  98. .banner{
  99. height: 22vh;
  100. width: 100%;
  101. margin-top:1vh
  102. }
  103. .swiper-box {
  104. height: 22vh;
  105. }
  106. .swiper-item {
  107. /* #ifndef APP-NVUE */
  108. display: flex;
  109. /* #endif */
  110. flex-direction: column;
  111. justify-content: center;
  112. align-items: center;
  113. color: #fff;
  114. height: 300rpx;
  115. line-height: 300rpx;
  116. }
  117. @media screen and (min-width: 500px) {
  118. .uni-swiper-dot-box {
  119. width: 400px;
  120. /* #ifndef APP-NVUE */
  121. margin: 0 auto;
  122. /* #endif */
  123. margin-top: 8px;
  124. }
  125. .image {
  126. width: 100%;
  127. }
  128. }
  129. .item{
  130. display: inline-block;
  131. width: 50%;
  132. }
  133. .item image{
  134. height: 12vh;
  135. }
  136. </style>