单点登录,动态新增 #94
+60
-2
@@ -13,11 +13,15 @@ import router from './router'
|
||||
import directive from './directive' // directive
|
||||
import plugins from './plugins' // plugins
|
||||
import { download } from '@/utils/request'
|
||||
|
||||
import { Message } from 'element-ui'
|
||||
import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { isRelogin } from '@/utils/request'
|
||||
import './assets/icons' // icon
|
||||
// 引入Iconfont 矢量图标库
|
||||
import './assets/icon/iconfont.css'
|
||||
import './permission' // permission control
|
||||
// import './permission' // permission control
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||
@@ -78,7 +82,61 @@ DictData.install()
|
||||
* Currently MockJs will be used in the production environment,
|
||||
* please remove it before going online! ! !
|
||||
*/
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
let path = to.fullPath
|
||||
if(path.indexOf('token') != -1){
|
||||
path = path.split('token=');
|
||||
path = path[1];
|
||||
Cookies.set("Admin-Token", path)
|
||||
}
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
} else {
|
||||
if (store.getters.roles.length === 0) {
|
||||
isRelogin.show = true
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
store.dispatch('GetInfo').then(() => {
|
||||
isRelogin.show = false
|
||||
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
})
|
||||
}).catch(err => {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
Message.error(err)
|
||||
next({ path: '/' })
|
||||
})
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
// next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
||||
next(`/login`)
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
router.afterEach(() => {
|
||||
NProgress.done()
|
||||
})
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
|
||||
@@ -11,6 +11,7 @@ NProgress.configure({ showSpinner: false })
|
||||
const whiteList = ['/login', '/register']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log("**************************************");
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
|
||||
@@ -66,6 +66,11 @@ export const constantRoutes = [
|
||||
component: () => import('@/views/onlyoffice/onlyoffice'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/test',
|
||||
component: () => import('@/views/test'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: Layout,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="案件编号" prop="caseNum">
|
||||
<el-input v-model="queryParams.caseNum" placeholder="请输入案件编号" clearable style="width: 240px"
|
||||
<el-input v-model="queryParams.caseNum" placeholder="请输入案件编号" :disabled='queryDisable' clearable style="width: 240px"
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="caseTime">
|
||||
@@ -211,6 +211,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
queryDisable:false,
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 总条数
|
||||
@@ -277,6 +278,12 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.queryParams.caseNum = this.$route.query.caseNum;
|
||||
if(this.$route.query.token){
|
||||
this.queryDisable = true;
|
||||
}else{
|
||||
this.queryDisable = false;
|
||||
}
|
||||
// this.getList(this.queryParams);
|
||||
this.listDeptFn();
|
||||
// this.getButtonList()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -206,11 +206,11 @@ export default {
|
||||
roleList: [],
|
||||
nationalityList:[
|
||||
{
|
||||
value:'国内',
|
||||
value:'境内',
|
||||
id:0
|
||||
},
|
||||
{
|
||||
value:'国外',
|
||||
value:'境外',
|
||||
id:1
|
||||
}
|
||||
],
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="dynamicValidateForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
|
||||
<el-form-item prop="email" label="邮箱" :rules="[
|
||||
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
|
||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
|
||||
]">
|
||||
<el-input v-model="dynamicValidateForm.email"></el-input>
|
||||
</el-form-item>
|
||||
<div v-for="(item, index) in dynamicValidateForm.domains" :key="item.key">
|
||||
<el-form-item :label="'域名' + index" :prop="'domains.' + index + '.value.name'" :rules="{
|
||||
required: true, message: '域名不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="item.value.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'链接' + index" :prop="'domains.' + index + '.value.url'" :rules="{
|
||||
required: true, message: '链接不能为空', trigger: 'blur'
|
||||
}">
|
||||
<el-input v-model="item.value.url"></el-input>
|
||||
</el-form-item>
|
||||
<el-button @click.prevent="removeDomain(item)">删除</el-button>
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dynamicValidateForm')">提交</el-button>
|
||||
<el-button @click="addDomain">新增域名</el-button>
|
||||
<el-button @click="resetForm('dynamicValidateForm')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dynamicValidateForm: {
|
||||
domains: [{
|
||||
value: {
|
||||
name: "",
|
||||
url: ""
|
||||
}
|
||||
}],
|
||||
email: ''
|
||||
},
|
||||
data: { "applicant": { "id": 123, "caseAppliId": 5453163805296176, "userId": null, "applicantDeptId": null, "code": null, "compLegalPerson": null, "roleType": 1, "groupOrder": 2, "operatorFlag": 0, "phone": "17691225077", "email": "1129801211@qq.com", "name": "白贵勇", "home": "西安", "address": "西安", "idCard": "612429198708193335", "idType": null, "nationality": null, "birth": null, "sex": null, "resName": null }, "applicantAgent": null, "res": { "id": 124, "caseAppliId": 5453163805296176, "userId": null, "applicantDeptId": null, "code": null, "compLegalPerson": null, "roleType": 3, "groupOrder": 2, "operatorFlag": 0, "phone": "18792927508", "email": "1322446236@qq.com", "name": "王琼", "home": "西安", "address": "西安", "idCard": "14050219970814622X", "idType": null, "nationality": null, "birth": null, "sex": null, "resName": null }, "resAgent": null }
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
alert('submit!');
|
||||
console.log(this.dynamicValidateForm);
|
||||
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
removeDomain(item) {
|
||||
var index = this.dynamicValidateForm.domains.indexOf(item)
|
||||
if (index !== -1) {
|
||||
this.dynamicValidateForm.domains.splice(index, 1)
|
||||
}
|
||||
},
|
||||
addDomain() {
|
||||
this.dynamicValidateForm.domains.push({
|
||||
value: {
|
||||
name: "",
|
||||
key: Date.now()
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user