Commit 2e753451 by 胡悦

Merge branch 'v1.4.0' into v2.1.0

2 parents 502ee2b4 8633f8c7
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-20 15:25:22
* @LastEditTime: 2023-08-15 18:14:04
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 页面头部组件
-->
......@@ -12,18 +12,34 @@
<img style="height: 2.89vh" src="@/assets/images/logo.png" alt="logo" />
</div>
<div class="tab">
<div v-for="(item, index) in menuList" :key="index">
<template v-if="item.tabName == 'business' && item.isShow">
<div class="tab-item first-tab" :class="currentMenu == item.tabName ? 'active' : ''" @click.prevent="jump(item.tabName)">
<div class="tab-title">{{ firstTab.label }}</div>
<img class="arrow-down" @click.stop="openSelect" src="@/assets/images/title-arrow.png" alt="">
<SelectBox :isShow="isShow" @clickOutside="clickOutside" :dataList="item.children" :boxWidth="'16.94vw'" isObject @selectVal="selectVal"></SelectBox>
</div>
</template>
<template v-else>
<div v-show="item.isShow" class="tab-item other-tab" :class="currentMenu == item.tabName ? 'active' : ''" @click="jump(item.tabName)">
<div class="tab-name">{{item.label}}</div>
</div>
</template>
</div>
</div>
<!-- <div class="tab">
<div class="tab-item first-tab" :class="currentMenu == 'home' ? 'active' : ''" @click.prevent="jump('home')">
<div class="tab-title">{{ firstTab.label }}</div>
<img class="arrow-down" @click.stop="openSelect" src="@/assets/images/title-arrow.png" alt="">
<SelectBox :isShow="isShow" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'16.94vw'" isObject @selectVal="selectVal"></SelectBox>
</div>
</div> -->
<!-- <div class="tab-item other-tab" :class="currentMenu == 'operational' ? 'active' : ''" @click="jump('operational')">
<div class="tab-name">运营数据</div>
</div>
<div class="tab-item other-tab" :class="currentMenu == 'interior' ? 'active' : ''" @click="jump('interior')">
<div class="tab-name">内部数据</div>
</div> -->
</div>
<!-- </div> -->
<!-- <div class="view-title user-select">嘀加智慧门店运营看板</div> -->
<div class="time">
<div class="top flex">
......@@ -41,7 +57,8 @@ export default {
data() {
return {
isShow: false,
dataList: datas.DefaultData.businessList,
// dataList: datas.DefaultData.businessList,
menuList: datas.DefaultData.menuList,
weekList: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
firstTab: '', // 存储第一个tab下的子菜单对象
now: new Date().format('yyyy-MM-dd hh:mm:ss'),
......@@ -49,9 +66,26 @@ export default {
currentMenu: 'home' // 标记当前是哪个tab菜单
}
},
created() {
const { menuList, $roleAuth, $role } = this
const permissions = $roleAuth[$role]
menuList.forEach(menu => {
if (menu.children) {
menu.children = menu.children.filter(child => {
child.isShow = permissions[child.value]
return child.isShow
})
menu.isShow = menu.children.length > 0
} else {
menu.isShow = permissions[menu.value]
}
})
this.menuList = menuList.filter(item => item.isShow)
this.firstTab = this.menuList[0].children ? this.menuList[0].children[0] : this.menuList[0]
this.jump(this.firstTab.tabName)
},
mounted() {
this.timer()
this.firstTab = this.dataList[0]
},
methods: {
timer() {
......@@ -72,7 +106,7 @@ export default {
jump(val) {
let _val = val
this.currentMenu = val
if (val === 'home') _val = this.firstTab.value
if (val === 'business') _val = this.firstTab.value
this.$bus.$emit('selectVal', _val)
this.isShow = false
},
......
......@@ -4,17 +4,17 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: huyue
* @LastEditTime: 2023-07-18 14:32:42
* @LastEditTime: 2023-08-15 16:22:12
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
let config = require('./conf.js')
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
if (isEnv) {
let { request } = config
Object.assign(request, { timeout })
return Promise.resolve(config)
}
// if (isEnv) {
// let { request } = config
// Object.assign(request, { timeout })
// return Promise.resolve(config)
// }
/**测试mock */ return window.fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=glsk-data-view').then(res => res.json())
// return window.fetch('https://oss-config.test.glsx.com.cn/mock/62cbf569f5137cf37678b828/data-view/config', {}).then(res => res.json())
}
......
......@@ -4,15 +4,15 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: huyue
* @LastEditTime: 2023-07-13 15:06:27
* @LastEditTime: 2023-08-15 17:15:24
*/
// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
// import 'core-js/stable'
// import 'regenerator-runtime/runtime'
import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import router from './router'
import store from './store'
......@@ -44,6 +44,8 @@ Vue.config.productionTip = false
// Vue.use(dialog)
const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
fetchConfig(!isMock).then(res => {
console.log(res)
Vue.prototype.$roleAuth = res.roleAuth
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
Vue.use(cfg)
......
......@@ -3,8 +3,8 @@
* @version:
* @Author: limin
* @Date: 2021-06-09 10:59:50
* @LastEditors: limin
* @LastEditTime: 2021-06-29 14:51:39
* @LastEditors: huyue
* @LastEditTime: 2023-08-15 17:00:16
*/
import Vue from 'vue'
import Router from 'vue-router'
......@@ -32,6 +32,7 @@ function createRouter() {
}
// http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/
router.beforeEach((to, from, next) => {
Vue.prototype.$role = to.query.role
next()
})
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
......
......@@ -3,26 +3,45 @@
* @Author: huyue
* @Date: 2023-07-04 11:46:53
* @LastEditors: huyue
* @LastEditTime: 2023-08-01 17:44:47
* @LastEditTime: 2023-08-15 18:16:39
*/
const DefaultData = {
yearList: ['2023', '2022'],
businessList: [
menuList: [
{
label: '业务数据 | 1.0太阳膜采购',
value: '1'
tabName: 'business',
children: [
{
label: '业务数据 | 1.0太阳膜采购',
tabName: 'business',
value: 'm_1.0'
},
{
label: '业务数据 | 1.1精品升级',
tabName: 'business',
value: 'm_1.1'
},
{
label: '业务数据 | 1.3售后众筹',
tabName: 'business',
value: 'm_1.3'
},
{
label: '业务数据 | 2.1会员权益',
tabName: 'business',
value: 'm_2.1'
}
]
},
{
label: '业务数据 | 1.1精品升级',
value: '2'
label: '运营数据',
tabName: 'operational',
value: 'operational'
},
{
label: '业务数据 | 1.3售后众筹',
value: '3'
},
{
label: '业务数据 | 2.1会员权益',
value: '4'
label: '内部数据',
tabName: 'interior',
value: 'interior'
}
],
directionTimer: 3000,
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-04 13:55:35
* @LastEditors: huyue
* @LastEditTime: 2023-08-01 18:03:26
* @LastEditTime: 2023-08-15 17:54:10
-->
<template>
<div class="layout">
......@@ -32,16 +32,16 @@ export default {
tabName() {
let sname
switch (this.activeName) {
case '1':
case 'm_1.0':
sname = 'ViewSolar'
break
case '2':
case 'm_1.1':
sname = 'ViewBoutique'
break
case '3':
case 'm_1.3':
sname = 'ViewCrowdfunding'
break
case '4':
case 'm_2.1':
sname = 'ViewEquity'
break
case 'operational':
......@@ -50,9 +50,11 @@ export default {
case 'interior':
sname = 'ViewInterior'
break
case 'home':
case 'business':
sname = 'ViewSolar'
break
// default:
// sname = 'ViewSolar'
}
return sname
}
......@@ -62,8 +64,9 @@ export default {
activeName: '4'
}
},
mounted() {
created() {
this.$bus.$on('selectVal', data => {
console.log('data:', data)
this.activeName = data
})
},
......
......@@ -3,11 +3,11 @@
* @Author: huyue
* @Date: 2023-07-04 13:55:35
* @LastEditors: huyue
* @LastEditTime: 2023-07-11 16:18:22
* @LastEditTime: 2023-08-15 16:52:55
-->
<template>
<div>
<ViewDate></ViewDate>
运营数据
</div>
</template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!