扫码登入更新
This commit is contained in:
parent
745a9f35f2
commit
6be051f59e
|
@ -11,7 +11,7 @@ axios.interceptors.request.use(
|
|||
(config) => {
|
||||
let user = tools.data.get("user");
|
||||
if (user) {
|
||||
config.headers["x-token"] = "Bearer " + user.token;
|
||||
config.headers["x-token"] = user.token;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
|
|
|
@ -69,7 +69,7 @@ export default {
|
|||
open (title, width = 400, grape) {
|
||||
|
||||
let user = tools.data.get("user");
|
||||
this.uploadHeader["x-token"] = `Bearer ${user.token}`
|
||||
this.uploadHeader["x-token"] = `${user.token}`
|
||||
console.log(user)
|
||||
this.title = title;
|
||||
this.width = width;
|
||||
|
|
|
@ -23,11 +23,8 @@
|
|||
</el-badge>
|
||||
<el-dropdown class="userCenter">
|
||||
<div class="el-dropdown-link">
|
||||
<el-avatar
|
||||
src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
||||
:size="24"
|
||||
></el-avatar>
|
||||
<span class="name">{{nameInfo.name}}</span>
|
||||
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" :size="24"></el-avatar>
|
||||
<span class="name">{{ nameInfo.name }}</span>
|
||||
<el-icon>
|
||||
<arrow-down />
|
||||
</el-icon>
|
||||
|
@ -35,42 +32,39 @@
|
|||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
icon="SwitchButton"
|
||||
@click="handleUserMenu('logout')"
|
||||
>退出</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item icon="Connection" v-if="isbind" @click="zzdSubmt('n')">浙政钉解绑</el-dropdown-item>
|
||||
<el-dropdown-item icon="Connection" v-else @click="zzdSubmt('y')">浙政钉绑定</el-dropdown-item>
|
||||
<el-dropdown-item icon="SwitchButton" @click="handleUserMenu('logout')">退出</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
</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-aside :class="['aside', isCollapse ? 'isCollapse' : '']">
|
||||
<el-scrollbar
|
||||
wrap-class="scrollbar_dropdown__wrap"
|
||||
style="height: calc(100vh - 60px)"
|
||||
>
|
||||
<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"
|
||||
>
|
||||
<el-scrollbar wrap-class="scrollbar_dropdown__wrap" style="height: calc(100vh - 60px)">
|
||||
<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">
|
||||
<menu-item :menu="menu" />
|
||||
</template>
|
||||
</el-menu>
|
||||
|
||||
<div
|
||||
class="icon_switch"
|
||||
@click="isCollapse = !isCollapse"
|
||||
>
|
||||
<div class="icon_switch" @click="isCollapse = !isCollapse">
|
||||
<img src="../../assets/images/fold.png" alt="" v-if="isCollapse" />
|
||||
<img src="../../assets/images/expand.png" alt="" v-else />
|
||||
</div>
|
||||
|
@ -93,15 +87,8 @@
|
|||
</el-icon>
|
||||
<span class="title" v-if="!isCollapse">{{ store.title }}</span>
|
||||
</div>
|
||||
<el-menu
|
||||
class="el-menu-demo"
|
||||
mode="horizontal"
|
||||
@select="handleSelect"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffffff"
|
||||
:router="true"
|
||||
:default-active="route.path"
|
||||
>
|
||||
<el-menu class="el-menu-demo" 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">
|
||||
<menu-item :menu="menu" />
|
||||
</template>
|
||||
|
@ -118,10 +105,7 @@
|
|||
</el-badge>
|
||||
<el-dropdown class="userCenter">
|
||||
<div class="el-dropdown-link">
|
||||
<el-avatar
|
||||
src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
||||
:size="24"
|
||||
></el-avatar>
|
||||
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" :size="24"></el-avatar>
|
||||
<span class="name">admin</span>
|
||||
<el-icon>
|
||||
<arrow-down />
|
||||
|
@ -130,17 +114,12 @@
|
|||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item icon="Avatar">个人中心</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
icon="Avatar"
|
||||
command="logout"
|
||||
@click="handleUserMenu('logout')"
|
||||
>退出</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item icon="Avatar" command="logout" @click="handleUserMenu('logout')">退出</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space></el-header
|
||||
>
|
||||
</el-space>
|
||||
</el-header>
|
||||
<div class="breadcrumb">
|
||||
<breadcrumb />
|
||||
</div>
|
||||
|
@ -155,11 +134,12 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from "vue";
|
||||
import { ref, reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { useCar } from "@/store";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import emitter from "@/plugins/Bus";
|
||||
import http from "@/utils/request.js";
|
||||
import tools from "@/utils/tools";
|
||||
|
||||
import menuItem from "./components/menu/menu-item.vue";
|
||||
|
@ -170,11 +150,38 @@ console.log("user", user);
|
|||
let nameInfo = ref(user);
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const isbind = ref(false)
|
||||
let store = useCar();
|
||||
|
||||
const dialogVisible = 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 screen = () => {
|
||||
|
@ -202,10 +209,45 @@ const data = reactive({
|
|||
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) => {
|
||||
data.dialog.visibled = false;
|
||||
});
|
||||
onMounted(() => {
|
||||
isbind.value = tools.data.get("isbind");
|
||||
})
|
||||
|
||||
const handleClose = () => {
|
||||
window.removeEventListener('message', loginListener)
|
||||
}
|
||||
|
||||
const handleUserMenu = (command) => {
|
||||
console.log("command");
|
||||
|
@ -229,10 +271,12 @@ const handleUserMenu = (command) => {
|
|||
width: 220px;
|
||||
background-color: #285fbc;
|
||||
transition: all 0.4s;
|
||||
|
||||
&.isCollapse {
|
||||
width: 64px;
|
||||
}
|
||||
}
|
||||
|
||||
.NavMenu_title {
|
||||
height: 60px;
|
||||
min-width: 200px;
|
||||
|
@ -241,6 +285,7 @@ const handleUserMenu = (command) => {
|
|||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
background-color: #ffffff;
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
|
@ -248,6 +293,7 @@ const handleUserMenu = (command) => {
|
|||
color: #3d454d;
|
||||
}
|
||||
}
|
||||
|
||||
.el-container {
|
||||
.el-header {
|
||||
background-color: #ffffff;
|
||||
|
@ -255,6 +301,7 @@ const handleUserMenu = (command) => {
|
|||
0px 4px 10px 0px rgba(78, 89, 105, 0.06);
|
||||
}
|
||||
}
|
||||
|
||||
.yd_header_top {
|
||||
.el-popper.is-pure {
|
||||
background-color: #3a84ff !important;
|
||||
|
@ -265,6 +312,7 @@ const handleUserMenu = (command) => {
|
|||
background-color: transparent;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.el-menu-item {
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
|
@ -275,27 +323,33 @@ const handleUserMenu = (command) => {
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
.icon {
|
||||
color: #3a84ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.userCenter {
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.yd_header {
|
||||
.el-space__item:last-child {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
.name {
|
||||
margin: 0 10px;
|
||||
|
@ -310,25 +364,30 @@ const handleUserMenu = (command) => {
|
|||
background-color: #3a84ff !important;
|
||||
overflow: hidden;
|
||||
color: #ffffff;
|
||||
|
||||
.yd_header_top_left {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
||||
.yd_header_top_title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
width: 220px;
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
margin-left: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -337,11 +396,13 @@ const handleUserMenu = (command) => {
|
|||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
background-color: #e6f7ff !important;
|
||||
}
|
||||
|
||||
.el-menu--horizontal .el-menu .el-menu-item,
|
||||
.el-menu--horizontal .el-menu .el-sub-menu__title {
|
||||
color: #595959 !important;
|
||||
|
@ -367,12 +428,13 @@ const handleUserMenu = (command) => {
|
|||
right: 0;
|
||||
bottom: 40px;
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-popper.is-light{
|
||||
.el-popper.is-light {
|
||||
background-color: #285fbc;
|
||||
}
|
||||
</style>
|
||||
|
@ -381,5 +443,4 @@ const handleUserMenu = (command) => {
|
|||
.el-menu-item.is-active {
|
||||
background-color: #3a84ff !important;
|
||||
}
|
||||
|
||||
</style>
|
File diff suppressed because one or more lines are too long
|
@ -29,14 +29,15 @@ export default defineConfig({
|
|||
proxy: {
|
||||
'/api': {
|
||||
// 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', // 刘进
|
||||
changeOrigin: true,
|
||||
// rewrite: (path) => path.replace(/^\/api/, '')
|
||||
// ws: true,// 开启webSocket
|
||||
},
|
||||
'/metadata': {
|
||||
target: 'http://122.112.237.44',
|
||||
target: 'http://192.168.1.14:7777',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
// ws: true,// 开启webSocket
|
||||
|
|
Loading…
Reference in New Issue