Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
17415f8a
提交
17415f8a
authored
7月 12, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代理修改
上级
3979db01
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
116 行增加
和
103 行删除
+116
-103
index.jsx
one_stop_public/filePreview/index.jsx
+57
-43
UploadCom.js
one_stop_public/libs/UploadCom.js
+1
-1
index.jsx
one_stop_public/tableCompon/index.jsx
+0
-0
queryConfig.js
one_stop_public/utils/queryConfig.js
+1
-1
token.js
one_stop_public/utils/token.js
+57
-58
没有找到文件。
one_stop_public/filePreview/index.jsx
浏览文件 @
17415f8a
/**
* web端文件预览功能
*/
import
React
,
{
Component
}
from
'react'
;
import
{
checkIsImage
}
from
'@/webPublic/one_stop_public/libs/UploadCom'
;
import
React
,
{
Component
}
from
'react'
;
import
{
checkIsImage
}
from
'@/webPublic/one_stop_public/libs/UploadCom'
;
import
{
getModal
,
getPopconfirm
,
isFromIframe
}
from
'@/webPublic/one_stop_public/utils/utils'
;
// const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer');
...
...
@@ -21,7 +21,7 @@ export default class index extends Component {
}
showModal
=
()
=>
{
if
(
isFromIframe
())
{
if
(
isFromIframe
())
{
return
false
;
}
this
.
setState
({
...
...
@@ -41,18 +41,26 @@ export default class index extends Component {
});
};
download
=
()
=>
{
let
{
path
,
pathName
}
=
this
.
props
;
if
(
window
?.
parent
?.
open
&&
typeof
window
.
parent
.
open
===
'function'
){
let
{
path
,
pathName
}
=
this
.
props
;
if
(
window
?.
parent
?.
open
&&
typeof
window
.
parent
.
open
===
'function'
)
{
window
.
parent
.
open
(
path
,
'_blank'
);
}
else
{
}
else
{
window
.
open
(
path
,
'_blank'
);
}
};
render
()
{
let
{
path
,
pathName
,
width
,
height
}
=
this
.
props
;
let
{
path
,
pathName
,
width
,
height
}
=
this
.
props
;
const
{
visible
}
=
this
.
state
;
const
{
visible
}
=
this
.
state
;
let
isShow
=
false
;
let
type
;
let
isImg
=
checkIsImage
(
pathName
);
...
...
@@ -77,15 +85,17 @@ export default class index extends Component {
<>
{
isShow
?
(
<
Popconfirm
title=
'查看附件'
title=
"查看附件"
onConfirm=
{
this
.
download
}
okText=
'下载'
okText=
"下载"
onCancel=
{
this
.
showModal
}
cancelText=
{
isFromIframe
()
?
'取消'
:
'预览'
}
>
cancelText=
{
isFromIframe
()
?
'取消'
:
'预览'
}
>
{
isImg
?
(
<
img
ref=
{
(
node
)
=>
{
this
.
imageDom
=
node
;}
}
ref=
{
(
node
)
=>
{
this
.
imageDom
=
node
;
}
}
style=
{
{
width
:
width
?
width
:
'100px'
,
height
:
height
?
height
:
'auto'
,
...
...
@@ -94,52 +104,56 @@ export default class index extends Component {
alt=
{
pathName
}
/>
)
:
(
<
a
target=
'_blank'
href=
{
path
}
>
<
a
target=
"_blank"
href=
{
path
}
>
{
pathName
}
</
a
>
)
}
</
Popconfirm
>
)
:
(
<
a
target=
'_blank'
href=
{
path
}
>
<
a
target=
"_blank"
href=
{
path
}
>
{
pathName
}
</
a
>
)
}
{
visible
&&
<
Modal
title=
{
pathName
}
visible=
{
true
}
width=
{
1200
}
destroyOnClose
centered=
{
true
}
onOk=
{
this
.
handleOk
}
onCancel=
{
this
.
handleCancel
}
>
{
type
===
'pdf'
?
(
<
iframe
style=
{
{
width
:
'100%'
,
height
:
600
,
}
}
src=
{
path
}
/>
)
:
(
<
div
style=
{
{
height
:
650
,
maxWidth
:
1200
,
}
}
>
<
a
onClick=
{
this
.
download
}
>
下载文件
</
a
>
{
/* {FileViewer && (
<
Modal
title=
{
pathName
}
visible=
{
true
}
width=
{
1200
}
destroyOnClose
centered=
{
true
}
onOk=
{
this
.
handleOk
}
onCancel=
{
this
.
handleCancel
}
>
{
type
===
'pdf'
?
(
<
iframe
style=
{
{
width
:
'100%'
,
height
:
600
,
}
}
src=
{
path
}
/>
)
:
(
<
div
style=
{
{
height
:
650
,
maxWidth
:
1200
,
}
}
>
<
a
onClick=
{
this
.
download
}
>
下载文件
</
a
>
{
!!
checkIsImage
(
path
)
&&
<
img
src=
{
path
}
style=
{
{
maxWidth
:
'100%'
,
}
}
/>
}
{
/* {FileViewer && (
<FileViewer
fileType={type}
filePath={path}
/>
)}*/
}
</
div
>
)
}
</
Modal
>
</
div
>
)
}
</
Modal
>
}
</>
...
...
one_stop_public/libs/UploadCom.js
浏览文件 @
17415f8a
...
...
@@ -21,7 +21,7 @@ export function checkIsImage(path) {
}
let
p
=
path
.
toLowerCase
();
let
find
=
[
'.jpg'
,
'.png'
,
'.jpeg'
,
'.bmp'
,
'.gif'
,
'.bmp'
,
'.svg'
].
find
((
x
)
=>
{
return
p
ath
.
indexOf
(
x
)
>
-
1
;
return
p
.
indexOf
(
x
)
>
-
1
;
});
return
!!
find
;
}
...
...
one_stop_public/tableCompon/index.jsx
浏览文件 @
17415f8a
差异被折叠。
点击展开。
one_stop_public/utils/queryConfig.js
浏览文件 @
17415f8a
...
...
@@ -44,7 +44,7 @@ const queryConfig = (key) => {
if
(
typeof
key
===
'undefined'
)
return
dynamicConfig
;
if
(
dynamicConfig
[
key
]
&&
typeof
dynamicConfig
[
key
]
===
'string'
&&
process
.
env
.
NODE_ENV
===
'development'
){
let
url
=
dynamicConfig
[
key
];
url
=
url
.
replace
(
'https://yx.bpi.edu.cn/produce'
,
'http://localhost:80
0
0/produce'
);
url
=
url
.
replace
(
'https://yx.bpi.edu.cn/produce'
,
'http://localhost:80
1
0/produce'
);
url
=
url
.
replace
(
'http://scjoyedu.eicp.net:51352/produce'
,
'http://localhost:8000/produce'
);
return
url
;
}
...
...
one_stop_public/utils/token.js
浏览文件 @
17415f8a
...
...
@@ -6,95 +6,94 @@ import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils';
import
{
delCookie
,
setCookie
}
from
'@/webPublic/one_stop_public/utils/cookie'
;
export
function
setToken
(
value
,
time
)
{
if
(
getToken
()
!==
value
)
{
setCookie
(
'token'
,
value
,
1
);
sessionStorage
.
removeItem
(
'cacheMobile'
);
localStorage
.
setItem
(
'antd-pro-token-onestop'
,
value
);
localStorage
.
setItem
(
'antd-pro-token'
,
value
);
localStorage
.
setItem
(
'wisdom-school-token'
,
value
);
return
getOneStopMyInfo
();
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
true
);
});
}
if
(
getToken
()
!==
value
)
{
setCookie
(
'token'
,
value
,
1
);
sessionStorage
.
removeItem
(
'cacheMobile'
);
localStorage
.
setItem
(
'antd-pro-token-onestop'
,
value
);
localStorage
.
setItem
(
'antd-pro-token'
,
value
);
localStorage
.
setItem
(
'wisdom-school-token'
,
value
);
return
getOneStopMyInfo
();
}
else
{
if
(
value
&&
value
.
length
>
10
)
{
setCookie
(
'token'
,
value
,
1
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
true
);
});
}
}
/**
* 获取token
* */
export
function
getToken
()
{
const
x
=
localStorage
.
getItem
(
'antd-pro-token-onestop'
);
if
(
x
&&
x
.
length
>
11
)
{
return
x
;
}
const
y
=
localStorage
.
getItem
(
'antd-pro-token'
);
if
(
y
&&
y
.
length
>
11
)
{
return
y
;
}
const
x
=
localStorage
.
getItem
(
'antd-pro-token-onestop'
);
if
(
x
&&
x
.
length
>
11
)
{
return
x
;
}
const
y
=
localStorage
.
getItem
(
'antd-pro-token'
);
if
(
y
&&
y
.
length
>
11
)
{
return
y
;
}
return
null
;
return
null
;
}
/**
* 删除token
* */
export
const
delToken
=
()
=>
{
delCookie
(
'token'
);
localStorage
.
removeItem
(
'antd-pro-type'
);
localStorage
.
removeItem
(
'antd-pro-token-onestop'
);
localStorage
.
removeItem
(
'antd-pro-token'
);
localStorage
.
removeItem
(
'wisdom-school-token'
);
localStorage
.
removeItem
(
'user'
);
sessionStorage
.
removeItem
(
'cacheMobile'
);
delCookie
(
'token'
);
localStorage
.
removeItem
(
'antd-pro-type'
);
localStorage
.
removeItem
(
'antd-pro-token-onestop'
);
localStorage
.
removeItem
(
'antd-pro-token'
);
localStorage
.
removeItem
(
'wisdom-school-token'
);
localStorage
.
removeItem
(
'user'
);
sessionStorage
.
removeItem
(
'cacheMobile'
);
};
export
const
getUserInfo
=
()
=>
{
let
x
=
localStorage
.
getItem
(
'user'
);
if
(
isJSON
(
x
))
{
x
=
JSON
.
parse
(
x
);
if
(
!
x
.
groupsId
)
{
x
.
groupsId
=
'pub'
;
}
return
x
;
}
else
{
return
{
groupsId
:
'pub'
,
};
}
let
x
=
localStorage
.
getItem
(
'user'
);
if
(
isJSON
(
x
))
{
x
=
JSON
.
parse
(
x
);
if
(
!
x
.
groupsId
)
{
x
.
groupsId
=
'pub'
;
}
return
x
;
}
else
{
return
{
groupsId
:
'pub'
,
};
}
};
export
function
setFetchUrl
(
data
)
{
return
localStorage
.
setItem
(
'fetch-url-data'
,
data
);
return
localStorage
.
setItem
(
'fetch-url-data'
,
data
);
}
export
function
getFetchUrl
()
{
return
localStorage
.
getItem
(
'fetch-url-data'
);
return
localStorage
.
getItem
(
'fetch-url-data'
);
}
export
function
getType
()
{
return
localStorage
.
getItem
(
'antd-pro-type'
)
||
''
;
return
localStorage
.
getItem
(
'antd-pro-type'
)
||
''
;
}
export
function
setType
(
type
)
{
return
localStorage
.
setItem
(
'antd-pro-type'
,
type
);
return
localStorage
.
setItem
(
'antd-pro-type'
,
type
);
}
export
function
getCurrentUser
()
{
const
d
=
sessionStorage
.
getItem
(
'currentUser'
);
if
(
d
&&
isJSON
(
d
))
{
return
JSON
.
parse
(
d
);
}
else
{
return
{};
}
const
d
=
sessionStorage
.
getItem
(
'currentUser'
);
if
(
d
&&
isJSON
(
d
))
{
return
JSON
.
parse
(
d
);
}
else
{
return
{};
}
}
export
function
setCurrentUser
(
v
){
if
(
v
&&
typeof
v
===
'object'
)
{
sessionStorage
.
setItem
(
'currentUser'
,
JSON
.
stringify
(
v
));
}
export
function
setCurrentUser
(
v
)
{
if
(
v
&&
typeof
v
===
'object'
)
{
sessionStorage
.
setItem
(
'currentUser'
,
JSON
.
stringify
(
v
));
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论