index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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">
  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. export default {
  26. data:function(){
  27. return {
  28. current: 0,
  29. swiperDotIndex: 0,
  30. data: [{
  31. image: '/index/banner-index.png'
  32. }
  33. ]
  34. }
  35. },
  36. computed: {
  37. imgUrl() {
  38. return getApp().globalData.config.imgUrl;
  39. }
  40. },
  41. onLoad: function() {
  42. },
  43. onShow(){
  44. },
  45. methods:{
  46. scan(){
  47. if(window.location.href.indexOf("localhost") != -1){
  48. this.scan2();
  49. }else{
  50. uni.navigateTo({
  51. url: '/pages/weitiandi/device/scan'
  52. });
  53. }
  54. // uni.scanCode({
  55. // success: function (res) {
  56. // console.log('条码类型:' + res.scanType);
  57. // console.log('条码内容:' + res.result);
  58. // getDeviceInfoFromQrcode(res.result).then(res=>{
  59. // if(res.data != null){
  60. // let imei = res.data.imei;
  61. // let ccid = res.data.ccid;
  62. // uni.navigateTo({
  63. // url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
  64. // });
  65. // }
  66. // });
  67. // }
  68. // });
  69. },
  70. scan2(){
  71. getDeviceInfoFromQrcode("http://wetiandi.com/app/index.php?i=1&j=1&c=entry&m=wdl_shopping&do=wepay&sn=GD1B342399").then(res=>{
  72. if(res.data != null){
  73. let imei = res.data.imei;
  74. let ccid = res.data.ccid;
  75. uni.navigateTo({
  76. url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
  77. });
  78. }
  79. });
  80. }
  81. }
  82. }
  83. </script>
  84. <style>
  85. .content {
  86. background: rgb(249, 252, 255);
  87. inset: 0;
  88. position: absolute;
  89. }
  90. .swiper {
  91. height: 22vh;
  92. }
  93. .banner{
  94. height: 22vh;
  95. width: 100%;
  96. margin-top:1vh
  97. }
  98. .swiper-box {
  99. height: 22vh;
  100. }
  101. .swiper-item {
  102. /* #ifndef APP-NVUE */
  103. display: flex;
  104. /* #endif */
  105. flex-direction: column;
  106. justify-content: center;
  107. align-items: center;
  108. color: #fff;
  109. height: 300rpx;
  110. line-height: 300rpx;
  111. }
  112. @media screen and (min-width: 500px) {
  113. .uni-swiper-dot-box {
  114. width: 400px;
  115. /* #ifndef APP-NVUE */
  116. margin: 0 auto;
  117. /* #endif */
  118. margin-top: 8px;
  119. }
  120. .image {
  121. width: 100%;
  122. }
  123. }
  124. .item{
  125. display: inline-block;
  126. width: 50%;
  127. }
  128. .item image{
  129. height: 12vh;
  130. }
  131. </style>