Commit 8c4e28bd authored by 罗超's avatar 罗超

调整

parent c75739e4
......@@ -3,105 +3,105 @@ import store from "../store/index";
import { LoadingBar, Notify } from "quasar";
import { getAuth } from "../utils/auth"; // 验权
LoadingBar.setDefaults({
color: "primary",
size: "5px",
position: "bottom"
color: "primary",
size: "5px",
position: "bottom"
});
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) => {
localStorage.setItem("routerBefore", from.path);
LoadingBar.start();
/** 请求头包含授权信息 并且 页面必须授权 直接进入 */
if (getAuth()) {
//debugger;
if (to.path === "/login" || to.path === "/") {
next({
path: "/home"
});
LoadingBar.stop();
localStorage.setItem("routerBefore", from.path);
LoadingBar.start();
/** 请求头包含授权信息 并且 页面必须授权 直接进入 */
if (getAuth()) {
//debugger;
if (to.path === "/login" || to.path === "/") {
next({
path: "/home"
});
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 {
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();
}
});
store
.dispatch("getAuth")
.then(auths => {
// 拉取user_info
store.dispatch("GenerateRoutes", auths).then(() => {
// 根据auths权限生成可访问的路由表
router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
if (to.path === "/404") {
next({
path: to.redirectedFrom || "/",
replace: true
});
LoadingBar.stop();
} else {
store
.dispatch("getAuth")
.then(auths => {
// 拉取user_info
store.dispatch("GenerateRoutes", auths).then(() => {
// 根据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: "/"
});
});
});
next({
...to,
replace: true
});
LoadingBar.stop();
}
} 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 {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next(`/login?redirect=${to.path}`); // 否则全部重定向到登录页
LoadingBar.stop();
}
next(`/login?redirect=${to.path}`); // 否则全部重定向到登录页
LoadingBar.stop();
}
}
});
router.afterEach(() => {
LoadingBar.stop(); // 结束Progress
LoadingBar.stop(); // 结束Progress
});
router.onError(error => {
const pattern = /Loading chunk (\d)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
const targetPath = router.history.pending.fullPath;
if (isChunkLoadFailed) {
router.replace(targetPath);
}
});
\ No newline at end of file
const pattern = /Loading chunk (\d)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
const targetPath = router.history.pending.fullPath;
if (isChunkLoadFailed) {
router.replace(targetPath);
}
});
<style scoped>
<style>
body {
min-width: 100% !important;
}
......@@ -14,7 +14,7 @@
left: 0;
right: 0;
bottom: 0;
z-index: 2;
z-index: 1;
background: rgba(30,30,30,.5);
}
.examList-popup-box{
......@@ -24,7 +24,7 @@
padding: 48px 55px 82px 55px;
box-sizing: border-box;
background: #ffffff;
z-index: 3;
z-index: 1;
position: relative;
margin-top: 100px;
border-radius: 15px;
......@@ -76,38 +76,47 @@
color: #fff;
margin-top: 20px;
}
.diy-upload-class .el-upload{
display: block !important;
}
</style>
<template>
<div class="uploadFiles">
<div class="uploadFiles-fixed"></div>
<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>
<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>
<div class="examList-popup-content">
<!-- <q-input rounded outlined
class="examList-popup-name"
v-model="uploadParm.ExamName"
v-model="uploadParm.ExamName"
label="请输入考试名称" /> -->
<input v-model="uploadParm.ExamName" class="examList-popup-name" placeholder="请输入考试名称"/>
<div>
<el-upload class="avatar-uploader" action="" :before-upload="uploadFile"
:show-file-list="false"
:disabled="show"
>
<div class="diy-upload-class">
<el-upload class="avatar-uploader"
:data="uploadParm"
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>
</el-upload>
</div>
<!-- <van-uploader
class="examList-popup-fil-box flex"
accept="file"
preview-size="120px"
:before-read="beforeRead"
@after-read="customUpload"
>
<button round color='#C91727' icon="add-o" custom-style='width: 360px;margin:0 auto;' block>选择文件</button>
</van-uploader> -->
......@@ -116,57 +125,82 @@
</div>
</template>
<script>
import {
Notify,
Loading
} from 'quasar'
// import {
// getClassNameList,
// queryStudyNameList
// } from "@/api/finance/index";
export default {
props: {
},
data() {
return {
show:false,
loading:false,
uploadParm:{
Uid:0,
CourseId:'',
Uid:10001,
CourseId:'1',
ExamName:''
}
};
},
created() {
},
components: {
},
mounted() {
var query=this.$route.query;
this.uploadParm.Uid=query.uid
this.uploadParm.CourseId=query.courseId
},
methods: {
uploadFile(files) {//文件上传
if(!this.uploadParm.ExamName){
uni.showToast({
title:'请输入考试名称',
icon:'none',
duration: 500
})
return
}
this.show = true
},
closepopup(){
this.show = false
this.uploadParm = {
Uid:'',
CourseId:'',
ExamName: ''
uploadFileCheck(files) {//文件上传
if(this.uploadParm.ExamName.length==0){
Notify.create({
icon: "error",
color: "dark",
message: '请填写考试名称',
position: "top"
});
console.log('......')
return false;
}
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: {}
};
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment