cuiqian2004
2025-09-19 d8743368ffda9bc0fb2c6818f695a9a6b1079e57
pages/index/backup.vue
@@ -72,7 +72,8 @@
      session,
      showToast,
      showModal,
      showInfo
      showInfo,
      showError
   } from "@/comm/utils.js"
   import {
      getAllScene,
@@ -139,7 +140,7 @@
               
               console.log(this.pageList[1].list)
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async loadScene() {
@@ -148,7 +149,7 @@
               const list = res?.sceneList || []
               return list
            } catch (ex) {
               this.showError(ex)
               showError(ex)
               return []
            }
         },
@@ -157,7 +158,7 @@
               const list = session.getValue("scene_db") || []
               return list
            } catch (ex) {
               this.showError(ex)
               showError(ex)
               return []
            }
         },
@@ -211,6 +212,9 @@
               this.setData({
                  loading: true
               })
               uni.showLoading({
                  title:"正在上传场景"
               })
               const scene = this.pageList[0].list[index]
               await handoffScene(this.ip, "", scene)
               session.setValue("scene_db", [])
@@ -222,15 +226,16 @@
               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()
            }
         },
@@ -256,30 +261,29 @@
               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>