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