Explorar el Código

Merge branch 'master' into cpq-dev

chenlei1231 hace 5 meses
padre
commit
abff21945a

+ 44 - 76
src/views/adweb/data/trafficAnalysis.vue

@@ -3,15 +3,17 @@
     <!-- 站点选择和时间筛选 -->
     <a-row class="r1">
       <a-col :span="6">
-        <span class="t1">站点:</span>
-        <select-site @comMethods="changeSite" selectWidth="300px" />
+        <div class="choose-site">
+          <span class="t1">站点:</span>
+          <select-site @set-site-info="changeSite" select-width="100%" />
+        </div>
       </a-col>
-      <a-col :span="6">
+      <a-col :span="8">
         <span class="t1">统计时间:</span>
         <a-range-picker @change="onChangeDatePciker" :disabledDate="disabledDate" :value="rangeDate"
                         style="width:70%" />
       </a-col>
-      <a-col :span="12">
+      <a-col :span="10">
         <a-button :class="queryParam.dateType == '' ? 'active' : ''" @click="setTime('')">全部时间
         </a-button>
         <a-button :class="queryParam.dateType == 'thirtyDay' ? 'active' : ''"
@@ -194,16 +196,8 @@
                       {{ record.type.split("/")[1] }}
                     </a-popover>
                   </template>
-                  <template v-if="column.key === 'avgPageNumSlot' ">
-                    <span
-                      style="margin-left: 20px;"></span>{{ record.pageViewsPerSession * record.sessions
-                    }}
-                  </template>
-                  <template v-if="column.key === 'centerSlot' ">
-                    <span style="margin-left: 20px;">{{ text }}</span>
-                  </template>
                   <template v-if="column.key === 'avgSessionDurationSlot' ">
-                    <span style="margin-left: 30px;">{{ text }} s</span>
+                    <span style="margin-left: 30px;">{{ record.avgSessionDuration }} s</span>
                   </template>
                 </template>
 
@@ -255,14 +249,14 @@
 <script lang="ts" name="data-trafficAnalysis" setup>
 import selectSite from "@/components/Adweb/selectSite.vue";
 import areaChart from "./chart/areaChart.vue";
-import { reactive, ref, watch } from "vue";
+import { onMounted, reactive, ref, watch } from "vue";
 import { getAction } from "@/api/manage/manage";
 import moment from "moment";
 import MapAdweb from "@/components/chart/mapAdweb.vue";
 
-const siteList = ref([]);
-const selectSiteInfo = ref({});
 const queryParam = reactive<any>({});
+queryParam.limit = 10;
+queryParam.siteCode = localStorage.getItem("siteCode");
 const loading = ref(false);
 const chartheight = ref(400);
 const chartDetailDataCol = ref([
@@ -291,12 +285,14 @@ const chartDetailDataCol = ref([
 const mediaListColumns = ref([
   {
     title: "来源",
+    key: "typeSlotFirst",
     scopedSlots: {
       customRender: "typeSlotFirst"
     }
   },
   {
     title: "媒介",
+    key: "typeSlotLast",
     scopedSlots: {
       filterDropdown: "filterDropdown",
       filterIcon: "filterIcon",
@@ -305,54 +301,39 @@ const mediaListColumns = ref([
   },
   {
     title: "访客数(UV)",
-    dataIndex: "users",
-    defaultSortOrder: "descend",
-    sorter: (a, b) => a.users - b.users,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
+    dataIndex: "totalUsers",
   },
   {
     title: "占比",
-    dataIndex: "userProportion"
+    dataIndex: "totalUsersProportion"
   },
   {
     title: "新访客数",
     dataIndex: "newUsers",
-    sortDirections: ["descend", "ascend"],
-    sorter: (a, b) => a.newUsers - b.newUsers,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
   },
   {
     title: "新客占比",
-    customRender: function(text, record, index) {
-      return (record.newUsers * 100 / record.users).toFixed(2) + " %";
-    }
+    dataIndex: "newUsersRatio"
   },
   {
     title: "浏览量(PV)",
-    scopedSlots: {
-      customRender: "avgPageNumSlot"
-    }
+    dataIndex: "pageViews",
   },
   {
     title: "平均访问页面数",
     dataIndex: "pageViewsPerSession",
-    sortDirections: ["descend", "ascend"],
-    sorter: (a, b) => a.pageviewsPerSession - b.pageviewsPerSession,
-    scopedSlots: {
-      customRender: "centerSlot"
-    }
+  },
+  {
+    title: "会话数",
+    dataIndex: "sessions",
   },
   {
     title: "平均会话时长",
-    dataIndex: "avgSessionDuration",
-    sortDirections: ["descend", "ascend"],
+    key: "avgSessionDurationSlot",
+    sortDirections: ['descend', 'ascend'],
     sorter: (a, b) => a.avgSessionDuration - b.avgSessionDuration,
     scopedSlots: {
-      customRender: "avgSessionDurationSlot"
+      customRender: 'avgSessionDurationSlot',
     }
   }
 ]);
@@ -378,7 +359,7 @@ const mostAccessColumns = ref([
   },
   {
     title: "浏览量占比",
-    dataIndex: "accessProportion",
+    dataIndex: "pvProportion",
     width: 160,
     scopedSlots: {
       customRender: "centerSlot"
@@ -395,20 +376,15 @@ const mostAccessColumns = ref([
   // },
 ]);
 
-function changeSite(value, e) {
-  selectSiteInfo.value = e.data.attrs.info;
-  queryParam.siteId = selectSiteInfo.id;
-  reloadData(queryParam.siteId);
+function changeSite(selectedSiteInfo: any) {
+  queryParam.siteCode = selectedSiteInfo.code;
+  localStorage.setItem("siteCode", queryParam.siteCode);
+  reloadData();
 }
 
 //重新刷新页面数据
-function reloadData(value) {
+function reloadData() {
   loading.value = true;
-  for (let i in siteList.value) {
-    if (value === siteList[i].id) {
-      localStorage.setItem("siteCode", siteList[i].code);
-    }
-  }
   getFlowIndexNumber();
   getCountryMapData();
   getMediaList();
@@ -504,7 +480,7 @@ const mediaDatasource = ref([]);
 //来源媒介列表、最多访问top10列表
 const getMediaList = async () => {
   try {
-    const res = await getAction("/datacenter/sourcemedia/list", queryParam);
+    const res = await getAction("/ga-data/source-medium/stats", queryParam);
     if (res.code == 200) {
       mediaDatasource.value = res.result;
     } else {
@@ -519,7 +495,8 @@ const mostAccessDatasource = ref([]);
 //
 const getMostAccessList = async () => {
   try {
-    const res = await getAction("/datacenter/mostaccess/list", queryParam);
+    const res = await getAction("/ga-data/page-path/stats", queryParam);
+    console.log("res", res);
     if (res.code == 200) {
       mostAccessDatasource.value = res.result;
     } else {
@@ -538,7 +515,7 @@ const onChangeDatePciker = (date, dateString) => {
     queryParam.value.start = dateString[0];
     queryParam.value.end = dateString[1];
     queryParam.value.dateType = undefined;
-    reloadData(queryParam.siteId);
+    reloadData();
   }
 };
 
@@ -564,13 +541,17 @@ const setTime = (time) => {
     rangeDate.value = [moment(), moment()];
   }
 
-  reloadData(queryParam.siteId);
+  reloadData();
 };
 
 // 监听queryParam的变化,当它变化时重新加载数据
-watch(queryParam, (newValue, oldValue) => {
-  reloadData(queryParam.siteId);
-});
+// watch(queryParam, (newValue, oldValue) => {
+//   reloadData();
+// });
+
+// onMounted(() => {
+//   reloadData();
+// });
 </script>
 
 <style lang="less" scoped>
@@ -614,32 +595,19 @@ watch(queryParam, (newValue, oldValue) => {
 
 .r1 {
   margin: 20px;
-  display: flex;
-
-  /deep/ .ant-select-selection {
-    background: transparent;
-  }
-
-  /deep/ .ant-select-selection__clear {
-    background: transparent;
-  }
-
-  /deep/ i, /deep/ .ant-calendar-range-picker-separator {
+  .choose-site {
+    display: flex;
   }
 
-
   .t1 {
     font-size: 18px;
   }
 
   .ant-calendar-picker {
     margin-right: 20px;
-
-    /deep/ .ant-input {
-      background: transparent;
-    }
   }
 
+
   /deep/ .ant-btn {
     background: transparent;
     margin-right: 10px;

+ 0 - 26
src/views/adweb/keywords/SeoKeywords.data.ts

@@ -54,32 +54,6 @@ export const columns: BasicColumn[] = [
 //查询数据
 export const searchFormSchema: FormSchema[] = [
   {
-    label: "站点",
-    field: 'siteCode',
-    component: 'ApiSelect',
-    componentProps: {
-      //multiple: 多选;不填写为单选
-      mode: '',
-      //请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
-      api: ()=> defHttp.get({ url: '/seo/seoKeywordsRank/getAllSites' }),
-      //数值转成String
-      numberToString: false,
-      //标题字段
-      labelField: 'name',
-      //值字段
-      valueField: 'code',
-      //是否为搜索模式
-      showSearch: true,
-      allowClear: false,
-      defaultValue: localStorage.getItem('siteCode'),
-      //请求参数
-      params:{},
-      // value:localStorage.getItem('siteCode') !== null?localStorage.getItem('siteCode'):'',
-      //返回结果字段
-      resultField:'result'
-    },
-  },
-  {
     label: "关键词",
     field: 'keywords',
     component: 'Input',

+ 55 - 165
src/views/adweb/keywords/SeoKeywordsList.vue

@@ -1,5 +1,36 @@
 <template>
   <div>
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-row class="r1">
+        <a-col :span="8">
+          <div class="choose-site">
+            <span class="t1">站点:</span>
+            <select-site @set-site-info="changeSite" select-width="100%"/>
+          </div>
+        </a-col>
+        <!--          <a-col span="8">-->
+        <!--            <span class="t1">套餐:</span>-->
+        <!--              <a-select-->
+        <!--                placeholder="请选择套餐"-->
+        <!--                @change="changeSeoPlans"-->
+        <!--                v-model="queryParam.historyId">-->
+        <!--                <a-select-option-->
+        <!--                  v-for="(data,index) in planList"-->
+        <!--                  :key="index"-->
+        <!--                  :value="data.subscriptionId"-->
+        <!--                >-->
+        <!--                  {{ data.planName }}-->
+        <!--                </a-select-option>-->
+        <!--              </a-select>-->
+        <!--          </a-col>-->
+        <!--          <a-col span="8" v-if=" marketPlanInfo.domain !== null">-->
+        <!--            <span class="t1">域名:</span>-->
+        <!--              {{ marketPlanInfo.domain }}-->
+        <!--          </a-col>-->
+      </a-row>
+    </div>
+    <!-- 查询区域-END -->
     <!--引用表格-->
     <BasicTable @register="registerTable" :rowSelection="rowSelection">
       <!--插槽:table标题-->
@@ -91,14 +122,10 @@ import { useListPage } from "/@/hooks/system/useListPage";
 import SeoKeywordsModal from "./components/SeoKeywordsModal.vue";
 import { columns, searchFormSchema, superQuerySchema } from "./SeoKeywords.data";
 import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from "./SeoKeywords.api";
-import { downloadFile } from "/@/utils/common/renderUtils";
-import { useUserStore } from "/@/store/modules/user";
-import { getAllSites } from "@/views/adweb/seo/SeoKeywordsRank.api";
-import { getAction } from "@/api/manage/manage";
+import SelectSite from "@/components/Adweb/selectSite.vue";
 
 const queryParam = reactive<any>({});
-const checkedKeys = ref<Array<string | number>>([]);
-const userStore = useUserStore();
+queryParam.siteCode = localStorage.getItem('siteCode')!;
 //注册model
 const [registerModal, { openModal }] = useModal();
 //注册table数据
@@ -137,71 +164,6 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
 
 const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
 
-const siteinfo = ref([]);
-
-const selectSiteInfo = ref({});
-
-const modalVisible = ref(false);
-
-const modalTitle = ref("");
-
-const addSeoKeywordStatus = ref(false);
-
-const addSeoKeywordResStatus = ref(false);
-
-const tipTitle = ref("");
-
-const spinning = ref(false);
-
-const seoRepeatKeywords = ref([]);
-
-const keywordType = ref(1);
-
-const formItemLayout = ref( {
-  labelCol: {
-    xs: { span: 24 },
-    sm: { span: 4 }
-  },
-  wrapperCol: {
-    xs: { span: 24 },
-    sm: { span: 20 }
-  }
-})
-
-const formItemLayoutWithOutLabel = ref({
-  wrapperCol: {
-    xs: { span: 24, offset: 0 },
-    sm: { span: 20, offset: 4 }
-  }
-})
-
-const dynamicValidateForm = ref({
-  domains: [
-    {
-      key: 1621308099985,
-      value: ''
-    },
-    {
-      key: 1621308099986,
-      value: ''
-    },
-    {
-      key: 1621308099987,
-      value: ''
-    }
-  ]
-})
-
-/**
- * 高级查询事件
- */
-function handleSuperQuery(params) {
-  Object.keys(params).map((k) => {
-    queryParam[k] = params[k];
-  });
-  reload();
-}
-
 /**
  * 新增事件
  */
@@ -273,9 +235,6 @@ function getTableAction(record) {
 function getDropDownAction(record) {
   return [
     {
-      label: "趋势",
-      onClick: handleDetail.bind(null, record)
-    }, {
       label: "删除",
       popConfirm: {
         title: "是否确认删除",
@@ -289,10 +248,10 @@ function getDropDownAction(record) {
 function onPriorityChange($event, id) {
   // postAction('/serp/seoKeywords/changePriority' + '?id=' + id + '&value=' + $event.target.value).then(function(res) {
   //   if (res.code === 200) {
-  //     that.$message.success('优先级更改成功!')
-  //     that.loadData()
+  //     $message.success('优先级更改成功!')
+  //     loadData()
   //   } else {
-  //     that.$message.error('优先级更改失败!')
+  //     $message.error('优先级更改失败!')
   //     return
   //   }
   // })
@@ -302,111 +261,42 @@ function onPriorityChange($event, id) {
 function onchange($event, id) {
 
   // let that = this
-  // postAction(that.url.changeTypeUrl + '?id=' + id + '&type=' + $event.target.value).then(function(res) {
+  // postAction(url.changeTypeUrl + '?id=' + id + '&type=' + $event.target.value).then(function(res) {
   //   if (res.code === 200) {
-  //     that.$message.success('关键词类型更改成功!')
-  //     that.loadData()
+  //     $message.success('关键词类型更改成功!')
+  //     loadData()
   //   } else {
-  //     that.$message.error(res.message)
+  //     $message.error(res.message)
   //     return
   //   }
   // })
 }
 
 //切换站点
-function changeSite(value, e) {
-  getSiteInfo();
-  selectSiteInfo.value = e.info;
-  // siteCode.value = value
-  // keywords.value = ''
-  localStorage.setItem("siteCode", value);
-}
-
-//先执行获取site信息,只有在获取到siteCode之后,才能执行以下方法
-function getSiteInfo() {
-  getAllSites().then((res) => {
-    siteinfo.value = res;
-    if (res.length > 0) {
-      let isInSite = false;
-      for (let i in res) {
-        if (localStorage.getItem("siteCode") !== null && res[i].code === localStorage.getItem("siteCode")) {
-          isInSite = true;
-          selectSiteInfo.value = res[i];
-        }
-      }
-      if (localStorage.getItem("siteCode") !== null && isInSite) {
-        // siteCode.value = localStorage.getItem('siteCode')
-      } else {
-        // siteCode.value = res[0].code
-        selectSiteInfo.value = res[0];
-        localStorage.setItem("siteCode", res[0].code);
-      }
-    }
-  });
+function changeSite(selectedSiteInfo: any) {
+  queryParam.siteCode = selectedSiteInfo.code;
+  handleSuccess()
 }
 
 //下载模板
 function downloadTemplate() {
   return window.open("/adwebv21/uploadDemo/关键词导入模版表.xlsx", "_self");
 }
+</script>
 
-function handleAddSeo() {
-  modalVisible.value = true;
-  modalTitle.value = "新增SEO关键词";
-  addSeoKeywordStatus.value = true;
-}
-
-function handleCancel() {
-
-}
-
-function handleRepeat(rule, value, callback) {
-  // let seoDatas = dynamicValidateForm.value.domains
-  // let getSeoKeywordUrl = `/seo/seoKeywords/getSeoKeyword` + '?siteCode=' + seoKeywordsForm.userFlag + '&keywords=' + value + '&historyId=' + queryParam.historyId
-  // getAction(getSeoKeywordUrl).then(function(res) {
-  //   // console.log(res)
-  //   if (res.code == 200) {
-  //     if (res.result) {
-  //       let resArr = seoDatas.filter(item => {
-  //         return item.value === value
-  //       })
-  //       // console.log("resArr", resArr)
-  //       if (resArr.length > 1) {
-  //         if (value && resArr[0].value) {
-  //           if (resArr[0].value === value) {
-  //             callback('SEO关键词重复')
-  //             return false
-  //           }
-  //           callback()
-  //         }
-  //       } else {
-  //         callback()
-  //       }
-  //     } else {
-  //       callback('SEO关键词已存在!')
-  //     }
-  //   }
-  // }).catch(function(err) {
-  //   console.log(err)
-  // })
-}
+<style scoped>
+.r1 {
+  margin: 20px;
+  .choose-site {
+    display: flex;
+  }
 
-function removeSeoKeywords(item) {
-  let index = dynamicValidateForm.value.domains.indexOf(item)
-  if (index !== -1) {
-    dynamicValidateForm.value.domains.splice(index, 1)
+  .t1 {
+    font-size: 18px;
   }
-}
-function addSeoKeywords() {
-  dynamicValidateForm.value.domains.push({
-    value: '',
-    key: Date.now()
-  })
-}
-</script>
 
-<style scoped>
-:deep(.ant-picker), :deep(.ant-input-number) {
-  width: 100%;
+  .ant-calendar-picker {
+    margin-right: 20px;
+  }
 }
 </style>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 379 - 337
src/views/adweb/seo/SeoKeywordsRankList.vue


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio