| | |
| | | session, |
| | | showToast, |
| | | showModal, |
| | | showInfo |
| | | showInfo, |
| | | showError |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | getAllScene, |
| | |
| | | |
| | | console.log(this.pageList[1].list) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadScene() { |
| | |
| | | const list = res?.sceneList || [] |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const list = session.getValue("scene_db") || [] |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | this.setData({ |
| | | loading: true |
| | | }) |
| | | uni.showLoading({ |
| | | title:"正在上传场景" |
| | | }) |
| | | const scene = this.pageList[0].list[index] |
| | | await handoffScene(this.ip, "", scene) |
| | | session.setValue("scene_db", []) |
| | |
| | | session.setValue("scene_db", list) |
| | | this.pageList[1].list = list |
| | | this.sceneIndex2 = -1 |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | showToast(`上传场景[${scene}]成功`) |
| | | } catch (ex) { |
| | | showInfo(ex) |
| | | showError(ex) |
| | | |
| | | } |
| | | finally { |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | |
| | | uni.hideLoading() |
| | | } |
| | | |
| | | }, |
| | |
| | | this.setData({ |
| | | loading: true |
| | | }) |
| | | console.log(this.pageList[1].list[index]) |
| | | uni.showLoading({ |
| | | title:"正在下载场景" |
| | | }) |
| | | |
| | | const data = this.pageList[1].list[index].data |
| | | const scene = this.pageList[1].list[index].name |
| | | await saveDBData(this.ip, data) |
| | | this.pageList[0].list.push(scene) |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | showToast(`下载场景[${scene}]成功`) |
| | | |
| | | } catch (ex) { |
| | | showInfo(ex) |
| | | showError(ex) |
| | | } |
| | | finally { |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | uni.hideLoading() |
| | | } |
| | | |
| | | }, |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |