扫码登入更新
This commit is contained in:
parent
745a9f35f2
commit
6be051f59e
|
@ -11,7 +11,7 @@ axios.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
let user = tools.data.get("user");
|
let user = tools.data.get("user");
|
||||||
if (user) {
|
if (user) {
|
||||||
config.headers["x-token"] = "Bearer " + user.token;
|
config.headers["x-token"] = user.token;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
|
@ -69,7 +69,7 @@ export default {
|
||||||
open (title, width = 400, grape) {
|
open (title, width = 400, grape) {
|
||||||
|
|
||||||
let user = tools.data.get("user");
|
let user = tools.data.get("user");
|
||||||
this.uploadHeader["x-token"] = `Bearer ${user.token}`
|
this.uploadHeader["x-token"] = `${user.token}`
|
||||||
console.log(user)
|
console.log(user)
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
|
|
@ -23,11 +23,8 @@
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<el-dropdown class="userCenter">
|
<el-dropdown class="userCenter">
|
||||||
<div class="el-dropdown-link">
|
<div class="el-dropdown-link">
|
||||||
<el-avatar
|
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" :size="24"></el-avatar>
|
||||||
src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
<span class="name">{{ nameInfo.name }}</span>
|
||||||
:size="24"
|
|
||||||
></el-avatar>
|
|
||||||
<span class="name">{{nameInfo.name}}</span>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<arrow-down />
|
<arrow-down />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
@ -35,42 +32,39 @@
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item icon="Connection" v-if="isbind" @click="zzdSubmt('n')">浙政钉解绑</el-dropdown-item>
|
||||||
icon="SwitchButton"
|
<el-dropdown-item icon="Connection" v-else @click="zzdSubmt('y')">浙政钉绑定</el-dropdown-item>
|
||||||
@click="handleUserMenu('logout')"
|
<el-dropdown-item icon="SwitchButton" @click="handleUserMenu('logout')">退出</el-dropdown-item>
|
||||||
>退出</el-dropdown-item
|
|
||||||
>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-space>
|
</el-space>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
|
||||||
|
<el-dialog v-model="dialogVisible" title="扫码绑定浙政钉" width="400px" destroy-on-close @close="handleClose">
|
||||||
|
<div style="display: flex; justify-content: center;">
|
||||||
|
<iframe :src="scanLogin.scanUrl" frameborder="0" height="300px" width="300px" />
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="dialogVisible = false">
|
||||||
|
返回
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside :class="['aside', isCollapse ? 'isCollapse' : '']">
|
<el-aside :class="['aside', isCollapse ? 'isCollapse' : '']">
|
||||||
<el-scrollbar
|
<el-scrollbar wrap-class="scrollbar_dropdown__wrap" style="height: calc(100vh - 60px)">
|
||||||
wrap-class="scrollbar_dropdown__wrap"
|
<el-menu :uniqueOpened="true" class="el-menu-vertical-demo" background-color="#285FBC" text-color="#fff"
|
||||||
style="height: calc(100vh - 60px)"
|
active-text-color="#ffffff" :collapse="isCollapse" :router="true" :default-active="route.path">
|
||||||
>
|
|
||||||
<el-menu
|
|
||||||
:uniqueOpened="true"
|
|
||||||
class="el-menu-vertical-demo"
|
|
||||||
background-color="#285FBC"
|
|
||||||
text-color="#fff"
|
|
||||||
active-text-color="#ffffff"
|
|
||||||
:collapse="isCollapse"
|
|
||||||
:router="true"
|
|
||||||
:default-active="route.path"
|
|
||||||
>
|
|
||||||
<template v-for="menu in user.menus" :key="menu.name">
|
<template v-for="menu in user.menus" :key="menu.name">
|
||||||
<menu-item :menu="menu" />
|
<menu-item :menu="menu" />
|
||||||
</template>
|
</template>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
|
||||||
<div
|
<div class="icon_switch" @click="isCollapse = !isCollapse">
|
||||||
class="icon_switch"
|
|
||||||
@click="isCollapse = !isCollapse"
|
|
||||||
>
|
|
||||||
<img src="../../assets/images/fold.png" alt="" v-if="isCollapse" />
|
<img src="../../assets/images/fold.png" alt="" v-if="isCollapse" />
|
||||||
<img src="../../assets/images/expand.png" alt="" v-else />
|
<img src="../../assets/images/expand.png" alt="" v-else />
|
||||||
</div>
|
</div>
|
||||||
|
@ -93,15 +87,8 @@
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="title" v-if="!isCollapse">{{ store.title }}</span>
|
<span class="title" v-if="!isCollapse">{{ store.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-menu
|
<el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect" text-color="#fff"
|
||||||
class="el-menu-demo"
|
active-text-color="#ffffff" :router="true" :default-active="route.path">
|
||||||
mode="horizontal"
|
|
||||||
@select="handleSelect"
|
|
||||||
text-color="#fff"
|
|
||||||
active-text-color="#ffffff"
|
|
||||||
:router="true"
|
|
||||||
:default-active="route.path"
|
|
||||||
>
|
|
||||||
<template v-for="menu in user.menus" :key="menu.name">
|
<template v-for="menu in user.menus" :key="menu.name">
|
||||||
<menu-item :menu="menu" />
|
<menu-item :menu="menu" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -118,10 +105,7 @@
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<el-dropdown class="userCenter">
|
<el-dropdown class="userCenter">
|
||||||
<div class="el-dropdown-link">
|
<div class="el-dropdown-link">
|
||||||
<el-avatar
|
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" :size="24"></el-avatar>
|
||||||
src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
|
||||||
:size="24"
|
|
||||||
></el-avatar>
|
|
||||||
<span class="name">admin</span>
|
<span class="name">admin</span>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<arrow-down />
|
<arrow-down />
|
||||||
|
@ -130,17 +114,12 @@
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item icon="Avatar" command="logout" @click="handleUserMenu('logout')">退出</el-dropdown-item>
|
||||||
icon="Avatar"
|
|
||||||
command="logout"
|
|
||||||
@click="handleUserMenu('logout')"
|
|
||||||
>退出</el-dropdown-item
|
|
||||||
>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-space></el-header
|
</el-space>
|
||||||
>
|
</el-header>
|
||||||
<div class="breadcrumb">
|
<div class="breadcrumb">
|
||||||
<breadcrumb />
|
<breadcrumb />
|
||||||
</div>
|
</div>
|
||||||
|
@ -155,11 +134,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from "vue";
|
import { ref, reactive, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { useCar } from "@/store";
|
import { useCar } from "@/store";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import emitter from "@/plugins/Bus";
|
import emitter from "@/plugins/Bus";
|
||||||
|
import http from "@/utils/request.js";
|
||||||
import tools from "@/utils/tools";
|
import tools from "@/utils/tools";
|
||||||
|
|
||||||
import menuItem from "./components/menu/menu-item.vue";
|
import menuItem from "./components/menu/menu-item.vue";
|
||||||
|
@ -170,11 +150,38 @@ console.log("user", user);
|
||||||
let nameInfo = ref(user);
|
let nameInfo = ref(user);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const isbind = ref(false)
|
||||||
let store = useCar();
|
let store = useCar();
|
||||||
|
const dialogVisible = ref(false)
|
||||||
const isCollapse = ref(false);
|
const isCollapse = ref(false);
|
||||||
|
|
||||||
|
const scanLogin = reactive({
|
||||||
|
scanShow: true,
|
||||||
|
environment: false,
|
||||||
|
redirect_uri: "http://demo35.ydool.net/",
|
||||||
|
zydd_client_id: "dss_dingoa",
|
||||||
|
zzd_client_id: "",
|
||||||
|
scanUrl: "",
|
||||||
|
code: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const loginListener = () => {
|
||||||
|
// console.log('进入message', event)
|
||||||
|
const code = event.data && event.data.code
|
||||||
|
if (code) {
|
||||||
|
// 根据 code 去获取用户信息
|
||||||
|
http.put(`/api/upms/admin/dg/binding?code=${code}`,).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
dialogVisible.value = false;
|
||||||
|
tools.data.set("isbind", true)
|
||||||
|
isbind.value = tools.data.get("isbind");
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(code)
|
||||||
|
}
|
||||||
|
}
|
||||||
//全屏
|
//全屏
|
||||||
const flag = ref(false);
|
const flag = ref(false);
|
||||||
const screen = () => {
|
const screen = () => {
|
||||||
|
@ -202,10 +209,45 @@ const data = reactive({
|
||||||
visibled: false,
|
visibled: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const zzdSubmt = (val) => {
|
||||||
|
if (val === 'n') {
|
||||||
|
ElMessageBox.confirm("确定要解绑浙政钉吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
http.put(`/api/upms/admin/dg/unbind`).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
ElMessage.success('解绑成功')
|
||||||
|
tools.data.set("isbind", false)
|
||||||
|
isbind.value = tools.data.get("isbind");
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ElMessageBox.confirm("确定要绑定浙政钉吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
scanLogin.scanUrl = `https://login.dg-work.cn/oauth2/auth.htm?response_type=code&client_id=${scanLogin.zydd_client_id}&redirect_uri=${scanLogin.redirect_uri}&scope=get_user_info&authType=QRCODE&embedMode=true`;
|
||||||
|
window.addEventListener("message", loginListener);
|
||||||
|
dialogVisible.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
emitter.on("closeModifyPassword", (e) => {
|
emitter.on("closeModifyPassword", (e) => {
|
||||||
data.dialog.visibled = false;
|
data.dialog.visibled = false;
|
||||||
});
|
});
|
||||||
|
onMounted(() => {
|
||||||
|
isbind.value = tools.data.get("isbind");
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
window.removeEventListener('message', loginListener)
|
||||||
|
}
|
||||||
|
|
||||||
const handleUserMenu = (command) => {
|
const handleUserMenu = (command) => {
|
||||||
console.log("command");
|
console.log("command");
|
||||||
|
@ -229,10 +271,12 @@ const handleUserMenu = (command) => {
|
||||||
width: 220px;
|
width: 220px;
|
||||||
background-color: #285fbc;
|
background-color: #285fbc;
|
||||||
transition: all 0.4s;
|
transition: all 0.4s;
|
||||||
|
|
||||||
&.isCollapse {
|
&.isCollapse {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.NavMenu_title {
|
.NavMenu_title {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
|
@ -241,6 +285,7 @@ const handleUserMenu = (command) => {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
@ -248,6 +293,7 @@ const handleUserMenu = (command) => {
|
||||||
color: #3d454d;
|
color: #3d454d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-container {
|
.el-container {
|
||||||
.el-header {
|
.el-header {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
@ -255,6 +301,7 @@ const handleUserMenu = (command) => {
|
||||||
0px 4px 10px 0px rgba(78, 89, 105, 0.06);
|
0px 4px 10px 0px rgba(78, 89, 105, 0.06);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.yd_header_top {
|
.yd_header_top {
|
||||||
.el-popper.is-pure {
|
.el-popper.is-pure {
|
||||||
background-color: #3a84ff !important;
|
background-color: #3a84ff !important;
|
||||||
|
@ -265,6 +312,7 @@ const handleUserMenu = (command) => {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
height: 48px;
|
height: 48px;
|
||||||
line-height: 48px;
|
line-height: 48px;
|
||||||
|
@ -275,27 +323,33 @@ const handleUserMenu = (command) => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 1px solid #f0f0f0;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
color: #3a84ff;
|
color: #3a84ff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userCenter {
|
.userCenter {
|
||||||
outline: none;
|
outline: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yd_header {
|
.yd_header {
|
||||||
.el-space__item:last-child {
|
.el-space__item:last-child {
|
||||||
margin-right: 0 !important;
|
margin-right: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
.name {
|
.name {
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
|
@ -310,25 +364,30 @@ const handleUserMenu = (command) => {
|
||||||
background-color: #3a84ff !important;
|
background-color: #3a84ff !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
|
||||||
.yd_header_top_left {
|
.yd_header_top_left {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
.yd_header_top_title {
|
.yd_header_top_title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 220px;
|
width: 220px;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
|
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
|
||||||
background-color: #096dd9;
|
background-color: #096dd9;
|
||||||
}
|
}
|
||||||
.el-menu--horizontal > .el-sub-menu .el-sub-menu__title:hover {
|
|
||||||
|
.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover {
|
||||||
background-color: #096dd9;
|
background-color: #096dd9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,11 +396,13 @@ const handleUserMenu = (command) => {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--horizontal .el-menu .el-menu-item.is-active,
|
.el-menu--horizontal .el-menu .el-menu-item.is-active,
|
||||||
.el-menu--horizontal .el-menu .el-sub-menu.is-active > .el-sub-menu__title {
|
.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title {
|
||||||
color: #3a84ff !important;
|
color: #3a84ff !important;
|
||||||
background-color: #e6f7ff !important;
|
background-color: #e6f7ff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--horizontal .el-menu .el-menu-item,
|
.el-menu--horizontal .el-menu .el-menu-item,
|
||||||
.el-menu--horizontal .el-menu .el-sub-menu__title {
|
.el-menu--horizontal .el-menu .el-sub-menu__title {
|
||||||
color: #595959 !important;
|
color: #595959 !important;
|
||||||
|
@ -367,12 +428,13 @@ const handleUserMenu = (command) => {
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 40px;
|
bottom: 40px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-popper.is-light{
|
.el-popper.is-light {
|
||||||
background-color: #285fbc;
|
background-color: #285fbc;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -381,5 +443,4 @@ const handleUserMenu = (command) => {
|
||||||
.el-menu-item.is-active {
|
.el-menu-item.is-active {
|
||||||
background-color: #3a84ff !important;
|
background-color: #3a84ff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
File diff suppressed because one or more lines are too long
|
@ -29,14 +29,15 @@ export default defineConfig({
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
// target: 'http://10.0.0.29:9999',
|
// target: 'http://10.0.0.29:9999',
|
||||||
target: 'http://demo35.ydool.net/',
|
// target: 'http://demo35.ydool.net/',
|
||||||
|
target: 'http://192.168.1.14:7777',
|
||||||
// target: 'http://10.0.0.63:7777', // 刘进
|
// target: 'http://10.0.0.63:7777', // 刘进
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
// rewrite: (path) => path.replace(/^\/api/, '')
|
// rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
// ws: true,// 开启webSocket
|
// ws: true,// 开启webSocket
|
||||||
},
|
},
|
||||||
'/metadata': {
|
'/metadata': {
|
||||||
target: 'http://122.112.237.44',
|
target: 'http://192.168.1.14:7777',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
// ws: true,// 开启webSocket
|
// ws: true,// 开启webSocket
|
||||||
|
|
Loading…
Reference in New Issue