Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
c5abe3b1
Commit
c5abe3b1
authored
Nov 26, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add website
parent
19dd0baf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
33 deletions
+59
-33
package.json
package.json
+1
-2
index.js
server/index.js
+0
-1
index.js
src/pages/webConfig/index.js
+30
-25
api.js
src/services/webConfig/api.js
+28
-5
No files found.
package.json
View file @
c5abe3b1
...
...
@@ -35,8 +35,6 @@
"update:deps"
:
"yarn upgrade-interactive --latest"
,
"presetup"
:
"npm i chalk shelljs"
,
"setup"
:
"node ./internals/scripts/setup.js"
,
"clean"
:
"shjs ./internals/scripts/clean.js"
,
"clean:all"
:
"npm run analyze:clean && npm run test:clean && npm run build:clean"
,
"generate"
:
"plop --plopfile internals/generators/index.js"
,
"lint"
:
"npm run lint:js && npm run lint:css"
,
"lint:css"
:
"stylelint src/**/*.less"
,
...
...
@@ -46,6 +44,7 @@
"lint:staged"
:
"lint-staged"
,
"pretest"
:
"npm run test:clean && npm run lint"
,
"test:clean"
:
"rimraf ./coverage"
,
"clean:node_modules"
:
"rimraf ./node_modules"
,
"test"
:
"cross-env NODE_ENV=test jest --coverage"
,
"test:watch"
:
"cross-env NODE_ENV=test jest --watchAll"
,
"coveralls"
:
"cat ./coverage/lcov.info | coveralls"
,
...
...
server/index.js
View file @
c5abe3b1
...
...
@@ -3,7 +3,6 @@
require
(
'./env'
);
const
express
=
require
(
'express'
);
const
logger
=
require
(
'./logger'
);
const
argv
=
require
(
'./argv'
);
const
port
=
require
(
'./port'
);
const
setup
=
require
(
'./middlewares/frontendMiddleware'
);
...
...
src/pages/webConfig/index.js
View file @
c5abe3b1
...
...
@@ -5,8 +5,9 @@ import {
getWebModuleTree
,
getWebconfig
,
postEditWebConfig
,
postAddWebSite
,
}
from
'@/services/webConfig/api'
;
import
{
c
ancelled
}
from
'redux-saga/effect
s'
;
import
{
c
onfig
}
from
'shellj
s'
;
import
styles
from
'./index.less'
;
import
SiteConfig
from
'./components/siteConfigDrawer'
;
import
{
appConnector
}
from
'@/containers/App/store'
;
...
...
@@ -122,34 +123,38 @@ const WebConfigPage = props => {
const
handleSubmit
=
values
=>
{
setSubmitting
(
true
);
if
(
isEdit
)
{
postEditWebConfig
(
values
)
.
then
(
res
=>
{
setSubmitting
(
false
);
if
(
res
.
success
)
{
setCurWeb
({
...
curWeb
,
text
:
values
.
title
});
notification
.
success
({
message
:
'保存成功!'
,
duration
:
3
,
});
updateModuleTree
(
userMode
||
'super'
);
}
else
{
notification
.
warning
({
message
:
res
.
message
||
'编辑失败!'
,
duration
:
5
,
});
}
})
.
catch
(
err
=>
{
const
requestMap
=
{
postEditWebConfig
,
postAddWebSite
,
};
const
successMsg
=
isEdit
?
'保存成功!'
:
'新增网站成功!'
;
const
failMsg
=
isEdit
?
'编辑失败!'
:
'新增网站失败!'
;
requestMap
[
isEdit
?
'postEditWebConfig'
:
'postAddWebSite'
](
values
)
.
then
(
res
=>
{
setSubmitting
(
false
);
if
(
res
.
success
)
{
setCurWeb
({
...
curWeb
,
text
:
values
.
title
});
notification
.
success
({
message
:
'编辑失败!'
,
message
:
successMsg
,
duration
:
3
,
});
updateModuleTree
(
userMode
||
'super'
);
}
else
{
notification
.
warning
({
message
:
res
.
message
||
failMsg
,
duration
:
5
,
});
// eslint-disable-next-line no-console
console
.
error
(
err
);
setSubmitting
(
false
);
}
})
.
catch
(
err
=>
{
notification
.
error
({
message
:
failMsg
,
duration
:
5
,
});
}
// eslint-disable-next-line no-console
console
.
error
(
err
);
setSubmitting
(
false
);
});
};
return
(
...
...
src/services/webConfig/api.js
View file @
c5abe3b1
import
qs
from
'qs'
;
import
{
CITY_SERVICE
,
get
,
PUBLISH_SERVICE
,
post
,
postForm
}
from
'../index'
;
/**
* 获取所有网站配置
* @param {*} userMode
*/
export
const
getWebModuleTree
=
userMode
=>
get
(
`
${
PUBLISH_SERVICE
}
/PlatformCenter/WebModuleTree?
${
qs
.
stringify
({
...
...
@@ -8,27 +12,44 @@ export const getWebModuleTree = userMode =>
})}
`
,
);
export
const
getWebConfigByName
=
webName
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetWebsite`
,
{
title
:
webName
});
/**
* 获取主题下拉选项
*/
export
const
getWebThemes
=
()
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetThemes`
,
{
query
:
''
});
/**
* 获取登录模板下拉选项
*/
export
const
getLoginPage
=
()
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetLoginPage`
,
{
query
:
''
});
/**
* 获取地图配置下拉选项
*/
export
const
getMapCofigs
=
()
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/GetAllConfigText?terminalType=scheme&isBaseMap=false`
,
{
query
:
''
},
);
/**
* 获取网站配置
* @param {*} title 网站标题
*/
export
const
getWebconfig
=
title
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetWebsite`
,
{
title
});
export
const
postEditWebConfig
=
config
=>
/**
* 编辑或添加网站。默认编辑模式
* @param {*} config 网站配置
* @param {*} isAdd true:添加 false:编辑
*/
export
const
postEditWebConfig
=
(
config
,
isAdd
=
false
)
=>
post
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_EditWebsite?_version=9999`
,
`
${
CITY_SERVICE
}
/OMS.svc/
${
isAdd
?
'W4_AddWebsite'
:
'W4_EditWebsite'
}
?_version=9999`
,
qs
.
stringify
({
config
:
JSON
.
stringify
(
config
)
}),
{
headers
:
{
...
...
@@ -36,3 +57,5 @@ export const postEditWebConfig = config =>
},
},
);
export
const
postAddWebSite
=
config
=>
postEditWebConfig
(
config
,
true
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment