Compare commits
2 Commits
7c2cc4a7f1
...
a0361b2eba
Author | SHA1 | Date |
---|---|---|
wuhongjian | a0361b2eba | |
wuhongjian | c2b323b14c |
|
@ -100,25 +100,25 @@
|
|||
</nav>
|
||||
</template>
|
||||
<script>
|
||||
import { messages } from "@/i18n";
|
||||
import screenfull from "screenfull";
|
||||
import UpdatePassword from "./main-navbar-update-password";
|
||||
import { clearLoginInfo } from "@/utils";
|
||||
import { messages } from '@/i18n'
|
||||
import screenfull from 'screenfull'
|
||||
import UpdatePassword from './main-navbar-update-password'
|
||||
import { clearLoginInfo } from '@/utils'
|
||||
// import Cookies from 'js-cookie'
|
||||
// var socket = null
|
||||
export default {
|
||||
inject: ["refresh"],
|
||||
data() {
|
||||
inject: ['refresh'],
|
||||
data () {
|
||||
return {
|
||||
i18nMessages: messages,
|
||||
updatePasswordVisible: false,
|
||||
messageTip: false,
|
||||
};
|
||||
messageTip: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
UpdatePassword,
|
||||
UpdatePassword
|
||||
},
|
||||
created() {
|
||||
created () {
|
||||
// var vue = this
|
||||
// socket = new WebSocket(`${window.SITE_CONFIG['socketURL']}?token=${Cookies.get('token')}`)
|
||||
// socket.onopen = function () {}
|
||||
|
@ -144,70 +144,70 @@ export default {
|
|||
// }
|
||||
|
||||
// 未读通知数
|
||||
this.getUnReadCount();
|
||||
this.getUnReadCount()
|
||||
},
|
||||
methods: {
|
||||
myNoticeRouter() {
|
||||
this.$router.replace("notice-notice-user");
|
||||
myNoticeRouter () {
|
||||
this.$router.replace('notice-notice-user')
|
||||
},
|
||||
getUnReadCount() {
|
||||
getUnReadCount () {
|
||||
this.$http
|
||||
.get("/sys/notice/mynotice/unread")
|
||||
.get('/sys/notice/mynotice/unread')
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
if (res.data > 0) {
|
||||
this.messageTip = true;
|
||||
this.messageTip = true
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {})
|
||||
},
|
||||
// 全屏
|
||||
fullscreenHandle() {
|
||||
fullscreenHandle () {
|
||||
if (!screenfull.enabled) {
|
||||
return this.$message({
|
||||
message: this.$t("fullscreen.prompt"),
|
||||
type: "warning",
|
||||
duration: 500,
|
||||
});
|
||||
message: this.$t('fullscreen.prompt'),
|
||||
type: 'warning',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
screenfull.toggle();
|
||||
screenfull.toggle()
|
||||
},
|
||||
// 修改密码
|
||||
updatePasswordHandle() {
|
||||
this.updatePasswordVisible = true;
|
||||
updatePasswordHandle () {
|
||||
this.updatePasswordVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.updatePassword.init();
|
||||
});
|
||||
this.$refs.updatePassword.init()
|
||||
})
|
||||
},
|
||||
// 退出
|
||||
logoutHandle() {
|
||||
logoutHandle () {
|
||||
this.$confirm(
|
||||
this.$t("prompt.info", { handle: this.$t("logout") }),
|
||||
this.$t("prompt.title"),
|
||||
this.$t('prompt.info', { handle: this.$t('logout') }),
|
||||
this.$t('prompt.title'),
|
||||
{
|
||||
confirmButtonText: this.$t("confirm"),
|
||||
cancelButtonText: this.$t("cancel"),
|
||||
type: "warning",
|
||||
confirmButtonText: this.$t('confirm'),
|
||||
cancelButtonText: this.$t('cancel'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.$http
|
||||
.post("/logout")
|
||||
.post('/logout')
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
clearLoginInfo();
|
||||
this.$router.push({ name: "login" });
|
||||
clearLoginInfo()
|
||||
this.$router.push({ name: 'login' })
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {})
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@font-face {
|
||||
|
|
|
@ -16,122 +16,122 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MainNavbar from "./main-navbar";
|
||||
import MainSidebar from "./main-sidebar";
|
||||
import MainContent from "./main-content";
|
||||
import MainThemeTools from "./main-theme-tools";
|
||||
import debounce from "lodash/debounce";
|
||||
import { isURL } from "@/utils/validate";
|
||||
import MainNavbar from './main-navbar'
|
||||
import MainSidebar from './main-sidebar'
|
||||
import MainContent from './main-content'
|
||||
import MainThemeTools from './main-theme-tools'
|
||||
import debounce from 'lodash/debounce'
|
||||
import { isURL } from '@/utils/validate'
|
||||
export default {
|
||||
provide() {
|
||||
provide () {
|
||||
return {
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.$store.state.contentIsNeedRefresh = true;
|
||||
refresh () {
|
||||
this.$store.state.contentIsNeedRefresh = true
|
||||
this.$nextTick(() => {
|
||||
this.$store.state.contentIsNeedRefresh = false;
|
||||
});
|
||||
},
|
||||
};
|
||||
this.$store.state.contentIsNeedRefresh = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
data () {
|
||||
return {
|
||||
loading: true,
|
||||
};
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MainNavbar,
|
||||
MainSidebar,
|
||||
MainContent,
|
||||
MainThemeTools,
|
||||
MainThemeTools
|
||||
},
|
||||
watch: {
|
||||
$route: "routeHandle",
|
||||
$route: 'routeHandle'
|
||||
},
|
||||
created() {
|
||||
this.windowResizeHandle();
|
||||
this.routeHandle(this.$route);
|
||||
created () {
|
||||
this.windowResizeHandle()
|
||||
this.routeHandle(this.$route)
|
||||
Promise.all([this.getUserInfo(), this.getPermissions()]).then(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 窗口改变大小
|
||||
windowResizeHandle() {
|
||||
windowResizeHandle () {
|
||||
this.$store.state.sidebarFold =
|
||||
document.documentElement["clientWidth"] <= 992 || false;
|
||||
document.documentElement.clientWidth <= 992 || false
|
||||
window.addEventListener(
|
||||
"resize",
|
||||
'resize',
|
||||
debounce(() => {
|
||||
this.$store.state.sidebarFold =
|
||||
document.documentElement["clientWidth"] <= 992 || false;
|
||||
document.documentElement.clientWidth <= 992 || false
|
||||
}, 150)
|
||||
);
|
||||
)
|
||||
},
|
||||
// 路由, 监听
|
||||
routeHandle(route) {
|
||||
routeHandle (route) {
|
||||
if (!route.meta.isTab) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
let tab = {};
|
||||
let routeName = route.name;
|
||||
let routeMeta = route.meta;
|
||||
if (route.name === "iframe") {
|
||||
let url = route.query.url || "";
|
||||
let tab = {}
|
||||
let routeName = route.name
|
||||
const routeMeta = route.meta
|
||||
if (route.name === 'iframe') {
|
||||
const url = route.query.url || ''
|
||||
if (!isURL(url)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
let key = route.query.key || new Date().getTime();
|
||||
routeName = `${routeName}_${key}`;
|
||||
routeMeta.title = key.toString();
|
||||
routeMeta.menuId = route.query.menuId || "";
|
||||
routeMeta.iframeURL = url;
|
||||
const key = route.query.key || new Date().getTime()
|
||||
routeName = `${routeName}_${key}`
|
||||
routeMeta.title = key.toString()
|
||||
routeMeta.menuId = route.query.menuId || ''
|
||||
routeMeta.iframeURL = url
|
||||
}
|
||||
tab = this.$store.state.contentTabs.filter(
|
||||
(item) => item.name === routeName
|
||||
)[0];
|
||||
)[0]
|
||||
if (!tab) {
|
||||
tab = {
|
||||
...window.SITE_CONFIG["contentTabDefault"],
|
||||
...window.SITE_CONFIG.contentTabDefault,
|
||||
...routeMeta,
|
||||
name: routeName,
|
||||
params: { ...route.params },
|
||||
query: { ...route.query },
|
||||
};
|
||||
query: { ...route.query }
|
||||
}
|
||||
this.$store.state.contentTabs =
|
||||
this.$store.state.contentTabs.concat(tab);
|
||||
this.$store.state.contentTabs.concat(tab)
|
||||
}
|
||||
this.$store.state.sidebarMenuActiveName = tab.menuId;
|
||||
this.$store.state.contentTabsActiveName = tab.name;
|
||||
this.$store.state.sidebarMenuActiveName = tab.menuId
|
||||
this.$store.state.contentTabsActiveName = tab.name
|
||||
},
|
||||
// 获取当前管理员信息
|
||||
getUserInfo() {
|
||||
getUserInfo () {
|
||||
return this.$http
|
||||
.get("/sys/user/info")
|
||||
.get('/sys/user/info')
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.$store.state.user.id = res.data.id;
|
||||
this.$store.state.user.name = res.data.username;
|
||||
this.$store.state.user.superAdmin = res.data.superAdmin;
|
||||
this.$store.state.user.id = res.data.id
|
||||
this.$store.state.user.name = res.data.realName
|
||||
this.$store.state.user.superAdmin = res.data.superAdmin
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {})
|
||||
},
|
||||
// 获取权限
|
||||
getPermissions() {
|
||||
getPermissions () {
|
||||
return this.$http
|
||||
.get("/sys/menu/permissions")
|
||||
.get('/sys/menu/permissions')
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
window.SITE_CONFIG["permissions"] = res.data;
|
||||
window.SITE_CONFIG.permissions = res.data
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.aui-content__wrapper {
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
import { mynotice } from '@/api/home'
|
||||
import { useStore } from 'vuex'
|
||||
import { getSgcTotal } from '@/api/home'
|
||||
import Cookies from 'js-cookie'
|
||||
import mybus from '@/myplugins/mybus'
|
||||
const store = useStore()
|
||||
const router = useRouter()
|
||||
|
@ -222,6 +223,7 @@
|
|||
})
|
||||
break
|
||||
case '后台管理':
|
||||
Cookies.remove('JESSIONID')
|
||||
window.open(window.SITE_CONFIG.backUrl + '/#/workBench-workBench')
|
||||
// window.reload('http://15.2.21.238:9797')
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue