| | |
| | | |
| | | let wxTemps = sessionStorage.getItem('wxTemplates' + appId) |
| | | |
| | | if (appId && window.GLOB.nginx && !wxTemps) { |
| | | this.getTemps(appId) |
| | | if (appId && !wxTemps) { |
| | | if (verify.wxNote === 'true') { |
| | | this.getTemps(appId) |
| | | } |
| | | } else if (wxTemps) { |
| | | wxTemps = JSON.parse(wxTemps) |
| | | |
| | |
| | | } |
| | | |
| | | getTemps = (appId) => { |
| | | Api.wxAccessToken(appId).then(res => { |
| | | if (res.status && res.access_token) { |
| | | Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${res.access_token}`, 'get').then(res => { |
| | | let temps = [] |
| | | if (res.template_list) { |
| | | temps = res.template_list.filter(item => { |
| | | if (!item.primary_industry || sysTempsIds.includes(item.template_id)) return false |
| | | if (item.content) { |
| | | item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } else if (res.errcode && res.errmsg) { |
| | | message.warning(res.errcode + ': ' + res.errmsg) |
| | | // cgi-bin/template/get_all_private_template |
| | | Api.directRequest({ |
| | | url: window.GLOB.baseurl + 'wechat/get_all_private_template?appid=' + appId, |
| | | method: 'get', |
| | | }).then(res => { |
| | | let temps = [] |
| | | if (res.template_list) { |
| | | temps = res.template_list.filter(item => { |
| | | if (!item.content || item.content.length < 25 || sysTempsIds.includes(item.template_id)) return false |
| | | if (item.content) { |
| | | item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') |
| | | } |
| | | |
| | | sessionStorage.setItem('wxTemplates' + appId, JSON.stringify(temps)) |
| | | |
| | | this.resetTemps(temps) |
| | | return true |
| | | }) |
| | | } else { |
| | | message.warning(res.message || '微信授权失败!') |
| | | sessionStorage.setItem('wxTemplates' + appId, JSON.stringify([])) |
| | | } else if (res.errcode && res.errmsg) { |
| | | message.warning(res.errcode + ': ' + res.errmsg) |
| | | } |
| | | |
| | | sessionStorage.setItem('wxTemplates' + appId, JSON.stringify(temps)) |
| | | |
| | | this.resetTemps(temps) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | this.props.onChange(_verify) |
| | | |
| | | if (key === 'wxNote' && value === 'true' && window.GLOB.WXAppID) { |
| | | let wxTemps = sessionStorage.getItem('wxTemplates' + window.GLOB.WXAppID) |
| | | |
| | | if (wxTemps) { |
| | | wxTemps = JSON.parse(wxTemps) |
| | | |
| | | this.resetTemps(wxTemps) |
| | | } else { |
| | | this.getTemps(window.GLOB.WXAppID) |
| | | } |
| | | } |
| | | } |
| | | |
| | | onNoteCodeChange = (val, option) => { |
| | |
| | | |
| | | let keys = [] |
| | | if (option.props.content) { |
| | | keys = option.props.content.match(/{{[a-zA-Z0-9]+\.DATA}}/g) |
| | | keys = option.props.content.match(/{{[a-zA-Z0-9_]+\.DATA}}/g) |
| | | keys = keys.map(key => key.replace(/{{|\.DATA}}/g, '')) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let miniable = '' |
| | | if (window.GLOB.WXApps) { |
| | | let apps = window.GLOB.WXApps.filter(app => app.appType === 'miniProgram') |
| | | |
| | | if (apps.length > 1) { |
| | | miniable = apps.map(app => `${app.appId}(${app.appName})`) |
| | | miniable = miniable.join(';') |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}></Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title="按钮执行完成后打开DeepSeek,请整理好需要提问的语句。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | DeekSeek |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.DeepSeekable} onChange={(e) => {this.onOptionChange(e.target.value, 'DeepSeekable')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}></Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | |
| | | </Col> : null} |
| | | {verify.wxNoteLink === 'miniProgram' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="top" title="可指定跳转小程序的ID,未设置时默认使用配置文件中的小程序ID。"> |
| | | <Tooltip placement="top" title={'可指定跳转小程序的ID,未设置时默认使用配置文件中的小程序ID。' + miniable}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 小程序ID |
| | | </Tooltip> |