| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <template>
- <view class="content">
- <!-- <view class="banner">
- <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
- <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
- <swiper-item v-for="(item, index) in data" :key="index">
- <view class="swiper-item" @click="clickBannerItem(item)">
- <image :src="imgUrl+item.image" mode="aspectFill" :draggable="false" />
- </view>
- </swiper-item>
- </swiper>
- </uni-swiper-dot>
- </view> -->
- <view style="height: 10vh;text-align: center;">
- <image style="height: 3vh;width: 35vw;margin-top: 5vh;"
- src="../static/images/new/starts/login/backImg2.png"></image>
- </view>
- <view style="text-align: center;top:12vh;position: relative;color: aliceblue;">
- <view style="font-size: 30rpx;">Charge up from the Ontions Below</view>
- <!-- <view style="font-size: 20rpx;">Charge up quickly & easily to enjoy a smarter life!</view> -->
- </view>
- <view style="margin:0 5vw;left:0px;right:0px;text-align: center;top:45vh;position: absolute;display: flex;flex-direction: rows;justify-content: space-evenly;">
- <!-- <view style="color:white;width:80px;">
- 设备编号
- </view> -->
- <view style="text-align: center;margin-top: -15vh">
- <view>
- <view class="blue" @click="buleTeeth()">
- <image :src="blueStatus==0?'../static/images/new/starts/index/blue.png':'../static/images/new/starts/index/blueto.png'"
- style="width: 60px;height: 60px;margin-top: 2vh;"></image>
- </view>
- <view style="color: aliceblue;">
- Scan With Bluetooth
- </view>
- </view>
- <view>
- <view class="" @click="scan">
- <image :src="scanStatus==0?'../static/images/new/starts/index/scan.png':'../static/images/new/starts/index/scanto.png'"
- style="width: 60px;height: 60px;margin-top: 2vh;"></image>
- </view>
- <view style="color: aliceblue;">
- Scan QR Code
- </view>
- </view>
- <view>
- <view class="" @click="wifi">
- <image :src="wifiStatus==0?'../static/images/new/starts/WiFi.png':'../static/images/new/starts/WIFIto.png'"
- style="width: 60px;height: 60px;margin-top: 2vh;"></image>
- </view>
- <view style="color: aliceblue;">
- Wifi Config
- </view>
- </view>
- <!-- <view class="" @click="scan">
- <image src="../static/images/new/starts/index/bind.png" style="width: 60px;height: 60px;margin-top: 2vh;"
- ></image>
- </view> -->
- <!-- <u--input v-model="sn" placeholder="请输入设备编号" color="white"
- style="width: 10vw;padding-left:10px;background: rgb(90, 88, 115);text-align: left;font-size: 20px;width:90vw;border-radius: 100vh;height: 40px;">
- <u-button slot="suffix" @click="binddevice"
- style="background: #505086;color:white;border-radius: 100vh;width: 120px;margin-right: -10px;">绑 定</u-button>
- </u--input> -->
- </view>
-
- <view style="position:fixed;bottom:10px;display: flex;align-items: center;justify-content: center;text-align: center;left:0px;right:0px;">
- <!-- <image style="height: 3vh;width: 35vw;position: absolute;bottom: 13vh;left: 32.5vw;" src="../static/images/new/starts/login/backImg2.png"></image> -->
- <view @click="skip(0)" style="margin:0px 10px;">
- <image src="@/static/images/new/starts/tabbar/one_on.png"
- style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
- </view>
- <view @click="skip(1)" style="margin:0px 10px;">
- <image src="@/static/images/new/starts/tabbar/two_off.png"
- style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
- </view>
- <view @click="skip(2)" style="margin:0px 10px;">
- <image src="@/static/images/new/starts/tabbar/three_off.png"
- style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
- </view>
- </view>
- </view>
- <!-- <view class="container">
- <view class="item" @click="buleTeeth">
- <image :src = "imgUrl+'/index/bluetooth.png'"/>
- <view class="item-text">{{i18('蓝牙连接')}}</view>
- </view>
- <view class="item" @click="scan">
- <image :src = "imgUrl+'/index/scan.png'"/>
- <view class="item-text">{{i18('扫码绑定')}}</view>
- </view>
- <view class="item" @click="devicelist">
- <image :src = "imgUrl+'/index/device-2.png'"/>
- <view class="item-text">{{i18('设备列表')}}</view>
- </view>
- <view class="item" @click="wifi">
- <image :src = "imgUrl+'/index/bluetooth.png'"/>
- <view class="item-text">{{i18('WIFI配网')}}</view>
- </view>
- </view> -->
- </view>
- </template>
- <script>
- import {
- getDeviceInfoFromQrcode,
- bindDevice
- } from '@/api/device/device.js'
- import i18 from '@/utils/i18.js'
- export default {
- data: function() {
- return {
- current: 0,
- swiperDotIndex: 0,
- data: [{
- image: '/index/banner-index.png'
- }],
- blueStatus: 0,
- scanStatus: 0,
- wifiStatus:0,
- }
- },
- computed: {
- imgUrl() {
- return getApp().globalData.config.imgUrl;
- }
- },
- onLoad: function() {},
- onShow() {
- uni.setNavigationBarTitle({
- title: " "
- })
- //console.log("???"+ uni.getStorageSync('blueStatus')+'||'+uni.getStorageSync('scanStatus')+'||'+uni.getStorageSync('wifiStatus'))
- this.blueStatus=uni.getStorageSync('blueStatus')!=null?uni.getStorageSync('blueStatus'):0
- this.scanStatus=uni.getStorageSync('scanStatus')!=null?uni.getStorageSync('scanStatus'):0
- this.wifiStatus=uni.getStorageSync('wifiStatus')!=null?uni.getStorageSync('wifiStatus'):0
- },
- methods: {
- iconStatus(type){
- if(type==1){
- this.blueStatus=1
- this.scanStatus=0
- this.wifiStatus=0
- uni.setStorageSync('blueStatus',1)
- uni.setStorageSync('scanStatus',0)
- uni.setStorageSync('wifiStatus',0)
- }else if(type==2){
- this.blueStatus=0
- this.scanStatus=1
- this.wifiStatus=0
- uni.setStorageSync('blueStatus',0)
- uni.setStorageSync('scanStatus',1)
- uni.setStorageSync('wifiStatus',0)
- }else{
- this.blueStatus=0
- this.scanStatus=0
- this.wifiStatus=1
- uni.setStorageSync('blueStatus',0)
- uni.setStorageSync('scanStatus',0)
- uni.setStorageSync('wifiStatus',1)
- }
- },
- skip(type) {
- if (type == 0) {
- uni.reLaunch({
- url: '/pages/index'
- })
- } else if (type == 1) {
- uni.reLaunch({
- url: '/pages/weitiandi/deviceList'
- })
- } else if (type == 2) {
- uni.reLaunch({
- url: '/pages/mine/index'
- })
- }
- },
- devicelist() {
- uni.navigateTo({
- url: '/pages/weitiandi/deviceList'
- });
- },
- i18(text) {
- return i18(text)
- },
- buleTeeth() {
- this.iconStatus(1)
- uni.navigateTo({
- url: '/pages/bluetooth/index/index'
- });
- },
- wifi() {
- this.iconStatus(3)
- uni.navigateTo({
- url: '/pages/bluetooth/index/wifi'
- });
- },
- toBind(qrcode) {
- bindDevice(qrcode).then(res => {
- let data = res.data;
- if (data != null) {
- let imei = res.data.imei;
- let ccid = res.data.ccid;
- let qrcode = res.data.qrcode;
- let uuid = res.data.uuid;
- this.$modal.showToast("绑定成功");
- } else {
- this.$modal.showToast("绑定失败");
- }
- })
- },
- scan() {
- this.iconStatus(2)
- let self = this;
- uni.scanCode({
- success: function(res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- getDeviceInfoFromQrcode(res.result).then(res => {
- if (res.data != null) {
- let imei = res.data.imei;
- let ccid = res.data.ccid;
- let qrcode = res.data.qrcode;
- let uuid = res.data.userId;
- if (uuid) {
- self.$modal.showToast("该设备已被绑定");
- } else {
- self.$modal.confirm("确认绑定该设备?").then(res => {
- self.toBind(qrcode)
- })
- }
- // uni.navigateTo({
- // url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
- // });
- } else {
- self.$modal.showToast("找不到设备,请联系管理员");
- }
- });
- }
- });
- },
- scan2() {
- let self = this;
- getDeviceInfoFromQrcode("http://wetiandi.com/index.php?do=wepay&sn=GD1B388803").then(res => {
- if (res.data != null) {
- let imei = res.data.imei;
- let ccid = res.data.ccid;
- let qrcode = res.data.qrcode;
- let uuid = res.data.userId;
- if (uuid) {
- self.$modal.showToast("该设备已被绑定");
- } else {
- self.$modal.confirm("确认绑定该设备?").then(res => {
- self.toBind(qrcode)
- })
- }
- // uni.navigateTo({
- // url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
- // });
- } else {
- self.$modal.showToast("找不到设备,请联系管理员");
- }
- });
- }
- }
- }
- </script>
- <style>
-
- .content {
- background-image: url('../static/images/new/starts/bg1.jpg');
- background-color: #050609;
- background-size: cover;
- background-repeat: no-repeat;
- inset: 0;
- position: absolute;
- height: 100%;
- width: 100%;
- }
- .swiper {
- height: 22vh;
- }
- .banner {
- height: 22vh;
- width: 100%;
- margin-top: 1vh
- }
- .swiper-box {
- height: 22vh;
- }
- .swiper-item {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: column;
- justify-content: center;
- align-items: center;
- color: #fff;
- height: 300rpx;
- line-height: 300rpx;
- }
- @media screen and (min-width: 500px) {
- .uni-swiper-dot-box {
- width: 400px;
- /* #ifndef APP-NVUE */
- margin: 0 auto;
- /* #endif */
- margin-top: 8px;
- }
- .image {
- width: 100%;
- }
- }
- .item {
- display: inline-block;
- width: 50%;
- position: relative;
- }
- .item image {
- height: 12vh;
- }
- .item-text {
- position: absolute;
- top: 30px;
- left: 50%;
- }
- </style>
|