Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
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
罗超
confucius
Commits
8c4e28bd
Commit
8c4e28bd
authored
Jun 10, 2022
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
c75739e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
161 additions
and
127 deletions
+161
-127
permission.js
src/boot/permission.js
+87
-87
uploadFiles.vue
src/pages/wxhtml/uploadFiles.vue
+74
-40
No files found.
src/boot/permission.js
View file @
8c4e28bd
...
@@ -3,105 +3,105 @@ import store from "../store/index";
...
@@ -3,105 +3,105 @@ import store from "../store/index";
import
{
LoadingBar
,
Notify
}
from
"quasar"
;
import
{
LoadingBar
,
Notify
}
from
"quasar"
;
import
{
getAuth
}
from
"../utils/auth"
;
// 验权
import
{
getAuth
}
from
"../utils/auth"
;
// 验权
LoadingBar
.
setDefaults
({
LoadingBar
.
setDefaults
({
color
:
"primary"
,
color
:
"primary"
,
size
:
"5px"
,
size
:
"5px"
,
position
:
"bottom"
position
:
"bottom"
});
});
let
loadAsyncRouter
=
false
;
let
loadAsyncRouter
=
false
;
const
whiteList
=
[
"/login"
,
"
/"
,
"/contractConfirm"
,
"/contractPay"
,
"/contractView"
,
"/contractSign"
,
"/noticeView"
,
"/autologin"
,
"/courseRefundH5"
,
"/koreaUpload"
,
"/uploadFiles"
];
// 不重定向白名单
const
whiteList
=
[
"/login"
,
"
uploadFiles"
,
"/"
,
"/contractConfirm"
,
"/contractPay"
,
"/contractView"
,
"/contractSign"
,
"/noticeView"
,
"/autologin"
,
"/courseRefundH5"
,
"/koreaUpload"
,
"/uploadFiles"
];
// 不重定向白名单
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
localStorage
.
setItem
(
"routerBefore"
,
from
.
path
);
localStorage
.
setItem
(
"routerBefore"
,
from
.
path
);
LoadingBar
.
start
();
LoadingBar
.
start
();
/** 请求头包含授权信息 并且 页面必须授权 直接进入 */
/** 请求头包含授权信息 并且 页面必须授权 直接进入 */
if
(
getAuth
())
{
if
(
getAuth
())
{
//debugger;
//debugger;
if
(
to
.
path
===
"/login"
||
to
.
path
===
"/"
)
{
if
(
to
.
path
===
"/login"
||
to
.
path
===
"/"
)
{
next
({
next
({
path
:
"/home"
path
:
"/home"
});
});
LoadingBar
.
stop
();
LoadingBar
.
stop
();
}
else
{
if
(
!
loadAsyncRouter
)
{
// 判断当前用户是否获取权限
loadAsyncRouter
=
true
;
if
(
store
.
getters
.
allAuth
)
{
store
.
dispatch
(
"GenerateRoutes"
,
store
.
getters
.
allAuth
).
then
(()
=>
{
// 根据auths权限生成可访问的路由表
//router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
if
(
to
.
path
===
"/404"
)
{
next
({
path
:
to
.
redirectedFrom
||
"/"
,
replace
:
true
});
}
else
{
next
({
...
to
,
replace
:
true
});
LoadingBar
.
stop
();
}
});
}
else
{
}
else
{
if
(
!
loadAsyncRouter
)
{
store
// 判断当前用户是否获取权限
.
dispatch
(
"getAuth"
)
loadAsyncRouter
=
true
;
.
then
(
auths
=>
{
if
(
store
.
getters
.
allAuth
)
{
// 拉取user_info
store
.
dispatch
(
"GenerateRoutes"
,
store
.
getters
.
allAuth
).
then
(()
=>
{
store
.
dispatch
(
"GenerateRoutes"
,
auths
).
then
(()
=>
{
// 根据auths权限生成可访问的路由表
// 根据auths权限生成可访问的路由表
//router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
router
.
addRoutes
(
store
.
getters
.
addRouters
);
// 动态添加可访问路由表
if
(
to
.
path
===
"/404"
)
{
if
(
to
.
path
===
"/404"
)
{
next
({
next
({
path
:
to
.
redirectedFrom
||
"/"
,
path
:
to
.
redirectedFrom
||
"/"
,
replace
:
true
replace
:
true
});
});
}
else
{
LoadingBar
.
stop
();
next
({
...
to
,
replace
:
true
});
LoadingBar
.
stop
();
}
});
}
else
{
}
else
{
store
next
({
.
dispatch
(
"getAuth"
)
...
to
,
.
then
(
auths
=>
{
replace
:
true
// 拉取user_info
});
store
.
dispatch
(
"GenerateRoutes"
,
auths
).
then
(()
=>
{
LoadingBar
.
stop
();
// 根据auths权限生成可访问的路由表
router
.
addRoutes
(
store
.
getters
.
addRouters
);
// 动态添加可访问路由表
if
(
to
.
path
===
"/404"
)
{
next
({
path
:
to
.
redirectedFrom
||
"/"
,
replace
:
true
});
LoadingBar
.
stop
();
}
else
{
next
({
...
to
,
replace
:
true
});
LoadingBar
.
stop
();
}
});
})
.
catch
(
err
=>
{
loadAsyncRouter
=
false
;
store
.
dispatch
(
"LogOut"
).
then
(()
=>
{
Notify
.
create
({
icon
:
"error"
,
color
:
"negative"
,
message
:
err
.
msg
||
"获取用户信息失败"
,
position
:
"top"
});
next
({
path
:
"/"
});
});
});
}
}
}
else
{
});
next
();
})
}
.
catch
(
err
=>
{
loadAsyncRouter
=
false
;
store
.
dispatch
(
"LogOut"
).
then
(()
=>
{
Notify
.
create
({
icon
:
"error"
,
color
:
"negative"
,
message
:
err
.
msg
||
"获取用户信息失败"
,
position
:
"top"
});
next
({
path
:
"/"
});
});
});
}
}
}
else
{
next
();
}
}
}
else
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
next
();
}
else
{
}
else
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
next
(
`/login?redirect=
${
to
.
path
}
`
);
// 否则全部重定向到登录页
next
();
LoadingBar
.
stop
();
}
else
{
next
(
`/login?redirect=
${
to
.
path
}
`
);
// 否则全部重定向到登录页
LoadingBar
.
stop
();
}
}
}
}
});
});
router
.
afterEach
(()
=>
{
router
.
afterEach
(()
=>
{
LoadingBar
.
stop
();
// 结束Progress
LoadingBar
.
stop
();
// 结束Progress
});
});
router
.
onError
(
error
=>
{
router
.
onError
(
error
=>
{
const
pattern
=
/Loading chunk
(\d)
+ failed/g
;
const
pattern
=
/Loading chunk
(\d)
+ failed/g
;
const
isChunkLoadFailed
=
error
.
message
.
match
(
pattern
);
const
isChunkLoadFailed
=
error
.
message
.
match
(
pattern
);
const
targetPath
=
router
.
history
.
pending
.
fullPath
;
const
targetPath
=
router
.
history
.
pending
.
fullPath
;
if
(
isChunkLoadFailed
)
{
if
(
isChunkLoadFailed
)
{
router
.
replace
(
targetPath
);
router
.
replace
(
targetPath
);
}
}
});
});
\ No newline at end of file
src/pages/wxhtml/uploadFiles.vue
View file @
8c4e28bd
<
style
scoped
>
<
style
>
body
{
body
{
min-width
:
100%
!important
;
min-width
:
100%
!important
;
}
}
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
bottom
:
0
;
bottom
:
0
;
z-index
:
2
;
z-index
:
1
;
background
:
rgba
(
30
,
30
,
30
,
.5
);
background
:
rgba
(
30
,
30
,
30
,
.5
);
}
}
.examList-popup-box
{
.examList-popup-box
{
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
padding
:
48px
55px
82px
55px
;
padding
:
48px
55px
82px
55px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
background
:
#ffffff
;
background
:
#ffffff
;
z-index
:
3
;
z-index
:
1
;
position
:
relative
;
position
:
relative
;
margin-top
:
100px
;
margin-top
:
100px
;
border-radius
:
15px
;
border-radius
:
15px
;
...
@@ -76,38 +76,47 @@
...
@@ -76,38 +76,47 @@
color
:
#fff
;
color
:
#fff
;
margin-top
:
20px
;
margin-top
:
20px
;
}
}
.diy-upload-class
.el-upload
{
display
:
block
!important
;
}
</
style
>
</
style
>
<
template
>
<
template
>
<div
class=
"uploadFiles"
>
<div
class=
"uploadFiles"
>
<div
class=
"uploadFiles-fixed"
></div>
<div
class=
"uploadFiles-fixed"
></div>
<div
class=
"examList-popup-box"
>
<div
class=
"examList-popup-box"
>
<
i
class=
"examList-popup-closure"
@
click=
"closepopup"
>
×
</i
>
<
!--
<i
class=
"examList-popup-closure"
@
click=
"closepopup"
>
×
</i>
--
>
<div
class=
"examList-popup-title"
>
导入考试信息
</div>
<div
class=
"examList-popup-title"
>
导入考试信息
</div>
<img
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1654136886000_860.png"
<img
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1654136886000_860.png"
mode=
"widthFix"
class=
"examList-popup-icon"
></img>
mode=
"widthFix"
class=
"examList-popup-icon"
></img>
<div
class=
"examList-popup-content"
>
<div
class=
"examList-popup-content"
>
<!--
<q-input
rounded
outlined
<!--
<q-input
rounded
outlined
class=
"examList-popup-name"
class=
"examList-popup-name"
v-model=
"uploadParm.ExamName"
v-model=
"uploadParm.ExamName"
label=
"请输入考试名称"
/>
-->
label=
"请输入考试名称"
/>
-->
<input
v-model=
"uploadParm.ExamName"
class=
"examList-popup-name"
placeholder=
"请输入考试名称"
/>
<input
v-model=
"uploadParm.ExamName"
class=
"examList-popup-name"
placeholder=
"请输入考试名称"
/>
<div>
<div
class=
"diy-upload-class"
>
<el-upload
class=
"avatar-uploader"
action=
""
:before-upload=
"uploadFile"
<el-upload
class=
"avatar-uploader"
:show-file-list=
"false"
:data=
"uploadParm"
:disabled=
"show"
action=
"https://jjswapi.oytour.com/api/Upload/UploadStuExamScore"
>
accept=
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
:before-upload=
"uploadFileCheck"
:on-success=
"uploadFileSuccess"
:on-error=
"uploadFileError"
:show-file-list=
"false"
:disabled=
"show"
>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"cloud_upload"
label=
"选择文件"
></q-btn>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"cloud_upload"
label=
"选择文件"
></q-btn>
</el-upload>
</el-upload>
</div>
</div>
<!--
<van-uploader
<!--
<van-uploader
class=
"examList-popup-fil-box flex"
class=
"examList-popup-fil-box flex"
accept=
"file"
accept=
"file"
preview-size=
"120px"
preview-size=
"120px"
:before-read=
"beforeRead"
:before-read=
"beforeRead"
@
after-read=
"customUpload"
@
after-read=
"customUpload"
>
>
<button
round
color=
'#C91727'
icon=
"add-o"
custom-style=
'width: 360px;margin:0 auto;'
block
>
选择文件
</button>
<button
round
color=
'#C91727'
icon=
"add-o"
custom-style=
'width: 360px;margin:0 auto;'
block
>
选择文件
</button>
</van-uploader>
-->
</van-uploader>
-->
...
@@ -116,57 +125,82 @@
...
@@ -116,57 +125,82 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
Notify
,
Loading
}
from
'quasar'
// import {
// import {
// getClassNameList,
// getClassNameList,
// queryStudyNameList
// queryStudyNameList
// } from "@/api/finance/index";
// } from "@/api/finance/index";
export
default
{
export
default
{
props
:
{
props
:
{
},
},
data
()
{
data
()
{
return
{
return
{
show
:
false
,
show
:
false
,
loading
:
false
,
uploadParm
:{
uploadParm
:{
Uid
:
0
,
Uid
:
10001
,
CourseId
:
''
,
CourseId
:
'
1
'
,
ExamName
:
''
ExamName
:
''
}
}
};
};
},
},
created
()
{
created
()
{
},
},
components
:
{
components
:
{
},
},
mounted
()
{
mounted
()
{
var
query
=
this
.
$route
.
query
;
this
.
uploadParm
.
Uid
=
query
.
uid
this
.
uploadParm
.
CourseId
=
query
.
courseId
},
},
methods
:
{
methods
:
{
uploadFile
(
files
)
{
//文件上传
uploadFileCheck
(
files
)
{
//文件上传
if
(
!
this
.
uploadParm
.
ExamName
){
if
(
this
.
uploadParm
.
ExamName
.
length
==
0
){
uni
.
showToast
({
Notify
.
create
({
title
:
'请输入考试名称'
,
icon
:
"error"
,
icon
:
'none'
,
color
:
"dark"
,
duration
:
500
message
:
'请填写考试名称'
,
})
position
:
"top"
return
});
}
console
.
log
(
'......'
)
this
.
show
=
true
return
false
;
},
closepopup
(){
this
.
show
=
false
this
.
uploadParm
=
{
Uid
:
''
,
CourseId
:
''
,
ExamName
:
''
}
}
console
.
log
(
'0000000000000'
)
Loading
.
show
({
message
:
"正在上传文件"
})
return
true
},
},
uploadFileSuccess
(
res
,
file
,
fileList
){
Loading
.
hide
()
if
(
res
.
data
.
Code
!=
1
){
Notify
.
create
({
icon
:
"error"
,
color
:
"dark"
,
message
:
'上传失败'
,
position
:
"top"
});
}
else
{
}
}
// closepopup(){
// this.show = false
// this.uploadParm = {
// Uid:'',
// CourseId:'',
// ExamName: ''
// }
// },
},
},
watch
:
{}
watch
:
{}
};
};
</
script
>
</
script
>
\ No newline at end of file
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