update code

prv
haha 2023-10-09 22:45:08 +08:00
parent d73a5a6488
commit 8ca7da71b8
16 changed files with 551 additions and 207 deletions

View File

@ -16,11 +16,13 @@
"emittery": "^0.8.1", "emittery": "^0.8.1",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"nprogress": "0.2.0",
"less": "^4.1.3", "less": "^4.1.3",
"less-loader": "^11.1.3", "less-loader": "^11.1.3",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"logt": "^1.4.1", "logt": "^1.4.1",
"vue": "^2.6.14", "vue": "^2.6.14",
"vuex": "3.6.0",
"vue-router": "^3.1.3" "vue-router": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {

View File

@ -166,7 +166,6 @@ table{
text-align: center; text-align: center;
} }
.head-title-weather{ .head-title-weather{
width: 55%;
display: flex; display: flex;
align-items: center; align-items: center;
} }

View File

@ -2,9 +2,9 @@
import request from '@/utils/request' import request from '@/utils/request'
// 查询流程表单列表 // 查询流程表单列表
const list=()=> { const list=(roleId)=> {
return request({ return request({
url: 'bgscreen/dept/list', url: 'bgscreen/dept/list?roleId='+(roleId||1),
method: 'get' method: 'get'
}) })
} }

View File

@ -0,0 +1,47 @@
import request from '@/utils/request'
// 登录方法
function login(username, password, code, uuid) {
const data = {
username,
password,
code,
uuid
}
return request({
url: '/login',
headers: {
isToken: false
},
method: 'post',
data: data
})
}
// 获取用户详细信息
function getInfo() {
return request({
url: '/getInfo',
method: 'get'
})
}
// 退出方法
function logout() {
return request({
url: '/logout',
method: 'post'
})
}
export {
login,
logout,
getInfo
}
export default {
login,
logout,
getInfo
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -13,9 +13,15 @@
<div>视频管理</div> <div>视频管理</div>
<div class="header-btn-list"> <div class="header-btn-list">
<div class="header-btn-list-arrow"></div> <div class="header-btn-list-arrow"></div>
<div class="header-btn-list-item" style="width: 276px;"><div class="header-btn-list-padding"> <div class="header-btn-list-item" style="width: 276px;">
<button type="button" :class="nav==61?'active':''" class="sub-btn" @click="pageJump(61,'#/video')"></button> <div class="header-btn-list-padding">
<button type="button" :class="nav==62?'active':''" class="sub-btn" @click="pageJump(62,'#/aiVideo')">AI</button></div></div></div> <button type="button" :class="nav == 61 ? 'active' : ''" class="sub-btn"
@click="pageJump(61, '#/video')">视频监控</button>
<button type="button" :class="nav == 62 ? 'active' : ''" class="sub-btn"
@click="pageJump(62, '#/aiVideo')">AI识别监控</button>
</div>
</div>
</div>
</div> </div>
<div :class="nav == 7 ? 'head-nav active' : 'head-nav'" @click="pageJump(7, '#/engin')">工程管理</div> <div :class="nav == 7 ? 'head-nav active' : 'head-nav'" @click="pageJump(7, '#/engin')">工程管理</div>
</div> </div>
@ -40,7 +46,7 @@
</el-collapse-transition> </el-collapse-transition>
</div> </div>
<div class="head-title-date"> <div class="head-title-date">
<div class="head-title-time"> <div class="head-title-time" v-if="1 == 2">
<div class="head-title-date-con">{{ date }}</div> <div class="head-title-date-con">{{ date }}</div>
<div class="head-title-time-con">{{ time }}</div> <div class="head-title-time-con">{{ time }}</div>
</div> </div>
@ -49,15 +55,40 @@
<span>{{ condTxt }}</span> <span>{{ condTxt }}</span>
<span>{{ temperature }}</span> <span>{{ temperature }}</span>
</div> </div>
<div class="header-title-user" style="margin-left:12px;">
{{ getName() }}
<i @click="doLogout" title="退出" style="margin-left:12px;cursor: pointer;">
<svg class="icon"
style=" width:20px;height: 20px;vertical-align: middle;fill: currentColor;overflow: hidden;"
viewBox="0 0 1072 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3432">
<path
d="M1057.279808 548.106418a47.221004 47.221004 0 0 1-7.674052 5.499737l-198.681223 199.525368a51.160351 51.160351 0 0 1-72.366316-72.340736l117.157204-117.668807L357.38063 562.763858a51.160351 51.160351 0 1 1 0-102.320701l540.713747 0.409282-119.58732-120.226824a51.160351 51.160351 0 0 1 72.366316-72.366316l199.83233 200.753216a48.09073 48.09073 0 0 1 6.574105 4.37421 54.511354 54.511354 0 0 1 0 74.719693zM972.046664 256.543579a51.160351 51.160351 0 0 1-51.160351-51.160351v-10.564612c-1.50923-72.289576-20.259499-91.85841-100.197547-92.421174l-627.430541 0.332542c-75.154555 2.148735-89.760835 24.173266-89.760835 101.885839L102.320701 157.57388l0.332543 685.369639c3.862606 61.597062 25.580175 77.968375 103.139267 77.968374l-103.088107-0.665084v1.099947l818.565612-0.409283-0.204642-66.943318-0.460443 66.227074-103.216007 0.690664c83.08441 0 102.0649-19.133971 103.59971-92.523494v-10.564612a51.160351 51.160351 0 0 1 102.320701 0L1023.386076 869.725962H1023.207015v51.160351a102.320701 102.320701 0 0 1-102.320702 102.320702h-54.357873l-709.849866 0.358122V1023.207015H102.320701a102.09048 102.09048 0 0 1-101.860258-97.767431L0 101.911419A102.03932 102.03932 0 0 1 97.74185 0.460443L921.244436 0A102.320701 102.320701 0 0 1 1023.207015 102.320701v51.160351h0.179061L1023.207015 205.383228a51.160351 51.160351 0 0 1-51.160351 51.160351zM102.320701 102.781145v0.179061l31.438036-0.204642H102.320701zM834.246259 102.320701l86.307512 0.588344 0.460443 66.227075L921.218855 102.320701z"
fill="#0090FF" p-id="3433"></path>
</svg>
</i>
</div> </div>
<i class="set-fullscreen set-font-size" style="margin-left: 16px;position: absolute;top: 4px;right: 16px;" @click="toggleFullScreen"> </div>
<svg class="icon" v-if="!isFullScreen" style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3304"><path d="M145.066667 85.333333h153.6c25.6 0 42.666667-17.066667 42.666666-42.666666S324.266667 0 298.666667 0H34.133333C25.6 0 17.066667 8.533333 8.533333 17.066667 0 25.6 0 34.133333 0 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666666s42.666667-17.066667 42.666666-42.666666V145.066667l230.4 230.4c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733334L145.066667 85.333333z m170.666666 563.2L162.133333 802.133333l-76.8 76.8V725.333333C85.333333 699.733333 68.266667 682.666667 42.666667 682.666667s-42.666667 17.066667-42.666667 42.666666v256c0 25.6 17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666666-42.666667s-17.066667-42.666667-42.666666-42.666666H145.066667l76.8-76.8 153.6-153.6c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0z m665.6 34.133334c-25.6 0-42.666667 17.066667-42.666666 42.666666v153.6l-76.8-76.8-153.6-153.6c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733334l153.6 153.6 76.8 76.8H725.333333c-25.6 0-42.666667 17.066667-42.666666 42.666666s17.066667 42.666667 42.666666 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666666z m0-682.666667h-256c-25.6 0-42.666667 17.066667-42.666666 42.666667s17.066667 42.666667 42.666666 42.666666h153.6l-76.8 76.8-153.6 153.6c-17.066667 17.066667-17.066667 42.666667 0 59.733334 17.066667 17.066667 42.666667 17.066667 59.733334 0l153.6-153.6 76.8-76.8v153.6c0 25.6 17.066667 42.666667 42.666666 42.666666s42.666667-17.066667 42.666667-42.666666v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z" fill="" p-id="3305"></path></svg> <i class="set-fullscreen set-font-size" style="margin-left: 16px;position: absolute;top: 30px;right: 24px;"
<svg class="icon" v-else style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3952"><path d="M384 597.333333h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h153.6L17.066667 947.2c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733333 0L341.333333 742.4v153.6c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z m358.4 85.333334h153.6c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667V742.4l264.533333 264.533333c17.066667 17.066667 42.666667 17.066667 59.733333 0 17.066667-17.066667 17.066667-42.666667 0-59.733333L742.4 682.666667zM640 426.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667H742.4L1006.933333 76.8c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733333 0L682.666667 281.6V128c0-25.6-17.066667-42.666667-42.666667-42.666667s-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667z m-256-341.333334c-25.6 0-42.666667 17.066667-42.666667 42.666667v153.6L76.8 8.533333C59.733333 0 25.6 0 8.533333 8.533333 0 25.6 0 59.733333 8.533333 76.8L281.6 341.333333H128c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z" p-id="3953"></path></svg> @click="toggleFullScreen">
<svg class="icon" v-if="!isFullScreen"
style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3304">
<path
d="M145.066667 85.333333h153.6c25.6 0 42.666667-17.066667 42.666666-42.666666S324.266667 0 298.666667 0H34.133333C25.6 0 17.066667 8.533333 8.533333 17.066667 0 25.6 0 34.133333 0 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666666s42.666667-17.066667 42.666666-42.666666V145.066667l230.4 230.4c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733334L145.066667 85.333333z m170.666666 563.2L162.133333 802.133333l-76.8 76.8V725.333333C85.333333 699.733333 68.266667 682.666667 42.666667 682.666667s-42.666667 17.066667-42.666667 42.666666v256c0 25.6 17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666666-42.666667s-17.066667-42.666667-42.666666-42.666666H145.066667l76.8-76.8 153.6-153.6c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0z m665.6 34.133334c-25.6 0-42.666667 17.066667-42.666666 42.666666v153.6l-76.8-76.8-153.6-153.6c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733334l153.6 153.6 76.8 76.8H725.333333c-25.6 0-42.666667 17.066667-42.666666 42.666666s17.066667 42.666667 42.666666 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666666z m0-682.666667h-256c-25.6 0-42.666667 17.066667-42.666666 42.666667s17.066667 42.666667 42.666666 42.666666h153.6l-76.8 76.8-153.6 153.6c-17.066667 17.066667-17.066667 42.666667 0 59.733334 17.066667 17.066667 42.666667 17.066667 59.733334 0l153.6-153.6 76.8-76.8v153.6c0 25.6 17.066667 42.666667 42.666666 42.666666s42.666667-17.066667 42.666667-42.666666v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z"
fill="" p-id="3305"></path>
</svg>
<svg class="icon" v-else style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3952">
<path
d="M384 597.333333h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h153.6L17.066667 947.2c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733333 0L341.333333 742.4v153.6c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z m358.4 85.333334h153.6c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667V742.4l264.533333 264.533333c17.066667 17.066667 42.666667 17.066667 59.733333 0 17.066667-17.066667 17.066667-42.666667 0-59.733333L742.4 682.666667zM640 426.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667H742.4L1006.933333 76.8c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733333 0L682.666667 281.6V128c0-25.6-17.066667-42.666667-42.666667-42.666667s-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667z m-256-341.333334c-25.6 0-42.666667 17.066667-42.666667 42.666667v153.6L76.8 8.533333C59.733333 0 25.6 0 8.533333 8.533333 0 25.6 0 59.733333 8.533333 76.8L281.6 341.333333H128c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z"
p-id="3953"></path>
</svg>
</i> </i>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
props: { props: {
red: { red: {
@ -89,7 +120,9 @@ export default {
condCode: '', condCode: '',
} }
}, },
mounted(){ async mounted() {
window.headerApp = this
await this.initMe();
this.getWeather(); this.getWeather();
if (location.hash.indexOf("#/detail") >= 0) { this.nav = 2; } if (location.hash.indexOf("#/detail") >= 0) { this.nav = 2; }
else if (location.hash.indexOf("#/safety") >= 0) { this.nav = 3; } else if (location.hash.indexOf("#/safety") >= 0) { this.nav = 3; }
@ -102,8 +135,8 @@ export default {
this.setTitle(); this.setTitle();
this.timerID = setInterval(this.updateTime, 1000); this.timerID = setInterval(this.updateTime, 1000);
this.updateTime(); this.updateTime();
this.init() this.init();
this.$api.dept.list().then(d=>{ this.$api.dept.list(this.$store.getters.roleId).then(d => {
this.$root.hasInitHeader = true; this.$root.hasInitHeader = true;
this.depts = [{ text: '产发集团', id: 0 }, ...(d?.data || []).map(it => { this.depts = [{ text: '产发集团', id: 0 }, ...(d?.data || []).map(it => {
it.text = it.deptName; it.text = it.deptName;
@ -112,9 +145,34 @@ export default {
})] })]
this.deptChange(); this.deptChange();
}); });
}, },
methods: { methods: {
initMe(){
return new Promise(resolve=>{
let func=()=>{
if(!this.$store.getters.roles||this.$store.getters.roles.length==0){
setTimeout(func,400);
return;
}
resolve(true);
};
func();
});
},
doLogout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/';
})
}).catch(() => { });
},
getName() {
return this.$store?.getters?.nickName || '';
},
getWeather() { getWeather() {
let url = `https://widget-api.heweather.net/s6/plugin/view?key=fcd4fc1e48a144a483b7af74284229b8&location=CN101110101&lang=zh`; let url = `https://widget-api.heweather.net/s6/plugin/view?key=fcd4fc1e48a144a483b7af74284229b8&location=CN101110101&lang=zh`;
this.$api.http.get(url).then(d => { this.$api.http.get(url).then(d => {
@ -211,6 +269,7 @@ export default {
this.loadProject(); this.loadProject();
}, },
loadProject(init) { loadProject(init) {
this.$api.project.findProjectByDept(this.localStorage1.id).then(d => { this.$api.project.findProjectByDept(this.localStorage1.id).then(d => {
let objs = (d?.data || []).map(it => { let objs = (d?.data || []).map(it => {
it.text = it.projectName; it.text = it.projectName;
@ -263,8 +322,7 @@ export default {
}; };
</script> </script>
<style lang="less"> <style lang="less">.main-header {
.main-header{
.head-title-tab { .head-title-tab {
.has-submenu { .has-submenu {
&:hover { &:hover {
@ -272,8 +330,10 @@ export default {
display: block; display: block;
} }
} }
.header-btn-list { .header-btn-list {
display: none; display: none;
.header-btn-list-item { .header-btn-list-item {
.sub-btn { .sub-btn {
&.active { &.active {
@ -286,5 +346,4 @@ export default {
} }
} }
} }</style>
</style>

View File

@ -1,11 +1,14 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import store from './store'
import router from './router' import router from './router'
import './permission'
import './pages/init.js' import './pages/init.js'
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
router, router,
store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')

View File

@ -132,3 +132,16 @@
} }
} }
} }
.el-message-box{
background-color: rgba(1, 169, 255,0.5);
border: solid 1px rgba(1, 169, 255,1);
}
.el-message-box__title{
color: #000;
}
.el-message-box__btns{
text-align: center;
}
.el-message-box__content{
color: #fff;
}

57
src/permission.js 100644
View File

@ -0,0 +1,57 @@
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
const whiteList = []
router.beforeEach((to, from, next) => {
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
next();
}).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=#/index`) // 否则全部重定向到登录页
let base="/";
if(location.host.indexOf("localhost")>=0){
base="/jhapp/"
}
location.href=base+"#/login?redirect=/jhbs/#/";
NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done()
})

View File

@ -0,0 +1,13 @@
const getters = {
token: state => state.user.token,
avatar: state => state.user.avatar,
userId: state => state.user.userId,
name: state => state.user.name,
dept:state=>state.user.dept,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
nickName:state=>state.user.nickName,
roleId:state=>state.user.roleId,
permissions: state => state.user.permissions,
}
export default getters

17
src/store/index.js 100644
View File

@ -0,0 +1,17 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import getters from './getters'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
user
},
getters
})
export default store

View File

@ -0,0 +1,118 @@
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
state: {
token: getToken(),
userId:'',
name: '',
nickName:'',
roleId:0,
avatar: '',
dept:null,
roles: [],
permissions: []
},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_USER_ID: (state, id) => {
state.userId = id
},
SET_NAME: (state, name) => {
state.name = name
},
SET_NICKNAME: (state, nickName) => {
state.nickName = nickName
},
SET_ROLEID: (state, roleId) => {
state.roleId = roleId
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
SET_DEPT: (state, dept) => {
state.dept = dept
}
},
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise(async (resolve, reject) => {
let res=await getInfo()
const user = res.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.png") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_USER_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_NICKNAME', user.nickName)
commit('SET_ROLEID', res.roleId)
commit("SET_DEPT",user.dept);
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit("SET_DEPT",null);
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
},
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()
resolve()
})
}
}
}
export default user

View File

@ -51,7 +51,6 @@ service.interceptors.request.use(config => {
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交'; const message = '数据正在处理,请勿重复提交';
//console.warn(`[${s_url}]: ` + message+",",config,s_url)
console.warn("--->",s_data,requestObj.data,s_url) console.warn("--->",s_data,requestObj.data,s_url)
return Promise.reject(new Error(message)) return Promise.reject(new Error(message))
} else { } else {
@ -81,7 +80,7 @@ service.interceptors.response.use(res => {
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false; isRelogin.show = false;
if(location.href.indexOf("localhost")>=0){ if(location.href.indexOf("localhost")>=0){
//location.href = `/#/login?redirect=${encodeURIComponent("http://localhost:3000/jhbs/")}`; //location.href = `/#/login?redirect=${encodeURIComponent("/jhbs/")}`;
location.href=`http://localhost/#/login?redirect=${encodeURI('http://localhost:3000/jhbs/')}` location.href=`http://localhost/#/login?redirect=${encodeURI('http://localhost:3000/jhbs/')}`
}else{ }else{
location.href = `/#/login?redirect=${encodeURIComponent("/jhbs/")}`; location.href = `/#/login?redirect=${encodeURIComponent("/jhbs/")}`;

View File

@ -1,7 +1,7 @@
const { defineConfig } = require('@vue/cli-service') const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
publicPath :'./' , publicPath :'/jhbs' ,
productionSourceMap:false, productionSourceMap:false,
devServer: { devServer: {
host: '0.0.0.0', host: '0.0.0.0',
@ -15,6 +15,13 @@ module.exports = defineConfig({
'^/jhapi/profile':'/' '^/jhapi/profile':'/'
} }
}, },
'/jhapp':{
target: `http://62.234.3.186/`,
changeOrigin: true,
pathRewrite: {
'^/jhapp':'/'
}
},
'/cesium':{ '/cesium':{
target: `http://62.234.3.186/cesium/`, target: `http://62.234.3.186/cesium/`,
changeOrigin: true, changeOrigin: true,

View File

@ -4450,6 +4450,11 @@ npm-run-path@^4.0.1:
dependencies: dependencies:
path-key "^3.0.0" path-key "^3.0.0"
nprogress@0.2.0:
version "0.2.0"
resolved "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"
integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==
nth-check@^2.0.1: nth-check@^2.0.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz" resolved "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz"
@ -6001,6 +6006,11 @@ vue@^2.6.14:
"@vue/compiler-sfc" "2.7.14" "@vue/compiler-sfc" "2.7.14"
csstype "^3.1.0" csstype "^3.1.0"
vuex@3.6.0:
version "3.6.0"
resolved "https://registry.npmmirror.com/vuex/-/vuex-3.6.0.tgz#95efa56a58f7607c135b053350833a09e01aa813"
integrity sha512-W74OO2vCJPs9/YjNjW8lLbj+jzT24waTo2KShI8jLvJW8OaIkgb3wuAMA7D+ZiUxDOx3ubwSZTaJBip9G8a3aQ==
watchpack@^2.4.0: watchpack@^2.4.0:
version "2.4.0" version "2.4.0"
resolved "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.0.tgz" resolved "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.0.tgz"