Commit 3c68eb62 authored by 姬鋆屾's avatar 姬鋆屾

tui

parent bff937dd
...@@ -14,3 +14,4 @@ VUE_APP_PORTAL_PORT = 21085 ...@@ -14,3 +14,4 @@ VUE_APP_PORTAL_PORT = 21085
# 站点请求地址 # 站点请求地址
VUE_APP_SITETREE_URL = http://8.136.255.30:11078/base/site/siteTree VUE_APP_SITETREE_URL = http://8.136.255.30:11078/base/site/siteTree
VUE_APP_API_appName = '智慧办公管理平台'
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title>智慧办公平台</title> <title><%= VUE_APP_API_appName %></title>
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css"> <link
rel="stylesheet"
href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css"
/>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong
>We're sorry but app doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong
>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
......
...@@ -6,25 +6,37 @@ ...@@ -6,25 +6,37 @@
<div class="layout-menu flex flex-1"> <div class="layout-menu flex flex-1">
<!-- logo --> <!-- logo -->
<div class="layout-logo flex"> <div class="layout-logo flex">
<i class="el-icon-menu" @click='showMobileMenu=!showMobileMenu'> </i> <i class="el-icon-menu" @click="showMobileMenu = !showMobileMenu">
</i>
<router-link to="/"> <router-link to="/">
<img src="../assets/images/logo.png" style="margin-bottom:5px" height="40" alt=""> <img
<b style="color:white;font-size:18px;">&nbsp;&nbsp;&nbsp; 智慧办公系统 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b> :src="sysLogo ? sysLogo : require('../assets/images/logo.png')"
style="margin-bottom:5px"
height="40"
alt=""
/>
<b style="color:white;font-size:18px;"
>&nbsp;&nbsp;&nbsp;
{{ sysName ? sysName : "智慧办公系统" }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b
>
</router-link> </router-link>
</div> </div>
<!-- 一级菜单 --> <!-- 一级菜单 -->
<ul class="menu-list flex"> <ul class="menu-list flex">
<li v-for='item in menu' :key='item.id'> <li v-for="item in menu" :key="item.id">
<router-link :to="item.path" :active='submenu.path === item.path' :title="item.name"> <router-link
<i :class="'el-icon-'+item.icon"></i> :to="item.path"
{{item.name}} :active="submenu.path === item.path"
:title="item.name"
>
<i :class="'el-icon-' + item.icon"></i>
{{ item.name }}
</router-link> </router-link>
</li> </li>
</ul> </ul>
</div> </div>
<div class="layout-profile"> <div class="layout-profile">
<!-- <span class="el-dropdown-link"> <!-- <span class="el-dropdown-link">
{{userData.currUserName}} {{userData.currUserName}}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
...@@ -32,7 +44,7 @@ ...@@ -32,7 +44,7 @@
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color:white"> <span class="el-dropdown-link" style="color:white">
{{userData.currUserName}} {{ userData.currUserName }}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
...@@ -44,23 +56,33 @@ ...@@ -44,23 +56,33 @@
</div> </div>
<!-- 一级菜单 --> <!-- 一级菜单 -->
<ul class="mobile-menu-list flex flex-pack-justify" v-if='showMobileMenu'> <ul class="mobile-menu-list flex flex-pack-justify" v-if="showMobileMenu">
<li v-for='item in menu' :key='item.id'> <li v-for="item in menu" :key="item.id">
<router-link :to="item.path" :active='submenu.path === item.path' :title="item.name"> <router-link
<i :class="'el-icon-'+item.icon"></i> :to="item.path"
{{item.name}} :active="submenu.path === item.path"
:title="item.name"
>
<i :class="'el-icon-' + item.icon"></i>
{{ item.name }}
</router-link> </router-link>
</li> </li>
</ul> </ul>
<!-- 二级菜单 --> <!-- 二级菜单 -->
<div class="layout-submenu-wrapper flex" v-if='submenu.children && submenu.children.length'> <div
class="layout-submenu-wrapper flex"
v-if="submenu.children && submenu.children.length"
>
<div class="layout-submenu"> <div class="layout-submenu">
<ul class="submenu-list flex"> <ul class="submenu-list flex">
<li v-for='item in submenu.children' :key='item.id'> <li v-for="item in submenu.children" :key="item.id">
<a :href="item.path" target="blank" v-if="item.isOut">{{
<a :href="item.path" target="blank" v-if='item.isOut'>{{item.name}}</a> item.name
<router-link :to="item.path" :active='group === item.path' v-else>{{item.name}}</router-link> }}</a>
<router-link :to="item.path" :active="group === item.path" v-else>{{
item.name
}}</router-link>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -73,161 +95,182 @@ export default { ...@@ -73,161 +95,182 @@ export default {
name: "Header", name: "Header",
methods: { methods: {
handleCommand(key) { handleCommand(key) {
if(key === 'update'){ if (key === "update") {
this.$router.push('/login/updatePwd') this.$router.push("/login/updatePwd");
} }
if(key === 'logout'){ if (key === "logout") {
this.logout() this.logout();
} }
}, },
// 退出登录 // 退出登录
logout() { logout() {
this.$post('/login/logout').then(data=>{}).catch(error=>{}).then(()=>{ this.$post("/login/logout")
this.$message.success('已退出登录'); .then((data) => {})
this.$store.commit('logout'); .catch((error) => {})
this.$router.replace('/login'); .then(() => {
}) this.$message.success("已退出登录");
} this.$store.commit("logout");
this.$router.replace("/login");
});
},
}, },
beforeDestroy() { beforeDestroy() {
console.log("beforeDestroy"); console.log("beforeDestroy");
//window.removeEventListener("message", this.getsocketData, false); //window.removeEventListener("message", this.getsocketData, false);
}, },
mounted() { created() {},
},
computed: { computed: {
group() { group() {
const relativeGroup = this.$store.state.group; const relativeGroup = this.$store.state.group;
if(relativeGroup) { if (relativeGroup) {
return relativeGroup; return relativeGroup;
} }
let groupArray = this.$route.path.split('/'); let groupArray = this.$route.path.split("/");
let group = this.$route.path; let group = this.$route.path;
let type = groupArray.pop(); let type = groupArray.pop();
if(['add', 'edit', 'view', 'new','importView','resetPwdView'].indexOf(type) > -1){ if (
groupArray.push('list'); ["add", "edit", "view", "new", "importView", "resetPwdView"].indexOf(
group = groupArray.join('/') type
) > -1
) {
groupArray.push("list");
group = groupArray.join("/");
} }
return group; return group;
}, },
relativeGroup() { relativeGroup() {
return this.$store.state.group return this.$store.state.group;
}, },
flat() { flat() {
return this.userData.flat return this.userData.flat;
}, },
menu() { menu() {
console.log("userData",this.userData) console.log("userData", this.userData);
if(!this.userData.barList) return []; if (!this.userData.barList) return [];
return this.userData.barList.map(item=>{ return this.userData.barList.map((item) => {
const url = item.url ? item.url : (item.childList[0] ? (item.childList[0].url || '') : ''); const url = item.url
? item.url
: item.childList[0]
? item.childList[0].url || ""
: "";
return { return {
name: item.name, name: item.name,
path: url, path: url,
id: item.id, id: item.id,
icon: item.imgPath, icon: item.imgPath,
children: item.childList.map(sub=>{ children: item.childList.map((sub) => {
return { return {
name: sub.name, name: sub.name,
path: sub.url ? sub.url : (sub.childList[0] ? (sub.childList[0].url || 0) : ''), path: sub.url
? sub.url
: sub.childList[0]
? sub.childList[0].url || 0
: "",
id: sub.id, id: sub.id,
parentId: sub.parentId, parentId: sub.parentId,
icon: sub.imgPath, icon: sub.imgPath,
isOut: /^https?\:\/\//.test(sub.url) isOut: /^https?\:\/\//.test(sub.url),
} };
}) }),
} };
}) });
}, },
submenu() { submenu() {
if(!this.menu.length) return {}; if (!this.menu.length) return {};
let matchMenu = {}; let matchMenu = {};
this.menu.forEach(item=>{ this.menu.forEach((item) => {
const menu = item; const menu = item;
item.children.forEach(item=>{ item.children.forEach((item) => {
if(item.path === this.group) { if (item.path === this.group) {
matchMenu = menu; matchMenu = menu;
return; return;
} }
}) });
}) });
return matchMenu return matchMenu;
}, },
userData() { userData() {
return this.$store.state.userData; return this.$store.state.userData;
} },
}, },
data() { data() {
return { return {
showMobileMenu: false, showMobileMenu: false,
} sysName: localStorage.getItem("sysName")
} ? localStorage.getItem("sysName")
} : "",
sysLogo: localStorage.getItem("sysLogo")
? localStorage.getItem("sysLogo")
: "",
};
},
};
</script> </script>
<style lang="less"> <style lang="less">
.layout-header{ .layout-header {
.mobile-menu-list{display: none} .mobile-menu-list {
.layout-menu-wrapper{ display: none;
}
.layout-menu-wrapper {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
font-size: 14px; font-size: 14px;
color: #eee; color: #eee;
background: #1848c8; background: #1848c8;
.layout-logo{ .layout-logo {
height: 50px; height: 50px;
.el-icon-menu{display: none} .el-icon-menu {
a{ display: none;
}
a {
margin: auto; margin: auto;
} }
img{ img {
vertical-align: middle; vertical-align: middle;
} }
} }
.menu-list{ .menu-list {
li{ li {
a{ a {
display: block; display: block;
padding: 0 12px; padding: 0 12px;
height: 100%; height: 100%;
color: #eee; color: #eee;
&.router-link-active, &.router-link-active,
&[active]{ &[active] {
//background: #1890ff; //background: #1890ff;
color: #fff; color: #fff;
list-style-type:none; list-style-type: none;
border-bottom:3px solid #fff; border-bottom: 3px solid #fff;
padding-bottom: 2px; padding-bottom: 2px;
} }
} }
} }
} }
.layout-profile{ .layout-profile {
padding-right: 30px; padding-right: 30px;
} }
} }
.layout-submenu-wrapper{ .layout-submenu-wrapper {
padding-left: 20px; padding-left: 20px;
background: #fff; background: #fff;
height: 42px; height: 42px;
border-bottom: 1px solid #ededed; border-bottom: 1px solid #ededed;
.layout-title{ .layout-title {
font-size: 18px; font-size: 18px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
color: #333; color: #333;
} }
.layout-submenu{ .layout-submenu {
margin-left: 15px; margin-left: 15px;
white-space: nowrap; white-space: nowrap;
overflow: auto; overflow: auto;
li{ li {
a{ a {
display: block; display: block;
padding: 0 10px; padding: 0 10px;
height: 40px; height: 40px;
...@@ -235,7 +278,7 @@ export default { ...@@ -235,7 +278,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
&.router-link-active, &.router-link-active,
&[active]{ &[active] {
color: #1890ff; color: #1890ff;
border-bottom: 2px solid #1890ff; border-bottom: 2px solid #1890ff;
} }
...@@ -245,48 +288,48 @@ export default { ...@@ -245,48 +288,48 @@ export default {
} }
} }
@media screen and (max-width: 800px){ @media screen and (max-width: 800px) {
.layout-header { .layout-header {
.mobile-menu-list{ .mobile-menu-list {
display: flex; display: flex;
background: #222333; background: #222333;
padding: 0 10px; padding: 0 10px;
li{ li {
padding: 8px 5px; padding: 8px 5px;
a{ a {
width: 1em; width: 1em;
display: block; display: block;
color: #eee; color: #eee;
font-size: 14px; font-size: 14px;
word-break: break-all; word-break: break-all;
&.router-link-active, &.router-link-active,
&[active]{ &[active] {
color: #1890ff; color: #1890ff;
} }
} }
} }
} }
.layout-submenu-wrapper{ .layout-submenu-wrapper {
padding-left: 0; padding-left: 0;
overflow: auto; overflow: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
.layout-menu-wrapper { .layout-menu-wrapper {
width: 100%; width: 100%;
.layout-logo{ .layout-logo {
width: 40px; width: 40px;
.el-icon-menu{ .el-icon-menu {
margin: auto; margin: auto;
display: inline-block; display: inline-block;
} }
a{ a {
display: none; display: none;
} }
} }
.menu-list{ .menu-list {
display: none; display: none;
} }
li{ li {
width: 100%; width: 100%;
} }
} }
......
...@@ -7,23 +7,34 @@ ...@@ -7,23 +7,34 @@
<script> <script>
export default { export default {
mounted() { mounted() {
let token = this.$route.query.token let token = this.$route.query.token;
console.log("token:"+token) if (token) {
if(token ) { this.$route.query.sysName
? localStorage.setItem("sysName", this.$route.query.sysName)
: "";
this.$route.query.sysLogo
? localStorage.setItem("sysLogo", this.$route.query.sysLogo)
: "";
process.env.VUE_APP_API_appName = this.$route.query.sysName
? this.$route.query.sysName
: process.env.VUE_APP_API_appName;
window.sessionStorage.setItem("token", token); window.sessionStorage.setItem("token", token);
this.$router.push('/index') // 有token直接跳转首页 this.$router.push("/index"); // 有token直接跳转首页
}else{ } else {
this.$message({ this.$message({
message: '没有权限,正在跳转登录页面...', message: "没有权限,正在跳转登录页面...",
center: true center: true,
}); });
setTimeout(function(){ setTimeout(function() {
window.location.href=process.env.VUE_APP_PORTAL_URL=='undefined'?'http://192.168.0.98:11072':process.env.VUE_APP_PORTAL_URL window.location.href =
process.env.VUE_APP_PORTAL_URL == "undefined"
? "http://192.168.0.98:11072"
: process.env.VUE_APP_PORTAL_URL;
//this.$router.push('/login') //this.$router.push('/login')
},1000) }, 1000);
} }
} },
} };
</script> </script>
<style> <style>
......
...@@ -3,32 +3,40 @@ ...@@ -3,32 +3,40 @@
<template> <template>
<div class="page page-login flex flex-v"> <div class="page page-login flex flex-v">
<div class="form-wrap flex flex-1"> <div class="form-wrap flex flex-1">
<el-form @submit.prevent='onSubmit' ref="form" :model="form" label-width="80px" size="small"> <el-form
<h1>智慧办公管理平台</h1> @submit.prevent="onSubmit"
ref="form"
:model="form"
label-width="80px"
size="small"
>
<h1>{{ sysName }}</h1>
<el-form-item label="用户名"> <el-form-item label="用户名">
<el-input v-model="form.loginName"></el-input> <el-input v-model="form.loginName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="form.password" type='password'></el-input> <el-input v-model="form.password" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="large"> <el-form-item size="large">
<el-button type="primary" native-type='submit' :loading='loading' @click='onSubmit'>登录</el-button> <el-button
type="primary"
native-type="submit"
:loading="loading"
@click="onSubmit"
>登录</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="footer"> <div class="footer"></div>
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "login", name: "login",
created() { created() {},
},
methods: { methods: {
login() { login() {
this.loading = true; this.loading = true;
...@@ -38,7 +46,7 @@ export default { ...@@ -38,7 +46,7 @@ export default {
}, },
loginSuccess({ data }) { loginSuccess({ data }) {
this.$store.commit("setUserData", data); this.$store.commit("setUserData", data);
console.log("userData",this.$store.state.userData) console.log("userData", this.$store.state.userData);
this.$router.replace({ this.$router.replace({
path: this.redirect, path: this.redirect,
}); });
...@@ -72,6 +80,7 @@ export default { ...@@ -72,6 +80,7 @@ export default {
loginName: "", loginName: "",
password: "", password: "",
}, },
sysName: process.env.VUE_APP_API_appName,
}; };
}, },
}; };
...@@ -120,4 +129,3 @@ export default { ...@@ -120,4 +129,3 @@ export default {
} }
} }
</style> </style>
module.exports = { module.exports = {
productionSourceMap: false, productionSourceMap: false,
assetsDir: 's', assetsDir: "s",
configureWebpack: { configureWebpack: {
externals: { externals: {
vue: "Vue", vue: "Vue",
vuex: "Vuex", vuex: "Vuex",
"vue-router": "VueRouter", "vue-router": "VueRouter",
"element-ui": "ELEMENT" "element-ui": "ELEMENT",
}, },
}, },
lintOnSave:false, lintOnSave: false,
devServer: { devServer: {
inline: true, inline: true,
disableHostCheck: true, disableHostCheck: true,
port: 8085, port: 8085,
hot: true,//自动保存 hot: true, //自动保存
proxy: { proxy: {
'/office': { "/office": {
target: 'http://8.136.255.30:11078', target: "http://192.168.0.98:11072",
// target: 'http://8.136.255.30:11078',
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
cookieDomainRewrite: 'localhost', cookieDomainRewrite: "localhost",
} },
} },
} },
} };
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