From 62115e77cbca335ce076f91f92314a7dded4d722 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 07 八月 2024 22:33:27 +0800
Subject: [PATCH] Merge branch 'develop'

---
 public/options.json                                |    2 
 src/index.js                                       |    5 ++
 src/menu/datasource/index.jsx                      |    8 +++
 src/pc/components/login/normal-login/options.jsx   |   15 +++++++
 src/views/login/loginform.jsx                      |   11 +++--
 src/api/index.js                                   |   10 ++++
 src/pc/components/login/normal-login/loginform.jsx |    2 
 public/README.txt                                  |    2 
 src/components/header/loginform.jsx                |   21 +++++-----
 src/menu/datasource/verifycard/index.jsx           |   39 +++++++++++++++++--
 10 files changed, 90 insertions(+), 25 deletions(-)

diff --git a/public/README.txt b/public/README.txt
index 685c921..c277902 100644
--- a/public/README.txt
+++ b/public/README.txt
@@ -20,7 +20,7 @@
 storeKey          -- 鐢靛瓙妗f鏈湴鎺堟潈鐮侊紝浣跨敤鏈湴璁稿彲瀵嗛挜鏃舵湁鏁�
 probation         -- 璇曠敤鏈燂紙YYYY-MM-DD锛夛紝鍦ㄦ寮忕郴缁熶腑锛岃瘯鐢ㄦ湡鍐呰皟鐢ㄧ郴缁熸帴鍙g殑鑴氭湰浼氳褰曚笅鏉�
 transfer          -- 鏄惁浣跨敤杞帴鍙o紝浣跨敤杞帴鍙f椂璇疯缃负 true, 浣跨敤杞帴鍙f椂锛屽閮ㄦ帴鍙h皟鐢ㄥ墠涓嶄細鍋氱櫥褰曢獙璇�
-keepPassword      -- 璁颁綇瀵嗙爜锛岄粯璁ゅ紑鍚紝褰撳�间负 false 鏃剁鐢�
+keepPwd           -- 璁颁綇瀵嗙爜锛岄粯璁ゅ紑鍚紝褰撳�间负 false 鏃剁鐢紝褰撳�间负 invisible 鏃惰浣忓瘑鐮佷絾瀵嗙爜涓嶅彲鏌ョ湅
 execType          -- 鑴氭湰浼犺緭鏂瑰紡锛屽�间负x鏃讹紝鍚敤AES鍔犲瘑
 updateStatus      -- 鏄惁鏇存柊寮�鍙戠姸鎬侊紝榛樿寮�鍚紝褰撳�间负 false 鏃剁鐢�
 forcedUpdate      -- 浼犺緭鍙峰崌绾ф椂锛屾槸鍚﹁嚜鍔ㄩ��鍑猴紝鏍煎紡涓猴紙YYYY-MM-DD锛夛紝鐢ㄤ簬鍗囩骇鍚庡埛鏂扮敤鎴锋湰鍦伴厤缃�
\ No newline at end of file
diff --git a/public/options.json b/public/options.json
index 73d5160..0c187d0 100644
--- a/public/options.json
+++ b/public/options.json
@@ -18,7 +18,7 @@
   "storeKey": "",
   "probation": "",
   "transfer": "false",
-  "keepPassword": "true",
+  "keepPwd": "true",
   "execType": "x",
   "host": "http://qingqiumarket.cn",
   "service": "MKWMS/"
diff --git a/src/api/index.js b/src/api/index.js
index 768aa69..fb91d42 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1012,7 +1012,15 @@
         data: param
       }).then(res => {
         if (res.status && res.urlPath) {
-          res.urlPath = window.GLOB.baseurl + res.urlPath
+          if (!/Content\/images/.test(res.urlPath)) {
+            let key = CryptoJS.enc.Utf8.parse('D1185ED7B32568C9')
+            let wordArray = CryptoJS.enc.Base64.parse(res.urlPath)
+            let decryptedWordArray = CryptoJS.AES.decrypt({ ciphertext: wordArray }, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
+            res.urlPath = CryptoJS.enc.Utf8.stringify(decryptedWordArray)
+          }
+          if (!/^http/.test(res.urlPath)) {
+            res.urlPath = window.GLOB.baseurl + res.urlPath
+          }
         }
         resolve(res)
       })
diff --git a/src/components/header/loginform.jsx b/src/components/header/loginform.jsx
index 5154a9c..cca3f3d 100644
--- a/src/components/header/loginform.jsx
+++ b/src/components/header/loginform.jsx
@@ -12,9 +12,9 @@
 
   state = {
     remember: false,
+    lock: false,
     username: '',
     password: '',
-    oripassword: '',
     delay: +sessionStorage.getItem('mkDelay')
   }
 
@@ -39,22 +39,17 @@
       this.setState({
         remember: true,
         username: _user.username,
-        password: _user.password ? '*********' : '',
-        oripassword: _user.password
+        password: _user.password,
+        lock: true
       })
     }
   }
 
   handleConfirm = () => {
-    const { oripassword } = this.state
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
-          if (oripassword && values.password === '*********') {
-            values.password = oripassword
-          }
-          
           values.username = values.username.replace(/\t+|\v+|\s+/g, '')
           values.password = values.password.replace(/\t+|\v+|\s+/g, '')
 
@@ -88,6 +83,12 @@
     }
   }
 
+  unLock = (e) => {
+    if (e.target.value) return
+    
+    this.setState({ lock: false })
+  }
+
   componentDidMount () {
     const { username, password } = this.state
 
@@ -102,7 +103,7 @@
 
   render() {
     const { getFieldDecorator } = this.props.form
-    const { remember, username, password, delay } = this.state
+    const { remember, username, password, delay, lock } = this.state
 
     return (
       <Form style={{margin: '0px 10px'}}>
@@ -131,7 +132,7 @@
                 message: '璇疯緭鍏ュ瘑鐮�',
               }
             ]
-          })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder="瀵嗙爜" prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
+          })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder="瀵嗙爜" visibilityToggle={!lock} onChange={this.unLock} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
         </Form.Item>
         {window.GLOB.keepKey ? <Form.Item style={{marginBottom: '10px'}}>
           {getFieldDecorator('remember', {
diff --git a/src/index.js b/src/index.js
index 3487b4a..3aea357 100644
--- a/src/index.js
+++ b/src/index.js
@@ -37,6 +37,8 @@
       }
     }
 
+    config.keepPwd = config.keepPwd || config.keepPassword
+
     let GLOB = {}
     GLOB.appId = config.appId || ''
     GLOB.lineColor = config.lineColor || ''
@@ -44,7 +46,8 @@
     GLOB.probation = false
     GLOB.watermark = config.watermark + '' !== 'false'
     GLOB.transfer = config.transfer + '' === 'true'
-    GLOB.keepKey = config.keepPassword + '' !== 'false'
+    GLOB.keepKey = config.keepPwd + '' !== 'false'
+    GLOB.vispwd = config.keepPwd + '' !== 'invisible'
     GLOB.WXAppID = config.WXAppID || ''
     GLOB.WXminiAppID = config.WXminiAppID || ''
     GLOB.WXMerchID = config.WXMerchID || ''
diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx
index 769b314..5d95704 100644
--- a/src/menu/datasource/index.jsx
+++ b/src/menu/datasource/index.jsx
@@ -288,6 +288,12 @@
     })
   }
 
+  cancel = () => {
+    this.verifyRef.closeDataSource(() => {
+      this.setState({ visible: false, loading: false })
+    })
+  }
+
   creatFunc = () => {
     const { config } = this.props
     const { mainSearch } = this.state
@@ -330,7 +336,7 @@
           onCancel={() => {this.setState({ visible: false, loading: false }) }}
           footer={[
             config.subtype !== 'dualdatacard' && record.interType === 'inner' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null,
-            <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>鍙栨秷</Button>,
+            <Button key="cancel" onClick={this.cancel}>鍙栨秷</Button>,
             <Button key="confirm" type="primary" loading={loading} onClick={this.verifySubmit}>纭畾</Button>
           ]}
           destroyOnClose
diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index c7078db..0aedf66 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -41,9 +41,8 @@
     loading: false,
     colLoading: false,
     searchKey: '',
-    initsql: '',          // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪��
     usefulfields: '',
-    defaultsql: '',       // 榛樿Sql
+    defaultsql: '',
     systemScripts: [],
     median: {},
     visible: false,
@@ -51,6 +50,7 @@
     pvisible: false,
     reload: false,
     script: null,
+    oriConfig: null,
     scriptValue: '',
     cols: null,
     colColumns: [
@@ -249,7 +249,13 @@
       median: _setting,
       searches: formatSearch(search),
       searchKey: '',
-      debugId: _setting.debugId || ''
+      debugId: _setting.debugId || '',
+      oriConfig: fromJS({
+        scripts,
+        columns: columns,
+        subColumns: subColumns,
+        setting: _setting
+      }).toJS()
     })
 
     this.getsysScript()
@@ -648,6 +654,32 @@
         this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit')
       }
     })
+  }
+
+  closeDataSource = (callback) => {
+    const { setting, columns, subColumns, scripts, oriConfig } = this.state
+
+    let line = scripts.map(item => item.sql).join('')
+    line += columns.map(item => item.field + item.datatype).join('')
+    line += subColumns.map(item => item.field + item.datatype).join('')
+    line += setting.interType + (setting.dataresource || '') + (setting.order || '') + (setting.primaryKey || '')
+
+    let _line = oriConfig.scripts.map(item => item.sql).join('')
+    _line += oriConfig.columns.map(item => item.field + item.datatype).join('')
+    _line += oriConfig.subColumns.map(item => item.field + item.datatype).join('')
+    _line += oriConfig.setting.interType + (oriConfig.setting.dataresource || '') + (oriConfig.setting.order || '') + (oriConfig.setting.primaryKey || '')
+
+    if (line !== _line) {
+      confirm({
+        content: '鏁版嵁婧愬凡淇敼锛岀‘瀹氬彇娑堝悧锛�',
+        onOk() {
+          callback()
+        },
+        onCancel() {}
+      })
+    } else {
+      callback()
+    }
   }
 
   sqlverify = (resolve, reject, type, testScripts) => {
@@ -1251,7 +1283,6 @@
               setting={setting}
               searches={searches}
               defaultsql={defaultsql}
-              initsql={this.state.initsql}
               customScripts={scripts}
               systemScripts={this.state.systemScripts}
               scriptsChange={this.scriptsChange}
diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx
index 154fadd..8790dd8 100644
--- a/src/pc/components/login/normal-login/loginform.jsx
+++ b/src/pc/components/login/normal-login/loginform.jsx
@@ -157,7 +157,7 @@
             />
           </Form.Item>
           <Form.Item>
-            <Input.Password placeholder="瀵嗙爜" prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />
+            <Input.Password placeholder="瀵嗙爜" visibilityToggle={wrap.vispwd !== 'false'} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />
           </Form.Item>
           {!activeWay.shortcut || activeWay.shortcut === 'remember' ? <Form.Item className="minline">
             <Checkbox>璁颁綇瀵嗙爜</Checkbox>
diff --git a/src/pc/components/login/normal-login/options.jsx b/src/pc/components/login/normal-login/options.jsx
index 72dae60..76b6eda 100644
--- a/src/pc/components/login/normal-login/options.jsx
+++ b/src/pc/components/login/normal-login/options.jsx
@@ -171,6 +171,21 @@
         {value: 'none', label: '鏃�'},
         {value: 'remember', label: '璁颁綇瀵嗙爜'},
         {value: 'autologon', label: '鑷姩鐧诲綍'},
+      ],
+      controlFields: [
+        {field: 'vispwd', values: ['remember', 'autologon']},
+      ]
+    },
+    {
+      type: 'radio',
+      field: 'vispwd',
+      label: '鏌ョ湅瀵嗙爜',
+      initval: wrap.vispwd || 'true',
+      tooltip: '瀵嗙爜鏄惁鍙煡鐪嬶紙瀵嗙爜妗嗗彸渚у浘鏍囨槸鍚︽樉绀猴級銆�',
+      required: false,
+      options: [
+        {value: 'true', label: '鍚敤'},
+        {value: 'false', label: '绂佺敤'},
       ]
     },
     {
diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx
index 4f4d150..0a245cf 100644
--- a/src/views/login/loginform.jsx
+++ b/src/views/login/loginform.jsx
@@ -39,6 +39,7 @@
     verdisabled: false,
     hasScan: false,
     timeout: false,
+    vispwd: window.GLOB.vispwd,
     wayLabels: {},
     dict: window.GLOB.dict,
     users: [],
@@ -102,14 +103,14 @@
       users = []
     }
 
-    if (users[0]) {
+    if (users[0] && activeKey === 'uname_pwd') {
       _user = users[0]
     }
 
     this.setState({
       users: users,
-      username: activeKey === 'uname_pwd' && _user ? _user.username : '',
-      password: activeKey === 'uname_pwd' && _user ? _user.password : '',
+      username: _user ? _user.username : '',
+      password: _user ? _user.password : '',
       smsId: smsId,
       loginWays: _loginWays,
       activeKey,
@@ -441,7 +442,7 @@
   render() {
     const { langList } = this.props
     const { getFieldDecorator } = this.props.form
-    const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang } = this.state
+    const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang, vispwd } = this.state
 
     return (
       <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}>
@@ -482,7 +483,7 @@
                   message: dict['password_required'] || '璇疯緭鍏ュ瘑鐮�',
                 }
               ]
-            })(<Input.Password placeholder={dict['password'] || '瀵嗙爜'} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
+            })(<Input.Password placeholder={dict['password'] || '瀵嗙爜'} visibilityToggle={vispwd} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
           </Form.Item>
           {window.GLOB.keepKey ? <Form.Item className="minline">
             {getFieldDecorator('remember', {

--
Gitblit v1.8.0