index.vue 3.0 KB

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