Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Gospely/cores
Browse files Browse the repository at this point in the history
  • Loading branch information
summerGN committed Apr 18, 2017
2 parents 913212c + 138a88b commit 7889d23
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 6 deletions.
45 changes: 42 additions & 3 deletions src/components/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,27 @@ const LeftSidebar = (props) => {
});
}

if(s == 'domain') {

const illegalLetter = ['!',' ', '@', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=', '[', ']',
'{', '}', '\\', '|', ':', ';', '\'', '"', '<', '>', ',', '.', '/', '?'];
let theCurrentLetter = dom.target.value.replace(props.sidebar.appCreatingForm.domain, '');
if(illegalLetter.indexOf(theCurrentLetter) !== -1) {
notification['warning']({
message: '请勿输入非法字符: \' ' + theCurrentLetter + ' \'',
description: '请重新输入'
});
return false;
}

props.dispatch({
type: 'sidebar/checkDomain',
payload: {
domain: dom.target.value
}
});
}

props.dispatch({
type: 'sidebar/handleInputChanged',
payload: {
Expand Down Expand Up @@ -1401,6 +1422,18 @@ const LeftSidebar = (props) => {
<Input onPressEnter={() => modalAppCreatorProps.next()} onChange={modalAppCreatorFromHandler.onFormInputChange.bind(this, 'appName')} value={props.sidebar.appCreatingForm.appName} />
</Col>
</Row>

</div>

<div style={{ marginTop: 32 }}>
<Row>
<Col span={4} style={{textAlign: 'right'}}>
<span>自定义域名:</span>
</Col>
<Col span={8} style={{textAlign: 'left'}}>
<Input onPressEnter={() => modalAppCreatorProps.next()} onChange={modalAppCreatorFromHandler.onFormInputChange.bind(this, 'domain')} value={props.sidebar.appCreatingForm.domain} addonAfter=".gospel.design" />
</Col>
</Row>
</div>

<div style={{ marginTop: 32 }} hidden={!props.sidebar.appCreatingForm.useGit}>
Expand Down Expand Up @@ -1495,7 +1528,10 @@ const LeftSidebar = (props) => {
message.error('请填写应用名!');
return false;
}

if(props.sidebar.appCreatingForm.domain == '') {
message.error('请填写域名!');
return false;
}
if(props.sidebar.appCreatingForm.fromGit) {
if(props.sidebar.appCreatingForm.git == '') {
message.error('请填写git地址');
Expand All @@ -1507,8 +1543,11 @@ const LeftSidebar = (props) => {
message.error('您的项目名与已有项目重复,请重新填写');
return false;
}


console.log(props.sidebar.appCreatingForm.isDomainAva);
if(!props.sidebar.appCreatingForm.isDomainAva) {
message.error('该域名已被占用,请重新填写');
return false;
}
}

if(props.sidebar.currentAppCreatingStep === 0) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/VDSite/VDRightPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ const VDRightPanel = (props) => {
type: 'vdstyles/changeVDStylePaneSpinActive',
payload: true
})
console.log(key);
console.log(props.vdassets.fileList.length);
if((key == 'assets' && props.vdassets.fileList.length ==0) || (key == 'settings' && props.vdassets.fileList.length ==0)){
props.dispatch({
type: 'vdassets/fetchFileList'
Expand Down
34 changes: 33 additions & 1 deletion src/models/ModelLeftSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export default {
mongodb: false,
isProjectNameAvailabel: true,
useGit: true,
domain: '',
isDomainAva: true
},

images: [],
Expand Down Expand Up @@ -370,6 +372,29 @@ export default {
message: '无法创建'
});
}
},
*checkDomain({payload: params}, {call, put}) {

var url = 'domains?subDomain=' + params.domain.toLocaleLowerCase();
var result = yield request(url, {
method: 'GET'
});

if(result.data.fields.length > 0) {
notification.open({
message: '该域名已被占用'
});
yield put({
type: 'handleDomainAva',
payload: false
})
}else {
yield put({
type: 'handleDomainAva',
payload: true
})
}

},
*deleteApp({payload: params}, {call, put}) {

Expand All @@ -393,6 +418,8 @@ export default {
*handleCreateApp({payload: params}, {call, put, select}) {

var app = yield select(state => state.sidebar.appCreatingForm);


if(!app.fromGit){
app.git = '';
}else {
Expand All @@ -419,7 +446,8 @@ export default {
password: app.databasePassword,
dbUser: app.databaseAccount,
framework: app.framework,
creator: localStorage.user
creator: localStorage.user,
domain: app.domain.toLocaleLowerCase()
};

yield put({
Expand Down Expand Up @@ -1031,6 +1059,10 @@ export default {
handleAvailable(state, { payload: params}){
state.appCreator.available = params.available;
return {...state};
},
handleDomainAva(state, { payload: params}){
state.appCreatingForm.isDomainAva = params;
return {...state};
},
initApplications(state, {payload: params}) {
state.applications = params.applications;
Expand Down

0 comments on commit 7889d23

Please sign in to comment.