Browse Source

Merge branch 'master' into chart13.1

jwyu 2 years ago
parent
commit
92174a06b0

+ 4 - 0
src/api/cygx/api.js

@@ -33,6 +33,10 @@ export const RaiApi = {
   pageHistoryCopy: (params) => {
     return post("/config/pageHistory", params, 1);
   },
+  // 用户的文章活动,关注/取消关注产业
+  userIndustryFollow: (params) => {
+    return post("/industry/follow", params);
+  },
 };
 export const FreeButton = {
   /*获取是否展示免费试用按钮接口*/

+ 151 - 0
src/views/cygx/isTrackFollow.vue

@@ -0,0 +1,151 @@
+<template>
+  <div class="track-follow-page" v-if="isShowFollowButton">
+    <view class="container-track-follow">
+      <view>若对该赛道不感兴趣,可点击 </view>
+      <view class="cancel-follow" @click="isFollowHandler">{{ isFollowData ? "取消关注" : "已取消" }} </view>
+      <Icon name="warning-o" @click="followInfoHandler" size="16" color="#fff" />
+      <Icon class="close-follow" name="cross" @click="cancelFollowClick" size="16" color="#fff" />
+    </view>
+    <van-dialog v-model:show="show" closeOnClickOverlay :show-confirm-button="false" @cancel="onClickHide">
+      <view class="content-dialog">
+        <div class="close">
+          <Icon name="cross" color="#333" @click="onClickHide" />
+        </div>
+        <p class="tips">提示</p>
+        <p>取消关注后,该赛道下的更新内容都不会对您做消息推送,您也可以在【查研观向小助手】公众号菜单栏【推送规则】下修改您关注的赛道</p>
+        <div class="img-dlg">
+          <img @click="previewImage" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/follow_dialog.png" />
+        </div>
+      </view>
+    </van-dialog>
+  </div>
+</template>
+
+<script setup>
+import { reactive, onMounted, toRefs, ref } from "vue";
+import { Icon, Dialog, Toast } from "vant";
+import { RaiApi, FreeButton } from "@/api/cygx/api.js";
+const VanDialog = Dialog.Component;
+const props = defineProps({
+  isShowFollowButton: {
+    type: Boolean,
+    required: true,
+    default: false,
+  },
+  isFollowData: {
+    type: Boolean,
+    required: true,
+    default: false,
+  },
+  sourceId: {
+    type: Number,
+    required: true,
+    default: null,
+  },
+});
+const emits = defineEmits(["update:isShowFollowButton", "update:isFollowData"]);
+const show = ref(false);
+// 打开弹框
+const followInfoHandler = () => {
+  show.value = true;
+};
+// 取消或者添加关注
+const isFollowHandler = async () => {
+  const res = await RaiApi.userIndustryFollow({
+    SourceId: props.sourceId,
+    Source: "article",
+    DoType: props.isFollowData ? "cancel" : "add",
+  });
+  if (res.Ret === 200) {
+    emits("update:isFollowData", res.Data.Status == 1 ? true : false);
+  }
+  Toast(res.Msg);
+};
+// 关闭弹框
+const onClickHide = () => {
+  show.value = false;
+};
+// 预览图片
+const previewImage = () => {
+  wx.previewImage({
+    current: "https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/follow_dialog.png", // 当前显示图片的 http 链接
+    urls: ["https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/follow_dialog.png"], // 需要预览的图片 http 链接列表
+  });
+};
+// 关闭横幅
+const cancelFollowClick = () => {
+  emits("update:isShowFollowButton", false);
+};
+</script>
+
+<style scoped lang="scss">
+.track-follow-page {
+  position: relative;
+  width: calc(100% + 40px);
+  margin-left: -35px;
+  .container-track-follow {
+    position: relative;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 100%;
+    height: 60px;
+    padding-right: 30px;
+    background-color: #3385ff;
+    color: #fff;
+    .cancel-follow {
+      width: 136px;
+      height: 44px;
+      background-color: #fff;
+      color: #3385ff;
+      text-align: center;
+      line-height: 46px;
+      margin: 0 20px 0 15px;
+    }
+    .close-follow {
+      position: absolute;
+      top: 50%;
+      right: 20px;
+      transform: translateY(-50%);
+      width: 30px;
+      height: 30px;
+    }
+  }
+  .content-dialog {
+    position: relative;
+    font-size: 32px;
+    color: #666;
+    line-height: 40px;
+    .close {
+      width: 100%;
+      display: flex;
+      justify-content: flex-end;
+      height: 30px;
+      padding: 20px;
+      .van-icon-cross {
+        float: right;
+      }
+    }
+    p {
+      text-align: center;
+      padding: 0 20px;
+    }
+    .tips {
+      color: #333;
+      font-size: 34px;
+      font-weight: 500;
+      margin-bottom: 12px;
+    }
+    img {
+      width: 545px;
+      height: 579px;
+    }
+  }
+  .img-dlg {
+    margin: 35px 0 0;
+    display: flex;
+    align-content: center;
+    justify-content: center;
+  }
+}
+</style>

+ 8 - 2
src/views/cygx/raiReportDtl.vue

@@ -1,5 +1,6 @@
 <template>
   <div :class="['container-cygx', reportInfo.IsResearch && 'no-cv', reportInfo.IsSpecialArticle && 'container-cygx-bg']" v-show="haveData">
+    <trackForm v-model:isShowFollowButton="reportInfo.IsShowFollowButton" :sourceId="rerportId" v-model:isFollowData="reportInfo.IsFollowButton" />
     <div class="z-index-content" ref="contentBox">
       <div class="content-top">
         <div class="report-title">{{ reportInfo.Title }}</div>
@@ -105,6 +106,7 @@ import { useRouter, useRoute } from "vue-router";
 import { RaiApi, FreeButton } from "@/api/cygx/api.js";
 import { Icon, Dialog, Toast } from "vant";
 import dlg from "./dlg.vue";
+import trackForm from "./isTrackFollow.vue";
 const router = useRouter();
 const route = useRoute();
 const state = reactive({
@@ -117,6 +119,8 @@ const haveData = ref(false);
 const fileLink = ref(false);
 const showTips = ref(false);
 const contentBox = ref(null);
+const isSendWx = ref("");
+
 /* 访谈接口 */
 const interviewApi = () => {
   RaiApi.applyRpt({
@@ -328,6 +332,7 @@ const getReport = (id, token, type) => {
     RaiApi.reportDtl({
       ArticleId: id,
       Authorization: token,
+      IsSendWx:isSendWx.value
     }).then((res) => {
       if (res.Ret === 200) {
         haveData.value = res.Data.HasPermission === 1 ? true : false;
@@ -391,7 +396,8 @@ const lookDeeperReport = () => {
 
 onMounted(() => {
   if (route.query.id) {
-    rerportId.value = route.query.id;
+    rerportId.value = +route.query.id;
+    isSendWx.value = route.query.IsSendWx || "";
     from_type.value = route.query.fromType;
     let access_token = route.query.token || "";
     localStorage.setItem("access_token", access_token);
@@ -414,7 +420,7 @@ onMounted(() => {
   }
 });
 const { reportInfo, reportResearch } = toRefs(state);
-// url: raiReportDtl?id=3001&token=20ec44c7fe0e02ff597c324406ce49ca6d949c0acd34f8f3775e5b5edbf8c44e&fromType=mpwechat
+// url: raiReportDtl?id=3001&token=20ec44c7fe0e02ff597c324406ce49ca4b6b838e1988df75bd82084a6c0672fc&fromType=mpwechat
 </script>
 
 <style lang="scss">

+ 2 - 2
src/views/cygx/strategyReport.vue

@@ -24,8 +24,8 @@ onMounted(() => {
   padding-bottom: calc(100px + env(safe-area-inset-bottom));
   .strategy-iframe {
     width: 100%;
-    height: calc(100% + 130px);
-    margin-top: -130px;
+    height: calc(100% + 70px);
+    margin-top: -70px;
   }
 }
 .container-strategy-pc {

+ 17 - 14
src/views/hzyb/chart/Detail.vue

@@ -564,12 +564,11 @@ const commodityXData = ref([]);//商品价格图的x轴
 const commodityEdbList = ref([]);//商品价格图的表格数据 只用于取值
  /* 商品价格曲线获取详情赋值 */
 const initCommodityData = (data) => {
-    const { XEdbIdValue,YDataList,EdbInfoList,ChartInfo } = data;
+    const { XDataList,YDataList,EdbInfoList,ChartInfo } = data;
 
-    let xData = EdbInfoList.map(_ => _.EdbAliasName);
     commodityEdbList.value = EdbInfoList;
     commodityChartData.value = YDataList;
-    commodityXData.value = xData;
+    commodityXData.value = XDataList;
 
     hasLeftAxis.value=true;
     axisLimitData.leftMin=Number(ChartInfo.LeftMin)
@@ -586,7 +585,7 @@ const setCommodityChart = () => {
     //x轴
     let xAxis = {
         ...scatterXAxis,
-        categories: commodityXData.value,
+        categories: commodityXData.value.map(_ => _.Name),
         tickWidth: 1,
         title: {
             text:  ``,
@@ -646,14 +645,18 @@ const setCommodityChart = () => {
     let tooltip = {
         formatter: function() {
             const ctx = this;
-            let str = `<strong>${ commodityEdbList.value.find(_ => _.EdbAliasName === ctx.x).EdbName }</strong>`;
+            let str = '';
             ctx.points.forEach(item => {
-                let obj_item = data.find(_ => _.Name === item.series.name);
-                if(!obj_item.NoDataEdbList.includes(commodityEdbList.value.find(_ => _.EdbAliasName === ctx.x).EdbInfoId)) {
-                    str += `<br>${obj_item.Date}: ${item.y}`
-                }else {
-                    str += `<br>${obj_item.Date}: 无`
-                }
+              let obj_item = data.find(_ => _.Name === item.series.name);
+              let index = commodityXData.value.findIndex(_ => _.Name === ctx.x);
+
+              str+=`<b>${ commodityEdbList.value.find(_ => _.EdbInfoId === obj_item.XEdbInfoIdList[index]).EdbName }</b>`
+
+              if(!obj_item.NoDataEdbList.includes(obj_item.XEdbInfoIdList[index])) {
+                str += `<br><span style="color:${item.color}">\u25CF</span>${obj_item.Date}: ${item.y}<br>`
+              }else {
+                str += `<br><span style="color:${item.color}">\u25CF</span>${obj_item.Date}: 无<br>`
+              }
             })
             return str
         },
@@ -672,10 +675,10 @@ const setCommodityChart = () => {
 };
 /* 处理无效数据为null */
 const filterInvalidData = (item)=> {
-    let validateArr = commodityEdbList.value.filter(_ =>!item.NoDataEdbList.includes(_.EdbInfoId));
+    let validateArr = item.XEdbInfoIdList.filter(_ =>!item.NoDataEdbList.includes(_));
 
-    let first_index = commodityEdbList.value.findIndex(_ => _.EdbInfoId === validateArr[0].EdbInfoId);
-    let last_index = commodityEdbList.value.findIndex(_ => _.EdbInfoId === validateArr[validateArr.length-1].EdbInfoId);
+    let first_index = item.XEdbInfoIdList.findIndex(_ => _ === validateArr[0]);
+    let last_index = item.XEdbInfoIdList.findIndex(_ => _ === validateArr[validateArr.length-1]);
     console.log('first_index',first_index)
     console.log('last_index',last_index)