Commit 2e753451 by 胡悦

Merge branch 'v1.4.0' into v2.1.0

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