From 43a517b80f2803e0dcf6658113520c4a14c8c17f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 22 五月 2023 18:21:52 +0800 Subject: [PATCH] 2023-05-22 --- src/templates/zshare/verifycard/baseform/index.jsx | 127 +++++++++++++++++++++++++++++++----------- 1 files changed, 94 insertions(+), 33 deletions(-) diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 606b0a8..00171d3 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -82,30 +82,30 @@ const { verify } = this.props let sysTemps = [ - // { - // template_id: '8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', - // title: '璁㈠崟鍙楃悊閫氱煡锛堟槑绉戜簯锛�', - // primary_industry: 'IT绉戞妧', - // deputy_industry: 'IT杞欢涓庢湇鍔�', - // content: '璁㈠崟鍙凤細{{keyword1.DATA}}\n璁㈠崟绫诲瀷锛歿{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}\n閫氱煡鏃堕棿锛歿{keyword4.DATA}}', - // example: '璁㈠崟鍙凤細20190101001\r\n璁㈠崟绫诲瀷锛氳。鏌淺r\n璁㈠崟鐘舵�侊細璁捐瀹屾垚\r\n閫氱煡鏃堕棿锛�2019骞�1鏈�1鏃�12:30' - // }, - // { - // template_id: 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok', - // title: '璁㈠崟杩涘害鎻愰啋锛堟槑绉戜簯锛�', - // primary_industry: 'IT绉戞妧', - // deputy_industry: 'IT杞欢涓庢湇鍔�', - // content: '璁㈠崟绫诲瀷锛歿{keyword1.DATA}}\n璁㈠崟鍙凤細{{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}', - // example: '璁㈠崟绫诲瀷锛氶��绉熺敵璇穃r\n璁㈠崟鍙凤細TZ16101909\r\n璁㈠崟鐘舵�侊細寰呭彇璐�' - // }, - // { - // template_id: 'mk_category_temp', - // title: '绫荤洰妯℃澘', - // primary_industry: '', - // deputy_industry: '', - // content: '', - // example: '' - // } + { + template_id: '8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', + title: '璁㈠崟鍙楃悊閫氱煡锛堟槑绉戜簯锛�', + primary_industry: 'IT绉戞妧', + deputy_industry: 'IT杞欢涓庢湇鍔�', + content: '璁㈠崟鍙凤細{{keyword1.DATA}}\n璁㈠崟绫诲瀷锛歿{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}\n閫氱煡鏃堕棿锛歿{keyword4.DATA}}', + example: '璁㈠崟鍙凤細20190101001\r\n璁㈠崟绫诲瀷锛氳。鏌淺r\n璁㈠崟鐘舵�侊細璁捐瀹屾垚\r\n閫氱煡鏃堕棿锛�2019骞�1鏈�1鏃�12:30' + }, + { + template_id: 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok', + title: '璁㈠崟杩涘害鎻愰啋锛堟槑绉戜簯锛�', + primary_industry: 'IT绉戞妧', + deputy_industry: 'IT杞欢涓庢湇鍔�', + content: '璁㈠崟绫诲瀷锛歿{keyword1.DATA}}\n璁㈠崟鍙凤細{{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}', + example: '璁㈠崟绫诲瀷锛氶��绉熺敵璇穃r\n璁㈠崟鍙凤細TZ16101909\r\n璁㈠崟鐘舵�侊細寰呭彇璐�' + }, + { + template_id: 'mk_category_temp', + title: '绫荤洰妯℃澘', + primary_industry: '', + deputy_industry: '', + content: '', + example: '' + } ] let _wxTemps = [...wxTemps, ...sysTemps] @@ -131,6 +131,8 @@ } else if (verify.wxNote === 'true') { if (!verify.wxTemplateId) { error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕侀�夋嫨娑堟伅妯℃澘锛�' + } else if (verify.wxTemplateId === 'mk_category_temp' && !verify.wxCustomTempId) { + error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕佸~鍐欐秷鎭ā鏉縄D锛�' } else if (verify.wxNoteLink === 'url' && !verify.wxNoteLinkUrl) { error = '璇峰~鍐欑綉鍧�锛�' } @@ -158,6 +160,8 @@ _verify.wxNoteLinkMenuId = '' _verify.wxNoteCallback = 'false' _verify.wxNoteKeys = null + + delete _verify.wxCustomTempId if (this.state.selectTemp) { this.setState({selectTemp: null}) @@ -196,15 +200,27 @@ keys = keys.map(key => key.replace(/{{|\.DATA}}/g, '')) } - let index = 1 - _verify.wxNoteKeys = keys.map(key => { - let item = { key: key } - - item.value = 'p' + index - index++ + delete _verify.wxCustomTempId - return item - }) + if (selectTemp.template_id === 'mk_category_temp') { + _verify.wxNoteKeys = [] + for (let i = 1; i <= 10; i++) { + _verify.wxNoteKeys.push({ + key: '', + value: 'p' + i + }) + } + } else { + let index = 1 + _verify.wxNoteKeys = keys.map(key => { + let item = { key: key } + + item.value = 'p' + index + index++ + + return item + }) + } this.setState({selectTemp}) @@ -221,6 +237,28 @@ return m }) + + this.props.onChange(_verify) + } + + onWxNoteValueChange = (value, val) => { + let _verify = fromJS(this.props.verify).toJS() + + _verify.wxNoteKeys = _verify.wxNoteKeys.map(m => { + if (m.value === value) { + m.key = val.replace(/\s+/ig, '') + } + + return m + }) + + this.props.onChange(_verify) + } + + onWxNoteTempIdChange = (value) => { + let _verify = fromJS(this.props.verify).toJS() + + _verify.wxCustomTempId = value.replace(/\s+/ig, '') this.props.onChange(_verify) } @@ -421,7 +459,7 @@ <Input placeholder="" autoComplete="off" value={verify.wxNoteLinkMenuId || ''} onChange={(e) => {this.onOptionChange(e.target.value, 'wxNoteLinkMenuId')}}/> </Form.Item> </Col> : null} - {verify.wxNote === 'true' && verify.wxNoteKeys ? verify.wxNoteKeys.map((item, index) => <Col span={8} key={'mk' + index}> + {verify.wxNote === 'true' && verify.wxNoteKeys && (!selectTemp || selectTemp.template_id !== 'mk_category_temp') ? verify.wxNoteKeys.map((item, index) => <Col span={8} key={'mk' + index}> <Form.Item label={item.key} required> <Select value={item.value} onSelect={(val) => this.onWxNoteKeyChange(item.key, val)}> <Select.Option value="p1">p1</Select.Option> @@ -435,6 +473,16 @@ <Select.Option value="p9">p9</Select.Option> <Select.Option value="p10">p10</Select.Option> </Select> + </Form.Item> + </Col>) : null} + {verify.wxNote === 'true' && verify.wxNoteKeys && (selectTemp && selectTemp.template_id === 'mk_category_temp') ? <Col span={8}> + <Form.Item label="妯℃澘ID" required> + <Input placeholder="" defaultValue={verify.wxCustomTempId} autoComplete="off" onChange={(e) => {this.onWxNoteTempIdChange(e.target.value)}}/> + </Form.Item> + </Col> : null} + {verify.wxNote === 'true' && verify.wxNoteKeys && (selectTemp && selectTemp.template_id === 'mk_category_temp') ? verify.wxNoteKeys.map((item, index) => <Col span={8} key={'mk' + index}> + <Form.Item label={item.value}> + <Input placeholder="" defaultValue={item.key} autoComplete="off" onChange={(e) => {this.onWxNoteValueChange(item.value, e.target.value)}}/> </Form.Item> </Col>) : null} {selectTemp && selectTemp.template_id !== 'mk_category_temp' && verify.wxNoteKeys ? <Col span={24} className="wx-note"> @@ -462,6 +510,19 @@ </div> </div> </Col> : null} + {selectTemp && selectTemp.template_id === 'mk_category_temp' && verify.wxNoteKeys ? <Col span={24} className="wx-note"> + <div className="note-wrap"> + <div className="note"> + <p>娑堟伅浣�</p> + <div> + <p>openid: "鎺ユ敹鑰卭penid",</p> + <p>send_id: "闃查噸鍏d",</p> + <p>bid: "璺宠浆灏忕▼搴忔椂锛屽彲浣滀负BID銆�"</p> + <p style={{color: '#1890ff'}}>璇峰湪閫氱敤瀛楁涓紙p1~p10锛夊~鍏ユā鏉夸腑瀵瑰簲鐨勫瓧娈靛悕锛屽 time1.DATA 鍒欏~鍐� time1銆�</p> + </div> + </div> + </div> + </Col> : null} </Row> </Form> ) -- Gitblit v1.8.0