Commit f94aa298 by 胡悦

提交详情头部组件

1 parent 67a8fd1c
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-07-10 11:15:12
* @LastEditTime: 2023-07-11 14:28:35
-->
<template>
<div>
......@@ -83,7 +83,6 @@ export default {
return _html
},
drawBar() {
console.log(this.dataList)
this.barLineOptions.xAxis.data = this.dataList.map(item => item.month)
this.barLineOptions.series[0].data = this.dataList.map(item => item.data1)
this.barLineOptions.series[1].data = this.dataList.map(item => item.data2)
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 16:22:32
* @LastEditTime: 2023-07-11 14:29:12
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -84,7 +84,6 @@ export default {
return _html
},
drawBarLine() {
console.log(this.dataList)
this.barLineOptions.xAxis.data = this.dataList.map(item => item.month)
this.barLineOptions.series[0].data = this.dataList.map(item => item.data1)
this.barLineOptions.series[1].data = this.dataList.map(item => item.data2)
......
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-11 15:47:34
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 页面头部组件
-->
<template>
<div class="content flex">
<div class="logo user-select">
<img style="height: 2.89vh" src="@/assets/images/logo.png" alt="logo" />
</div>
<div class="tab">
<div class="tab-item first-tab active" @click.prevent="openSelect">
<div class="merchant-name">{{ firstTab.label }}</div>
<img class="arrow-down" src="@/assets/images/title-arrow.png" alt="">
</div>
<SelectBox :isShow="isShow" :dataList="dataList" :boxWidth="'23.33vw'" isObject @selectVal="selectVal">
<div slot="search" class="search">
<input type="text" class="search-input" v-model="search" @input="handleInput">
<img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt="">
</div>
</SelectBox>
</div>
<!-- <div class="view-title user-select">嘀加智慧门店运营看板</div> -->
<div class="time">
<div class="top flex">
<div class="now">{{ now }}</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import utils from '@/utils/util'
export default {
name: 'DetailTitle',
data() {
return {
isShow: false,
dataList: [],
firstTab: '', // 存储第一个tab下的子菜单对象
now: new Date().format('yyyy-MM-dd hh:mm:ss'),
currentMenu: 'home', // 标记当前是哪个tab菜单
search: ''
}
},
created() {
const _obj = {
label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX',
value: '1'
}
this.dataList.push(_obj)
},
mounted() {
this.timer()
this.firstTab = this.dataList[0]
},
methods: {
timer() {
setInterval(() => {
this.now = new Date().format('yyyy-MM-dd hh:mm:ss')
}, 1e3)
},
openSelect() {
this.isShow = !this.isShow
},
// 监听子菜单变化
selectVal(val) {
console.log(val)
this.firstTab = val
this.$bus.$emit('selectVal', val.value)
this.openSelect()
this.search = ''
},
searchMerchant() {
this.dataList = [
{
label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX',
value: '1'
},
{
label: '广东省XXXXXXXXX服务商1',
value: '2'
},
{
label: '广东省XXXXXXXXX服务商2',
value: '3'
},
{
label: '广东省XXXXXXXXX服务商3',
value: '4'
}
]
},
handleInput: utils.throttle(function(e) {
console.log(this.search)
this.searchMerchant()
}, 1000 / 60)
}
}
</script>
<style scoped lang="scss">
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 26px 0 24px;
justify-content: space-between;
.view-title {
font-weight: 600;
font-size: 24px;
color: #ffffff;
letter-spacing: 8px;
text-align: center;
}
.time {
text-align: right;
font-size: 16px;
color: #ffffff;
.top {
justify-content: flex-end;
.now {
width: 10.97vw;
}
}
.icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
}
.tab {
position: relative;
display: flex;
// align-items: center;
color: #FFFFFF;
font-size: 16px;
&-item {
display: flex;
align-items: center;
justify-content: center;
height: 4.44vh;
box-sizing: border-box;
margin-right: 0.56vw;
border: 2px solid;
border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;
background-image: linear-gradient(180deg, #001948 0%, #00223C 99%);
cursor: pointer;
}
.first-tab {
position: relative;
width: 23.33vw;
box-sizing: border-box;
.merchant-name {
max-width: 18.61vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&.active {
background-image: url('../assets/images/first-tab-bg.png');
background-repeat: no-repeat;
background-size: 100% 100%;
border: none;
}
.arrow-down {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 1.39vw;
margin-left: 0.28vw;
width: 1.39vw;
height: 2.22vh;
}
.select-box {
left: 0;
}
}
.other-tab{
width: 7.22vw;
box-sizing: border-box;
&.active {
background-image: url('../assets/images/other-tab-bg.png');
background-repeat: no-repeat;
background-size: 100% 100%;
border: none;
}
}
}
.search {
position: relative;
margin-bottom: 2.22vh;
&-input {
width: 100%;
background-color: #001B46;
border: 1px solid #183D6F;
padding: 0.89vh 2.15vw 0.89vh 0.56vw;
color: #fff;
box-sizing: border-box;
}
.icon-search {
position: absolute;
right: 0.56vw;
top: 50%;
transform: translateY(-50%);
width: 15px;
height: 15px;
}
}
</style>
......@@ -126,7 +126,6 @@ export default {
fontWeight: 'bold',
color: '#fff',
formatter(param) {
console.log(param)
}
}
},
......
......@@ -3,10 +3,11 @@
* @Author: huyue
* @Date: 2023-07-05 15:11:53
* @LastEditors: huyue
* @LastEditTime: 2023-07-06 12:01:43
* @LastEditTime: 2023-07-11 11:20:38
-->
<template>
<div v-show="isShow" class="select-box" :style="{'width': boxWidth}">
<slot name="search"></slot>
<div class="year-item" :class="(isObject ? item[valueName] : item) == value ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click="select(item)">{{isObject ? item[labelName] : item}}</div>
</div>
</template>
......@@ -72,6 +73,9 @@ export default {
.year-item {
margin-bottom: 8px;
color: #C9C9C9;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
&:hover {
color: #FFFFFF;
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-06 14:16:20
* @LastEditTime: 2023-07-11 15:51:08
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 页面头部组件
-->
......@@ -13,7 +13,7 @@
</div>
<div class="tab">
<div class="tab-item first-tab" :class="currentMenu == 'home' ? 'active' : ''" @click.self="jump('home')">
{{ firstTab.label }}
<div class="tab-title">{{ firstTab.label }}</div>
<img class="arrow-down" @click.stop="openSelect" src="@/assets/images/title-arrow.png" alt="">
<SelectBox :isShow="isShow" :dataList="dataList" :boxWidth="'17.1vw'" isObject @selectVal="selectVal"></SelectBox>
</div>
......@@ -110,6 +110,7 @@ export default {
color: #FFFFFF;
font-size: 16px;
&-item {
position: relative;
display: flex;
align-items: center;
justify-content: center;
......@@ -121,6 +122,9 @@ export default {
border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;
background-image: linear-gradient(180deg, #001948 0%, #00223C 99%);
cursor: pointer;
.tab-title {
max-width: 18.61vw;
}
}
.first-tab {
position: relative;
......@@ -133,6 +137,11 @@ export default {
border: none;
}
.arrow-down {
position: absolute;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0.9vw;
margin-left: 0.28vw;
width: 1.39vw;
height: 2.22vh;
......
......@@ -26,19 +26,21 @@ Date.prototype.format = function (fmt) {
}
return fmt
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
const throttle = (fn, delay = 1000) => {
// 距离上一次的执行时间
let lastTime = 0
return function() {
const _this = this
const _arguments = arguments
const now = new Date().getTime()
// 如果距离上一次执行超过了delay才能再次执行
if (now - lastTime > delay) {
fn.apply(_this, _arguments)
lastTime = now
}
}
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
......
......@@ -2,7 +2,7 @@
<div class="layout">
<view-container>
<template #title>
<view-title></view-title>
<DetailTitle></DetailTitle>
</template>
<template #content>
<div class="solar-detail-content">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!