From c33ac9ddcdbed91bd2267bed2a96199441806a04 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 22 九月 2022 17:00:15 +0800 Subject: [PATCH] 2022-09-22 --- src/menu/components/card/cardsimplecomponent/options.jsx | 30 +++++++++ src/menu/components/share/actioncomponent/actionform/index.jsx | 15 +++- src/menu/components/card/cardcellcomponent/index.jsx | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 45 +++++++++----- src/tabviews/zshare/actionList/normalbutton/index.jsx | 6 + src/menu/components/card/cardcellcomponent/dragaction/action.jsx | 4 + src/mob/modulesource/index.jsx | 4 + src/mob/modulesource/option.jsx | 2 src/menu/components/card/cardcomponent/options.jsx | 29 ++++++++- src/menu/modulecell/index.jsx | 2 10 files changed, 107 insertions(+), 32 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx index baf28f1..31328d0 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx @@ -53,8 +53,10 @@ if (card.OpenType === 'form') { if (card.formType === 'switch') { btnElement = (<Switch style={_style} className={card.size === 'large' ? 'ant-switch-large' : ''} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) - } else { + } else if (card.formType === 'radio') { btnElement = (<Checkbox style={_style}></Checkbox>) + } else { + btnElement = (<Button style={_style} type="link"><MkIcon type="scan"/></Button>) } } else if (card.show === 'icon') { btnElement = (<Button style={_style} type="link"><MkIcon type={card.icon}/>{warning}</Button>) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 20e37de..ce15a0c 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -149,7 +149,7 @@ let options = ['font', 'border', 'padding', 'margin', 'background'] if (element.eleType === 'button') { - if (element.OpenType === 'form') { + if (element.OpenType === 'form' && element.formType !== 'scan') { options = ['margin', 'float'] } else { options.push('width', 'minHeight', 'float') diff --git a/src/menu/components/card/cardcomponent/options.jsx b/src/menu/components/card/cardcomponent/options.jsx index d36487f..a2faaf0 100644 --- a/src/menu/components/card/cardcomponent/options.jsx +++ b/src/menu/components/card/cardcomponent/options.jsx @@ -40,6 +40,12 @@ if (hasMenus) { ops = [{value: 'menus', label: '鑿滃崟缁�'}] } + let adapters = sessionStorage.getItem('adapter') || '' + if (adapters.indexOf('wxmini') > -1) { + ops.push({value: 'miniprogram', label: '灏忕▼搴�'}) + } else if (setting.click === 'miniprogram') { + setting.click = '' + } const cardSettingForm = [ { @@ -97,11 +103,11 @@ forbid: subtype !== 'propcard' }, { - type: !hasMenus ? 'radio' : 'select', + type: ops.length === 0 ? 'radio' : 'select', field: 'click', label: '鐐瑰嚮浜嬩欢', initval: setting.click || '', - tooltip: '褰撶粦瀹氱偣鍑讳簨浠舵椂锛屽崱鐗囩殑鍒囨崲鍔熻兘灏嗗け鏁堛��', + // tooltip: '褰撶粦瀹氱偣鍑讳簨浠舵椂锛屽崱鐗囩殑鍒囨崲鍔熻兘灏嗗け鏁堛��', required: false, options: [ {value: '', label: '鏃�'}, @@ -114,11 +120,13 @@ {field: 'menu', values: ['menu']}, {field: 'linkurl', values: ['link']}, {field: 'open', values: ['menu', 'link', 'menus']}, - {field: 'joint', values: ['menu', 'link', 'menus']}, + {field: 'joint', values: ['menu', 'link', 'menus', 'miniprogram']}, {field: 'linkbtn', values: ['button']}, {field: 'clickType', values: ['button']}, {field: 'menuType', values: ['menus']}, {field: 'menus', values: ['menus']}, + {field: 'miniAppId', values: ['miniprogram']}, + {field: 'miniPath', values: ['miniprogram']}, ] }, { @@ -148,6 +156,21 @@ span: 24 }, { + type: 'text', + field: 'miniAppId', + label: '灏忕▼搴廇ppID', + initval: setting.miniAppId || '', + required: true + }, + { + type: 'text', + field: 'miniPath', + label: '椤甸潰璺緞', + initval: setting.miniPath || '', + tooltip: '鍙寚瀹氳烦杞皬绋嬪簭椤甸潰锛屼负绌烘椂鎵撳紑棣栭〉锛屾敞锛氬弬鏁版嫾鎺ュ湪鎸囧畾椤甸潰鏃舵湁鏁堛��', + required: false + }, + { type: 'radio', field: 'open', label: '鎵撳紑鏂瑰紡', diff --git a/src/menu/components/card/cardsimplecomponent/options.jsx b/src/menu/components/card/cardsimplecomponent/options.jsx index 7b397d1..06b6740 100644 --- a/src/menu/components/card/cardsimplecomponent/options.jsx +++ b/src/menu/components/card/cardsimplecomponent/options.jsx @@ -83,7 +83,7 @@ field: 'click', label: '鐐瑰嚮浜嬩欢', initval: setting.click || '', - tooltip: '褰撻�夋嫨瑙﹀彂鎸夐挳鏃讹紝鍙湁褰撳崱鐗囦腑鍙瓨鍦ㄤ竴涓寜閽椂鏈夋晥銆�', + // tooltip: '褰撻�夋嫨瑙﹀彂鎸夐挳鏃讹紝鍙湁褰撳崱鐗囦腑鍙瓨鍦ㄤ竴涓寜閽椂鏈夋晥銆�', required: false, options: [ {value: '', label: '鏃�'}, @@ -198,6 +198,14 @@ } } + let ops = [] + let adapters = sessionStorage.getItem('adapter') || '' + if (adapters.indexOf('wxmini') > -1) { + ops.push({value: 'miniprogram', label: '灏忕▼搴�'}) + } else if (setting.click === 'miniprogram') { + setting.click = '' + } + const cardSettingForm = [ { type: 'text', @@ -218,12 +226,15 @@ {value: '', label: '鏃�'}, {value: 'menu', label: '鑿滃崟'}, {value: 'link', label: '閾炬帴'}, + ...ops ], controlFields: [ {field: 'menu', values: ['menu']}, {field: 'linkurl', values: ['link']}, {field: 'open', values: ['menu', 'link']}, - {field: 'joint', values: ['menu', 'link']}, + {field: 'joint', values: ['menu', 'link', 'miniprogram']}, + {field: 'miniAppId', values: ['miniprogram']}, + {field: 'miniPath', values: ['miniprogram']}, ] }, { @@ -248,6 +259,21 @@ forbid: appType !== 'pc' && appType !== 'mob' }, { + type: 'text', + field: 'miniAppId', + label: '灏忕▼搴廇ppID', + initval: setting.miniAppId || '', + required: true + }, + { + type: 'text', + field: 'miniPath', + label: '椤甸潰璺緞', + initval: setting.miniPath || '', + tooltip: '鍙寚瀹氳烦杞皬绋嬪簭椤甸潰锛屼负绌烘椂鎵撳紑棣栭〉锛屾敞锛氬弬鏁版嫾鎺ュ湪鎸囧畾椤甸潰鏃舵湁鏁堛��', + required: false + }, + { type: 'radio', field: 'joint', label: '鍙傛暟鎷兼帴', diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 489073b..29dcf6e 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -236,8 +236,10 @@ if (this.record.formType === 'switch') { shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') - } else { + } else if (this.record.formType === 'radio') { shows.push('field', 'openVal', 'closeVal') + } else { + shows.push('field') } reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom') @@ -881,9 +883,14 @@ values.modal = card.modal || null if (values.OpenType === 'form') { - if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) { - values.openVal = +values.openVal - values.closeVal = +values.closeVal + if (values.formType !== 'scan') { + if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) { + values.openVal = +values.openVal + values.closeVal = +values.closeVal + } + } else { + values.show = 'icon' + values.icon = 'scan' } } else if (values.OpenType === 'excelOut') { values.Ot = 'notRequired' diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 149307b..970a91a 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -173,7 +173,7 @@ if (type === 'card') { opentypes.push({ value: 'form', - text: '琛ㄥ崟锛堝紑鍏虫垨鍕鹃�夋锛�' + text: '琛ㄥ崟' }) } else if (card.OpenType === 'form') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 card.OpenType = 'pop' @@ -197,6 +197,16 @@ value: 'closetab', text: '鍏抽棴鏍囩' }] + } + + let formTypes = [] + if (appType === 'mob') { + formTypes = [{ + value: 'scan', + text: '鎵弿' + }] + } else if (card.formType === 'scan') { + card.formType = 'switch' } let forms = [ @@ -245,7 +255,8 @@ }, { value: 'radio', text: '鍕鹃�夋' - }] + }, + ...formTypes] }, { type: 'select', @@ -908,6 +919,21 @@ required: false }, { + type: 'radio', + key: 'hidden', + label: '闅愯棌', + initVal: card.hidden || 'false', + tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { type: 'splitLine', key: 'title', label: '琛ㄥ崟', @@ -966,21 +992,6 @@ label: '鍏抽棴鎻愮ず', initVal: card.closeText || '', required: false, - }, - { - type: 'radio', - key: 'hidden', - label: '闅愯棌', - initVal: card.hidden || 'false', - tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��', - required: false, - options: [{ - value: 'false', - text: '鍚�' - }, { - value: 'true', - text: '鏄�' - }] }, { type: 'radio', diff --git a/src/menu/modulecell/index.jsx b/src/menu/modulecell/index.jsx index 135b1e9..e1c5fad 100644 --- a/src/menu/modulecell/index.jsx +++ b/src/menu/modulecell/index.jsx @@ -38,7 +38,7 @@ { value: 'tab', text: '鏍囩椤�', type: 'action', class: 'button', $init: true }, { value: 'innerpage', text: '鏂伴〉闈�', type: 'action', class: 'button', $init: true }, { value: 'funcbutton', text: '鍔熻兘鎸夐挳', type: 'action', class: 'button', $init: true }, - { value: 'form', text: '琛ㄥ崟(寮�鍏�)', type: 'action', class: 'button', $init: true } + { value: 'form', text: '琛ㄥ崟', type: 'action', class: 'button', $init: true } ] }, { diff --git a/src/mob/modulesource/index.jsx b/src/mob/modulesource/index.jsx index f84cdd7..2ee0d7e 100644 --- a/src/mob/modulesource/index.jsx +++ b/src/mob/modulesource/index.jsx @@ -23,6 +23,10 @@ options = fromJS(components).toJS() } else { options = fromJS(menuOptions).toJS() + let adapters = sessionStorage.getItem('adapter') || '' + if (adapters.indexOf('wxmini') === -1) { + options = options.filter(item => item.adapter !== 'mini') + } } this.setState({ diff --git a/src/mob/modulesource/option.jsx b/src/mob/modulesource/option.jsx index 6843f2a..3052eb7 100644 --- a/src/mob/modulesource/option.jsx +++ b/src/mob/modulesource/option.jsx @@ -60,5 +60,5 @@ { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '鑷畾涔�', width: 24 }, { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '鍒嗙粍', width: 24 }, { type: 'menu', url: Login, component: 'login', subtype: 'normallogin', title: '娉ㄥ唽/鐧诲綍', width: 24 }, - { type: 'menu', url: officialAccount, component: 'officialAccount', subtype: 'officialAccount', title: '鍏虫敞鍏紬鍙凤紙灏忕▼搴忎腑锛�', width: 24 }, + { type: 'menu', url: officialAccount, component: 'officialAccount', subtype: 'officialAccount', title: '鍏虫敞鍏紬鍙凤紙灏忕▼搴忎腑锛�', width: 24, adapter: 'mini' }, ] diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 7b31de2..8787af5 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2563,10 +2563,12 @@ if (hidden) return null if (btn.OpenType === 'form') { - if (btn.formType === 'switch') { + if (btn.formType === 'switch') { return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> - } else { + } else if (btn.formType === 'radio') { return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> + } else { + return <Button type="link" icon="scan" disabled={true} style={btn.style} onClick={(e) => {e.stopPropagation()}}></Button> } } -- Gitblit v1.8.0