index.vue 3.3 KB

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