| | |
| | | <swiper v-if="pageList.length > 0" circular indicator-dots class="swiper" :current="currentPage" |
| | | @change="changeSwiper"> |
| | | <swiper-item v-for="(page,index) in pageList" class="swiper-item"> |
| | | |
| | | <view class="vehicle-header"> |
| | | <view class="link-view"> |
| | | <view v-if="page.link_status"> |
| | |
| | | |
| | | </view> |
| | | |
| | | |
| | | </swiper-item> |
| | | <swiper-item class="swiper-item"> |
| | | |
| | | <image class="title-img gray-image" src="/images/image 15.png" alt="图片" /> |
| | | <image class="title-img gray-image" src="/images/image_15.png" alt="图片" /> |
| | | <view class="button-group"> |
| | | <a-button type="primary" class="button" @click="clickScanCode">扫描添加设备</a-button> |
| | | <a-button type="ghost" class="button" @click="clickManualAdd">手动添加设备</a-button> |
| | |
| | | </swiper> |
| | | <view v-else class="no-page items-center"> |
| | | <view class="content "> |
| | | <image class="title-img gray-image" src="/images/image 15.png" alt="图片" /> |
| | | <image class="title-img gray-image" src="/images/image_15.png" alt="图片" /> |
| | | <view class="button-group"> |
| | | <a-button type="primary" class="button" @click="clickScanCode">扫描添加设备</a-button> |
| | | <a-button type="ghost" class="button" @click="clickManualAdd">手动添加设备</a-button> |
| | |
| | | console.log("hide") |
| | | }, |
| | | computed: { |
| | | |
| | | tabList() { |
| | | return [...this.pageList, { |
| | | ip: "" |
| | | }] |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | setData(obj) { |
| | | let that = this; |
| | |
| | | break |
| | | } |
| | | } |
| | | |
| | | this.pageList = [...list] |
| | | this.setData({ |
| | | pageList: list |
| | | }) |
| | | //this.pageList = [...list] |
| | | } else { |
| | | this.setData({ |
| | | currentPage: curIndex |
| | |
| | | page.soc = 0 |
| | | page.link_status = false |
| | | } |
| | | } |
| | | this.pageList = [...list] |
| | | } |
| | | |
| | | // this.pageList = [...list] |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | // showError(ex) |
| | | showToast(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | this.navigationBarTitle = "添加设备" |
| | | else |
| | | this.navigationBarTitle = this.pageList[this.currentPage].name |
| | | this.loadVehicleBattery() |
| | | }, |
| | | async clickRelink() { |
| | | try { |
| | |
| | | pageList: list |
| | | }) |
| | | session.setValue("vehicles", list) |
| | | if (list.length > 0) |
| | | that.navigationBarTitle = that.pageList[that.currentPage].name |
| | | else |
| | | that.navigationBarTitle = "添加设备" |
| | | // if (list.length > 0) |
| | | // that.navigationBarTitle = that.pageList[that.currentPage].name |
| | | // else |
| | | // that.navigationBarTitle = "添加设备" |
| | | uni.reLaunch({ |
| | | url:"/pages/indde/index" |
| | | }) |
| | | }, |
| | | update_vehicle: function(data) { |
| | | console.log("update_vehicle", data) |
| | |
| | | }, |
| | | async clickToMap(index, page) { |
| | | try { |
| | | |
| | | console.log("clicktomap") |
| | | const _this = this |
| | | // const res = await getAllScene(page.ip) || [] |
| | | // const list = res?.sceneList || [] |
| | | // if (list.length === 0) { |
| | | // uni.navigateTo({ |
| | | // url: `/pages/scene/index?ip=${page.ip}`, |
| | | // events: { |
| | | // // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 |
| | | // finish: function() { |
| | | // _this.clickToMap(index, page) |
| | | // }, |
| | | // } |
| | | // }) |
| | | // return |
| | | // } |
| | | const res = await getAllScene(page.ip) || [] |
| | | const list = res?.sceneList || [] |
| | | if (list.length === 0) { |
| | | uni.navigateTo({ |
| | | url: `/pages/map/scene?ip=${page.ip}`, |
| | | events: { |
| | | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 |
| | | create_finish: function() { |
| | | setTimeout(() => { |
| | | _this.clickToMap(index, page) |
| | | }, 500); |
| | | |
| | | }, |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | // getApp().globalData.sceneList = list |
| | | |
| | | uni.navigateTo({ |
| | |
| | | showModal(`确定要删除设备“${ page.name}”吗`, "警告", true, "确定", "取消").then((res) => { |
| | | if (res) { |
| | | const list = this.pageList |
| | | const curPage = this.currentPage |
| | | let curPage = this.currentPage |
| | | list.splice(this.currentPage, 1) |
| | | this.setData({ |
| | | currentPage: curPage, |
| | | pageList: list |
| | | }) |
| | | |
| | | // this.setData({ |
| | | // currentPage: 0, |
| | | // pageList: list |
| | | // }) |
| | | console.log(curPage, this.currentPage, this.pageList) |
| | | session.setValue("vehicles", list) |
| | | if (list.length > 0) |
| | | this.navigationBarTitle = this.pageList[this.currentPage].name |
| | | else |
| | | this.navigationBarTitle = "添加设备" |
| | | // if (list.length > 0) |
| | | // this.navigationBarTitle = this.pageList[this.currentPage].name |
| | | // else |
| | | // this.navigationBarTitle = "添加设备" |
| | | uni.reLaunch({ |
| | | url: "/pages/index/index" |
| | | }) |
| | | |
| | | } |
| | | }) |