不记录路由

master
许宏杰 1 year ago
parent ac1c3d060c
commit 7627c015b7

@ -64,7 +64,7 @@ body {
z-index: 2000; z-index: 2000;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; /*隐藏滚轮*/ // display: none; /**/
} }
// //
input:-webkit-autofill, input:-webkit-autofill,

@ -82,6 +82,7 @@ request.interceptors.response.use(
}, },
async (error) => { async (error) => {
let errorData = error.response let errorData = error.response
if (errorData.status === 401 && !isRefreshRequest(errorData.config)) { if (errorData.status === 401 && !isRefreshRequest(errorData.config)) {
const isSucceed = await refreshToken() const isSucceed = await refreshToken()
if (isSucceed) { if (isSucceed) {

@ -8,7 +8,7 @@
// 总路由 // 总路由
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import Login from '@/views/Login'
import store from '@/store' import store from '@/store'
Vue.use(Router) Vue.use(Router)
// 引入其他路由文件 // 引入其他路由文件
@ -22,6 +22,7 @@ const router = new Router({ routes })
// 路由拦截 // 路由拦截
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('值', to)
store.commit('SET_IS_SHOW', { store.commit('SET_IS_SHOW', {
text: to.name == '企业详情' ? '工业园' : '企业', text: to.name == '企业详情' ? '工业园' : '企业',
isShow: to.query.isShow || to.params.isShow, isShow: to.query.isShow || to.params.isShow,

@ -13,8 +13,16 @@ export default new Vuex.Store({
text: '', text: '',
isShow: false, isShow: false,
}, },
parkId: null,
enterpriseId: null,
}, },
mutations: { mutations: {
SET_PERK_ID(state, parkId) {
state.parkId = parkId
},
SET_ENTERPRISE_ID(state, enterpriseId) {
state.enterpriseId = enterpriseId
},
MYSHOW(state, value) { MYSHOW(state, value) {
state.myShow = value state.myShow = value
}, },

@ -21,5 +21,6 @@ export async function refreshToken() {
} }
export function isRefreshRequest(config) { export function isRefreshRequest(config) {
console.log(config.__isRefreshToken)
return !!config.__isRefreshToken //两个取反变成boolean return !!config.__isRefreshToken //两个取反变成boolean
} }

@ -1,497 +0,0 @@
<!--
* @Author: 张涛
* @Date: 2021-06-01 10:46:29
* @LastEditors: 许宏杰
* @LastEditTime: 2021-09-23 10:27:23
* @FilePath: \MuduAPP\src\views\Login.vue
-->
<template>
<div class="login-page" :style="{ height: height + 'px' }">
<!-- <div class="login-page"> -->
<div class="header">
<!-- <img class="header-logo" src="../assets/image/logo.png" />
<img
class="header-title"
src="../assets/image/leader/icon_login_title@2x.png"
alt=""
/> -->
<img class="new-header-logo" src="../assets/image/logo@2x.png" alt="" />
</div>
<div class="main">
<div class="login-box">
<van-form validate-first ref="scrolltops">
<div class="login-field-groups">
<!-- <div class="login-field-title">
手机号
</div> -->
<van-field
v-model="username"
name="用户名"
label=""
clearable
class="cell-field cell-username"
placeholder="请输入用户名"
/>
</div>
<div class="login-field-group">
<!-- <div class="login-field-title">
密码
</div> -->
<van-field
v-model="password"
name="密码"
label=""
type="password"
clearable
class="cell-field cell-pwd"
placeholder="请输入密码"
/>
</div>
<div class="login-field-btn-group">
<van-button
class="login-field-btn"
round
block
type="info"
@click="onSubmit"
native-type="submit"
>登录</van-button
>
</div>
</van-form>
</div>
</div>
<div class="text-document">
<p>木渎镇人民政府</p>
<p>木渎镇安全生产委员会</p>
<p>木渎镇应急管理局</p>
<p>V{{ version }}</p>
</div>
<!-- 选择 -->
<van-overlay :show="show" @click="show = false">
<div class="model_show">
<div class="model_tops">请选择进入领导端/安全员端</div>
<div class="model_bottoms">
<div>
<van-button @click="pathLeader()"></van-button>
</div>
<div>
<van-button @click="pathSafety()"></van-button>
</div>
</div>
</div>
</van-overlay>
</div>
</template>
<script>
import { Overlay } from 'vant'
import * as api from '@/api/api.js'
import { Toast } from 'vant'
import { phoneIf } from '@/util/sbIf.js'
export default {
name: 'login',
data() {
return {
username: '',
password: '',
height: 0,
show: false,
version: '',
}
// admin 123456 68702749
// 123321
// 123321
// 12345678901 678901
// LoginId: '',
// Password: 123456,
},
mounted() {
let shebei = phoneIf()
if (shebei == 'IOS') {
this.version = process.env.VUE_APP_VERSION2
} else if (shebei == 'Android') {
this.version = process.env.VUE_APP_VERSION
}
// console.log('', this.height)
this.$nextTick(() => {
if (window.plus) {
this.height = window.plus.screen.resolutionHeight //
// console.log('',this.height)
} else {
this.height = window.screen.height
// console.log('',this.height)
}
})
},
created() {
let mudu_logpwd = localStorage.getItem('mudu_logpwd')
if (mudu_logpwd) {
let logpwdInfo = JSON.parse(mudu_logpwd)
this.username = logpwdInfo.LoginId
this.password = logpwdInfo.Password
}
let mudu_token = localStorage.getItem('mudu_token')
let _res = localStorage.getItem('mudu_userInfo')
let res = JSON.parse(_res)
if (mudu_token && res) {
//
if (res.type === 'system') {
if (
res.profile.roleName === '综合执法局' ||
res.profile.roleName === '管理员' ||
res.profile.roleName === '镇领导' ||
res.profile.roleName === '村领导'
) {
this.$router.push('/leader/LeaderIndex')
} else if (res.profile.roleName === '安全员') {
this.$router.push('/safety/app')
} else if (res.profile.roleName === '综合执法局工作人员') {
this.show = true
}
} else if (res.type === 'enterprise') {
//
this.$router.push('/enterprise/home')
}
}
},
methods: {
pathSafety() {
this.$router.push('/safety/app')
this.$toast({ message: '登录成功', position: 'bottom' })
},
pathLeader() {
// this.$store.commit('MYSHOW', true)
this.$router.push('/leader/LeaderIndex')
this.$toast({ message: '登录成功', position: 'bottom' })
},
onSubmit() {
if (this.username == '') {
Toast({
message: '用户名不能为空',
position: 'bottom',
})
return
}
if (this.password == '') {
Toast({
message: '密码不能为空',
position: 'bottom',
})
return
}
this.$toast({
message: '正在登录,请稍后',
position: 'bottom',
duration: 0,
})
let data = {
LoginId: this.username,
Password: this.password,
// LoginId: 'admin',
// Password: 68702749
// LoginId: '',
// Password: 123321
// LoginId: '',
// Password: 123321
// LoginId: '12345678901',
// Password: 678901
// LoginId: '',
// Password: 123456,
}
api.login(data).then((res) => {
localStorage.setItem('mudu_token', res.access_token)
localStorage.setItem('mudu_type', res.type) //
localStorage.setItem('mudu_userInfo', JSON.stringify(res))
localStorage.setItem('mudu_username', res.profile.userName)
localStorage.setItem('mudu_userId', res.profile.userId)
localStorage.setItem('mudu_logpwd', JSON.stringify(data))
//
if (localStorage.getItem('submitPopupParams')) {
localStorage.removeItem('submitPopupParams')
}
//
if (res.type === 'system') {
if (
res.profile.roleName === '综合执法局' ||
res.profile.roleName === '管理员' ||
res.profile.roleName === '镇领导' ||
res.profile.roleName === '村领导'
) {
this.$toast({ message: '登录成功', position: 'bottom' })
this.$router.push('/leader/LeaderIndex')
} else if (
res.profile.roleName === '安全员' ||
res.profile.roleName === '安全员(只读)'
) {
this.$toast({ message: '登录成功', position: 'bottom' })
this.$router.push('/safety/app')
} else if (res.profile.roleName === '综合执法局工作人员') {
this.show = true
} else if (
res.profile.roleName === '养老护理和救助' ||
res.profile.roleName === '农业农村' ||
res.profile.roleName === '旅游' ||
res.profile.roleName === '油气输送管道' ||
res.profile.roleName === '消防安全专项治理' ||
res.profile.roleName === '商业综合体' ||
res.profile.roleName === '建筑工程施工' ||
res.profile.roleName === '城镇燃气' ||
res.profile.roleName === '交通运输' ||
res.profile.roleName === '特种设备' ||
res.profile.roleName === '校园' ||
res.profile.roleName === '民族宗教'
) {
this.$toast({ message: '登录成功', position: 'bottom' })
this.$router.push('/leader/LeaderIndex')
} else {
this.$toast({
message: res.profile.roleName + '没有访问权限',
position: 'bottom',
})
}
} else if (res.type === 'enterprise') {
//
localStorage.setItem('mudu_enterpriseID', res.profile.enterpriseID)
this.$toast({ message: '登录成功', position: 'bottom' })
this.$router.push('/enterprise/home')
}
})
},
},
}
</script>
<style lang="scss" scoped>
//
.cell-username::before {
content: '';
width: 0.3rem;
left: 0.267rem;
background-image: url('../assets/image/icon_user@2x.png');
background-size: 100%;
background-position: center;
background-repeat: no-repeat;
}
.cell-pwd::before {
content: ' ';
width: 0.3rem;
left: 0.267rem;
background-image: url('../assets/image/icon_password@2x.png');
background-repeat: no-repeat;
background-size: 100%;
background-position: center;
}
.cell-pwd input {
-webkit-user-select: text !important;
}
.cell-field {
background: #ffffff;
border-radius: 4px;
height: 0.733rem;
display: flex;
flex-direction: row;
border: none;
padding-top: 0.2rem;
padding-bottom: 0.2rem;
}
/deep/.van-cell {
padding: 0 0.25rem; //
}
/deep/.van-field__control {
font-size: 0.283rem;
font-weight: 400;
color: #464765;
margin-left: 0.3rem;
background: none;
outline: none;
border: none;
line-height: 0.733rem;
}
/deep/.van-field__control::placeholder {
font-weight: 400;
color: #adb0bd;
}
.login-page {
width: 100%;
position: fixed;
height: 100vh;
height: calc(100vh + constant(safe-area-inset-top));
height: calc(100vh + env(safe-area-inset-top));
top: 0;
background-color: #81a2e3;
background-image: url('../assets/image/img-bg@2x.png');
// background-size: cover;
background-size: 100% 100%;
background-position: 50%;
background-repeat: no-repeat;
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
}
.header {
display: flex; /* 新版本语法: Opera 12.1, Firefox 22+ */
flex-direction: column;
// align-self: center;
width: 100%;
}
.new-header-logo {
width: 4.8333rem;
height: 1.7167rem;
margin: 2.4667rem auto 0.6rem auto;
}
.header-logo {
width: 1.5rem;
height: 1.5rem;
margin: 0.892rem auto 0 auto;
}
.header-title {
width: 4.583rem;
height: 0.85rem;
margin: 0.5rem auto 0 auto;
}
// .login-box {
// margin-top: 0.475rem;
// }
.login-field-group {
display: -webkit-flex;
display: flex;
flex-direction: column;
text-align: left;
margin: 0.3333rem 0.542rem;
}
.login-field-groups {
display: -webkit-flex;
display: flex;
flex-direction: column;
text-align: left;
margin: 0rem 0.542rem;
}
.login-field {
margin-left: 0.542rem;
margin-right: 0.542rem;
border-radius: 0.4rem;
height: 0.533rem;
background-color: rgba(82, 143, 226, 0.5);
display: flex;
}
// .login-field-title {
// font-size: 0.267rem;
// font-weight: 400;
// color: #f2f2f2;
// margin-top: 0.358rem;
// margin-left: 0.26rem;
// margin-bottom: 0.05rem;
// }
/* 登录按钮 */
.login-field-btn-group {
margin-top: 0.4167rem;
margin-left: 0.533rem;
margin-right: 0.533rem;
}
.login-field-btn {
font-size: 0.283rem;
text-shadow: 0rem 0rem 0rem #2a61d1;
color: #ffffff;
letter-spacing: 0.15rem;
height: 0.733rem;
background: #3c7dff;
box-shadow: 0rem 0.1rem 0.1rem 0rem rgba(42, 97, 209, 0.14);
border-radius: 4px;
border: 1px solid #97c5ff;
}
/deep/ .van-overlay {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.van-overlay > div {
margin-bottom: 0.5rem;
}
.model_show {
width: 5.5rem;
height: 2.5rem;
background: white;
border-radius: 0.3rem;
}
.model_tops {
height: 1rem;
font-weight: bold;
font-size: 0.3rem;
line-height: 1.1rem;
margin-top: 0.2rem;
}
.model_bottoms {
height: 1.1rem;
overflow: hidden;
display: flex;
}
.model_bottoms > div {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
/deep/.model_bottoms > div button {
border: 1px solid;
width: 2.2rem;
height: 0.6rem;
border-radius: 0.3rem;
color: white;
font-weight: bold;
}
.model_bottoms > div:nth-child(1) button {
background: linear-gradient(to right, #ff6034, #ee0a24);
}
.model_bottoms > div:nth-child(2) button {
background: linear-gradient(to right, #58a95c, #1f6822);
}
.text-document {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 0.583rem;
p {
margin: 0;
color: #d6e7ff;
letter-spacing: 0.0333rem;
&:nth-child(2) {
margin: 0.1667rem 0;
}
&:nth-child(4) {
margin-top: 0.5667rem;
font-size: 0.2667rem;
font-weight: 600;
color: #d6e7ff;
}
}
}
</style>

@ -209,6 +209,7 @@ div {
.info-content { .info-content {
height: calc(100% - 0.1rem); height: calc(100% - 0.1rem);
overflow-y: auto; overflow-y: auto;
padding: 0 0.15rem;
.list-item { .list-item {
display: flex; display: flex;
// align-items: center; // align-items: center;

@ -48,8 +48,17 @@ export default {
}, },
methods: { methods: {
backHome() { backHome() {
console.log('sasasa') if (this.$store.state.showBtnData.text == '工业园') {
this.$router.back() this.$router.replace({
path: '/park',
query: { id: this.$store.state.parkId },
})
} else {
this.$router.replace({
path: '/enterpriseData/info',
query: { id: this.$store.state.enterpriseId, isShow: true },
})
}
}, },
handlerDownload() { handlerDownload() {
let temp = document.createElement('a') // a let temp = document.createElement('a') // a

@ -372,6 +372,7 @@ export default {
mounted() { mounted() {
let enterpriseId = this.$route.query.id let enterpriseId = this.$route.query.id
this.enterpriseId = this.$route.query.id this.enterpriseId = this.$route.query.id
this.$store.commit('SET_ENTERPRISE_ID', this.enterpriseId)
this.getIdInfo(enterpriseId) this.getIdInfo(enterpriseId)
this.getYinHuan(enterpriseId) this.getYinHuan(enterpriseId)
this.getJianChaNum(enterpriseId) this.getJianChaNum(enterpriseId)
@ -520,7 +521,7 @@ export default {
}, },
// //
goInfo(item) { goInfo(item) {
this.$router.push({ this.$router.replace({
path: '/enterpriseData/check/info/', path: '/enterpriseData/check/info/',
query: { query: {
id: item.id, id: item.id,

@ -89,7 +89,7 @@ export default {
this.getList() this.getList()
}, },
onInfoClcik(item) { onInfoClcik(item) {
this.$router.push({ this.$router.replace({
path: '/enterpriseData', path: '/enterpriseData',
query: { query: {
id: item.id, id: item.id,

@ -252,6 +252,8 @@ export default {
} }
}) })
this.$store.commit('SET_PERK_ID', this.$route.query.id)
this.loading = Toast.loading('加载中...') this.loading = Toast.loading('加载中...')
this.$nextTick(() => { this.$nextTick(() => {
this.getList() this.getList()
@ -484,6 +486,7 @@ div {
.container-box { .container-box {
height: calc(100% - 0.5rem); height: calc(100% - 0.5rem);
overflow-y: auto; overflow-y: auto;
padding: 0 0.1rem;
} }
.tab-type { .tab-type {
padding-bottom: 0.2rem; padding-bottom: 0.2rem;

Loading…
Cancel
Save