From 57266ee8c62f0fddb42c18c705507fc0dc2416f6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 18 八月 2023 17:42:39 +0800
Subject: [PATCH] 2023-08-18

---
 src/menu/components/share/sourcecomponent/inputform/index.jsx |   58 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx
index b1a4249..5f552ce 100644
--- a/src/menu/components/share/sourcecomponent/inputform/index.jsx
+++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx
@@ -36,7 +36,7 @@
 
   UNSAFE_componentWillMount () {
     if (this.props.keyword === 'system') {
-      this.init()
+      this.preInit()
     }
   }
 
@@ -54,26 +54,40 @@
     return !is(fromJS(this.state), fromJS(nextState))
   }
 
-  init = () => {
+  preInit = () => {
     const { type } = this.props
 
-    let originlist = []
-    if (type === 'video') {
-      let videos = sessionStorage.getItem('app_videos')
-      try {
-        originlist = JSON.parse(videos)
-      } catch (e) {
-        originlist = []
-      }
-    } else {
-      let pictures = sessionStorage.getItem('app_pictures')
-      try {
-        originlist = JSON.parse(pictures)
-      } catch (e) {
-        originlist = []
-      }
-    }
+    let _type = type === 'video' ? 'video' : 'image'
+    let _sname = type === 'video' ? 'app_videos' : 'app_pictures'
 
+    this.getSource(_type, _sname).then(res => {
+      this.init(res)
+    })
+  }
+
+  getSource = (type, sessionName) => {
+    return new Promise(resolve => {
+      if (window.GLOB[sessionName]) {
+        resolve(window.GLOB[sessionName])
+      } else {
+        let param = {
+          func: 's_url_db_adduptdel',
+          PageIndex: 0,  // 0 浠h〃鍏ㄩ儴
+          PageSize: 0,   // 0 浠h〃鍏ㄩ儴
+          type: 'search',
+          typecharone: type
+        }
+        Api.getCloudConfig(param).then(res => {
+          let data = res.data || []
+          window.GLOB[sessionName] = data
+
+          resolve(data)
+        })
+      }
+    })
+  }
+
+  init = (originlist) => {
     let list = originlist
     let pagelist = list.filter((item, index) => index < this.state.pageSize)
 
@@ -136,11 +150,11 @@
       }).then(result => {
         if (result.status) {
           if (card.typecharone === 'image') {
-            sessionStorage.setItem('app_pictures', JSON.stringify(result.data || []))
-            this.init()
+            window.GLOB.app_pictures = result.data || []
+            this.init(result.data || [])
           } else {
-            sessionStorage.setItem('app_videos', JSON.stringify(result.data || []))
-            this.init()
+            window.GLOB.app_videos = result.data || []
+            this.init(result.data || [])
           }
           this.setState({editvisible: false})
         } else {

--
Gitblit v1.8.0