feat: 管理端添加多标签Tab页内嵌模式设置

master
Yer 2023-07-14 09:19:52 +08:00
parent 36ef331b94
commit 873764b59e
18 changed files with 238 additions and 89 deletions

View File

@ -0,0 +1,78 @@
<template>
<div>
<Drawer width="300px" title="页面配置" v-model="drawer">
<!-- 内容 -->
<h3>
内容设置
</h3>
<div class="config-item flex flex-a-c flex-j-sb">
<div>
<Tooltip theme="light" placement="bottom-end" max-width="100" content="关闭之后部分页面点击'查看''详情'等按钮将跳到新页面展示" >
<div>
多标签Tab页内嵌模式
</div>
</Tooltip>
</div>
<i-switch v-model="setting.isUseTabsRouter"></i-switch>
</div>
</Drawer>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "configDrawer",
data() {
return {
drawer: false,
};
},
computed: {
...mapState({
setting: state => {
return state.setting.setting
}
})
},
watch: {
setting: {
handler(val) {
this.setStore('admin-setting', val)
this.$store.commit('updateSetting', val);
},
deep: true
}
},
mounted() {
},
methods: {
open() {
this.drawer = true
},
close() {
this.drawer = false
},
toggle() {
this.drawer != this.drawer
},
}
}
</script>
<style lang="scss" scoped>
* {
color: #333 !important;
}
h3 {
margin: 10px 0 20px 0;
}
.config-item {
cursor: pointer;
margin-bottom: 20px;
justify-content: space-between;
}
</style>

View File

@ -13,4 +13,7 @@ module.exports = {
port: 10003, //端口 port: 10003, //端口
inputMaxLength:'140', //全局输入框默认最大输入长度字 inputMaxLength:'140', //全局输入框默认最大输入长度字
mainColor:"#ff5c58", //主题色 mainColor:"#ff5c58", //主题色
setting: {
isUseTabsRouter: true, //多标签Tab页模式
},
}; };

View File

@ -0,0 +1,6 @@
{
"setting": {
"isUseTabsRouter": true,
"showFooter": false
}
}

View File

@ -2,6 +2,7 @@ import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import app from "./modules/app"; import app from "./modules/app";
import setting from './modules/setting';
import user from "./modules/user"; import user from "./modules/user";
import dict from "./modules/dict"; import dict from "./modules/dict";
@ -21,6 +22,7 @@ const store = new Vuex.Store({
modules: { modules: {
app, app,
user, user,
setting,
dict dict
} }
}); });

View File

@ -0,0 +1,15 @@
const { setting } = require("@/config");
const localSetting = window.localStorage.getItem('admin-setting')
const settingData = {
state: {
setting:localSetting ? JSON.parse(localSetting) : setting,
},
mutations: {
updateSetting(state, data) {
state.setting = data;
},
},
};
export default settingData;

View File

@ -32,6 +32,25 @@ export function enCode(v1) {
return v1; return v1;
} }
import {router} from "@/router/index";
/**
* 自定义跳转
*/
export function customRouterPush(push){
const setting = window.localStorage.getItem('admin-setting') ? JSON.parse(window.localStorage.getItem('admin-setting')) : {};
if(setting.isUseTabsRouter){
router.push(push)
}
else{
if(Object.keys(setting).length == 0){router.push(push)}
else{
let url = router.resolve(push);
window.open(url.href, '_blank');
}
}
}
/** /**
* 订单来源 * 订单来源

View File

@ -12,14 +12,14 @@
<shrinkable-menu></shrinkable-menu> <shrinkable-menu></shrinkable-menu>
</div> </div>
<!-- 顶部标题栏主体 --> <!-- 顶部标题栏主体 -->
<div class="main-header-con"> <div class="main-header-con" :style="{ height: setting.isUseTabsRouter ? '100px' : '60px' }">
<div class="main-header"> <div class="main-header">
<div <div class="header-avator-con">
:class="{ <!-- 左侧栏 -->
'header-avator-con': navType != 4, <div>
'header-avator-con nav4': navType == 4,
}" </div>
> <div class="flex flex-a-c user-module">
<!-- 通知消息 --> <!-- 通知消息 -->
<message-tip v-if="tipsMessage" :res="tipsMessage"></message-tip> <message-tip v-if="tipsMessage" :res="tipsMessage"></message-tip>
<!-- 用户头像 --> <!-- 用户头像 -->
@ -30,6 +30,13 @@
align="middle" align="middle"
class="user-dropdown-innercon" class="user-dropdown-innercon"
> >
<ul class="nav-list">
<li class="nav-item " @click="handleClickSetting">
<Tooltip content="设置">
<Icon size="16" type="md-settings" />
</Tooltip>
</li>
</ul>
<Dropdown <Dropdown
transfer transfer
trigger="hover" trigger="hover"
@ -37,8 +44,8 @@
> >
<div class="dropList"> <div class="dropList">
<span class="main-user-name">{{ userInfo.nickName }}</span> <span class="main-user-name">{{ userInfo.nickName }}</span>
<Icon type="md-arrow-dropdown" />
<Avatar <Avatar
icon="ios-person"
:src="avatarPath" :src="avatarPath"
style="background: #fff; margin-left: 10px" style="background: #fff; margin-left: 10px"
></Avatar> ></Avatar>
@ -59,12 +66,13 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- 已打开的页面标签 --> <!-- 已打开的页面标签 -->
<div class="tags-con"> <div class="tags-con" v-if="setting.isUseTabsRouter">
<tags-page-opened :pageTagsList="pageTagsList"></tags-page-opened> <tags-page-opened :pageTagsList="pageTagsList"></tags-page-opened>
</div> </div>
</div> </div>
<div class="single-page-con"> <div class="single-page-con" :style="{ 'top': setting.isUseTabsRouter ? '100px' : '60px', height: setting.isUseTabsRouter ? 'calc(100% - 110px)' : 'calc(100% - 70px)' }">
<div class="single-page"> <div class="single-page">
<!-- <keep-alive :include="cachePage"> --> <!-- <keep-alive :include="cachePage"> -->
<router-view></router-view> <router-view></router-view>
@ -73,6 +81,8 @@
</div> </div>
<!-- 全局加载动画 --> <!-- 全局加载动画 -->
<circleLoading class="loading-position" v-show="loading" /> <circleLoading class="loading-position" v-show="loading" />
<!-- 右侧抽屉配置 -->
<configDrawer ref="config"/>
</div> </div>
</template> </template>
@ -81,29 +91,37 @@ import shrinkableMenu from "./main-parts/shrinkable-menu/shrinkable-menu.vue";
import tagsPageOpened from "./main-parts/tags-page-opened.vue"; import tagsPageOpened from "./main-parts/tags-page-opened.vue";
import messageTip from "./main-parts/message-tip.vue"; import messageTip from "./main-parts/message-tip.vue";
import circleLoading from "@/components/lili/circle-loading.vue"; import circleLoading from "@/components/lili/circle-loading.vue";
import configDrawer from "@/components/lili/config-drawer.vue";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import util from "@/libs/util.js"; import util from "@/libs/util.js";
import { getNoticePage, logout } from "@/api/index"; import { getNoticePage, logout } from "@/api/index";
import { getBaseSite } from "@/api/common"; import { getBaseSite } from "@/api/common";
var client; var client;
const config = require("@/config/index.js");
export default { export default {
components: { components: {
shrinkableMenu, shrinkableMenu,
tagsPageOpened, tagsPageOpened,
messageTip, messageTip,
circleLoading, circleLoading,
configDrawer
}, },
data() { data() {
return { return {
config,
sliceNum: 5, // nav sliceNum: 5, // nav
userInfo: "", // userInfo: "", //
navType: 1, // nav
tipsMessage: "", // tipsMessage: "", //
domainLogo: "", domainLogo: "",
}; };
}, },
computed: { computed: {
setting(){
let data = this.$store.state.setting
return data.setting
},
loading() { loading() {
return this.$store.state.app.loading; return this.$store.state.app.loading;
}, },
@ -119,6 +137,9 @@ export default {
}, },
methods: { methods: {
handleClickSetting() {
this.$refs.config.open();
},
init() { init() {
// //
let userInfo = JSON.parse(Cookies.get("userInfoManager")); let userInfo = JSON.parse(Cookies.get("userInfoManager"));

View File

@ -422,10 +422,10 @@ export default {
// //
showDetail(v) { showDetail(v) {
let id = v.id; let id = v.id;
this.$router.push({ this.$options.filters.customRouterPush({
name: "goods-detail", name: "goods-detail",
query: { id: id }, query: { id: id },
}); })
}, },
}, },
mounted() { mounted() {

View File

@ -286,10 +286,10 @@ export default {
// //
showDetail(v) { showDetail(v) {
let id = v.id; let id = v.id;
this.$router.push({ this.$options.filters.customRouterPush({
name: "goods-detail", name: "goods-detail",
query: { id: id }, query: { id: id },
}); })
}, },
}, },
mounted() { mounted() {

View File

@ -145,9 +145,8 @@
.header-avator-con { .header-avator-con {
display: flex; display: flex;
align-items: center; align-items: center;
position: absolute; padding: 0 30px;
right: 0; justify-content: space-between;
top: 0;
height: 100%; height: 100%;
@ -188,27 +187,7 @@
align-items: center; align-items: center;
} }
.user-dropdown {
&-menu-con {
.main-user-name {
font-size: 14px;
display: inline-block;
cursor: pointer;
margin-right: 5px;
max-width: 200px;
overflow: hidden;
word-wrap: normal;
white-space: nowrap;
text-overflow: ellipsis;
vertical-align: middle;
overflow: hidden;
text-align: right;
}
}
}
.full-screen-btn-con { .full-screen-btn-con {
display: inline-block; display: inline-block;
@ -312,3 +291,26 @@
z-index: 100; z-index: 100;
top: 1px; top: 1px;
} }
.nav-item {
cursor: pointer;
width: 30px;
height: 30px;
border-radius: 50%;
border: 1px solid #ededed;
display: flex;
align-items: center;
justify-content: center;
margin: 0 10px;
}
.footer-page-on{
width: 100%;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
}
.user-module{
align-items: center;
}

View File

@ -439,7 +439,7 @@ export default {
}, },
// //
detail(row) { detail(row) {
this.$router.push({ name: "member-detail", query: { id: row.id } }); this.$options.filters.customRouterPush({ name: "member-detail", query: { id: row.id } })
}, },
// //

View File

@ -400,7 +400,8 @@ export default {
// //
detail(row) { detail(row) {
this.$router.push({ name: "member-detail", query: { id: row.id } }); this.$options.filters.customRouterPush({ name: "member-detail", query: { id: row.id } })
}, },
// //
enable(v) { enable(v) {

View File

@ -354,10 +354,10 @@ export default {
// //
detail(v) { detail(v) {
let sn = v.sn; let sn = v.sn;
this.$router.push({ this.$options.filters.customRouterPush({
name: "after-order-detail", name: "after-order-detail",
query: { sn: sn }, query: { sn: sn },
}); })
}, },
// //
serviceStatusClick(item) { serviceStatusClick(item) {

View File

@ -244,10 +244,10 @@
// //
detail(v) { detail(v) {
let id = v.id; let id = v.id;
this.$router.push({ this.$options.filters.customRouterPush({
name: "order-complaint-detail", name: "order-complaint-detail",
query: { id: id }, query: { id: id },
}); })
}, },
}, },
mounted() { mounted() {

View File

@ -267,13 +267,11 @@ export default {
}, },
// //
detail (v) { detail (v) {
console.log(v.orderType);
let sn = v.sn; let sn = v.sn;
this.$router.push({ this.$options.filters.customRouterPush({
name: "order-detail", name: "order-detail",
query: { sn: sn, orderType: v.orderType }, query: { sn: sn, orderType: v.orderType },
}); })
}, },
// //
orderStatusClick(item) { orderStatusClick(item) {

View File

@ -383,10 +383,11 @@ export default {
// //
detail(v) { detail(v) {
let sn = v.sn; let sn = v.sn;
this.$router.push({ this.$options.filters.customRouterPush({
name: "order-detail", name: "order-detail",
query: { sn: sn }, query: { sn: sn },
}); })
}, },
// //
async exportOrder() { async exportOrder() {

View File

@ -197,10 +197,10 @@ export default {
}, },
detail(v) { // detail(v) { //
let id = v.id; let id = v.id;
this.$router.push({ this.$options.filters.customRouterPush({
name: "bill-detail", name: "bill-detail",
query: { id: id }, query: { id: id },
}); })
}, },
remove(v) { remove(v) {
this.$Modal.confirm({ this.$Modal.confirm({

View File

@ -42,10 +42,13 @@ export function customRouterPush(push){
if(setting.isUseTabsRouter){ if(setting.isUseTabsRouter){
router.push(push) router.push(push)
} }
else{
if(Object.keys(setting).length == 0){router.push(push)}
else{ else{
let url = router.resolve(push); let url = router.resolve(push);
window.open(url.href, '_blank'); window.open(url.href, '_blank');
} }
}
} }