Bläddra i källkod

修改tab样式

WanGxC 1 år sedan
förälder
incheckning
29e271636b

+ 311 - 265
src/theme/app.scss

@@ -1,375 +1,417 @@
 /* 初始化样式
 ------------------------------- */
 * {
-	margin: 0;
-	padding: 0;
-	box-sizing: border-box;
-	outline: none !important;
+  margin: 0;
+  padding: 0;
+  box-sizing: border-box;
+  outline: none !important;
 }
 
 :root {
-	--next-color-white: #ffffff;
-	--next-bg-main-color: #f8f8f8;
-	--next-bg-color: #f5f5ff;
-	--next-border-color-light: #f1f2f3;
-	--next-color-primary-lighter: #ecf5ff;
-	--next-color-success-lighter: #f0f9eb;
-	--next-color-warning-lighter: #fdf6ec;
-	--next-color-danger-lighter: #fef0f0;
-	--next-color-dark-hover: #0000001a;
-	--next-color-menu-hover: rgba(0, 0, 0, 0.2);
-	--next-color-user-hover: rgba(0, 0, 0, 0.04);
-	--next-color-seting-main: #e9eef3;
-	--next-color-seting-aside: #d3dce6;
-	--next-color-seting-header: #b3c0d1;
+  --next-color-white: #ffffff;
+  --next-bg-main-color: #f8f8f8;
+  --next-bg-color: #f5f5ff;
+  --next-border-color-light: #f1f2f3;
+  --next-color-primary-lighter: #ecf5ff;
+  --next-color-success-lighter: #f0f9eb;
+  --next-color-warning-lighter: #fdf6ec;
+  --next-color-danger-lighter: #fef0f0;
+  --next-color-dark-hover: #0000001a;
+  --next-color-menu-hover: rgba(0, 0, 0, 0.2);
+  --next-color-user-hover: rgba(0, 0, 0, 0.04);
+  --next-color-seting-main: #e9eef3;
+  --next-color-seting-aside: #d3dce6;
+  --next-color-seting-header: #b3c0d1;
 }
 
 html,
 body,
 #app {
-	margin: 0;
-	padding: 0;
-	width: 100%;
-	height: 100%;
-	font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
-	font-weight: 400;
-	-webkit-font-smoothing: antialiased;
-	-webkit-tap-highlight-color: transparent;
-	background-color: var(--next-bg-main-color);
-	font-size: 14px;
-	overflow: hidden;
-	position: relative;
+  margin: 0;
+  padding: 0;
+  width: 100%;
+  height: 100%;
+  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
+  font-weight: 400;
+  -webkit-font-smoothing: antialiased;
+  -webkit-tap-highlight-color: transparent;
+  background-color: var(--next-bg-main-color);
+  font-size: 14px;
+  overflow: hidden;
+  position: relative;
 }
 
 /* 主布局样式
 ------------------------------- */
 .layout-container {
-	width: 100%;
-	height: 100%;
-	.layout-pd {
-		padding: 15px !important;
-	}
-	.layout-flex {
-		display: flex;
-		flex-direction: column;
-		flex: 1;
-	}
-	.layout-aside {
-		background: var(--next-bg-menuBar);
-		box-shadow: 2px 0 6px rgb(0 21 41 / 1%);
-		height: inherit;
-		position: relative;
-		z-index: 1;
-		display: flex;
-		flex-direction: column;
-		overflow-x: hidden !important;
-		.el-scrollbar__view {
-			overflow: hidden;
-		}
-	}
-	.layout-header {
-		padding: 0 !important;
-		height: auto !important;
-	}
-	.layout-main {
-		padding: 0 !important;
-		overflow: hidden;
-		width: 100%;
-		background-color: var(--next-bg-main-color);
-		display: flex;
-		flex-direction: column;
-		// 内层 el-scrollbar样式,用于界面高度自适应(main.vue)
-		.layout-main-scroll {
-			@extend .layout-flex;
-			.layout-parent {
-				@extend .layout-flex;
-				position: relative;
-			}
-		}
-	}
-	// 用于界面高度自适应
-	.layout-padding {
-		@extend .layout-pd;
-		position: absolute;
-		left: 0;
-		top: 0;
-		height: 100%;
-		overflow: hidden;
-		@extend .layout-flex;
-		&-auto {
-			height: inherit;
-			@extend .layout-flex;
-		}
-		&-view {
-			background: var(--el-color-white);
-			width: 100%;
-			height: 100%;
-			border-radius: 4px;
-			border: 1px solid var(--el-border-color-light, #ebeef5);
-			overflow: hidden;
-		}
-	}
-	// 用于界面高度自适应,主视图区 main 的内边距,用于 iframe
-	.layout-padding-unset {
-		padding: 0 !important;
-		&-view {
-			border-radius: 0 !important;
-			border: none !important;
-		}
-	}
-	// 用于设置 iframe loading 时的高度(loading 垂直居中显示)
-	.layout-iframe {
-		.el-loading-parent--relative {
-			height: 100%;
-		}
-	}
-	.el-scrollbar {
-		width: 100%;
-	}
-	.layout-el-aside-br-color {
-		border-right: 1px solid var(--el-border-color-light, #ebeef5);
-	}
-	// pc端左侧导航样式
-	.layout-aside-pc-220 {
-		width: 220px !important;
-		transition: width 0.3s ease;
-	}
-	.layout-aside-pc-64 {
-		width: 64px !important;
-		transition: width 0.3s ease;
-	}
-	.layout-aside-pc-1 {
-		width: 1px !important;
-		transition: width 0.3s ease;
-	}
-	// 手机端左侧导航样式
-	.layout-aside-mobile {
-		position: fixed;
-		top: 0;
-		left: -220px;
-		width: 220px;
-		z-index: 9999999;
-	}
-	.layout-aside-mobile-close {
-		left: -220px;
-		transition: all 0.3s cubic-bezier(0.39, 0.58, 0.57, 1);
-	}
-	.layout-aside-mobile-open {
-		left: 0;
-		transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
-	}
-	.layout-aside-mobile-mode {
-		position: fixed;
-		top: 0;
-		right: 0;
-		bottom: 0;
-		left: 0;
-		height: 100%;
-		background-color: rgba(0, 0, 0, 0.5);
-		z-index: 9999998;
-		animation: error-img 0.3s;
-	}
-	.layout-mian-height-50 {
-		height: calc(100vh - 50px);
-	}
-	.layout-columns-warp {
-		flex: 1;
-		display: flex;
-		overflow: hidden;
-	}
-	.layout-hide {
-		display: none;
-	}
+  width: 100%;
+  height: 100%;
+
+  .layout-pd {
+    padding: 15px !important;
+  }
+
+  .layout-flex {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+  }
+
+  .layout-aside {
+    background: var(--next-bg-menuBar);
+    box-shadow: 2px 0 6px rgb(0 21 41 / 1%);
+    height: inherit;
+    position: relative;
+    z-index: 1;
+    display: flex;
+    flex-direction: column;
+    overflow-x: hidden !important;
+
+    .el-scrollbar__view {
+      overflow: hidden;
+    }
+  }
+
+  .layout-header {
+    padding: 0 !important;
+    height: auto !important;
+  }
+
+  .layout-main {
+    padding: 0 !important;
+    overflow: hidden;
+    width: 100%;
+    background-color: var(--next-bg-main-color);
+    display: flex;
+    flex-direction: column;
+    // 内层 el-scrollbar样式,用于界面高度自适应(main.vue)
+    .layout-main-scroll {
+      @extend .layout-flex;
+
+      .layout-parent {
+        @extend .layout-flex;
+        position: relative;
+      }
+    }
+  }
+
+  // 用于界面高度自适应
+  .layout-padding {
+    @extend .layout-pd;
+    position: absolute;
+    left: 0;
+    top: 0;
+    height: 100%;
+    overflow: hidden;
+    @extend .layout-flex;
+
+    &-auto {
+      height: inherit;
+      @extend .layout-flex;
+    }
+
+    &-view {
+      background: var(--el-color-white);
+      width: 100%;
+      height: 100%;
+      border-radius: 4px;
+      border: 1px solid var(--el-border-color-light, #ebeef5);
+      overflow: hidden;
+    }
+  }
+
+  // 用于界面高度自适应,主视图区 main 的内边距,用于 iframe
+  .layout-padding-unset {
+    padding: 0 !important;
+
+    &-view {
+      border-radius: 0 !important;
+      border: none !important;
+    }
+  }
+
+  // 用于设置 iframe loading 时的高度(loading 垂直居中显示)
+  .layout-iframe {
+    .el-loading-parent--relative {
+      height: 100%;
+    }
+  }
+
+  .el-scrollbar {
+    width: 100%;
+  }
+
+  .layout-el-aside-br-color {
+    border-right: 1px solid var(--el-border-color-light, #ebeef5);
+  }
+
+  // pc端左侧导航样式
+  .layout-aside-pc-220 {
+    width: 220px !important;
+    transition: width 0.3s ease;
+  }
+
+  .layout-aside-pc-64 {
+    width: 64px !important;
+    transition: width 0.3s ease;
+  }
+
+  .layout-aside-pc-1 {
+    width: 1px !important;
+    transition: width 0.3s ease;
+  }
+
+  // 手机端左侧导航样式
+  .layout-aside-mobile {
+    position: fixed;
+    top: 0;
+    left: -220px;
+    width: 220px;
+    z-index: 9999999;
+  }
+
+  .layout-aside-mobile-close {
+    left: -220px;
+    transition: all 0.3s cubic-bezier(0.39, 0.58, 0.57, 1);
+  }
+
+  .layout-aside-mobile-open {
+    left: 0;
+    transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
+  }
+
+  .layout-aside-mobile-mode {
+    position: fixed;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    height: 100%;
+    background-color: rgba(0, 0, 0, 0.5);
+    z-index: 9999998;
+    animation: error-img 0.3s;
+  }
+
+  .layout-mian-height-50 {
+    height: calc(100vh - 50px);
+  }
+
+  .layout-columns-warp {
+    flex: 1;
+    display: flex;
+    overflow: hidden;
+  }
+
+  .layout-hide {
+    display: none;
+  }
 }
 
 /* element plus 全局样式
 ------------------------------- */
 .layout-breadcrumb-seting {
-	.el-divider {
-		background-color: rgb(230, 230, 230);
-	}
+  .el-divider {
+    background-color: rgb(230, 230, 230);
+  }
 }
 
 /* nprogress 进度条跟随主题颜色
 ------------------------------- */
 #nprogress {
-	.bar {
-		background: var(--el-color-primary) !important;
-		z-index: 9999999 !important;
-	}
+  .bar {
+    background: var(--el-color-primary) !important;
+    z-index: 9999999 !important;
+  }
 }
 
 /* flex 弹性布局
 ------------------------------- */
 .flex {
-	display: flex;
+  display: flex;
 }
+
 .flex-auto {
-	flex: 1;
-	overflow: hidden;
+  flex: 1;
+  overflow: hidden;
 }
+
 .flex-center {
-	@extend .flex;
-	flex-direction: column;
-	width: 100%;
-	overflow: hidden;
+  @extend .flex;
+  flex-direction: column;
+  width: 100%;
+  overflow: hidden;
 }
+
 .flex-margin {
-	margin: auto;
+  margin: auto;
 }
+
 .flex-warp {
-	display: flex;
-	flex-wrap: wrap;
-	align-content: flex-start;
-	margin: 0 -5px;
-	.flex-warp-item {
-		padding: 5px;
-		.flex-warp-item-box {
-			width: 100%;
-			height: 100%;
-		}
-	}
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  margin: 0 -5px;
+
+  .flex-warp-item {
+    padding: 5px;
+
+    .flex-warp-item-box {
+      width: 100%;
+      height: 100%;
+    }
+  }
 }
 
 /* cursor 鼠标形状
 ------------------------------- */
 // 默认
 .cursor-default {
-	cursor: default !important;
+  cursor: default !important;
 }
+
 // 帮助
 .cursor-help {
-	cursor: help !important;
+  cursor: help !important;
 }
+
 // 手指
 .cursor-pointer {
-	cursor: pointer !important;
+  cursor: pointer !important;
 }
+
 // 移动
 .cursor-move {
-	cursor: move !important;
+  cursor: move !important;
 }
 
 /* 宽高 100%
 ------------------------------- */
 .w100 {
-	width: 100% !important;
+  width: 100% !important;
 }
+
 .h100 {
-	height: 100% !important;
+  height: 100% !important;
 }
+
 .vh100 {
-	height: 100vh !important;
+  height: 100vh !important;
 }
+
 .max100vh {
-	max-height: 100vh !important;
+  max-height: 100vh !important;
 }
+
 .min100vh {
-	min-height: 100vh !important;
+  min-height: 100vh !important;
 }
 
 /* 颜色值
 ------------------------------- */
 .color-primary {
-	color: var(--el-color-primary);
+  color: var(--el-color-primary);
 }
+
 .color-success {
-	color: var(--el-color-success);
+  color: var(--el-color-success);
 }
+
 .color-warning {
-	color: var(--el-color-warning);
+  color: var(--el-color-warning);
 }
+
 .color-danger {
-	color: var(--el-color-danger);
+  color: var(--el-color-danger);
 }
+
 .color-info {
-	color: var(--el-color-info);
+  color: var(--el-color-info);
 }
 
 /* 字体大小全局样式
 ------------------------------- */
 @for $i from 10 through 32 {
-	.font#{$i} {
-		font-size: #{$i}px !important;
-	}
+  .font#{$i} {
+    font-size: #{$i}px !important;
+  }
 }
 
 /* 外边距、内边距全局样式
 ------------------------------- */
 @for $i from 1 through 35 {
-	.mt#{$i} {
-		margin-top: #{$i}px !important;
-	}
-	.mr#{$i} {
-		margin-right: #{$i}px !important;
-	}
-	.mb#{$i} {
-		margin-bottom: #{$i}px !important;
-	}
-	.ml#{$i} {
-		margin-left: #{$i}px !important;
-	}
-	.pt#{$i} {
-		padding-top: #{$i}px !important;
-	}
-	.pr#{$i} {
-		padding-right: #{$i}px !important;
-	}
-	.pb#{$i} {
-		padding-bottom: #{$i}px !important;
-	}
-	.pl#{$i} {
-		padding-left: #{$i}px !important;
-	}
+  .mt#{$i} {
+    margin-top: #{$i}px !important;
+  }
+  .mr#{$i} {
+    margin-right: #{$i}px !important;
+  }
+  .mb#{$i} {
+    margin-bottom: #{$i}px !important;
+  }
+  .ml#{$i} {
+    margin-left: #{$i}px !important;
+  }
+  .pt#{$i} {
+    padding-top: #{$i}px !important;
+  }
+  .pr#{$i} {
+    padding-right: #{$i}px !important;
+  }
+  .pb#{$i} {
+    padding-bottom: #{$i}px !important;
+  }
+  .pl#{$i} {
+    padding-left: #{$i}px !important;
+  }
 }
 
 // 自定义全局样式
 .asj-container {
-  padding: 3px 10px 3px 5px;
+  padding: 0px 10px 3px 5px;
 }
 
 .fs-page-custom {
-	position: initial !important;
+  position: initial !important;
 
-	.fs-search-col >* {
-		margin-left: 0 !important;
-	}
+  .fs-search-col > * {
+    margin-left: 0 !important;
+  }
 }
 
 .asj-tabs {
   background-color: #fff;
   position: sticky;
-  top: 32px;
+  top: 48px;
   z-index: 9;
-  box-shadow: 0px 0px 12px rgba(51,89,181,0.16);
+  box-shadow: 0px 0px 12px rgba(51, 89, 181, 0.16);
 
-	padding: 0 12px;
-	display: flex;
-	height: 40px;
-	gap: 24px;
+  padding: 0 12px;
+  display: flex;
+  height: 40px;
+  gap: 24px;
 }
 
 .asj-tab {
-	display: flex;
-	align-items: center;
-	padding: 0 4px;
-	height: 40px;
-	font-weight: 700;
-	line-height: 40px;
-	cursor: pointer;
-	border-bottom: 2px solid #fff;
+  display: flex;
+  align-items: center;
+  padding: 0 4px;
+  height: 40px;
+  font-weight: 700;
+  line-height: 40px;
+  cursor: pointer;
+  border-bottom: 2px solid #fff;
 }
 
 .asj-tab.active {
-	color: #409eff;
-	border-color: #409eff
+  color: #409eff;
+  border-color: #409eff
 }
 
 // 详细页里面的样式
 .asj-detail-header {
   position: sticky;
   background-color: #fff;
-  box-shadow: 0px 0px 12px rgba(51,89,181,0.16);
+  box-shadow: 0px 0px 12px rgba(51, 89, 181, 0.16);
   z-index: 10;
   top: 0;
   height: 80px;
@@ -377,12 +419,14 @@ body,
   display: flex;
   flex-direction: column;
 }
+
 .asj-detail-info {
   margin: 5px;
   display: flex;
   flex-direction: row;
   gap: 30px;
 }
+
 .asj-detail-tabs > .el-tabs__header.is-top {
   position: sticky;
   top: 80px;
@@ -392,25 +436,27 @@ body,
 // 顶层公共搜索样式
 .public-search {
   display: flex;
-  gap: 3px;
-  padding-bottom: 3px;
+  gap: 8px;
+  padding-bottom: 8px;
   position: sticky;
   top: 0;
+  padding-top: 8px;
   z-index: 10;
   width: 100%;
   background-color: #f8f8f8;
-  box-shadow: 0px 0px 0px rgba(51,89,181,0.16);
+  box-shadow: 0px 0px 0px rgba(51, 89, 181, 0.16);
 
-	.el-input__wrapper {
-		border-radius: 0;
-	}
+  .el-input__wrapper {
+    border-radius: 0;
+  }
 }
 
 .chart-tabs {
-	margin: 5px 0;
-	.el-tabs__nav {
-		padding-left: 0 !important;
-	}
+  margin: 5px 0;
+
+  .el-tabs__nav {
+    padding-left: 0 !important;
+  }
 }
 
 

+ 66 - 0
src/views/adManage/ad-overview/api.ts

@@ -0,0 +1,66 @@
+import { request } from '/@/utils/service';
+import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
+import XEUtils from 'xe-utils';
+
+export const apiPrefix = '/api/ad_manage/summary/report/';
+export function GetList(query: UserPageQuery) {
+  return request({
+    url: apiPrefix,
+    method: 'get',
+    params: query,
+  })
+}
+export function GetObj(id: any) {
+  return request({
+    url: apiPrefix + id + "/",
+    method: 'get',
+  });
+}
+
+export function AddObj(obj: AddReq) {
+  return request({
+    url: apiPrefix,
+    method: 'post',
+    data: obj,
+  });
+}
+
+export function UpdateObj(obj: EditReq) {
+  return request({
+    url: apiPrefix + obj.id + '/',
+    method: 'put',
+    data: obj,
+  });
+}
+
+export function DelObj(id: DelReq) {
+  return request({
+    url: apiPrefix + id + '/',
+    method: 'delete',
+    data: { id },
+  });
+}
+
+export function getCardData(query: UserPageQuery) {
+  return request({
+    url: apiPrefix + "total/",
+    method: 'GET',
+    params: query
+  })
+}
+
+export function getLineData(query: UserPageQuery) {
+  return request({
+    url: apiPrefix + "daily/",
+    method: 'GET',
+    params: query
+  })
+}
+
+export function getTotalData(query) {
+  return request({
+    url: apiPrefix + "total",
+    method: 'GET',
+    params: query
+  })
+}

+ 62 - 29
src/views/adManage/ad-overview/index.vue

@@ -4,15 +4,8 @@
       <DateRangePicker v-model="dateRange"></DateRangePicker>
     </div>
     <div class="container-main">
-      <!--<div class="top-car" style="display: flex; justify-content: space-around">-->
-      <!--  <ShowCard :cardData="cardData"></ShowCard>-->
-      <!--  <ShowCard :cardData="cardData" style="margin: 0 5px"></ShowCard>-->
-      <!--  <ShowCard :cardData="cardData" style="margin-right: 5px;"></ShowCard>-->
-      <!--  <ShowCard :cardData="cardData"></ShowCard>-->
-      <!--</div>-->
-
-      <!-- 不要删除这个类 -->
-      <div class="home-container">
+      <!-- 卡片内容 不要删除这个类 -->
+      <div class="home-container" style="margin-top: 2px">
         <el-row :gutter="15" class="home-card-one mb15">
           <el-col
               :xs="24"
@@ -50,30 +43,30 @@
           </el-col>
         </el-row>
       </div>
-
+      <!-- 折线图 -->
       <el-card v-loading="loading" style="margin-top: -5px;">
         <div style="height: 350px;" ref="chartRefOne"></div>
       </el-card>
       <el-row :gutter="5" style="margin-top: 10px">
         <el-col :span="12">
-          <el-card>
+          <el-card v-loading="loading">
             <div style="height: 350px;" ref="chartRefAcos"></div>
           </el-card>
         </el-col>
         <el-col :span="12">
-          <el-card>
+          <el-card v-loading="loading">
             <div style="height: 350px;" ref="chartRefCPCandCTR"></div>
           </el-card>
         </el-col>
       </el-row>
       <el-row :gutter="5" style="margin-top: 10px">
         <el-col :span="12">
-          <el-card>
+          <el-card v-loading="loading">
             <div style="height: 350px;" ref="chartRefTotalPurchases"></div>
           </el-card>
         </el-col>
         <el-col :span="12">
-          <el-card>
+          <el-card v-loading="loading">
             <div style="height: 350px;" ref="chartRefImpandCli"></div>
           </el-card>
         </el-col>
@@ -85,18 +78,56 @@
 </template>
 
 <script lang="ts" setup>
-import {onBeforeMount, onMounted, provide, reactive, ref} from 'vue'
+import {onBeforeMount, onMounted, provide, reactive, ref, watch} from 'vue'
 import * as echarts from 'echarts'
 import {useShopInfo} from '/@/stores/shopInfo'
 import {usePublicData} from '/@/stores/publicData'
 import {storeToRefs} from 'pinia'
 import DateRangePicker from '/@/components/DateRangePicker/index.vue'
+import {createCrudOptions} from '/@/views/adManage/sp/targets/crud'
+import {useFs} from '@fast-crud/fast-crud'
+import {getTotalData} from '/@/views/adManage/ad-overview/api'
 
-const shopInfo = useShopInfo()
 const publicData = usePublicData()
 const {dateRange} = storeToRefs(publicData)
+const shopInfo = useShopInfo()
+const { profile } = storeToRefs(shopInfo)
 const tabActiveName = ref('Campaigns')
-provide('dateRange', dateRange)
+const queryParams = ref({
+  profileId: profile.value.profile_id,
+  dateRange
+})
+const {crudBinding, crudRef, crudExpose} = useFs({createCrudOptions, context: queryParams})
+
+
+// 发送请求获取数据
+let totalData = ref()
+async function setTotalData() {
+  try {
+    const data = await getTotalData({ startDate: dateRange.value[0], endDate: dateRange.value[1], profileId: queryParams.value.profileId })
+    totalData.value = data
+    console.log('totalData', data)
+  } catch (error) {
+    console.log('获取数据失败', error)
+  }
+}
+
+onMounted(async () => {
+  // crudExpose.doRefresh()
+  await setTotalData()
+})
+
+watch(queryParams, async() => {
+  try {
+    loading.value = true
+    await setChartOptions()
+    console.log('queryParams.value', queryParams.value)
+  } catch (error) {
+    console.log(error)
+  }
+
+}, {deep: true})
+
 
 // 卡片相关功能
 const state = reactive({
@@ -176,6 +207,7 @@ function changeCardData() {
 
 // 折线图相关功能
 const loading = ref(true)
+
 const chartRefOne = ref()
 let chartObjOne
 const option = {
@@ -244,7 +276,7 @@ const option = {
           colorStops: [{
             offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
           }, {
-            offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
           }],
@@ -274,7 +306,7 @@ const option = {
           colorStops: [{
             offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
           }, {
-            offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
           }],
@@ -345,7 +377,7 @@ const option2 = {
           colorStops: [{
             offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
           }, {
-            offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
           }],
@@ -424,7 +456,7 @@ const option3 = {
           colorStops: [{
             offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
           }, {
-            offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
           }],
@@ -451,7 +483,7 @@ const option3 = {
           colorStops: [{
             offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
           }, {
-            offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
           }],
@@ -522,7 +554,7 @@ const option4 = {
           colorStops: [{
             offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
           }, {
-            offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
           }],
@@ -601,7 +633,7 @@ const option5 = {
           colorStops: [{
             offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
           }, {
-            offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
           }],
@@ -628,7 +660,7 @@ const option5 = {
           colorStops: [{
             offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
           }, {
-            offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
+            offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
           }, {
             offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
           }],
@@ -639,15 +671,15 @@ const option5 = {
   ]
 }
 
-
-const initLine = async () => {
+function initLine() {
   chartObjOne = echarts.init(chartRefOne.value)
   chartObjAcos = echarts.init(chartRefAcos.value)
   chartObjCPCandCTR = echarts.init(chartRefCPCandCTR.value)
   chartObjTotalPurchases = echarts.init(chartRefTotalPurchases.value)
   chartObjImpandCli = echarts.init(chartRefImpandCli.value)
-  // const items = await getDataset()
-  // option.dataset.source = items
+}
+
+function setChartOptions() {
   chartObjOne.setOption(option)
   chartObjAcos.setOption(option2)
   chartObjCPCandCTR.setOption(option3)
@@ -666,6 +698,7 @@ function resizeChart() {
 
 onMounted(async () => {
   await initLine()
+  await setChartOptions()
   window.addEventListener('resize', resizeChart)  // 监听窗口大小变化,调整图表大小
   setTimeout(() => {
     resizeChart()

+ 1 - 1
src/views/adManage/sp/campaigns/chartComponents/adStruct.vue

@@ -248,7 +248,7 @@ onMounted(async () => {
 let allData = null
 
 async function setAdStructureData() {
-    allData = await getAdStructureData({ start: dateRange.value[0], end: dateRange.value[1], profile: shopInfo.profile.profile_id })
+    allData = await getAdStructureData({ startDate: dateRange.value[0], endDate: dateRange.value[1], profileId: shopInfo.profile.profile_id })
     console.log('allData.data', allData.data)
     return allData.data
 }