xy 7 år sedan
förälder
incheckning
6db64ce090
3 ändrade filer med 151 tillägg och 18 borttagningar
  1. 113 17
      src/app/wechatService/wxConfig/WxConfig.jsx
  2. 20 1
      src/language/en_US.js
  3. 18 0
      src/language/zh_CN.js

+ 113 - 17
src/app/wechatService/wxConfig/WxConfig.jsx

@@ -5,14 +5,61 @@ import {UPDATE_WXCONFIG, SHOW_WXCONTENT, DELETE_WXCONFIG, SHOW_WXCONFIG,DELETE_P
 import gql from "graphql-tag";
 import {Mutation, Query} from "react-apollo";
 import {getCookie} from "../../../cookie";
-
+import {FormattedMessage} from 'react-intl';
 const confirm = Modal.confirm;
 
+const valueToKey = {
+    'appName': 'appName',
+    'appID': 'appID',
+    'appSecret': 'appSecret',
+    'enter_url': 'enter_url',
+    'token': 'token',
+    'welcome_words': 'welcome_words',
+    'pay_api_key': 'pay_api_key',
+    'attach': 'attach',
+    'mch_id': 'mch_id',
+    'body': 'body',
+    'spbill_create_ip': 'spbill_create_ip',
+    'notify_url': 'notify_url',
+};
+
+const toolTipTitle = {
+    'appName': 'its appName',
+    'appID': 'its appID',
+    'appSecret': 'its appSecret',
+    'enter_url': 'its enter_url',
+    'token': 'its token',
+    'welcome_words': 'its welcome_words',
+    'pay_api_key': 'its pay_api_key',
+    'attach': 'its attach',
+    'mch_id': 'its mch_id',
+    'body': 'its body',
+    'spbill_create_ip': 'its spbill_create_ip',
+    'notify_url': 'its notify_url',
+};
+
+const youMustFill = {
+    'appName': true,
+    'appID': true,
+    'appSecret': true,
+    'enter_url': true,
+    'token': true,
+    'welcome_words': true,
+    'pay_api_key': true,
+    'attach': true,
+    'mch_id': true,
+    'body': true,
+    'spbill_create_ip': true,
+    'notify_url': true,
+};
+
 class WxConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            configs: ['appName', 'appID', 'appSecret', 'enter_url', 'token', 'welcome_words', 'pay_api_key', 'attach', 'mch_id', 'body', 'spbill_create_ip', 'notify_url'],
+            config1s: ['appName', 'appID', 'appSecret'],
+            config2s: ['enter_url', 'token', 'welcome_words'],
+            config3s: ['pay_api_key', 'attach', 'mch_id', 'body', 'spbill_create_ip', 'notify_url'],
             configID: props.location.state === undefined ? props.defaultConfigID : props.location.state.configID,
             appName: props.location.state === undefined ? props.defaultAppName : props.location.state.appName,
             projectID: props.location.state === undefined ? props.projectID : props.location.state.projectID,
@@ -41,10 +88,12 @@ class WxConfig extends Component {
                             return 'error!';
                         }
                         let {history, location, trialcase} = this.props;
-                        let {appName, configID, configs,projectID,userID} = this.state;
+                        let {appName, configID, config1s, config2s, config3s, projectID,userID} = this.state;
                         return (
                             <Display
-                                configs={configs}
+                                config1s={config1s}
+                                config2s={config2s}
+                                config3s={config3s}
                                 userID={userID}
                                 projectID={projectID}
                                 configID={configID}
@@ -116,18 +165,65 @@ class Display extends Component {
     };
 
     render() {
-        let {configs} = this.props;
+        let {config1s, config2s, config3s} = this.props;
         let {userID,configID, appName,projectID, mch_id, notify_url, appSecret, appID, token, spbill_create_ip, enter_url, pay_api_key, body, welcome_words, attach} = this.state;
         return (
             <div>
                 <div className={'schema-name'}>
-                    {/*<FormattedMessage id='service manage'/>*/}
-                    app
+                    <FormattedMessage id="WeChat Subscription Data"/>
                 </div>
                 {
-                    configs.map(config => (
+                    config1s.map(config => (
                         <div key={config} style={{marginBottom: 10}}>
-                            <span className='vice-title'>{config}: </span>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                            </span>
+                            <Input value={this.state[config]} style={{width: 200}}
+                                   onChange={this.switchConfig(config)}/>
+                        </div>
+                    ))
+                }
+                <div className={'schema-name'}>
+                    <FormattedMessage id="Server configurations"/>
+                </div>
+                {
+                    config2s.map(config => (
+                        <div key={config} style={{marginBottom: 10}}>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                            </span>
+                            <Input value={this.state[config]} style={{width: 200}}
+                                   onChange={this.switchConfig(config)}/>
+                        </div>
+                    ))
+                }
+                <div className={'schema-name'}>
+                    <FormattedMessage id="Pay configurations"/>
+                </div>
+                {
+                    config3s.map(config => (
+                        <div key={config} style={{marginBottom: 10}}>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                            </span>
                             <Input value={this.state[config]} style={{width: 200}}
                                    onChange={this.switchConfig(config)}/>
                         </div>
@@ -153,12 +249,12 @@ class Display extends Component {
                                 welcome_words={welcome_words}
                                 attach={attach}
                             />
-                            <DeleteWXProjectButton
-                                id={configID}
-                                userID={userID}
-                                projectID={projectID}
-                                history={this.props.history}
-                            />
+                            {/*<DeleteWXProjectButton*/}
+                                {/*id={configID}*/}
+                                {/*userID={userID}*/}
+                                {/*projectID={projectID}*/}
+                                {/*history={this.props.history}*/}
+                            {/*/>*/}
                         </div>
 
                 }
@@ -202,7 +298,7 @@ class UpdateWXConfigButton extends Component {
                                     updatedAt: new Date().getTime()
                                 }
                             });
-                        }}>save</Button>
+                        }}><FormattedMessage id="save"/></Button>
                     )
                 }}
             </Mutation>
@@ -253,7 +349,7 @@ class DeleteWXProjectButton extends Component {
                             type={'danger'}
                             onClick={() => {
                                 this.showConfirm(delete_wx_project, projectID, userID);
-                            }}>delete</Button>
+                            }}><FormattedMessage id="delete"/></Button>
                     )
                 }}
             </Mutation>

+ 20 - 1
src/language/en_US.js

@@ -123,6 +123,25 @@ const en_US = {
     'login failed': 'login filed',
     'relogin': 'relogin',
     'nickname': 'nickname',
-    'username has been used': 'username has been used, please change one'
+    'username has been used': 'username has been used, please change one',
+
+
+    // 微信
+    'WeChat Subscription Data': 'WeChat Subscription Data',
+    'Server configurations': 'Server configurations',
+    'Pay configurations': 'Pay configurations',
+
+    'appName': 'appName',
+    'appID': 'appID',
+    'appSecret': 'appSecret',
+    'enter_url': 'enter url',
+    'token': 'token',
+    'welcome_words': 'welcome words',
+    'pay_api_key': 'pay api key',
+    'attach': 'attach',
+    'mch_id': 'mch id',
+    'body': 'body',
+    'spbill_create_ip': 'spbill_create ip',
+    'notify_url': 'notify url',
 };
 export default en_US;

+ 18 - 0
src/language/zh_CN.js

@@ -125,5 +125,23 @@ const zh_CN = {
     'relogin': '重新登录',
     'nickname': '昵称',
     'username has been used': '用户名已被占用,请更换',
+
+    // 微信
+    'WeChat Subscription Data': '公众号开发信息',
+    'Server configurations': '服务器配置',
+    'Pay configurations': '支付配置',
+
+    'appName': '名称',
+    'appID': 'AppID',
+    'appSecret': 'AppSecret',
+    'enter_url': '服务器地址',
+    'token': '令牌',
+    'welcome_words': '关注回复语',
+    'pay_api_key': '商户平台 API key',
+    'attach': '附加数据',
+    'mch_id': '商户号',
+    'body': '商品描述',
+    'spbill_create_ip': '终端 IP',
+    'notify_url': '支付通知地址',
 };
 export default zh_CN;