From ce2b708f61de1855771d78f35309bd77df9d3b15 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 09 八月 2020 23:28:08 +0800 Subject: [PATCH] 2020-08-09 --- src/tabviews/treepage/index.jsx | 2 src/tabviews/formtab/index.jsx | 2 src/components/header/index.jsx | 9 src/mob/datasource/verifycard/customscript/index.jsx | 7 src/mob/datasource/index.jsx | 12 public/options.json | 1 src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.scss | 3 src/mob/components/login/mob-login-2/index.jsx | 290 +++++++++++++++------ src/api/index.js | 230 +++++++++++++++++ src/tabviews/subtable/index.jsx | 2 src/tabviews/subtabtable/index.jsx | 2 src/tabviews/commontable/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 2 public/README.txt | 1 src/index.js | 16 + src/mob/components/login/mob-login-2/index.scss | 5 src/mob/datasource/index.scss | 8 src/mob/contdelete/index.scss | 25 + src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.jsx | 7 src/tabviews/zshare/actionList/printbutton/index.jsx | 2 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 22 - src/mob/contdelete/index.jsx | 59 ++++ src/mob/datasource/verifycard/customscript/index.scss | 3 src/tabviews/zshare/verifycard/index.jsx | 2 src/mob/contupdate/index.jsx | 2 src/templates/sharecomponent/treesettingcomponent/settingform/index.scss | 9 src/views/login/index.jsx | 12 27 files changed, 594 insertions(+), 143 deletions(-) diff --git a/public/README.txt b/public/README.txt index 1dcfbce..50a998f 100644 --- a/public/README.txt +++ b/public/README.txt @@ -5,4 +5,5 @@ mainSystemApi -- sso绯荤粺鐨勬帴鍙h矾寰勶紝娉細涓氬姟绯荤粺闇�瑕佸~鍐欙紝涓斿�间负閫氱敤鎺ュ彛鐨勫畬鏁磋矾寰� systemType -- 鍒ゆ柇涓氬姟绯荤粺涓烘祴璇� (绌�) 鎴栨寮� (production) 锛屾寮忕郴缁熷紑鍙戞潈闄愬彧鍚湁绯荤粺鍗囩骇绛夐檺瀹氬姛鑳� lineColor -- 鐧诲綍椤靛垎鍓茬嚎棰滆壊 +webStorage -- 鍓嶇瀛樺偍锛屼娇鐢ㄦ椂濉叆websql filter -- 椤甸潰婊ら暅锛屽�间负'true'鏃讹紝椤甸潰鏄剧ず涓洪粦鐧借壊 \ No newline at end of file diff --git a/public/options.json b/public/options.json index a918828..9547a18 100644 --- a/public/options.json +++ b/public/options.json @@ -4,5 +4,6 @@ "mainSystemApi": "http://cloud.mk9h.cn/webapi/dostars", "systemType": "", "lineColor": "", + "webStorage": "websql", "filter": "false" } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index d917c41..bae643c 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,6 +6,32 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' +let mkDB = null + +if (window.GLOB.webSqlUsable) { + let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' + try { + mkDB = openDatabase(`mkdb${service}`, '1', 'mk-pc-database', 50 * 1024 * 1024) + mkDB.transaction(tx => { + tx.executeSql('CREATE TABLE IF NOT EXISTS VERSIONS (id unique, version varchar(50), CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { + + }, () => { + // eslint-disable-next-line + throw 'CREATE TABLE ERROR' + }) + tx.executeSql('CREATE TABLE IF NOT EXISTS CONFIGS (id unique, menuid varchar(50), userid varchar(50), openEdition varchar(50), webEdition varchar(50), LongParam text, LongParamUser text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50), CDefine4 varchar(50), CDefine5 varchar(50))', [], () => { + + }, () => { + // eslint-disable-next-line + throw 'CREATE TABLE ERROR' + }) + }) + } catch (e) { + console.warn(e) + mkDB = null + } +} + axios.defaults.crossDomain = true axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.withCredentials = true @@ -199,6 +225,82 @@ } /** + * @description 鑾峰彇绯荤粺鍩烘湰璁剧疆锛屽惎鐢ㄦ垨鏇存柊websql + */ + getSystemStyle () { + // 鑾峰彇绯荤粺淇℃伅 + let param = { + func: 's_Get_style', + TypeCharOne: 'PC', + LText: `select '${window.GLOB.appkey}'`, + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.userid = sessionStorage.getItem('UserID') || '' + param.lang = localStorage.getItem('lang') || '' + param.SessionUid = localStorage.getItem('SessionUid') || '' + param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.appkey = window.GLOB.appkey || '' + + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + + param.nonc = Utils.getuuid() + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + if (key === 'rduri' || key === 't') return + if (typeof(param[key]) === 'object') { + values += key + JSON.stringify(param[key]) + } else { + values += key + param[key] + } + }) + param.sign = md5(values) + param.t = new Date().getTime() + + return new Promise(resolve => { + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + data: param + }).then(res => { + if (mkDB) { + let version = res.app_version ? `${res.app_version}` : '1' + // mkDB.transaction(tx => { + // tx.executeSql('DROP TABLE CONFIGS') + // }) + + mkDB.transaction(tx => { + tx.executeSql('SELECT * FROM VERSIONS', [], (tx, results) => { + if (results.rows.length === 0) { + tx.executeSql('INSERT INTO VERSIONS (id, version) VALUES (?, ?)', ['pc', version]) + tx.executeSql('DELETE FROM CONFIGS') + } else if (results.rows.length === 1) { + let _ver = results.rows[0] + if (version !== _ver.version) { + tx.executeSql(`UPDATE VERSIONS SET version=${version}`) + tx.executeSql('DELETE FROM CONFIGS') + } + } else if (results.rows.length > 1) { + tx.executeSql('DELETE FROM VERSIONS') + tx.executeSql('INSERT INTO VERSIONS (id, version) VALUES (?, ?)', ['pc', version]) + tx.executeSql('DELETE FROM CONFIGS') + } + }, (tx, results) => { + console.warn(results) + }) + }) + } + resolve(res) + }) + }) + } + + /** * @description 鑾峰彇鎴栦慨鏀逛簯绔厤缃� */ getCloudConfig (param) { @@ -311,6 +413,133 @@ } /** + * @description 鑾峰彇绯荤粺閰嶇疆锛屽彇鍊间紭鍏堢瓑绾ebsql銆佺紦瀛樸�佹湇鍔″櫒 + * @param {Object} param 璇锋眰鍙傛暟 + */ + getCacheConfig (param) { + param.userid = sessionStorage.getItem('UserID') || '' + param.lang = localStorage.getItem('lang') || '' + param.SessionUid = localStorage.getItem('SessionUid') || '' + param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.appkey = window.GLOB.appkey || '' + + if (sessionStorage.getItem('isEditState') === 'true') { // 缂栬緫鐘舵�侊紝鍗曠偣鐧诲綍鏈嶅姟鍣ㄤ负浜戠 + if (options.cloudServiceApi) { // 瀛樺湪浜戠鍦板潃鏃讹紝浣跨敤浜戠绯荤粺鍙傛暟 + param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + } + } else if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + + let _param = JSON.parse(JSON.stringify(param)) // 缂撳瓨鏍¢獙锛屽幓闄ゆ椂闂村拰鍔犲瘑瀛楃 + delete _param.timestamp + delete _param.secretkey + delete _param.open_key + _param = JSON.stringify(_param) + _param = md5(_param) + + if (mkDB) { + param.nonc = Utils.getuuid() + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + if (key === 'rduri' || key === 't') return + if (typeof(param[key]) === 'object') { + values += key + JSON.stringify(param[key]) + } else { + values += key + param[key] + } + }) + param.sign = md5(values) + param.t = new Date().getTime() + + return new Promise(resolve => { + mkDB.transaction(tx => { + tx.executeSql(`SELECT * FROM CONFIGS WHERE menuid='${param.MenuID}' and userid='${param.userid}'`, [], (tx, results) => { + let paramItem = results.rows[0] + if (paramItem) { + resolve({ + ErrCode: 'S', + ErrMesg: '', + LongParam: paramItem.LongParam, + LongParamUser: paramItem.LongParamUser, + message: '', + open_edition: paramItem.openEdition, + status: true, + web_edition: paramItem.webEdition + }) + } else { + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + data: param + }).then(res => { + if (res.status) { + this.writeInWebSql([param.MenuID, param.MenuID, param.userid, res.open_edition, res.web_edition, res.LongParam, res.LongParamUser]) + } + resolve(res) + }) + } + }, (tx, results) => { + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + data: param + }).then(res => { + if (res.status) { + window.GLOB.CacheMap.set(_param, res) + } + resolve(res) + }) + mkDB = null + console.warn(results) + }) + }) + }) + } else if (window.GLOB.CacheMap.has(_param)) { + return Promise.resolve(window.GLOB.CacheMap.get(_param)) + } else { + param.nonc = Utils.getuuid() + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + if (key === 'rduri' || key === 't') return + if (typeof(param[key]) === 'object') { + values += key + JSON.stringify(param[key]) + } else { + values += key + param[key] + } + }) + param.sign = md5(values) + param.t = new Date().getTime() + + return new Promise(resolve => { + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + data: param + }).then(res => { + if (res.status) { + window.GLOB.CacheMap.set(_param, res) + } + resolve(res) + }) + }) + } + } + + /** + * @description 灏嗘暟鎹啓鍏ebsql + */ + writeInWebSql (data) { + if (!mkDB) return + mkDB.transaction(tx => { + tx.executeSql('INSERT INTO CONFIGS (id, menuid, userid, openEdition, webEdition, LongParam, LongParamUser) VALUES (?, ?, ?, ?, ?, ?, ?)', data) + }) + } + + /** * @description 鑾峰彇绯荤粺閰嶇疆锛屼紭鍏堜粠缂撳瓨涓彇鍊硷紝澧炲姞appkey * @param {Object} param 璇锋眰鍙傛暟 * @param {Boolean} SSO 鏄惁涓哄崟鐐圭櫥褰曞湴鍧� @@ -335,6 +564,7 @@ let _param = JSON.parse(JSON.stringify(param)) // 缂撳瓨鏍¢獙锛屽幓闄ゆ椂闂村拰鍔犲瘑瀛楃 delete _param.timestamp delete _param.secretkey + delete _param.open_key _param = JSON.stringify(_param) _param = md5(_param) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index d3638de..40bbeb0 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -579,7 +579,10 @@ result.UserRoles.forEach(role => { role.RoleMenu.forEach(menu => { if (!menu.MenuID) return - if (menukeys.includes(menu.MenuID)) return + if (menukeys.includes(menu.MenuID)) { + console.warn('s_Get_TrdMenu_Role閲嶅鐨勮彍鍗旾D锛�' + menu.MenuID) + return + } _permMenus[menu.MenuID] = true let _type = '' @@ -692,9 +695,9 @@ {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} {this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {/* {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? + {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <a href="#/mobmanage" target="_blank" className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></a> : null - } */} + } {/* 缂栬緫鑿滃崟 */} {this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} {/* 澶村儚銆佺敤鎴峰悕 */} diff --git a/src/index.js b/src/index.js index 88e31d7..f9dd9e5 100644 --- a/src/index.js +++ b/src/index.js @@ -168,6 +168,22 @@ document.getElementById('root').className = option[window.GLOB.style] } + let mkDBUseable = false + if (process.env.NODE_ENV === 'production') { // 鏄惁浣跨敤web瀛樺偍 + mkDBUseable = options.sysType !== 'local' || window.GLOB.systemType === 'production' + } else { + mkDBUseable = true + } + + if (config.webStorage && mkDBUseable) { + let stor = config.webStorage.toLowerCase() + if (stor.indexOf('websql') > -1) { + window.GLOB.webSqlUsable = true + } else if (stor.indexOf('indexeddb') > -1) { + window.GLOB.IndexedDBUsable = true + } + } + render(Route) }) diff --git a/src/mob/components/login/mob-login-2/index.jsx b/src/mob/components/login/mob-login-2/index.jsx index 685e6b0..37e1952 100644 --- a/src/mob/components/login/mob-login-2/index.jsx +++ b/src/mob/components/login/mob-login-2/index.jsx @@ -8,6 +8,7 @@ import enUS from '@/locales/en-US/mob.js' import Utils from '@/utils/utils.js' import ContentUpdate from '@/mob/contupdate' +import ContentDelete from '@/mob/contdelete' import './index.scss' class MobLogin2 extends Component { @@ -26,30 +27,73 @@ type: 'login', subtype: 'mob-login-2', box: { uuid: Utils.getuuid(), eleType: 'box', style: {}}, - title: { uuid: Utils.getuuid(), eleType: 'text', content: '鐧诲綍', style: {fontSize: '18px', fontWeight: 'bold', color: '#000000', textAlign: 'center', marginTop: '10vh', marginBottom: '10vh'}}, + title: { + uuid: Utils.getuuid(), eleType: 'text', content: '鐧诲綍', + style: { + fontSize: '18px', fontWeight: 'bold', color: '#000000', textAlign: 'center', marginTop: '10vh', marginBottom: '10vh' + } + }, user: { uuid: Utils.getuuid(), eleType: 'input', content: '閭/鎵嬫満', style: {}}, password: { uuid: Utils.getuuid(), eleType: 'input', content: '瀵嗙爜', style: {}}, - login: { uuid: Utils.getuuid(), eleType: 'button', content: '鐧诲綍', style: {fontSize: '16px', color: '#ffffff', textAlign: 'center', lineHeight: 2.4, backgroundColor: '#44a8f2'}}, - phone: { uuid: Utils.getuuid(), eleType: 'button', content: '鎵嬫満鐭俊鐧诲綍', style: {fontSize: '16px', color: '#44a8f2', textAlign: 'center', lineHeight: 2.4, border: '1px solid #44a8f2'}}, - register: { uuid: Utils.getuuid(), eleType: 'text', content: '娉ㄥ唽', style: {fontSize: '14px', color: '#44a8f2', textAlign: 'left'}}, - lose: { uuid: Utils.getuuid(), eleType: 'text', content: '蹇樿瀵嗙爜锛�', style: {fontSize: '14px', color: '#44a8f2', textAlign: 'right', textDecoration: 'underline'}}, - auth: { - uuid: Utils.getuuid(), eleType: 'text', - subItems: [ - {type: 'qq', icon: 'qq', label: 'QQ'}, - {type: 'wechat', icon: 'wechat', label: '寰俊'}, - ], - content: '鍏朵粬鐧诲綍鏂瑰紡', style: {fontSize: '14px', color: '#bcbcbc', textAlign: 'center', marginTop: '30px', marginBottom: '20px'} + login: { + uuid: Utils.getuuid(), eleType: 'button', content: '鐧诲綍', + style: { + fontSize: '16px', color: '#ffffff', textAlign: 'center', lineHeight: 2.4, backgroundColor: '#44a8f2' + } }, - copyright: { uuid: Utils.getuuid(), eleType: 'textarea', content: 'Copyright漏2017 鎵�鏈夌浉鍏崇増鏉冨綊 鍖椾含鏄庣鏅崕淇℃伅鎶�鏈湁闄愬叕鍙�', style: {fontSize: '12px', textAlign: 'center'} }, + phone: { + uuid: Utils.getuuid(), eleType: 'button', content: '鎵嬫満鐭俊鐧诲綍', + style: { + fontSize: '16px', color: '#44a8f2', textAlign: 'center', lineHeight: 2.4, border: '1px solid #44a8f2' + } + }, + register: { + uuid: Utils.getuuid(), eleType: 'text', content: '娉ㄥ唽', + style: { + fontSize: '14px', color: '#44a8f2', textAlign: 'left' + } + }, + lose: { + uuid: Utils.getuuid(), eleType: 'text', content: '蹇樿瀵嗙爜锛�', + style: { + fontSize: '14px', color: '#44a8f2', textAlign: 'right', textDecoration: 'underline' + } + }, + auth: { + uuid: Utils.getuuid(), eleType: 'text', content: '鍏朵粬鐧诲綍鏂瑰紡', + style: { + fontSize: '14px', color: '#bcbcbc', textAlign: 'center', marginTop: '30px', marginBottom: '20px' + } + }, + authlist: { + uuid: Utils.getuuid(), + subItems: [ + {uuid: 'qq', type: 'qq', icon: 'qq', label: 'QQ'}, + {uuid: 'wechat', type: 'wechat', icon: 'wechat', label: '寰俊'}, + ], + }, + copyright: { + uuid: Utils.getuuid(), eleType: 'textarea', content: 'Copyright漏2017 鎵�鏈夌浉鍏崇増鏉冨綊 鍖椾含鏄庣鏅崕淇℃伅鎶�鏈湁闄愬叕鍙�', + style: { + fontSize: '12px', textAlign: 'center', color: 'rgba(0, 0, 0, 0.65)' + } + }, links: { uuid: Utils.getuuid(), eleType: 'link', substyle: false, subItems: [ {eleType: 'link', content: '闅愮鏀跨瓥', url: '', uuid: Utils.getuuid()}, {eleType: 'link', content: '浣跨敤鏉℃', url: '', uuid: Utils.getuuid()}, ], - style: {fontSize: '12px', textAlign: 'center', color: '#44a8f2', textDecoration: 'underline'} - } + style: { + fontSize: '12px', textAlign: 'center', color: '#44a8f2', textDecoration: 'underline' + } + }, + account: { + uuid: Utils.getuuid(), eleType: 'button', content: '璐﹀彿瀵嗙爜鐧诲綍', + style: { + fontSize: '16px', color: '#44a8f2', textAlign: 'center', lineHeight: 2.4, border: '1px solid #44a8f2' + } + }, } } @@ -96,7 +140,7 @@ ...fromJS(card.copyright.style).toJS(), componentId: card.uuid, uuid: card.copyright.uuid, - items: ['font'], + items: ['font', 'margin'], } this.props.triggerEdit(element) } @@ -121,7 +165,7 @@ ...fromJS(card[type].style).toJS(), componentId: card.uuid, uuid: card[type].uuid, - items: ['font', 'background', 'border'] + items: ['font', 'background', 'border', 'margin'] } this.props.triggerEdit(element) } @@ -226,77 +270,153 @@ titleStyle.marginBottom = `calc(${(percent / 100) * 615}px)` } - if (view === 'account') return ( - <div className="mob-login-2" onClick={this.editBox} style={card.box.style}> - {card.title ? <div className={'plat-name ' + (editId === card.title.uuid ? 'editing' : '')} style={titleStyle} onClick={this.editTitle}> - <ContentUpdate element={card.title} updateContent={(ele) => this.updateContent({...card, title: ele})}/> - {card.title.content} - </div> : null} - - <div className={`mk-login-input ${editId === card.user.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'user')}> - <ContentUpdate element={card.user} deletable={false} updateContent={(ele) => this.updateContent({...card, user: ele})}/> - <InputItem placeholder={card.user.content}></InputItem> - </div> - <div className={`mk-login-input ${editId === card.password.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'password')}> - <ContentUpdate element={card.password} deletable={false} updateContent={(ele) => this.updateContent({...card, password: ele})}/> - <InputItem placeholder={card.password.content}></InputItem> - </div> - <Button - className={'login ' + (editId === card.login.uuid ? 'editing' : '')} - onDoubleClick={() => this.props.doubleClickCard(card.login)} - style={card.login.style} - onClick={(e) => this.editLogin(e, 'login')} - > - <ContentUpdate element={card.login} deletable={false} updateContent={(ele) => this.updateContent({...card, login: ele})}/> - {card.login.content} - </Button> - <Button - className={'login ' + (editId === card.phone.uuid ? 'editing' : '')} - onDoubleClick={() => this.props.doubleClickCard(card.phone)} - style={card.phone.style} - onClick={(e) => this.editLogin(e, 'phone')} - > - <ContentUpdate element={card.phone} updateContent={(ele) => this.updateContent({...card, phone: ele})}/> - {card.phone.content} - </Button> - <div className="row-box"> - {card.register ? <div className={'col-item ' + (editId === card.register.uuid ? 'editing' : '')} style={card.register.style} onClick={this.editRegister}> - <ContentUpdate element={card.register} updateContent={(ele) => this.updateContent({...card, register: ele})}/> - {card.register.content} + if (view === 'account') { + return ( + <div className="mob-login-2" onClick={this.editBox} style={card.box.style}> + {card.title ? <div className={'plat-name ' + (editId === card.title.uuid ? 'editing' : '')} style={titleStyle} onClick={this.editTitle}> + <ContentUpdate element={card.title} updateContent={(ele) => this.updateContent({...card, title: ele})}/> + {card.title.content} </div> : null} - {card.lose ? <div className={'col-item right ' + (editId === card.lose.uuid ? 'editing' : '')} style={card.lose.style} onClick={this.editLose}> - <ContentUpdate element={card.lose} updateContent={(ele) => this.updateContent({...card, lose: ele})}/> - {card.lose.content} + + <div className={`mk-login-input ${editId === card.user.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'user')}> + <ContentUpdate element={card.user} deletable={false} updateContent={(ele) => this.updateContent({...card, user: ele})}/> + <InputItem disabled={true} placeholder={card.user.content}></InputItem> + </div> + <div className={`mk-login-input ${editId === card.password.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'password')}> + <ContentUpdate element={card.password} deletable={false} updateContent={(ele) => this.updateContent({...card, password: ele})}/> + <InputItem disabled={true} placeholder={card.password.content}></InputItem> + </div> + <Button + className={'login ' + (editId === card.login.uuid ? 'editing' : '')} + onDoubleClick={() => this.props.doubleClickCard(card.login)} + style={card.login.style} + onClick={(e) => this.editLogin(e, 'login')} + > + <ContentUpdate element={card.login} deletable={false} updateContent={(ele) => this.updateContent({...card, login: ele})}/> + {card.login.content} + </Button> + <Button + className={'login ' + (editId === card.phone.uuid ? 'editing' : '')} + onDoubleClick={() => this.setState({view: 'phone'})} + style={card.phone.style} + onClick={(e) => this.editLogin(e, 'phone')} + > + <ContentUpdate element={card.phone} updateContent={(ele) => this.updateContent({...card, phone: ele})}/> + {card.phone.content} + </Button> + <div className="row-box"> + {card.register ? <div className={'col-item ' + (editId === card.register.uuid ? 'editing' : '')} style={card.register.style} onClick={this.editRegister}> + <ContentUpdate element={card.register} updateContent={(ele) => this.updateContent({...card, register: ele})}/> + {card.register.content} + </div> : null} + {card.lose ? <div className={'col-item right ' + (editId === card.lose.uuid ? 'editing' : '')} style={card.lose.style} onClick={this.editLose}> + <ContentUpdate element={card.lose} updateContent={(ele) => this.updateContent({...card, lose: ele})}/> + {card.lose.content} + </div> : null} + <div style={{clear: 'both'}}></div> + </div> + {card.auth ? <div className={'plat-name ' + (editId === card.auth.uuid ? 'editing' : '')} style={card.auth.style} onClick={this.editAuth}> + <ContentUpdate element={card.auth} updateContent={(ele) => this.updateContent({...card, auth: ele})}/> + {card.auth.content} </div> : null} - <div style={{clear: 'both'}}></div> + {card.authlist ? <div className="other-auth"> + {card.authlist.subItems.map(cell => ( + <span className="deletable-item" key={cell.type}> + <ContentDelete element={cell} list={card.authlist} updateContent={(ele) => this.updateContent({...card, authlist: ele})}/> + <Icon type={cell.icon} /> + <p>{cell.label}</p> + </span> + ))} + </div> : null} + {card.copyright ? <div className={'company-msg ' + (editId === card.copyright.uuid ? 'editing' : '')} style={card.copyright.style} onClick={this.editMsg}> + <ContentUpdate element={card.copyright} updateContent={(ele) => this.updateContent({...card, copyright: ele})}/> + {card.copyright.content} + </div> : null} + {card.links ? <div className="links" style={card.links.style}> + {card.links.subItems.map(item => ( + <span className={(editId === item.uuid ? 'editing' : '')} key={item.uuid} onClick={(e) => this.editLinks(e, item)}> + <ContentUpdate element={item} updateContent={(val) => this.updateLinkItem(val, item)}/> + {item.content} + </span> + ))} + <Icon type="plus" onClick={this.linkItemAdd} /> + </div> : null} </div> - {card.auth ? <div className={'plat-name ' + (editId === card.auth.uuid ? 'editing' : '')} style={card.auth.style} onClick={this.editAuth}> - <ContentUpdate element={card.auth} updateContent={(ele) => this.updateContent({...card, auth: ele})}/> - {card.auth.content} - </div> : null} - {card.auth ? <div className="other-auth"> - {card.auth.subItems.map(cell => ( - <span key={cell.type}> - <Icon type={cell.icon} /> - <p>{cell.label}</p> - </span> - ))} - </div> : null} - {card.copyright ? <div className={'company-msg ' + (editId === card.copyright.uuid ? 'editing' : '')} style={card.copyright.style} onClick={this.editMsg}> - <ContentUpdate element={card.copyright} updateContent={(ele) => this.updateContent({...card, copyright: ele})}/> - {card.copyright.content} - </div> : null} - {card.links ? <div className="links" style={card.links.style}> - {card.links.subItems.map(item => ( - <span className={(editId === item.uuid ? 'editing' : '')} key={item.uuid} onClick={(e) => this.editLinks(e, item)}> - <ContentUpdate element={item} updateContent={(val) => this.updateLinkItem(val, item)}/> - {item.content} - </span> - ))} - <Icon type="plus" onClick={this.linkItemAdd} /> - </div> : null} - </div> - ) + ) + } else if (view === 'phone') { + return ( + <div className="mob-login-2" onClick={this.editBox} style={card.box.style}> + {card.title ? <div className={'plat-name ' + (editId === card.title.uuid ? 'editing' : '')} style={titleStyle} onClick={this.editTitle}> + <ContentUpdate element={card.title} updateContent={(ele) => this.updateContent({...card, title: ele})}/> + {card.title.content} + </div> : null} + + <div className={`mk-login-input ${editId === card.user.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'user')}> + <ContentUpdate element={card.user} deletable={false} updateContent={(ele) => this.updateContent({...card, user: ele})}/> + <InputItem disabled={true} placeholder={card.user.content}></InputItem> + </div> + <div className={`mk-login-input ${editId === card.password.uuid ? 'editing' : ''}`} onClick={(e) => this.editPlaceholder(e, 'password')}> + <ContentUpdate element={card.password} deletable={false} updateContent={(ele) => this.updateContent({...card, password: ele})}/> + <InputItem disabled={true} placeholder={card.password.content}></InputItem> + </div> + <Button + className={'login ' + (editId === card.login.uuid ? 'editing' : '')} + onDoubleClick={() => this.props.doubleClickCard(card.login)} + style={card.login.style} + onClick={(e) => this.editLogin(e, 'login')} + > + <ContentUpdate element={card.login} deletable={false} updateContent={(ele) => this.updateContent({...card, login: ele})}/> + {card.login.content} + </Button> + <Button + className={'login ' + (editId === card.account.uuid ? 'editing' : '')} + onDoubleClick={() => this.setState({view: 'account'})} + style={card.account.style} + onClick={(e) => this.editLogin(e, 'account')} + > + <ContentUpdate element={card.account} updateContent={(ele) => this.updateContent({...card, account: ele})}/> + {card.account.content} + </Button> + <div className="row-box"> + {card.register ? <div className={'col-item ' + (editId === card.register.uuid ? 'editing' : '')} style={card.register.style} onClick={this.editRegister}> + <ContentUpdate element={card.register} updateContent={(ele) => this.updateContent({...card, register: ele})}/> + {card.register.content} + </div> : null} + {card.lose ? <div className={'col-item right ' + (editId === card.lose.uuid ? 'editing' : '')} style={card.lose.style} onClick={this.editLose}> + <ContentUpdate element={card.lose} updateContent={(ele) => this.updateContent({...card, lose: ele})}/> + {card.lose.content} + </div> : null} + <div style={{clear: 'both'}}></div> + </div> + {card.auth ? <div className={'plat-name ' + (editId === card.auth.uuid ? 'editing' : '')} style={card.auth.style} onClick={this.editAuth}> + <ContentUpdate element={card.auth} updateContent={(ele) => this.updateContent({...card, auth: ele})}/> + {card.auth.content} + </div> : null} + {card.authlist ? <div className="other-auth"> + {card.authlist.subItems.map(cell => ( + <span className="deletable-item" key={cell.type}> + <ContentDelete element={cell} list={card.authlist} updateContent={(ele) => this.updateContent({...card, authlist: ele})}/> + <Icon type={cell.icon} /> + <p>{cell.label}</p> + </span> + ))} + </div> : null} + {card.copyright ? <div className={'company-msg ' + (editId === card.copyright.uuid ? 'editing' : '')} style={card.copyright.style} onClick={this.editMsg}> + <ContentUpdate element={card.copyright} updateContent={(ele) => this.updateContent({...card, copyright: ele})}/> + {card.copyright.content} + </div> : null} + {card.links ? <div className="links" style={card.links.style}> + {card.links.subItems.map(item => ( + <span className={(editId === item.uuid ? 'editing' : '')} key={item.uuid} onClick={(e) => this.editLinks(e, item)}> + <ContentUpdate element={item} updateContent={(val) => this.updateLinkItem(val, item)}/> + {item.content} + </span> + ))} + <Icon type="plus" onClick={this.linkItemAdd} /> + </div> : null} + </div> + ) + } } } diff --git a/src/mob/components/login/mob-login-2/index.scss b/src/mob/components/login/mob-login-2/index.scss index 6642ec3..59cd1e1 100644 --- a/src/mob/components/login/mob-login-2/index.scss +++ b/src/mob/components/login/mob-login-2/index.scss @@ -55,6 +55,7 @@ color: rgb(68, 168, 242); span { + position: relative; display: inline-block; vertical-align: top; p { @@ -78,6 +79,10 @@ margin-bottom: 10px; border: 1px solid #dddddd; + .am-input-control input:disabled { + color: rgba(0, 0, 0, 0.65); + } + .am-input-label { width: 30px; color: inherit; diff --git a/src/mob/contdelete/index.jsx b/src/mob/contdelete/index.jsx new file mode 100644 index 0000000..f18fa66 --- /dev/null +++ b/src/mob/contdelete/index.jsx @@ -0,0 +1,59 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { is, fromJS } from 'immutable' +import { Icon, Modal } from 'antd' + +import zhCN from '@/locales/zh-CN/mob.js' +import enUS from '@/locales/en-US/mob.js' +import './index.scss' + +const { confirm } = Modal + +class ContentDelete extends Component { + static propTpyes = { + element: PropTypes.object, + list: PropTypes.array, + updateContent: PropTypes.func + } + + state = { + dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + images: [], + visible: false + } + + UNSAFE_componentWillMount () { + + } + + // shouldComponentUpdate (nextProps, nextState) { + // return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + // } + + deleteElement = () => { + const { list, element } = this.props + const _this = this + + confirm({ + title: '纭畾鍒犻櫎鍏冪礌鍚楋紵', + okText: this.state.dict['mob.confirm'], + cancelText: this.state.dict['mob.cancel'], + onOk() { + _this.props.updateContent({...list, subItems: list.subItems.filter(item => item.uuid !== element.uuid)}) + }, + onCancel() {} + }) + } + + + + render () { + return ( + <div className="mob-content-list-delete"> + <Icon type="close" onClick={this.deleteElement} /> + </div> + ) + } +} + +export default ContentDelete \ No newline at end of file diff --git a/src/mob/contdelete/index.scss b/src/mob/contdelete/index.scss new file mode 100644 index 0000000..a36b973 --- /dev/null +++ b/src/mob/contdelete/index.scss @@ -0,0 +1,25 @@ +.mob-content-list-delete { + position: absolute; + top: -10px; + left: -10px; + border-radius: 2px; + font-size: 14px; + display: none; + line-height: 1.5; + z-index: 1; + + i { + padding: 2px 5px; + cursor: pointer; + } + .anticon-close { + color: #ff4d4f; + } +} +.deletable-item { + position: relative; +} +.deletable-item:hover .mob-content-list-delete { + display: inline-block; +} + diff --git a/src/mob/contupdate/index.jsx b/src/mob/contupdate/index.jsx index 1fc2b9a..e31dd45 100644 --- a/src/mob/contupdate/index.jsx +++ b/src/mob/contupdate/index.jsx @@ -76,6 +76,8 @@ confirm({ title: '纭畾鍒犻櫎鍏冪礌鍚楋紵', + okText: this.state.dict['mob.confirm'], + cancelText: this.state.dict['mob.cancel'], onOk() { _this.props.updateContent(null) }, diff --git a/src/mob/datasource/index.jsx b/src/mob/datasource/index.jsx index 8a03a45..cf08081 100644 --- a/src/mob/datasource/index.jsx +++ b/src/mob/datasource/index.jsx @@ -107,7 +107,13 @@ } render () { + const { config } = this.props const { sourcelist, visible, source, dict, searches, loading } = this.state + + let addable = true + if (config.components && config.components.length === 1 && config.components[0].type === 'login') { + addable = false + } return ( <div className="mob-datasource"> @@ -122,15 +128,15 @@ </span> </span> ))} - <span className="mob-input-group-wrapper"> + {addable ? <span className="mob-input-group-wrapper"> <span className="mob-input-wrapper"> <span className="mob-input-insert" onClick={() => this.editDataSource()}> <Icon type="plus" /> </span> </span> - </span> + </span> : null} <Modal - wrapClassName="mob-datasource-verify-modal" + wrapClassName="mob-datasource-verify-modal popview-modal" title={'鏁版嵁婧愰厤缃�'} visible={visible} width={'75vw'} diff --git a/src/mob/datasource/index.scss b/src/mob/datasource/index.scss index aa0aab7..ea28922 100644 --- a/src/mob/datasource/index.scss +++ b/src/mob/datasource/index.scss @@ -78,4 +78,12 @@ color: #ff4d4f; } } +} +.mob-datasource-verify-modal { + .ant-modal { + top: 50px; + .ant-modal-body { + max-height: calc(100vh - 190px); + } + } } \ No newline at end of file diff --git a/src/mob/datasource/verifycard/customscript/index.jsx b/src/mob/datasource/verifycard/customscript/index.jsx index cbc3019..5267ea7 100644 --- a/src/mob/datasource/verifycard/customscript/index.jsx +++ b/src/mob/datasource/verifycard/customscript/index.jsx @@ -1,11 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button, notification, Select } from 'antd' +import { Form, Row, Col, Button, notification, Select } from 'antd' import Utils from '@/utils/utils.js' +import CodeMirror from '@/templates/zshare/codemirror' import './index.scss' - -const { TextArea } = Input class CustomForm extends Component { static propTpyes = { @@ -218,7 +217,7 @@ message: this.props.dict['mob.required.input'] + 'sql!' } ] - })(<TextArea rows={15} />)} + })(<CodeMirror />)} </Form.Item> </Col> </Row> diff --git a/src/mob/datasource/verifycard/customscript/index.scss b/src/mob/datasource/verifycard/customscript/index.scss index 80c8d19..2a1d2d8 100644 --- a/src/mob/datasource/verifycard/customscript/index.scss +++ b/src/mob/datasource/verifycard/customscript/index.scss @@ -27,5 +27,8 @@ width: 89.5%; padding-top: 4px; } + .CodeMirror { + height: 350px; + } } } \ No newline at end of file diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index f09b8fe..ccabdc5 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -84,7 +84,7 @@ func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(_param) + let result = await Api.getCacheConfig(_param) if (result.status) { let config = '' diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 67fba19..f93d948 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -60,7 +60,7 @@ func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(param) + let result = await Api.getCacheConfig(param) if (result.status) { let config = '' diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index b5f3a7f..a1f212c 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -110,7 +110,7 @@ func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(param) + let result = await Api.getCacheConfig(param) if (result.status) { let config = '' diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index c43cd29..53f272b 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -68,7 +68,7 @@ func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(param) + let result = await Api.getCacheConfig(param) if (result.status) { let config = '' diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index e66612b..1d4b56f 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -68,7 +68,7 @@ func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(_param) + let result = await Api.getCacheConfig(_param) if (result.status) { let config = '' diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index e53c507..06de85c 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -802,7 +802,7 @@ }) } } else { - Api.getSystemCacheConfig({ + Api.getCacheConfig({ func: 'sPC_Get_LongParam', MenuID: btn.uuid }).then(res => { diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 42b1325..d2af58f 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -1020,7 +1020,7 @@ }) } } else { - Api.getSystemCacheConfig({ + Api.getCacheConfig({ func: 'sPC_Get_LongParam', MenuID: btn.uuid }).then(res => { diff --git a/src/tabviews/zshare/verifycard/index.jsx b/src/tabviews/zshare/verifycard/index.jsx index f60d0aa..a8d1db8 100644 --- a/src/tabviews/zshare/verifycard/index.jsx +++ b/src/tabviews/zshare/verifycard/index.jsx @@ -80,7 +80,7 @@ func: 'sPC_Get_LongParam', MenuID: tab.linkTab } - Api.getSystemCacheConfig(param).then(res => { + Api.getCacheConfig(param).then(res => { res.tab = tab resolve(res) }) diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.jsx index 1a81170..3c4492e 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.jsx @@ -1,14 +1,13 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button, notification, Modal, Select } from 'antd' +import { Form, Row, Col, Button, notification, Modal, Select } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' import SettingUtils from '../utils.jsx' +import CodeMirror from '@/templates/zshare/codemirror' import Api from '@/api' import './index.scss' - -const { TextArea } = Input class CustomForm extends Component { static propTpyes = { @@ -238,7 +237,7 @@ message: this.props.dict['form.required.input'] + 'sql!' } ] - })(<TextArea rows={15} />)} + })(<CodeMirror />)} </Form.Item> </Col> </Row> diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.scss b/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.scss index d453a92..d853da1 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.scss +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/customscript/index.scss @@ -27,5 +27,8 @@ width: 89.5%; padding-top: 4px; } + .CodeMirror { + height: 350px; + } } } \ No newline at end of file diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index 97eaa07..345a05e 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -8,9 +8,9 @@ import Utils from '@/utils/utils.js' import SettingUtils from './utils.jsx' import CustomScript from './customscript' +import CodeMirror from '@/templates/zshare/codemirror' import './index.scss' -const { TextArea } = Input const { confirm } = Modal const { Paragraph } = Typography @@ -568,7 +568,7 @@ } else if (item.type === 'datasource') { fields.push( <Col span={24} key={index} style={{paddingLeft: '7px'}}> - <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } help={item.help} label={ + <Form.Item className="text-area" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } help={item.help} label={ <Tooltip placement="topLeft" title={item.tooltip}> <Icon type="question-circle" /> {item.label} @@ -576,23 +576,7 @@ }> {getFieldDecorator(item.key, { initialValue: item.initVal - })(<TextArea rows={4} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'textarea') { - fields.push( - <Col span={20} offset={4} key={index}> - <Form.Item className="text-area"> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(<TextArea rows={4} />)} + })(<CodeMirror />)} </Form.Item> </Col> ) diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.scss b/src/templates/sharecomponent/treesettingcomponent/settingform/index.scss index aa3e0b8..3db3b45 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.scss +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.scss @@ -1,12 +1,9 @@ .model-tree-setting-form-box { position: relative; .model-tree-setting-form { - .textarea { - .ant-form-item-label { - width: 16.3%; - } - .ant-form-item-control-wrapper { - width: 83.33333333%; + .text-area { + .CodeMirror { + height: 150px; } } .anticon-question-circle { diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 8b029a1..d72c7b0 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -222,17 +222,7 @@ this.setState({touristLogin: true}) } - // 鑾峰彇绯荤粺淇℃伅 - let _param = { - func: 's_Get_style', - TypeCharOne: 'PC', - LText: `select '${window.GLOB.appkey}'`, - } - - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - - Api.getSystemConfig(_param).then(res => { + Api.getSystemStyle().then(res => { if (res.status) { let _url = window.location.href.split('#')[0] + 'system' let systemMsg = { -- Gitblit v1.8.0