From 5b166dd93003adb0749002d74109a519f746e204 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 03 八月 2024 16:49:15 +0800
Subject: [PATCH] 2024-08-03

---
 src/views/appmanage/submutilform/index.jsx |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx
index 0467a7c..369b47f 100644
--- a/src/views/appmanage/submutilform/index.jsx
+++ b/src/views/appmanage/submutilform/index.jsx
@@ -21,7 +21,8 @@
     typename: 'mob',
     adapters: [],
     exts: [],
-    WXApps: null
+    WXApps: null,
+    WXMerchs: null
   }
 
   UNSAFE_componentWillMount() {
@@ -38,6 +39,12 @@
       typename = card.typename || 'mob'
       adapters = card.adapter ? card.adapter.split(',') : []
 
+      if (!adapters.includes('fbdH5')) {
+        adapters.unshift('H5')
+      }
+
+      adapters = adapters.filter(n => n !== 'fbdH5')
+
       if (typename !== 'pc') {
         if (card.user_binding === 'true') {
           exts.push('user_binding')
@@ -46,18 +53,26 @@
           exts.push('share')
         }
       }
+    } else {
+      adapters = ['H5']
     }
 
-    let apps = null
+    let WXApps = null
+    let WXMerchs = null
     if (window.GLOB.WXApps) {
-      apps = window.GLOB.WXApps.filter(app => app.appType === 'public')
+      WXApps = window.GLOB.WXApps.filter(app => app.appType === 'public')
 
-      if (apps.length === 0) {
-        apps = null
+      if (WXApps.length === 0) {
+        WXApps = null
+      }
+      WXMerchs = window.GLOB.WXApps.filter(app => app.appType === 'merchant')
+
+      if (WXMerchs.length === 0) {
+        WXMerchs = null
       }
     }
 
-    this.setState({typename, adapters, exts, langs: _langs, WXApps: apps})
+    this.setState({typename, adapters, exts, langs: _langs, WXApps, WXMerchs})
   }
 
   /**
@@ -67,6 +82,12 @@
     return new Promise(resolve => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
+          if (values.adapter) {
+            if (!values.adapter.includes('H5')) {
+              values.adapter.unshift('fbdH5')
+            }
+          }
+
           values.adapter = values.adapter ? values.adapter.join(',') : ''
 
           if (values.exts) {
@@ -77,6 +98,10 @@
           if (values.wxAppId) {
             let app = window.GLOB.WXApps.filter(app => app.appType === 'public' && values.wxAppId === app.appId)[0]
             values.wxAppName = app ? app.appName : values.wxAppId
+          }
+          if (values.wxMerchId) {
+            let app = window.GLOB.WXApps.filter(app => app.appType === 'merchant' && values.wxMerchId === app.appId)[0]
+            values.wxMerchName = app ? app.appName : values.wxMerchId
           }
 
           resolve(values)
@@ -103,7 +128,7 @@
   render() {
     const { card, type } = this.props
     const { getFieldDecorator } = this.props.form
-    const { typename, adapters, exts, langs, WXApps } = this.state
+    const { typename, adapters, exts, langs, WXApps, WXMerchs } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -185,6 +210,7 @@
                 initialValue: adapters
               })(
                 <Checkbox.Group onChange={this.onAdapterChange}>
+                  <Checkbox value="H5">H5</Checkbox>
                   <Checkbox value="app">app</Checkbox>
                   <Checkbox value="weixin">鍏紬鍙�</Checkbox>
                   <Checkbox value="wxmini">灏忕▼搴�</Checkbox>
@@ -194,9 +220,9 @@
           </Col> : null}
           {WXApps ? <Col span={12}>
             <Form.Item label={
-              <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ叕浼楀彿杩涜鏀粯鍙婇��娆俱��">
+              <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ叕浼楀彿杩涜鏀粯銆侀��娆俱�佹巿鏉冪櫥褰曘��">
                 <QuestionCircleOutlined className="mk-form-tip" />
-                鍏宠仈鍏紬鍙�
+                鍏宠仈搴旂敤
               </Tooltip>
             }>
               {getFieldDecorator('wxAppId', {
@@ -208,6 +234,22 @@
               )}
             </Form.Item>
           </Col> : null}
+          {WXMerchs ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ晢鎴峰彿杩涜鏀粯鍙婇��娆俱��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍏宠仈鍟嗘埛
+              </Tooltip>
+            }>
+              {getFieldDecorator('wxMerchId', {
+                initialValue: card ? card.wxMerchId : ''
+              })(
+                <Select allowClear>
+                  {WXMerchs.map(item => <Select.Option key={item.appId} value={item.appId}>{item.appName}</Select.Option>)}
+                </Select>
+              )}
+            </Form.Item>
+          </Col> : null}
           {typename !== 'pc' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="鍦ㄥ叕浼楀彿鎴栧皬绋嬪簭涓紝鍙坊鍔犵粦瀹氱郴缁熺敤鎴枫�佽嚜瀹氫箟鍒嗕韩绛夊姛鑳斤紝鑷畾涔夊垎浜缃悗锛屽綋鍓嶅瓙搴旂敤灏嗛粯璁や娇鐢ㄦ鍒嗕韩閾炬帴銆�">

--
Gitblit v1.8.0