上线修改

master
yujialong 3 months ago
parent 251563e0cb
commit 2cee7d6edd
  1. BIN
      src/assets/img/login-bg-1.jpg
  2. 621
      src/components/page/Login.vue
  3. 493
      src/router/index.js
  4. 6
      src/utils/api.js
  5. 237
      src/utils/http.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

@ -1,339 +1,354 @@
<template> <template>
<div class="home_view"> <div class="home_view">
<div class="homeback"> <div class="homeback">
<div class="homeHeader flex-between"> <div class="homeHeader flex-between">
<div class="logo flex-center"> <div class="logo flex-center">
<!-- 非凡 --> <!-- 非凡 -->
<!-- <img src="../../assets/img/ff-icon.png" class="ff-icon"> --> <!-- <img src="../../assets/img/ff-icon.png" class="ff-icon"> -->
<!-- 大庆待恢复 --> <!-- 大庆待恢复 -->
<img src="../../assets/img/logo.png"> <img src="../../assets/img/logo.png">
<span>智慧管理平台</span> <span>智慧管理平台</span>
</div>
<span class="aboutUs">关于我们</span>
</div>
<!-- 登录card -->
<div class="Login_view" v-show="cardType == 1" v-loading="loading" >
<div class="flex-between login_title">
<span>登录</span>
<router-link :to="{path:'beforeLogin'}">
<i class="el-icon-close"></i>
</router-link>
</div>
<el-form :model="param" :rules="rules" ref="param" label-width="0px" class="login_form">
<el-form-item prop="username">
<p>用户名</p>
<el-input v-model="param.username" placeholder="请输入账号/手机号" maxlength="11" @keyup.enter.native="nextInput($event)"></el-input>
</el-form-item>
<el-form-item prop="password" class="item_password">
<p>密码</p>
<el-input
type="password"
maxlength="20"
ref="password"
placeholder="请输入账号密码"
v-model="param.password"
@keyup.enter.native="submitForm('param')"
></el-input>
</el-form-item>
<div class="login-btn">
<el-button v-preventReClick type="primary" round @click="submitForm('param')">马上登录</el-button>
</div>
<div class="flex-between forget_view">
<el-checkbox v-model="checked">十天内自动登录</el-checkbox>
<el-button type="text" @click="cardType = 2">忘记密码?</el-button>
</div>
<p class="login-wechat">其他登陆方式</p>
<div class="wechat-btn">
<el-button type="primary" round @click="wxCode"><i class="icon-weixin"></i>微信一键登录</el-button>
</div>
</el-form>
</div>
<!-- 找回密码card -->
<RetrievePsd v-show="cardType == 2" @gohome="gohome" @nextStep="nextStep"></RetrievePsd>
<!-- 重新设置密码card -->
<SetPsd v-show="cardType == 3" @setBack="setBack" @reLogin="reLogin"></SetPsd>
<!-- 微信一键扫码 -->
<ScanCode v-show="cardType == 4" @toAccount="toAccount"></ScanCode>
<!-- 微信扫码后绑定手机号 -->
<BindPhone v-show="cardType == 5" @toWechat="toWechat"></BindPhone>
</div> </div>
<Foot></Foot> <span class="aboutUs">关于我们</span>
</div>
<!-- 登录card -->
<div class="Login_view" v-show="cardType == 1" v-loading="loading">
<div class="flex-between login_title">
<span>登录</span>
<router-link :to="{ path: 'beforeLogin' }">
<i class="el-icon-close"></i>
</router-link>
</div>
<el-form :model="param" :rules="rules" ref="param" label-width="0px" class="login_form">
<el-form-item prop="username">
<p>用户名</p>
<el-input v-model="param.username" placeholder="请输入账号/手机号" maxlength="11"
@keyup.enter.native="nextInput($event)"></el-input>
</el-form-item>
<el-form-item prop="password" class="item_password">
<p>密码</p>
<el-input type="password" maxlength="20" ref="password" placeholder="请输入账号密码" v-model="param.password"
@keyup.enter.native="submitForm('param')"></el-input>
</el-form-item>
<div class="login-btn">
<el-button v-preventReClick type="primary" round @click="submitForm('param')">马上登录</el-button>
</div>
<div class="flex-between forget_view">
<el-checkbox v-model="checked">十天内自动登录</el-checkbox>
<el-button type="text" @click="cardType = 2">忘记密码?</el-button>
</div>
<p class="login-wechat">其他登陆方式</p>
<div class="wechat-btn">
<el-button type="primary" round @click="wxCode"><i class="icon-weixin"></i>微信一键登录</el-button>
</div>
</el-form>
</div>
<!-- 找回密码card -->
<RetrievePsd v-show="cardType == 2" @gohome="gohome" @nextStep="nextStep"></RetrievePsd>
<!-- 重新设置密码card -->
<SetPsd v-show="cardType == 3" @setBack="setBack" @reLogin="reLogin"></SetPsd>
<!-- 微信一键扫码 -->
<ScanCode v-show="cardType == 4" @toAccount="toAccount"></ScanCode>
<!-- 微信扫码后绑定手机号 -->
<BindPhone v-show="cardType == 5" @toWechat="toWechat"></BindPhone>
</div> </div>
<Foot></Foot>
</div>
</template> </template>
<script> <script>
import { login,WXCordImg,bindPhone,phoneAuthCord,getNowRole } from '../../utils/api'; import { login, WXCordImg, bindPhone, phoneAuthCord, getNowRole } from '../../utils/api';
import {resetRouter} from '../../router/resetRouter'; import { resetRouter } from '../../router/resetRouter';
export default { export default {
data() { data () {
return { return {
// //
param: { param: {
// username: '15773390498', // username: '15773390498',
// password: 'Aa1111', // password: 'Aa1111',
// username: 'admin', // username: 'admin',
// password: 'Aa1234' // password: 'Aa1234'
}, },
rules: { rules: {
username: [ username: [
{ required: true, message: '请输入账号/手机号', trigger: 'blur' } { required: true, message: '请输入账号/手机号', trigger: 'blur' }
// { // {
// pattern: /^1[3456789]\d{9}$/, // pattern: /^1[3456789]\d{9}$/,
// message: '', // message: '',
// trigger: 'blur' // trigger: 'blur'
// } // }
], ],
password: [{ required: true, message: '请输入账号密码', trigger: 'blur' }] password: [{ required: true, message: '请输入账号密码', trigger: 'blur' }]
}, },
cardType: 1, //12 cardType: 1, //12
checked: false, checked: false,
tenDayEffective: 2, tenDayEffective: 2,
loginType: 1,//12 loginType: 1,//12
// appid : 'wx3b7bca679da34921', // appid : 'wx3b7bca679da34921',
// scope : 'snsapi_login', // scope : 'snsapi_login',
// redirect_uri : encodeURIComponent("http://192.168.31.254:8080/#/Dashboard"), // redirect_uri : encodeURIComponent("http://192.168.31.254:8080/#/Dashboard"),
loading:false loading: false
}; };
}, },
beforeCreate(){ beforeCreate () {
if(this.$route.query.token){// if (this.$route.query.token) {//
sessionStorage.setItem("token",this.$route.query.token) sessionStorage.setItem("token", this.$route.query.token)
if(this.$route.query.account){ if (this.$route.query.account) {
if(this.$route.query.headerImg){ if (this.$route.query.headerImg) {
this.$store.commit("userNameData", { userName: this.$route.query.account,headerImg: this.changePercent(this.$route.query.headerImg) }); this.$store.commit("userNameData", { userName: this.$route.query.account, headerImg: this.changePercent(this.$route.query.headerImg) });
}else{ } else {
this.$store.commit("userNameData", { userName: this.$route.query.account }); this.$store.commit("userNameData", { userName: this.$route.query.account });
} }
} }
this.$router.push('/homePage') this.$router.push('/homePage')
}
},
created () {
// this.$store.commit("homeMenuData", { homeMenu: [] })
if (this.$route.query.token) {//
sessionStorage.setItem("token", this.$route.query.token)
sessionStorage.setItem('userID', this.$route.query.id)
if (this.$route.query.account) {
if (this.$route.query.headerImg) {
this.$store.commit("userNameData", { userName: this.$route.query.account, headerImg: this.changePercent(this.$route.query.headerImg) });
} else {
this.$store.commit("userNameData", { userName: this.$route.query.account });
}
}
this.$router.push('/homePage')
}
},
methods: {
//
submitForm (param) {
sessionStorage.clear()
localStorage.clear()
resetRouter()
this.$store.commit("routerData", { router: false });//
sessionStorage.removeItem('routerData')//
// this.$store.getters.clear
this.$refs.param.validate(valid => {
// ,
// this.$router.push('/customer')
if (valid) {
if (this.checked) {
this.tenDayEffective = 1
} else {
this.tenDayEffective = 2
}
this.loading = true
login({
phone: this.param.username,
type: this.loginType,
wechatId: '',
password: this.param.password,
tenDayEffective: this.tenDayEffective
}).then(res => {
sessionStorage.setItem("token", res.data.token);
sessionStorage.setItem("userID", res.data.id);
this.$store.commit("userNameData", { userName: res.data.account, userPhone: this.param.username, headerImg: res.data.headPortaritUrl });
this.getNowRole()// id
this.loading = false
}).catch(res => {
this.loading = false
});
} }
});
}, },
created(){ nextInput (event) {
// this.$store.commit("homeMenuData", { homeMenu: [] }) if (event) {
if(this.$route.query.token){// event.target.blur()
sessionStorage.setItem("token",this.$route.query.token) this.$refs.password.focus()
sessionStorage.setItem('userID',this.$route.query.id) }
if(this.$route.query.account){ },
if(this.$route.query.headerImg){ getNowRole () {
this.$store.commit("userNameData", { userName: this.$route.query.account,headerImg: this.changePercent(this.$route.query.headerImg) }); return getNowRole().then(res => {
}else{ if (res.success) {
this.$store.commit("userNameData", { userName: this.$route.query.account }); sessionStorage.setItem("now-roleBtn", res.data);
} this.$nextTick(() => {
if (this.$route.query.redirect && this.$route.query.redirect != '/login') {//
this.$router.push(this.$route.query.redirect)
} else {
this.$router.push('/homePage')
// console.log(sessionStorage.getItem('token'))
} }
this.$router.push('/homePage') })
} }
}).catch(err => {
// this.getNowRole()
})
}, },
methods:{ //
// nextStep (val) {
submitForm(param) { this.cardType = val
sessionStorage.clear() },
localStorage.clear() // X
resetRouter() gohome (val) {
this.$store.commit("routerData", { router: false });// this.cardType = val
sessionStorage.removeItem('routerData')// },
// this.$store.getters.clear // X
this.$refs.param.validate(valid => { setBack (val) {
// , this.cardType = val
// this.$router.push('/customer') },
if (valid) { reLogin (val) {
if(this.checked){ this.cardType = val
this.tenDayEffective = 1 },
}else{ // X
this.tenDayEffective = 2 toAccount (val) {
} this.cardType = val
this.loading = true },
login({ // X
phone: this.param.username, toWechat (val) {
type: this.loginType, this.cardType = val
wechatId: '', },
password: this.param.password, wxCode () {
tenDayEffective: this.tenDayEffective this.cardType = 4
}).then(res => {
sessionStorage.setItem("token",res.data.token);
sessionStorage.setItem("userID",res.data.id);
this.$store.commit("userNameData", { userName: res.data.account, userPhone: this.param.username,headerImg:res.data.headPortaritUrl });
this.getNowRole()// id
this.loading = false
}).catch(res => {
this.loading = false
});
}
});
},
nextInput (event) {
if (event) {
event.target.blur()
this.$refs.password.focus()
}
},
getNowRole(){
return getNowRole().then(res=>{
if(res.success){
sessionStorage.setItem("now-roleBtn",res.data);
this.$nextTick(()=>{
if(this.$route.query.redirect&&this.$route.query.redirect!='/login'){//
this.$router.push(this.$route.query.redirect)
}else{
this.$router.push('/homePage')
// console.log(sessionStorage.getItem('token'))
}
})
}
}).catch(err=>{
// this.getNowRole()
})
},
//
nextStep(val){
this.cardType = val
},
// X
gohome(val){
this.cardType = val
},
// X
setBack(val){
this.cardType = val
},
reLogin(val){
this.cardType = val
},
// X
toAccount(val){
this.cardType = val
},
// X
toWechat(val){
this.cardType = val
},
wxCode(){
this.cardType = 4
},
// %/
changePercent(str){
return str.replace(/%2F/g,'/').replace(/%3A/g,':')
},
}, },
mounted() { // %/
// this.setWxerwma() changePercent (str) {
return str.replace(/%2F/g, '/').replace(/%3A/g, ':')
}, },
},
mounted () {
// this.setWxerwma()
},
} }
// } // }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.home_view{ .home_view {
width: 100%;
height: 100%;
color: #00B9FF;
.homeback {
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #00B9FF; overflow: hidden;
.homeback{ background: url('../../assets/img/login-bg-1.jpg');
width: 100%; // background: url('https://www.feifanhitech.com/enclosureFile/3d7ad5b15d0141eelogin-bg-1.jpg');
height: 100%; // background: url('https://www.huorantech.cn/enclosureFile/96664d5774e54494login-bg-1.jpg');
overflow:hidden; background-size: 100% 100%;
// background: url('../../assets/img/login-bg-1.jpg'); position: relative;
background: url('https://www.feifanhitech.com/enclosureFile/3d7ad5b15d0141eelogin-bg-1.jpg');
// background: url('https://www.huorantech.cn/enclosureFile/96664d5774e54494login-bg-1.jpg'); .homeHeader {
background-size: 100% 100%; width: 100%;
position: relative; height: 60px;
.homeHeader{ position: absolute;
width: 100%; top: 0;
height: 60px; left: 0;
position: absolute; color: #fff;
top: 0;
left: 0; .logo {
color: #fff; margin-left: 140px;
.logo{
margin-left: 140px; img {
img{ //
// // width: 45px;
// width: 45px; // height: 34px;
// height: 34px; margin-right: 9px;
margin-right: 9px;
}
}
.aboutUs{
margin-right: 140px;
cursor: pointer;
}
} }
.Login_view{ }
position: absolute;
left: 50%; .aboutUs {
top: 120px; margin-right: 140px;
transform: translate(-50%, 0); cursor: pointer;
background-color: #fff; }
border-radius: 20px; }
width: 812px;
padding: 52px 0; .Login_view {
.login_title{ position: absolute;
span{ left: 50%;
font-size: 26px; top: 120px;
margin-left: 146px; transform: translate(-50%, 0);
} background-color: #fff;
i{ border-radius: 20px;
margin-right: 50px; width: 812px;
color: #666; padding: 52px 0;
font-size: 20px;
} .login_title {
} span {
.login_form{ font-size: 26px;
margin: 60px 146px 0 146px; margin-left: 146px;
p{ }
margin-bottom: 10px;
font-size: 14px; i {
} margin-right: 50px;
.item_password{ color: #666;
margin-top: 40px; font-size: 20px;
} }
.login-btn{ }
margin-top: 70px;
} .login_form {
.forget_view{ margin: 60px 146px 0 146px;
font-size: 14px;
} p {
.login-wechat{ margin-bottom: 10px;
text-align: center; font-size: 14px;
color: #00B9FF; }
font-size: 14px;
margin-top: 60px; .item_password {
} margin-top: 40px;
} }
.login-btn {
margin-top: 70px;
}
.forget_view {
font-size: 14px;
}
.login-wechat {
text-align: center;
color: #00B9FF;
font-size: 14px;
margin-top: 60px;
} }
}
} }
}
} }
.login_form /deep/ .el-form-item{ .login_form /deep/ .el-form-item {
margin-bottom: 0; margin-bottom: 0;
} }
.login_form /deep/ .el-input__inner{
background-color: #f5f5f5; .login_form /deep/ .el-input__inner {
height: 46px; background-color: #f5f5f5;
line-height: 46px; height: 46px;
border: none; line-height: 46px;
border: none;
} }
.login-btn /deep/ .el-button{
width: 100%; .login-btn /deep/ .el-button {
// border-radius: 23px; width: 100%;
height: 46px; // border-radius: 23px;
height: 46px;
} }
.forget_view /deep/ .el-button--text{
color: #FF9784; .forget_view /deep/ .el-button--text {
color: #FF9784;
} }
.forget_view /deep/ .el-button--text:hover{
text-decoration:underline; .forget_view /deep/ .el-button--text:hover {
text-decoration: underline;
} }
.wechat-btn /deep/ .el-button{
width: 100%; .wechat-btn /deep/ .el-button {
// border-radius: 23px; width: 100%;
height: 46px; // border-radius: 23px;
background-color: #f5f5f5; height: 46px;
border: none; background-color: #f5f5f5;
color: #666; border: none;
margin-top: 20px; color: #666;
margin-top: 20px;
} }
.ff-icon{
width: 100%; .ff-icon {
width: 100%;
} }
</style> </style>

@ -1,19 +1,19 @@
import Vue from 'vue'; import Vue from 'vue';
import Router from 'vue-router'; import Router from 'vue-router';
import axios from 'axios' import axios from 'axios'
import {getPermission} from '../utils/api' import { getPermission } from '../utils/api'
//解决编程式路由往同一地址跳转时会报错的情况 //解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push; const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace; const originalReplace = Router.prototype.replace;
//push //push
Router.prototype.push = function push(location, onResolve, onReject) { Router.prototype.push = function push (location, onResolve, onReject) {
if (onResolve || onReject) if (onResolve || onReject)
return originalPush.call(this, location, onResolve, onReject); return originalPush.call(this, location, onResolve, onReject);
return originalPush.call(this, location).catch(err => err); return originalPush.call(this, location).catch(err => err);
}; };
//replace //replace
Router.prototype.replace = function push(location, onResolve, onReject) { Router.prototype.replace = function push (location, onResolve, onReject) {
if (onResolve || onReject) if (onResolve || onReject)
return originalReplace.call(this, location, onResolve, onReject); return originalReplace.call(this, location, onResolve, onReject);
return originalReplace.call(this, location).catch(err => err); return originalReplace.call(this, location).catch(err => err);
@ -74,267 +74,268 @@ const noticeDesign = () => import('../components/common/noticeDesign.vue')
// 404页面,随便写了个 // 404页面,随便写了个
const notFind = () => import('../components/page/404.vue') const notFind = () => import('../components/page/404.vue')
// 重载路由,用于权限更新后的重载 // 重载路由,用于权限更新后的重载
import {resetRouter} from './resetRouter' import { resetRouter } from './resetRouter'
Vue.use(Router); Vue.use(Router);
export const constantRouterMap = [ // 默认路由,不需要权限 export const constantRouterMap = [ // 默认路由,不需要权限
{ {
path: '/', path: '/',
redirect: '/beforeLogin', redirect: '/login',
}, },
{ {
path: '/beforeLogin', path: '/beforeLogin',
component: () => import('../components/page/beforeLogin.vue'), component: () => import('../components/page/beforeLogin.vue'),
meta: { title: '智慧管理平台' } meta: { title: '智慧管理平台' }
}, },
{ {
path: '/login', path: '/login',
component: () => import('../components/page/Login.vue'), component: () => import('../components/page/Login.vue'),
meta: { title: '登录' } meta: { title: '登录' }
}, },
{ {
path: '/bind-phone', path: '/bind-phone',
component: () => import('../components/page/phoneBind.vue'), component: () => import('../components/page/phoneBind.vue'),
meta: { title: '绑定手机' } meta: { title: '绑定手机' }
} }
] ]
let router = new Router({ let router = new Router({
mode: 'hash', mode: 'hash',
    base: process.env.BASE_URL, base: process.env.BASE_URL,
routes: [] routes: []
}); });
export default router export default router
router.addRoutes(constantRouterMap) router.addRoutes(constantRouterMap)
function createdRouter(item,val) {// 处理成路由接受对象的方法 function createdRouter (item, val) {// 处理成路由接受对象的方法
if(item.menuOrNot===1){ if (item.menuOrNot === 1) {
let len,com,obj let len, com, obj
// 匹配路由名称对应的component // 匹配路由名称对应的component
switch (item.name) { switch (item.name) {
case '待办事项': com = Dashboard case '待办事项': com = Dashboard
break; break;
case '工作台': com = Workbench case '工作台': com = Workbench
break; break;
case '人力资源管理系统': com = WorkbenchManpower case '人力资源管理系统': com = WorkbenchManpower
break; break;
case '客户资源管理系统': com = WorkbenchClient case '客户资源管理系统': com = WorkbenchClient
break; break;
case '工作台客户信息': com = WorkbenchClientmessage case '工作台客户信息': com = WorkbenchClientmessage
break; break;
case '担保业务管理系统': com = WorkbenchGuarantee case '担保业务管理系统': com = WorkbenchGuarantee
break; break;
case '后台管理': com = Background case '后台管理': com = Background
break; break;
case '客户资源后台管理系统': com = Customer case '客户资源后台管理系统': com = Customer
break; break;
case '后台客户信息': com = AddCustomer case '后台客户信息': com = AddCustomer
break; break;
case '人力资源后台管理系统': com = backgroundManpower case '人力资源后台管理系统': com = backgroundManpower
break; break;
case '担保业务后台管理系统': com = backgroundGuarantee case '担保业务后台管理系统': com = backgroundGuarantee
break; break;
case '系统管理': com = SystemManagement case '系统管理': com = SystemManagement
break; break;
case '保后业务管理系统': com = afterLoan case '保后业务管理系统': com = afterLoan
break; break;
default:console.log('未匹配到文件地址'); default: console.log('未匹配到文件地址');
break; break;
} }
// 每个路由对应的数据形式 // 每个路由对应的数据形式
obj = { obj = {
path:item.menuUrl, path: item.menuUrl,
component:com, component: com,
meta:{title:item.name,btn:[]}, meta: { title: item.name, btn: [] },
children:[] children: []
}
// 判断是否为主路由文件,进行递归匹配
if (item.children && item.children.length !== 0) {
len = item.children.length
for (let i = 0; i < len; i++) {
obj.meta.btn.push(item.children[i].name)// 权限判断,把非主路由name作为鉴权信息
if (item.children[i].menuOrNot !== 0) {
// 是页面的话,生成新的obj,赛进父级
obj.children.push(createdRouter(item.children[i]))
} }
// 判断是否为主路由文件,进行递归匹配 }
if(item.children&&item.children.length!==0){ // if(item.name === '工作台'){
len = item.children.length // if(item.children&&item.children.length){
for(let i=0;i<len;i++){ // for(let i=0;i<item.children.length;i++){
obj.meta.btn.push(item.children[i].name)// 权限判断,把非主路由name作为鉴权信息 // if(item.children[i].name==='客户资源管理系统'){
if(item.children[i].menuOrNot!==0){ // obj.children.push(
// 是页面的话,生成新的obj,赛进父级 // {
obj.children.push(createdRouter(item.children[i])) // path: '/workbench-client-message',
// component: WorkbenchClientmessage,
// meta: { title: '工作台客户信息', btn:[]}
// }
// )
// }
// }
// }
// }
if (item.name === '后台管理') {
if (item.children && item.children.length) {
for (let i = 0; i < item.children.length; i++) {
if (item.children[i].name === '客户资源后台管理系统') {
obj.children.push(
{
path: '/addcustomer',
component: AddCustomer,
meta: { title: '担保业务后台管理系统', btn: [] }
} }
)
} }
// if(item.name === '工作台'){ // 判断后台管理系统,添加十个表单设计页面
// if(item.children&&item.children.length){ if (item.children[i].name === '担保业务后台管理系统') {
// for(let i=0;i<item.children.length;i++){ obj.children.push(
// if(item.children[i].name==='客户资源管理系统'){ {
// obj.children.push( path: '/applyDesign',
// { component: applyDesign,
// path: '/workbench-client-message', meta: { title: '业务申请表单设计', btn: [] }
// component: WorkbenchClientmessage, },
// meta: { title: '工作台客户信息', btn:[]} {
// } path: '/guaranteeDesign',
// ) component: guaranteeDesign,
// } meta: { title: '担保部调查', btn: [] }
// } },
// } {
// } path: '/assetDesign',
if(item.name === '后台管理'){ component: assetDesign,
if(item.children&&item.children.length){ meta: { title: '资产部调查表单设计', btn: [] }
for(let i=0;i<item.children.length;i++){ },
if(item.children[i].name==='客户资源后台管理系统'){ {
obj.children.push( path: '/messageDesign',
{ component: messageDesign,
path: '/addcustomer', meta: { title: '信息部调查表单设计', btn: [] }
component: AddCustomer, },
meta: { title: '担保业务后台管理系统', btn:[]} {
} path: '/complianceDesign',
) component: complianceDesign,
} meta: { title: '合规调查表单设计', btn: [] }
// 判断后台管理系统,添加十个表单设计页面 },
if(item.children[i].name==='担保业务后台管理系统'){ {
obj.children.push( path: '/workDesign',
{ component: workDesign,
path:'/applyDesign', meta: { title: '工作会表单设计', btn: [] }
component: applyDesign, },
meta: { title: '业务申请表单设计', btn:[]} {
}, path: '/loansDepartDesign',
{ component: loansDepartDesign,
path:'/guaranteeDesign', meta: { title: '贷审会表单设计', btn: [] }
component: guaranteeDesign, },
meta: { title: '担保部调查', btn:[]} {
}, path: '/letterDesign',
{ component: letterDesign,
path:'/assetDesign', meta: { title: '担保函流程设计', btn: [] }
component: assetDesign, },
meta: { title: '资产部调查表单设计', btn:[]} {
}, path: '/paymentDesign',
{ component: paymentDesign,
path:'/messageDesign', meta: { title: '财务部确认流程设计', btn: [] }
component: messageDesign, },
meta: { title: '信息部调查表单设计', btn:[]} {
}, path: '/noticeDesign',
{ component: noticeDesign,
path:'/complianceDesign', meta: { title: '放款通知流程设计', btn: [] }
component: complianceDesign,
meta: { title: '合规调查表单设计', btn:[]}
},
{
path:'/workDesign',
component: workDesign,
meta: { title: '工作会表单设计', btn:[]}
},
{
path:'/loansDepartDesign',
component: loansDepartDesign,
meta: { title: '贷审会表单设计', btn:[]}
},
{
path:'/letterDesign',
component: letterDesign,
meta: { title: '担保函流程设计', btn:[]}
},
{
path:'/paymentDesign',
component: paymentDesign,
meta: { title: '财务部确认流程设计', btn:[]}
},
{
path:'/noticeDesign',
component: noticeDesign,
meta: { title: '放款通知流程设计', btn:[]}
}
)
}
}
} }
)
} }
}
} }
return obj }
}else return
}
router.beforeEach(function(to,from,next){
if(to.path == '/login'){
sessionStorage.removeItem('token')
} }
if(sessionStorage.getItem('token')){ return obj
if(!sessionStorage.getItem('success')){// 记录路由是否处理过 } else return
getPermission().then(res=>{ }
if(res.success){ router.beforeEach(function (to, from, next) {
sessionStorage.setItem('getRouter','true') if (to.path == '/login') {
let permissions = { sessionStorage.removeItem('token')
path: '/', }
component: Home, if (sessionStorage.getItem('token')) {
meta: { title: '' }, if (!sessionStorage.getItem('success')) {// 记录路由是否处理过
children: [ getPermission().then(res => {
{ if (res.success) {
path: '/homePage', sessionStorage.setItem('getRouter', 'true')
component: HomePage, let permissions = {
meta: { title: '首页' ,btn:[]} path: '/',
}, component: Home,
{ meta: { title: '' },
path: '/workbench', children: [
component: () => import('../components/page/Workbench.vue'), {
meta: { title: '工作台' ,btn:[]}, path: '/homePage',
children: [ component: HomePage,
{ meta: { title: '首页', btn: [] }
path: '/workbench-manpower', },
component: WorkbenchManpower, {
meta: { title: '人力资源管理',btn:[] } path: '/workbench',
}, component: () => import('../components/page/Workbench.vue'),
{ meta: { title: '工作台', btn: [] },
path: '/workbench-client-message', children: [
component: WorkbenchClientmessage, {
meta: { title: '工作台客户信息', btn:[]} path: '/workbench-manpower',
} component: WorkbenchManpower,
] meta: { title: '人力资源管理', btn: [] }
}, },
] {
}, path: '/workbench-client-message',
len = res.data.length, component: WorkbenchClientmessage,
homeMenu = [] meta: { title: '工作台客户信息', btn: [] }
// console.log(res.data,'路由处理,工作台和非工作台路由匹配') }
]
},
]
},
len = res.data.length,
homeMenu = []
// console.log(res.data,'路由处理,工作台和非工作台路由匹配')
// 此处为主路由页面的操作,通过对应的 createdRouter 函数进行路由数据处理,文件地址分配 // 此处为主路由页面的操作,通过对应的 createdRouter 函数进行路由数据处理,文件地址分配
for(let i=0;i<len;i++){ for (let i = 0; i < len; i++) {
//匹配非工作台的路由 //匹配非工作台的路由
if(res.data[i].name!=='客户资源管理系统'&&res.data[i].name!=='担保业务管理系统'&&res.data[i].name!=='保后业务管理系统'){ if (res.data[i].name !== '客户资源管理系统' && res.data[i].name !== '担保业务管理系统' && res.data[i].name !== '保后业务管理系统') {
permissions.children.push(createdRouter(res.data[i])) permissions.children.push(createdRouter(res.data[i]))
homeMenu.push(res.data[i].name) homeMenu.push(res.data[i].name)
}else{ } else {
permissions.children[1].meta.btn.push(res.data[i].name) permissions.children[1].meta.btn.push(res.data[i].name)
permissions.children[1].children.push(createdRouter(res.data[i])) permissions.children[1].children.push(createdRouter(res.data[i]))
} }
} }
// 记录主页顶部大按钮的值(路由主页面权限) // 记录主页顶部大按钮的值(路由主页面权限)
router.app.$options.store.commit("homeMenuData", { homeMenu: homeMenu }); router.app.$options.store.commit("homeMenuData", { homeMenu: homeMenu });
let errPage = [ let errPage = [
{ {
path: '*', path: '*',
redirect: '/404' redirect: '/404'
}, },
{ {
path: '/404', path: '/404',
component: notFind, component: notFind,
meta: { title: '找不到页面', btn:[]} meta: { title: '找不到页面', btn: [] }
} }
] ]
router.addRoutes([permissions]) router.addRoutes([permissions])
router.addRoutes(errPage) router.addRoutes(errPage)
sessionStorage.setItem('routerData',JSON.stringify([permissions])) sessionStorage.setItem('routerData', JSON.stringify([permissions]))
// 处理过路由否 // 处理过路由否
sessionStorage.setItem('success',true) sessionStorage.setItem('success', true)
}
}).catch(err=>{
console.log(err,'路由处理出错')
let errPage = {
path: '*',
redirect: '/login'
}
router.addRoutes([errPage])
})
} }
}else{ }).catch(err => {
if (to.path !== '/login'&&to.path !=="/beforeLogin"&&to.path !=='/bind-phone') { console.log(err, '路由处理出错')
next({ path: '/login', let errPage = {
query:{redirect:to.path} path: '*',
}) redirect: '/login'
} }
router.addRoutes([errPage])
})
}
} else {
if (to.path !== '/login' && to.path !== "/beforeLogin" && to.path !== '/bind-phone') {
next({
path: '/login',
query: { redirect: to.path }
})
} }
// 根据路由元信息设置文档标题 }
window.document.title = to.meta.title || '智慧管理' // 根据路由元信息设置文档标题
next() window.document.title = to.meta.title || '智慧管理'
next()
}) })

@ -1,4 +1,4 @@
import {get,post,put,del,Url} from './http'; import { get, post, put, del, Url } from './http';
let host = Url; let host = Url;
export const login = p => post('/apiHrmsAuth/hrms/auth/userlogin/login', p); export const login = p => post('/apiHrmsAuth/hrms/auth/userlogin/login', p);
export const phoneCode = p => get('/apiHrmsAuth/hrms/auth/userlogin/sendCode', p); export const phoneCode = p => get('/apiHrmsAuth/hrms/auth/userlogin/sendCode', p);
@ -94,7 +94,7 @@ export const personnelSelection = p => get('/api-guarantee/al-collection-statist
export const annualStatisticsDeleted = p => post(`/api-guarantee/al-collection-statistics/annualStatisticsDeleted?year=${p}`); export const annualStatisticsDeleted = p => post(`/api-guarantee/al-collection-statistics/annualStatisticsDeleted?year=${p}`);
export const annualStatisticsListExport = p => `${host}/api-guarantee/al-collection-statistics/annualStatisticsListExport?year=${p}` export const annualStatisticsListExport = p => `${host}/api-guarantee/al-collection-statistics/annualStatisticsListExport?year=${p}`
export const importInsurance = `${host}/api-guarantee/al-insurance-list/importInsurance`; export const importInsurance = `${host}/api-guarantee/al-insurance-list/importInsurance`;
export const exportFailure = p=> `${host}/api-guarantee/al-insurance-list/exportFailure?exportCode=${p}`; export const exportFailure = p => `${host}/api-guarantee/al-insurance-list/exportFailure?exportCode=${p}`;
@ -108,7 +108,7 @@ export const collectionListDetail = p => get('/api-guarantee/al-collection/overd
export const modifyReimbursement = p => get('/api-guarantee/al-reimbursement/modifyReimbursement', p);// 查清收组人员 export const modifyReimbursement = p => get('/api-guarantee/al-reimbursement/modifyReimbursement', p);// 查清收组人员
export const collectionHisList = p => post('/api-guarantee/al-collection/collection/list', p); export const collectionHisList = p => post('/api-guarantee/al-collection/collection/list', p);
export const updateCollection = p => post('/api-guarantee/al-collection/updateCollection', p);// 编辑催收记录 export const updateCollection = p => post('/api-guarantee/al-collection/updateCollection', p);// 编辑催收记录
export const delCollection = p => post('/api-guarantee/al-collection/delCollection?id='+p);// 删除催收记录 export const delCollection = p => post('/api-guarantee/al-collection/delCollection?id=' + p);// 删除催收记录
export const collectionHisListDetail = p => get('/api-guarantee/al-collection/examine/detail', p); export const collectionHisListDetail = p => get('/api-guarantee/al-collection/examine/detail', p);
export const excelInsurance = `${host}/api-guarantee/al-insurance-list/excelExport`; export const excelInsurance = `${host}/api-guarantee/al-insurance-list/excelExport`;

@ -6,8 +6,9 @@ import router from '../router/index'
// 服务器的切换 // 服务器的切换
// export const Url = 'https://test.feifanhitech.com'// 测试服务器地址 // export const Url = 'https://test.feifanhitech.com'// 测试服务器地址
export const Url = 'https://www.feifanhitech.com';// 非凡(正式服) // export const Url = 'https://www.feifanhitech.com';// 非凡(正式服)
// export const Url = 'http://192.168.31.137:8080';//陈赓 // export const Url = 'http://192.168.31.51:8089';//陈赓
export const Url = 'http://10.0.0.40:8089';
axios.defaults.baseURL = Url; axios.defaults.baseURL = Url;
const baseurl = Url const baseurl = Url
// 请求超时时间 // 请求超时时间
@ -17,145 +18,145 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use(config => { axios.interceptors.request.use(config => {
if (sessionStorage.getItem('token')) { if (sessionStorage.getItem('token')) {
config.headers.token = `${sessionStorage.getItem('token')}`; config.headers.token = `${sessionStorage.getItem('token')}`;
} }
return config; return config;
}, err => { }, err => {
return Promise.reject(err); return Promise.reject(err);
}) })
// 响应拦截器 // 响应拦截器
axios.interceptors.response.use( axios.interceptors.response.use(
response => { response => {
if (response.data.code === 10000) { if (response.data.code === 10000) {
return Promise.resolve(response); return Promise.resolve(response);
} else } else
if(response.data.code === 401){ if (response.data.code === 401) {
Message.error('登录过期,请重新登录!');
// 清除token
sessionStorage.removeItem('token');
localStorage.removeItem('token')
// 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面
setTimeout(() => {
router.replace({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
}
});
}, 1000);
} else {
if (response.data.message) {
Message.error(response.data.message);
}
return Promise.reject(response)
// return Promise.reject(response);
}
},
// 服务器状态码不是200的情况
error => {
if (error.response) {
if (error.response.status) {
switch (error.response.status) {
// 401: 未登录
// 未登录则跳转登录页面,并携带当前页面的路径
// 在登录成功后返回当前页面,这一步需要在登录页操作。
case 403:
router.replace({
path: '/login',
query: { redirect: router.currentRoute.fullPath }
});
break;
// 403 token过期
// 登录过期对用户进行提示
// 清除本地token和清空vuex中token对象
// 跳转登录页面
case 401:
Message.error('登录过期,请重新登录!'); Message.error('登录过期,请重新登录!');
// 清除token // 清除token
sessionStorage.removeItem('token'); sessionStorage.removeItem('token');
localStorage.removeItem('token') localStorage.removeItem('token')
// store.commit('loginSuccess', null);
// 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面
setTimeout(() => { setTimeout(() => {
router.replace({ router.replace({
path: '/login', path: '/login',
query: { query: {
redirect: router.currentRoute.fullPath redirect: router.currentRoute.fullPath
}
});
}, 1000);
}else{
if(response.data.message){
Message.error(response.data.message);
}
return Promise.reject(response)
// return Promise.reject(response);
}
},
// 服务器状态码不是200的情况
error => {
if(error.response){
if (error.response.status) {
switch (error.response.status) {
// 401: 未登录
// 未登录则跳转登录页面,并携带当前页面的路径
// 在登录成功后返回当前页面,这一步需要在登录页操作。
case 403:
router.replace({
path: '/login',
query: { redirect: router.currentRoute.fullPath }
});
break;
// 403 token过期
// 登录过期对用户进行提示
// 清除本地token和清空vuex中token对象
// 跳转登录页面
case 401:
Message.error('登录过期,请重新登录!');
// 清除token
sessionStorage.removeItem('token');
localStorage.removeItem('token')
// store.commit('loginSuccess', null);
// 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面
setTimeout(() => {
router.replace({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
}
});
}, 1000);
break;
// 404请求不存在
case 404:
Message.error('网络请求不存在!');
break;
// 404请求不存在
case 500:
Message.error('网络请求出错!');
break;
// 其他错误,直接抛出错误提示
default:
Message.error(error.response.errmessage);
} }
return Promise.reject(error.response); });
} }, 1000);
break;
// 404请求不存在
case 404:
Message.error('网络请求不存在!');
break;
// 404请求不存在
case 500:
Message.error('网络请求出错!');
break;
// 其他错误,直接抛出错误提示
default:
Message.error(error.response.errmessage);
} }
return Promise.reject(error.response);
}
} }
}
); );
/** get方法,对应get请求---sb封装,本身axios就是封装的promis **/ /** get方法,对应get请求---sb封装,本身axios就是封装的promis **/
export function get(url, params){ export function get (url, params) {
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) => {
axios.get(url, { axios.get(url, {
params: params params: params
}) })
.then(res => { .then(res => {
resolve(res.data); resolve(res.data);
}) })
.catch(err => { .catch(err => {
reject(err.data) reject(err.data)
}) })
}); });
} }
/** post方法,对应post请求 **/ /** post方法,对应post请求 **/
export function post(url, params) { export function post (url, params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post(url,params) axios.post(url, params)
.then(res => { .then(res => {
resolve(res.data); resolve(res.data);
}) })
.catch(err => { .catch(err => {
reject(err.data) reject(err.data)
}) })
}); });
} }
/** delete方法,对应delete请求 **/ /** delete方法,对应delete请求 **/
export function del(url, params){ export function del (url, params) {
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) => {
axios.delete(url, { axios.delete(url, {
data: params data: params
}) })
.then(res => { .then(res => {
resolve(res.data); resolve(res.data);
}) })
.catch(err => { .catch(err => {
reject(err.data) reject(err.data)
}) })
}); });
} }
/** put修改 **/ /** put修改 **/
export function put(url, params){ export function put (url, params) {
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) => {
axios.put(url, params) axios.put(url, params)
.then(res => { .then(res => {
resolve(res.data); resolve(res.data);
}) })
.catch(err => { .catch(err => {
reject(err.data) reject(err.data)
}) })
}); });
} }
Loading…
Cancel
Save