Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
40430826
提交
40430826
authored
6月 22, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
706caa15
6553cb56
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
399 行增加
和
5 行删除
+399
-5
binaryEncode.js
one_stop_public/Base16/binaryEncode.js
+10
-1
prepareShow.js
one_stop_public/Table/prepareShow.js
+2
-1
request.js
one_stop_public/utils/request.js
+6
-3
token.js
one_stop_public/utils/token.js
+13
-0
apiSystemConfig.js
zyd_public/request/apiSystemConfig.js
+90
-0
request.js
zyd_public/request/request.js
+278
-0
没有找到文件。
one_stop_public/Base16/binaryEncode.js
浏览文件 @
40430826
...
@@ -109,7 +109,16 @@ export function giveFilePostData(datas, url) {
...
@@ -109,7 +109,16 @@ export function giveFilePostData(datas, url) {
});
});
}
}
export
function
requestFileInfo
(
url
,
datas
)
{
function
testPromise
(
d
){
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
d
);
});
}
export
async
function
requestFileInfo
(
url
,
datas
)
{
for
(
let
i
=
0
;
i
<
100
;
i
++
){
datas
=
await
testPromise
(
datas
);
}
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
if
(
getToken
())
{
if
(
getToken
())
{
datas
.
token
=
getToken
();
datas
.
token
=
getToken
();
...
...
one_stop_public/Table/prepareShow.js
浏览文件 @
40430826
...
@@ -7,6 +7,7 @@ import moment from 'moment';
...
@@ -7,6 +7,7 @@ import moment from 'moment';
import
{
giveSmartFormGlobalProps
}
from
'@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps'
;
import
{
giveSmartFormGlobalProps
}
from
'@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps'
;
import
{
getToken
}
from
'@/webPublic/one_stop_public/utils/token'
;
import
{
getToken
}
from
'@/webPublic/one_stop_public/utils/token'
;
import
{
getUrlInfo
}
from
'@/webPublic/one_stop_public/DetailForAudit/utils'
;
import
{
getUrlInfo
}
from
'@/webPublic/one_stop_public/DetailForAudit/utils'
;
const
test
=
getUrlInfo
().
test
;
export
default
function
prepareShow
(
postData
=
{},
content
=
''
)
{
export
default
function
prepareShow
(
postData
=
{},
content
=
''
)
{
// 模板挂载前执行的公式
// 模板挂载前执行的公式
...
@@ -24,7 +25,7 @@ export default function prepareShow(postData = {}, content = '') {
...
@@ -24,7 +25,7 @@ export default function prepareShow(postData = {}, content = '') {
window
.
moment
=
moment
;
window
.
moment
=
moment
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
agg
?.
unifiedServicePatternModel
?.
id
);
// 表单id;
console
.
log
(
agg
?.
unifiedServicePatternModel
?.
id
);
// 表单id;
if
(
agg
?.
unifiedServicePatternModel
?.
id
&&
window
.
location
.
href
.
indexOf
(
'localhost'
)
>
-
1
)
{
if
(
agg
?.
unifiedServicePatternModel
?.
id
&&
(
window
.
location
.
href
.
indexOf
(
'localhost'
)
>
-
1
||
test
===
'true'
)
)
{
const
SystemConfig
=
window
.
specialImportantSystemConfig
||
{};
const
SystemConfig
=
window
.
specialImportantSystemConfig
||
{};
console
.
log
(
'%c'
+
`
${
SystemConfig
?.
gateWayPort
}
/onestop/
#
/
admin
/
processServices
/
modelConfig
/
templateDetail
/
designById
?
id
=
$
{
agg
.
unifiedServicePatternModel
.
id
}
&
token
=
$
{
getToken
()}
`, 'color: green;background: white;font-size: 14px');
console
.
log
(
'%c'
+
`
${
SystemConfig
?.
gateWayPort
}
/onestop/
#
/
admin
/
processServices
/
modelConfig
/
templateDetail
/
designById
?
id
=
$
{
agg
.
unifiedServicePatternModel
.
id
}
&
token
=
$
{
getToken
()}
`, 'color: green;background: white;font-size: 14px');
console.log('%c' + `
$
{
SystemConfig
?.
gateWayPort
}
/wisdomSchool/
#
/
designFormByUrl
?
id
=
$
{
agg
.
unifiedServicePatternModel
.
id
}
&
token
=
$
{
getToken
()}
`, 'color: green;background: white;font-size: 14px');
console.log('%c' + `
$
{
SystemConfig
?.
gateWayPort
}
/wisdomSchool/
#
/
designFormByUrl
?
id
=
$
{
agg
.
unifiedServicePatternModel
.
id
}
&
token
=
$
{
getToken
()}
`, 'color: green;background: white;font-size: 14px');
...
...
one_stop_public/utils/request.js
浏览文件 @
40430826
...
@@ -16,6 +16,7 @@ import { showToast } from '../location/Toast';
...
@@ -16,6 +16,7 @@ import { showToast } from '../location/Toast';
import
{
offline
}
from
'../location/Toast'
;
import
{
offline
}
from
'../location/Toast'
;
import
{
giveBase16EnCode
,
requestFileInfo
}
from
'@/webPublic/one_stop_public/Base16'
;
import
{
giveBase16EnCode
,
requestFileInfo
}
from
'@/webPublic/one_stop_public/Base16'
;
import
objectToFormData
from
'@/webPublic/zyd_public/utils/object-to-formdata-custom'
;
import
objectToFormData
from
'@/webPublic/zyd_public/utils/object-to-formdata-custom'
;
import
{
getUrlInfo
}
from
'@/webPublic/one_stop_public/DetailForAudit/utils'
;
const
codeMessage
=
{
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
200
:
'服务器成功返回请求的数据。'
,
...
@@ -62,7 +63,7 @@ export const qqCw = ({
...
@@ -62,7 +63,7 @@ export const qqCw = ({
return
undefined
;
return
undefined
;
};
};
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
if
(
param
==
null
)
return
''
;
if
(
param
==
null
)
return
''
;
var
paramStr
=
''
;
var
paramStr
=
''
;
var
t
=
typeof
param
;
var
t
=
typeof
param
;
...
@@ -126,10 +127,12 @@ const loginUmiRequest = extend({
...
@@ -126,10 +127,12 @@ const loginUmiRequest = extend({
});
});
const
getUrl
=
url
=>
(
url
.
startsWith
(
'/'
)
?
url
:
'/'
+
url
);
const
getUrl
=
url
=>
(
url
.
startsWith
(
'/'
)
?
url
:
'/'
+
url
);
const
test
=
getUrlInfo
().
test
;
export
const
request
=
(
url
,
data
,
options
=
{})
=>
{
export
const
request
=
(
url
,
data
,
options
=
{})
=>
{
if
(
url
&&
url
.
indexOf
(
'getSqlData'
)
>
-
1
)
{
if
(
url
&&
test
===
'true'
)
{
console
.
log
(
data
);
console
.
log
(
url
,
data
);
}
}
return
giveBase16EnCode
(
data
,
url
)
return
giveBase16EnCode
(
data
,
url
)
.
then
((
newData
)
=>
{
.
then
((
newData
)
=>
{
...
...
one_stop_public/utils/token.js
浏览文件 @
40430826
...
@@ -57,3 +57,16 @@ export const getUserInfo = () => {
...
@@ -57,3 +57,16 @@ export const getUserInfo = () => {
};
};
}
}
};
};
export
function
setFetchUrl
(
data
)
{
return
localStorage
.
setItem
(
'fetch-url-data'
,
data
);
}
export
function
getFetchUrl
()
{
return
localStorage
.
getItem
(
'fetch-url-data'
);
}
export
function
getType
()
{
return
localStorage
.
getItem
(
'antd-pro-type'
)
||
""
;
}
zyd_public/request/apiSystemConfig.js
0 → 100644
浏览文件 @
40430826
const
routes
=
[
{
path
:
'/v1/api/flow/'
,
name
:
''
,
},
{
path
:
'/v1/api/message'
,
name
:
'消息中心系统'
,
},
{
path
:
'/v1/api/perm/'
,
name
:
'权限管理系统'
,
},
{
path
:
'/v1/api/permuaa/'
,
name
:
'认证管理系统'
,
},
{
path
:
'/uaa/'
,
name
:
'认证系统'
,
},
{
path
:
'/wx/'
,
name
:
'微信消息系统'
,
},
{
path
:
'/v1/api/folder/'
,
name
:
'文件系统'
,
},
{
path
:
'/v1/api/pubFolder/'
,
name
:
'文件系统'
,
},
{
path
:
'/dsf/'
,
name
:
''
,
},
{
path
:
'/v1/api/xgWeb/'
,
name
:
'学工系统'
,
},
{
path
:
'/v1/api/lxWeb/'
,
name
:
'离校系统'
,
},
{
path
:
'/v1/api/yxWeb/'
,
name
:
'迎新系统'
,
},
{
path
:
'/v1/api/yxMobile/'
,
name
:
''
,
},
{
path
:
'/yxAdmin/'
,
name
:
'迎新系统'
,
},
{
path
:
'/lxAdmin/'
,
name
:
'离校系统'
,
},
{
path
:
'/v1/api/zydxgWeb/'
,
name
:
'系统'
,
},
{
path
:
'/v1/api/twWeb/'
,
name
:
'团委系统'
,
},
{
path
:
'/v1/api/twMobile'
,
name
:
''
,
},
{
path
:
'/v1/api/zydxgMobile/'
,
name
:
''
,
},
{
path
:
'/v1/api/perm/'
,
name
:
'权限系统'
,
},
{
path
:
'/v1/api/activityWebApi/'
,
name
:
'活动管理'
,
}
];
export
default
routes
;
zyd_public/request/request.js
0 → 100644
浏览文件 @
40430826
import
fetch
from
'dva/fetch'
;
import
router
from
'umi/router'
;
import
moment
from
'moment'
;
import
FormdataWrapper
from
'@/webPublic/zyd_public/utils/object-to-formdata-custom'
;
import
{
isJSON
,
controlNotification
,
getIsBei_Dian
}
from
'@/webPublic/zyd_public/utils/utils'
;
import
config
from
'@/config/config'
;
import
apiConfig
from
'./apiSystemConfig'
;
import
{
omit
}
from
'lodash'
;
import
qs
from
'qs'
;
import
{
queryIsSafe
}
from
'@/webPublic/one_stop_public/utils/queryConfig'
;
import
{
uaaRequest
}
from
'@/webPublic/one_stop_public/utils/request'
;
import
{
getToken
,
setToken
,
setFetchUrl
,
getFetchUrl
,
getType
}
from
'@/webPublic/one_stop_public/utils/token'
;
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
201
:
'新建或修改数据成功。'
,
202
:
'一个请求已经进入后台排队(异步任务)。'
,
204
:
'删除数据成功。'
,
400
:
'发出的请求有错误,服务器没有进行新建或修改数据的操作。'
,
401
:
'登录已过期,请重新登录'
,
403
:
'用户得到授权,但是访问是被禁止的。'
,
404
:
'发出的请求针对的是不存在的记录,服务器没有进行操作。'
,
406
:
'请求的格式不可得。'
,
410
:
'请求的资源被永久删除,且不会再得到的。'
,
422
:
'当创建一个对象时,发生一个验证错误。'
,
500
:
'服务器发生错误,请检查服务器。'
,
502
:
'网关错误。'
,
503
:
'服务不可用,服务器暂时过载或维护。'
,
504
:
'网关超时。'
,
};
const
checkStatus
=
response
=>
{
if
(
response
.
status
!==
401
)
{
return
response
;
}
const
errortext
=
codeMessage
[
response
.
status
]
||
response
.
statusText
;
const
token
=
getToken
();
if
(
token
&&
token
!==
'null'
)
{
controlNotification
({
message
:
`
${
response
.
status
===
401
?
'登录过期'
:
'请求错误'
}
`
,
description
:
errortext
,
});
}
if
(
response
.
status
===
401
)
{
setToken
(
null
);
if
(
window
.
top
!=
window
.
self
){
window
.
top
.
postMessage
(
"returnLogin"
,
'*'
);
// Iframe 返回登录页
return
true
;
}
}
const
error
=
new
Error
(
errortext
);
error
.
name
=
response
.
status
;
error
.
response
=
response
;
throw
error
;
};
const
cachedSave
=
(
response
,
hashcode
)
=>
{
/**
* Clone a response data and store it in sessionStorage
* Does not support data other than json, Cache only json
*/
const
contentType
=
response
.
headers
.
get
(
'Content-Type'
);
if
(
contentType
&&
contentType
.
match
(
/application
\/
json/i
))
{
// All data is saved as text
response
.
clone
()
.
text
()
.
then
(
content
=>
{
sessionStorage
.
setItem
(
hashcode
,
content
);
sessionStorage
.
setItem
(
`
${
hashcode
}
:timestamp`
,
Date
.
now
());
});
}
return
response
;
};
async
function
queryDemo
()
{
return
false
;
}
function
setFetchInfo
(
url
,
options
)
{
let
session
=
getFetchUrl
();
if
(
isJSON
(
session
))
{
session
=
JSON
.
parse
(
session
);
if
(
session
.
url
===
url
&&
moment
().
valueOf
()
-
session
.
time
<
500
)
{
if
(
options
.
body
&&
JSON
.
stringify
(
options
.
body
)
===
session
.
body
)
{
console
.
log
(
'频繁调用接口: '
,
url
);
return
false
;
}
}
}
return
JSON
.
stringify
({
url
,
time
:
moment
().
valueOf
(),
body
:
options
.
body
?
JSON
.
stringify
(
options
.
body
)
:
''
,
});
}
/**
* Requests a URL, returning a promise.
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
*/
export
default
function
request
(
url
,
options
=
{},
)
{
if
(
url
&&
url
.
indexOf
(
'/CmsApi/'
)
>
-
1
&&
queryIsSafe
()
&&
url
.
indexOf
(
'/CmsApi/getExportInfo'
)
<=
-
1
)
{
url
=
url
.
replace
(
config
.
httpServer
,
''
);
return
uaaRequest
(
url
,
options
.
body
);
}
if
(
process
.
env
.
NODE_ENV
===
'development'
&&
getIsBei_Dian
()){
url
=
url
.
replace
(
'https://yx.bpi.edu.cn/produce'
,
'http://localhost:8010/produce'
);
}
let
sessionFetch
=
setFetchInfo
(
url
,
options
);
if
(
!
sessionFetch
)
{
return
queryDemo
();
}
else
{
setFetchUrl
(
sessionFetch
);
}
let
defaultToken
=
getToken
();
const
token
=
defaultToken
!==
null
&&
defaultToken
!==
'null'
?
defaultToken
:
''
;
if
(
url
.
indexOf
(
'oauthPub=true'
)
<=
-
1
&&
url
.
indexOf
(
'uia/logout'
)
<=
-
1
){
if
(
url
.
indexOf
(
'?'
)
>
-
1
){
url
=
url
+
'&token='
+
(
process
.
env
.
NODE_ENV
===
'development'
?
token
:
''
);
}
else
{
url
=
url
+
'?token='
+
(
process
.
env
.
NODE_ENV
===
'development'
?
token
:
''
);
}
}
if
(
options
.
time
)
{
const
time
=
new
Date
().
getTime
();
if
(
url
.
indexOf
(
'?'
)
===
-
1
)
{
url
=
url
+
'?time='
+
time
;
}
else
{
url
=
url
+
'&time='
+
time
;
}
}
const
defaultOptions
=
{
credentials
:
'omit'
,
// credentials: 'include',
mode
:
'cors'
,
};
let
newOptions
=
{
...
defaultOptions
,
...
options
};
if
(
newOptions
.
method
===
'POST'
||
newOptions
.
method
===
'PUT'
||
newOptions
.
method
===
'DELETE'
)
{
if
(
!
(
newOptions
.
body
instanceof
FormData
))
{
newOptions
.
headers
=
{
Accept
:
'application/json'
,
...
newOptions
.
headers
,
Authorization
:
`bearer
${
token
}
`
,
};
newOptions
.
body
=
FormdataWrapper
(
newOptions
.
body
);
}
else
{
// newOptions.body is FormData
newOptions
.
headers
=
{
Accept
:
'application/json'
,
'Content-Type'
:
'multipart/form-data'
,
...
newOptions
.
headers
,
Authorization
:
`bearer
${
token
}
`
,
};
}
}
if
(
newOptions
.
method
===
'GET'
)
{
url
=
url
+
'&'
+
qs
.
stringify
(
newOptions
.
body
||
{});
newOptions
=
omit
(
newOptions
,
'body'
);
}
if
(
!
token
||
token
===
'null'
||
url
.
indexOf
(
'uia/logout'
)
>
-
1
){
delete
newOptions
.
headers
.
Authorization
;
}
// console.log({
// url,
// newOptions,
// })
return
fetch
(
url
,
newOptions
)
.
then
(
checkStatus
)
//.then(response => cachedSave(response, hashcode))
.
then
(
response
=>
{
if
(
response
.
status
!==
200
)
{
return
response
.
text
();
}
return
response
.
json
();
})
.
then
(
response
=>
{
if
(
typeof
response
==
'string'
)
{
try
{
const
xxx
=
JSON
.
parse
(
response
);
if
(
xxx
.
status
===
404
){
controlNotification
({
message
:
'接口异常'
,
});
return
null
;
}
if
(
xxx
.
errMsg
||
xxx
.
message
)
{
controlNotification
({
//message: '',
message
:
xxx
.
errMsg
||
xxx
.
message
,
});
return
null
;
}
return
xxx
;
}
catch
(
e
)
{
return
response
;
}
}
return
response
;
})
.
catch
(
e
=>
{
const
status
=
e
.
name
;
if
(
status
===
401
)
{
if
(
window
.
top
!=
window
.
self
){
window
.
top
.
postMessage
(
"returnLogin"
,
'*'
);
// Iframe 返回登录页
return
true
;
}
// @HACK
/* eslint-disable no-underscore-dangle */
window
.
g_app
.
_store
.
dispatch
({
type
:
'login/logout'
,
});
return
false
;
}
// environment should not be used
if
(
status
===
403
)
{
router
.
push
(
'/exception/403'
);
return
false
;
}
if
(
status
<=
504
&&
status
>=
500
)
{
router
.
push
(
'/exception/500'
);
return
false
;
}
if
(
status
>=
404
&&
status
<
422
)
{
router
.
push
(
'/exception/404'
);
}
let
systemName
=
'学工系统'
;
let
type
=
getType
();
if
(
url
.
indexOf
(
'/v1/api/zydxgWeb/'
)
>
-
1
&&
type
)
{
let
reg
=
new
RegExp
(
'/'
,
'g'
);
type
=
type
&&
type
.
replace
(
reg
,
''
);
systemName
=
config
.
systems
[
type
]
&&
config
.
systems
[
type
].
name
||
systemName
;
}
else
{
let
findApiConfig
=
apiConfig
.
find
((
x
)
=>
{
return
url
.
indexOf
(
x
.
path
)
>
-
1
;
});
systemName
=
findApiConfig
&&
findApiConfig
.
name
||
'系统'
;
}
if
(
!
window
.
navigator
.
onLine
){
return
controlNotification
({
message
:
'网络故障'
,
description
:
`
${
systemName
}
无法连接到网络,请稍后再试`
,
});
}
controlNotification
({
message
:
'网络故障'
,
description
:
`
${
systemName
}
无法连接到服务器,请稍后再试`
,
});
if
(
window
.
top
!=
window
.
self
){
window
.
top
.
postMessage
(
"returnLogin"
,
'*'
);
// Iframe 返回登录页
return
true
;
}
return
;
});
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论