From 972f277c5920d9d38749d675912b47b2b120320e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 25 五月 2023 10:17:41 +0800 Subject: [PATCH] 2023-05-25 --- src/index.js | 2 src/components/header/index.scss | 15 +++ src/tabviews/custom/components/card/cardcellList/index.jsx | 11 - src/components/header/index.jsx | 12 ++ src/views/pcdesign/index.jsx | 7 - src/menu/components/share/actioncomponent/formconfig.jsx | 3 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 20 +++ public/options.json | 13 +- src/menu/components/card/cardcellcomponent/formconfig.jsx | 83 +++++++++++++++- src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/api/index.js | 40 ++++--- src/tabviews/zshare/actionList/normalbutton/index.jsx | 13 ++ src/views/mobdesign/index.jsx | 7 - src/utils/utils.js | 18 +-- 14 files changed, 171 insertions(+), 75 deletions(-) diff --git a/public/options.json b/public/options.json index bedcbee..858e91f 100644 --- a/public/options.json +++ b/public/options.json @@ -1,15 +1,16 @@ { - "appId": "202108312122504607B107A83F55B40C98CCF", - "appkey": "20210831212235413F287EC3BF489424496C8", + "appId": "201912040924165801464FF1788654BC5AC73", + "appkey": "20191106103859640976D6E924E464D029CF0", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", "externalDatabase": "", "lineColor": "", "filter": "false", - "defaultApp": "mkindustry", + "defaultApp": "mk", "defaultLang": "zh-CN", - "WXAppID": "", + "WXAppID": "wx4d8a34c8d4494872", "WXminiAppID": "", + "WXNotice": "true", "nginx": "true", "debugger": false, "licenseKey": "", @@ -17,6 +18,6 @@ "transfer": "false", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], - "host": "http://demo.mk9h.cn", - "service": "erp_new/" + "host": "http://qingqiumarket.cn", + "service": "MKWMS/" } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 5936c99..2f79f5e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -98,17 +98,18 @@ /** * @description 寰俊涓氬姟璇锋眰 */ - wxAccessToken () { + wxAccessToken (domain = '') { let _url = window.GLOB.baseurl + 'wxpay/getaccesstoken' - if (process.env.NODE_ENV !== 'production') { - _url = document.location.origin + '/wxpay/getaccesstoken' + + if (domain) { + _url = domain + 'wxpay/getaccesstoken' } return new Promise(resolve => { - if (window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { + if (window.GLOB.accessToken.domain === domain && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { resolve(window.GLOB.accessToken) } else { - window.GLOB.accessToken = {} + window.GLOB.accessToken = {domain} axios({ url: _url, method: 'get' @@ -128,19 +129,23 @@ * @description 寰俊涓氬姟璇锋眰 */ wxNginxRequest (url, method, param) { - let _url = window.GLOB.location + '/' + url - if (process.env.NODE_ENV === 'production') { - _url = document.location.origin + '/' + url - } - if (/^http:\/\/(qingqiumarket.cn|cloud.mk9h.cn|sso.mk9h.cn)/.test(_url)) { - _url = window.GLOB.location + ':8080/' + url + let _url = url + + if (!/^http/.test(url)) { + _url = window.GLOB.location + '/' + url if (process.env.NODE_ENV === 'production') { - _url = document.location.origin + ':8080/' + url + _url = document.location.origin + '/' + url } - } else if (/^https:\/\/(qingqiumarket.cn|cloud.mk9h.cn|sso.mk9h.cn)/.test(_url)) { - _url = window.GLOB.location + ':8443/' + url - if (process.env.NODE_ENV === 'production') { - _url = document.location.origin + ':8443/' + url + if (/^http:\/\/(qingqiumarket.cn|cloud.mk9h.cn|sso.mk9h.cn)/.test(_url)) { + _url = window.GLOB.location + ':8080/' + url + if (process.env.NODE_ENV === 'production') { + _url = document.location.origin + ':8080/' + url + } + } else if (/^https:\/\/(qingqiumarket.cn|cloud.mk9h.cn|sso.mk9h.cn)/.test(_url)) { + _url = window.GLOB.location + ':8443/' + url + if (process.env.NODE_ENV === 'production') { + _url = document.location.origin + ':8443/' + url + } } } @@ -1026,9 +1031,6 @@ */ getWxNativePay (param) { let _url = window.GLOB.baseurl + 'wxpay/wxNativePay' - if (process.env.NODE_ENV !== 'production') { - _url = document.location.origin + '/wxpay/wxNativePay' - } return axios({ url: _url, diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 8c1efa8..def0339 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -23,6 +23,7 @@ const { confirm } = Modal const { Search } = Input const Resetpwd = asyncComponent(() => import('@/components/resetPassword')) +const QrCode = asyncComponent(() => import('@/components/qrcode')) const LoginForm = asyncSpinComponent(() => import('./loginform')) class Header extends Component { @@ -534,6 +535,14 @@ }) } + wxnotice = () => { + Modal.success({ + className: 'mk-wx-notice', + title: <QrCode card={{qrWidth: 320, color: '#000000'}} value={window.GLOB.baseurl + 'mob/wxnotice.html?userid=' + sessionStorage.getItem('UserID') + '&loginuid=' + sessionStorage.getItem('LoginUID')}/>, + okText: '鍏抽棴' + }) + } + changeToHome = () => { if (!['linkage', 'menu_board'].includes(window.GLOB.navBar)) return @@ -561,6 +570,9 @@ <Menu.Item key="verup" onClick={this.verup}> 椤甸潰鏇存柊 </Menu.Item> + {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={this.wxnotice}> + 寰俊娑堟伅 + </Menu.Item> : null} {window.GLOB.appVersion ? <Menu.Item key="version" onClick={this.about}> 鍏充簬 </Menu.Item> : null} diff --git a/src/components/header/index.scss b/src/components/header/index.scss index 913208f..d38a22d 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -274,4 +274,19 @@ } } } +} + +.mk-wx-notice { + top: 100px!important; + .anticon-check-circle { + display: none; + } + .ant-modal-confirm-title { + text-align: center; + min-height: 320px; + } + .ant-modal-confirm-btns { + float: none!important; + text-align: center; + } } \ No newline at end of file diff --git a/src/index.js b/src/index.js index 090fd3e..21f3ba5 100644 --- a/src/index.js +++ b/src/index.js @@ -74,6 +74,7 @@ GLOB.nginx = config.nginx + '' === 'true' GLOB.WXAppID = config.WXAppID || '' GLOB.WXminiAppID = config.WXminiAppID || '' + GLOB.WXNotice = config.WXNotice + '' === 'true' GLOB.accessToken = {} GLOB.mkHS = false @@ -136,6 +137,7 @@ if (options.sysType === 'cloud') { // cloud涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧�,浜戠appkey涓虹郴缁熻缃� GLOB.appkey = options.cakey + GLOB.WXNotice = false } else if (options.sysType === 'SSO') { // sso涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� GLOB.appkey = config.appkey } else if (options.sysType === 'local') { // 涓氬姟绯荤粺 diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 647b4ee..b0620bb 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -173,7 +173,19 @@ } if (['text', 'picture'].includes(this.record.eleType) && this.record.link) { - _options.push('linkurl', 'joint', 'linkType') + _options.push('linkType') + if (this.record.linkType === 'linkmenu') { + _options.push('open', 'joint') + if (this.record.link === 'static') { + _options.push('linkmenu') + } else { + _options.push('linkurl') + } + } else if (this.record.linkType === 'other') { + _options.push('linkurl', 'joint') + } else { + _options.push('linkurl') + } } else if (this.record.eleType === 'picture' && !this.record.link) { _options.push('scale') } else if (this.record.eleType === 'slider') { @@ -324,7 +336,7 @@ return item }) }) - } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval'].includes(key)) { + } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType'].includes(key)) { let _options = this.getOptions() this.setState({ @@ -468,8 +480,8 @@ getPopupContainer={() => document.getElementById('card-winter')} > {item.options.map((option, index) => - <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> - {option.text} + <Select.Option id={`${index}`} title={option.text || option.label} key={`${index}`} value={option.value}> + {option.text || option.label} </Select.Option> )} </Select> diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 47866cd..603aeaf 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -56,6 +56,58 @@ width = +width.replace(/x/, '.5') } + let linkTypes = [ + { value: 'tel', text: '鐢佃瘽' }, + { value: 'email', text: '閭' }, + { value: 'other', text: '鍏朵粬' } + ] + + if (appType === 'mob') { + linkTypes = [ + { value: 'tel', text: '鐢佃瘽' }, + { value: 'email', text: '閭' }, + { value: 'qywx', text: '浼佷笟寰俊' }, + { value: 'linkmenu', text: '鍏宠仈鑿滃崟' }, + { value: 'other', text: '鍏朵粬' } + ] + } else if (appType === 'pc') { + linkTypes = [ + { value: 'tel', text: '鐢佃瘽' }, + { value: 'email', text: '閭' }, + { value: 'linkmenu', text: '鍏宠仈鑿滃崟' }, + { value: 'other', text: '鍏朵粬' } + ] + } + + if (card.linkType === 'qywx') { + if (appType !== 'mob') { + card.link = '' + card.linkType = '' + card.linkurl = '' + } + } else if (card.linkType === 'linkmenu') { + if (appType !== 'mob' && appType !== 'pc') { + card.link = '' + card.linkType = '' + card.linkurl = '' + card.linkmenu = '' + } + } + + let appMenus = sessionStorage.getItem('appMenus') + if (['pc', 'mob'].includes(appType)) { + if (appMenus) { + try { + appMenus = JSON.parse(appMenus) + } catch (e) { + appMenus = [] + } + } else { + appMenus = [] + } + appMenus.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}) + } + let forms = [ { type: 'select', @@ -519,17 +571,12 @@ forbid: isHeader }, { - type: 'radio', + type: linkTypes.length > 4 ? 'select' : 'radio', key: 'linkType', label: '閾炬帴绫诲瀷', initVal: card.linkType || 'other', required: false, - options: [ - { value: 'tel', text: '鐢佃瘽' }, - { value: 'email', text: '閭' }, - { value: 'qywx', text: '浼佷笟寰俊' }, - { value: 'other', text: '鍏朵粬' } - ] + options: linkTypes }, { type: 'radio', @@ -544,6 +591,15 @@ }, { type: 'select', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || '', + required: true, + options: appMenus || [], + forbid: !['pc', 'mob'].includes(appType) + }, + { + type: 'select', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', @@ -552,6 +608,19 @@ }, { type: 'radio', + key: 'open', + label: '鎵撳紑鏂瑰紡', + initVal: card.open || 'blank', + tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�', + required: true, + forbid: !['pc', 'mob'].includes(appType), + options: [ + {value: 'blank', text: appType !== 'mob' ? '鏂扮獥鍙�' : '鏂伴〉闈�'}, + {value: 'self', text: appType !== 'mob' ? '褰撳墠绐楀彛' : '褰撳墠椤甸潰'}, + ] + }, + { + type: 'radio', key: 'joint', label: '鎷兼帴鍙傛暟', initVal: card.joint || 'true', diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index eef2620..ca3792b 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -1000,7 +1000,7 @@ values.verify.invalid = 'true' } } - } else if (values.OpenType === 'tab' && values.linkmenu) { + } else if (values.OpenType === 'tab' && values.linkmenu && Array.isArray(values.linkmenu)) { if (sessionStorage.getItem('thdMenuList')) { let list = null try { diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 394da22..8ab35f0 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -112,6 +112,7 @@ } else { appMenus = [] } + appMenus.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}) } else { menulist = sessionStorage.getItem('fstMenuList') if (menulist) { @@ -819,7 +820,7 @@ extendName: 'MenuNo', required: false, allowClear: true, - options: appType === 'mob' || appType === 'pc' ? [...appMenus, {value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}] : menulist, + options: appType === 'mob' || appType === 'pc' ? appMenus : menulist, forbid: viewType === 'popview' }, { diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 450e8e9..8e9c1f8 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -76,10 +76,8 @@ elements: PropTypes.array, // 鍏冪礌闆� } - state = {} - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) + return !is(fromJS(this.props), fromJS(nextProps)) } /** @@ -133,12 +131,7 @@ } window.open(_url) return - } else if (card.linkType === 'qywx') { - notification.warning({ - top: 92, - message: 'PC涓嶆敮鎸佹墦寮�浼佷笟寰俊锛�', - duration: 5 - }) + } else if (card.linkType === 'qywx' || card.linkType === 'linkmenu') { return } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index abea1d7..4a56408 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2139,8 +2139,15 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) + let domain1 = '' + let domain2 = '' + if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && options.sysType !== 'cloud') { + domain1 = 'https://cloud.mk9h.cn/' + domain2 = 'https://cloud.mk9h.cn:8443/' + } + Api.genericInterface(param).then(res => { - res.send_data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: Utils.getuuid(), p1: '010000000001', p2: '鏄庣', p3: 'dddd', p4: '椤洪', p5: '鎴愬姛'}] + // res.send_data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: Utils.getuuid(), p1: '010000000001', p2: '鏄庣', p3: 'dddd', p4: '椤洪', p5: '鎴愬姛'}] if (!res.status) { notification.warning({ top: 92, @@ -2201,11 +2208,11 @@ return m }) - Api.wxAccessToken().then(res => { + Api.wxAccessToken(domain1).then(res => { if (!res.oa_access_token) return params.forEach(n => { - Api.wxNginxRequest(`cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { + Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { if (verify.wxNoteCallback === 'true') { let msg = re.errmsg || '' diff --git a/src/utils/utils.js b/src/utils/utils.js index cf01abb..5f9d942 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -960,9 +960,7 @@ let _position = (_topline + lindex + 1) + '琛� ' + _colindex + '鍒� ' if (/^Nvarchar/ig.test(col.type)) { - if (typeof(val) === 'number') { - val = val.toString() - } + val = val + '' if (/'/.test(val)) { val = val.replace(/'/ig, '"') @@ -985,14 +983,12 @@ } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { if (!val && val !== 0) { errors.push(_position + '鍐呭涓嶅彲涓虹┖') - } else { - if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(val)) { // 妫�楠屾槸鍚︿负娴偣鏁� - errors.push(_position + '鍐呭搴斾负鏁板��') - } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� - errors.push(_position + '灏忎簬鏈�灏忓��') - } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� - errors.push(_position + '澶т簬鏈�澶у��') - } + } else if (isNaN(val)) { // 妫�楠屾槸鍚︿负鏁板�� + errors.push(_position + '鍐呭搴斾负鏁板��') + } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� + errors.push(_position + '灏忎簬鏈�灏忓��') + } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� + errors.push(_position + '澶т簬鏈�澶у��') } } else if (col.type === 'date') { if (typeof(val) === 'number') { diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 404d210..fd1711e 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1228,8 +1228,6 @@ }) } card.elements && card.elements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1239,8 +1237,6 @@ if (item.subtype === 'dualdatacard') { card.backElements && card.backElements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1251,8 +1247,6 @@ }) } else if (item.type === 'balcony') { item.elements && item.elements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1279,7 +1273,6 @@ loopCol(col.subcols) } else if (col.type === 'custom') { col.elements.forEach(cell => { - if (cell.eleType !== 'button') return if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 76e490b..38beaf3 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1041,8 +1041,6 @@ }) } card.elements && card.elements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1051,8 +1049,6 @@ }) card.backElements && card.backElements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1062,8 +1058,6 @@ }) } else if (item.type === 'balcony') { item.elements && item.elements.forEach(cell => { - if (cell.eleType !== 'button') return - if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { @@ -1090,7 +1084,6 @@ loopCol(col.subcols) } else if (col.type === 'custom') { col.elements.forEach(cell => { - if (cell.eleType !== 'button') return if (cell.linkmenu && menuObj[cell.linkmenu]) { menus.push(menuObj[cell.linkmenu]) } else if (cell.openmenu && menuObj[cell.openmenu]) { -- Gitblit v1.8.0