From 8e003c1a94d26cc4d477e7aa03593ccb4d7e6c61 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 11 十月 2024 17:47:40 +0800
Subject: [PATCH] 2024-10-11

---
 src/views/pcdesign/index.jsx |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 102 insertions(+), 10 deletions(-)

diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx
index b1abf07..0638e83 100644
--- a/src/views/pcdesign/index.jsx
+++ b/src/views/pcdesign/index.jsx
@@ -9,8 +9,8 @@
 import md5 from 'md5'
 
 import Api from '@/api'
-import Utils, { setGLOBFuncs } from '@/utils/utils.js'
-import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
+import Utils from '@/utils/utils.js'
+import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
@@ -68,7 +68,9 @@
     eyeopen: false,
     view: '',
     popConfig: null,
-    needUpdate: false
+    needUpdate: false,
+    appLoginId: '',
+    appHomeId: ''
   }
 
   UNSAFE_componentWillMount() {
@@ -115,10 +117,33 @@
           sessionStorage.removeItem('applangList')
         }
 
+        if (param.wxAppId) {
+          sessionStorage.setItem('wxAppId', param.wxAppId)
+        }
+
         this.getAppMessage(param.MenuID)
       } else if (param.type === 'view') {
+        let appLoginId = ''
+        let appHomeId = ''
+        if (sessionStorage.getItem('appViewList')) {
+          try {
+            let appMenus = JSON.parse(sessionStorage.getItem('appViewList'))
+            appMenus.forEach(item => {
+              if (item.keys_type === 'login') {
+                appLoginId = item.keys_id
+              } else if (item.keys_type === 'index') {
+                appHomeId = item.keys_id
+              }
+            })
+          } catch (e) {
+
+          }
+        }
+
         this.setState({
-          MenuId: param.MenuID
+          MenuId: param.MenuID,
+          appLoginId: appLoginId,
+          appHomeId: appHomeId
         }, () => {
           this.getMenuParam(param)
         })
@@ -152,9 +177,13 @@
     MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
     MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave)
 
+    if (sessionStorage.getItem('wxAppId')) {
+      window.GLOB.WXAppID = sessionStorage.getItem('wxAppId')
+    }
+
     setTimeout(() => {
       this.getRoleFields()
-      setGLOBFuncs()
+      // setGLOBFuncs()
     }, 1000)
 
     document.onkeydown = (event) => {
@@ -1152,6 +1181,8 @@
     } else if (this.checklog()) {
       if (sessionStorage.getItem('applangList') && !config.trans) {
 
+      } else if (config.enabled && !config.allSqls) {
+        
       } else {
         notification.success({
           top: 92,
@@ -1176,6 +1207,52 @@
       } else if (!config.enabled && config.force && _pass) {
         config.enabled = true
         delete config.force
+      }
+
+      let long_data = ''
+      if (config.enabled) {
+        let sqls = getAllSqls(config)
+        let _t = moment().format('YYYYMMDDHHmmss')
+        let getguid = () => {
+          let uuid = ''
+          for (let i = 0; i < 18; i++) {
+            uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65)
+          }
+          uuid = uuid.replace(/minke/ig, 'MNKIE')
+          return uuid
+        }
+
+        long_data = []
+        let oriIds = {}
+        if (config.allSqls) {
+          config.allSqls.forEach(item => {
+            if (!item.md5) return
+            oriIds[item.uuid + item.md5] = item.v_id
+          })
+        }
+        
+        config.allSqls = sqls.map(item => {
+          let v_id = _t + getguid()
+
+          if (oriIds[item.uuid + item.md5]) {
+            v_id = oriIds[item.uuid + item.md5]
+          }
+          
+          long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))}`)
+          
+          return {
+            uuid: item.uuid,
+            v_id: v_id,
+            type: item.type,
+            reps: item.reps,
+            md5: item.md5 || '',
+            luser: item.luser === true
+          }
+        })
+
+        long_data = long_data.join(';')
+      } else {
+        delete config.allSqls
       }
 
       if (config.cacheUseful !== 'true') {
@@ -1228,7 +1305,10 @@
       }
 
       let interfaces = getFuncsAndInters(config)
+      let msg = getOutMessage(config)
       roleParam.interfaces = interfaces
+      roleParam.msg = msg
+      roleParam.backend = 'level1'
       let langSql = getLangTrans(config)
 
       let param = {
@@ -1243,9 +1323,10 @@
         TypeCharOne: sessionStorage.getItem('kei_no'),
         Typename: 'pc',
         MenuName: config.MenuName || '',
-        PageParam: JSON.stringify({Template: 'webPage', interfaces}),
+        PageParam: JSON.stringify({Template: 'webPage', interfaces, msg}),
         menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))),
         open_edition: config.open_edition,
+        long_data: long_data,
         // LText: '',
         // LTexttb: '',
         menus_used_list,
@@ -1617,6 +1698,8 @@
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
     param.secretkey = Utils.encrypt('', param.timestamp)
 
+    const that = this
+
     confirm({
       title: '纭畾璁剧疆鏈〉闈负棣栭〉鍚楋紵',
       content: '',
@@ -1630,6 +1713,10 @@
             })
           } else {
             sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
+
+            that.setState({
+              appHomeId: config.MenuID
+            })
           }
         })
       },
@@ -1677,6 +1764,7 @@
     param.secretkey = Utils.encrypt('', param.timestamp)
 
     let hasLogin = config.components.findIndex(item => item.type === 'login') > -1
+    const that = this
 
     confirm({
       title: '纭畾璁剧疆鏈〉闈负鐧诲綍椤靛悧锛�',
@@ -1691,6 +1779,10 @@
             })
           } else {
             sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
+
+            that.setState({
+              appLoginId: config.MenuID
+            })
           }
         })
       },
@@ -1719,7 +1811,7 @@
   }
 
   render () {
-    const { view, loading, comloading, activeKey, settingshow, controlshow, MenuId, config, menuloading, eyeopen, needUpdate } = this.state
+    const { view, loading, comloading, activeKey, settingshow, controlshow, MenuId, config, menuloading, eyeopen, needUpdate, appLoginId, appHomeId } = this.state
 
     return (
       <>
@@ -1767,7 +1859,7 @@
                 {!controlshow ? <DoubleLeftOutlined onClick={() => {sessionStorage.setItem('controlshow', 'true'); this.setState({controlshow: true})}}/> : null}
               </div>
               <div className="wrap">
-                <Button type="primary" className={needUpdate ? 'update-tip' : ''} id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
+                <Button type="primary" className={needUpdate ? 'update-tip' : ''} disabled={!config} id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
                 {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                 <ArrowLeftOutlined title="鍚庨��" className="back-view" onClick={this.backView}/>
                 {config ? <Debug config={config}/> : null}
@@ -1780,8 +1872,8 @@
                 <PictureController/>
                 <Quotecomponent config={config} updateConfig={this.updateConfig}/>
                 <StyleCombControlButton menu={config} />
-                <Button className="mk-border-green" onClick={this.setHomeView}><HomeOutlined /> 璁句负棣栭〉</Button>
-                <Button className="mk-border-purple" onClick={this.setLoginView}><LoginOutlined/> 璁句负鐧诲綍椤�</Button>
+                <Button className="mk-border-green" disabled={MenuId === appHomeId} onClick={this.setHomeView}><HomeOutlined /> 璁句负棣栭〉</Button>
+                <Button className="mk-border-purple" disabled={MenuId === appLoginId} onClick={this.setLoginView}><LoginOutlined/> 璁句负鐧诲綍椤�</Button>
                 <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                 <Transfer MenuID={MenuId} />
                 {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}

--
Gitblit v1.8.0