Sfoglia il codice sorgente

Merge branch 'yb9.3'

jwyu 2 anni fa
parent
commit
5abd36f714

+ 20 - 1
src/api/hzyb/user.js

@@ -19,6 +19,25 @@ export const apiUserInfo=(params)=>{
  * @param source_agent 来源平台:1:小程序、2:pc
  * @param from_page 来源页面: '活动列表'、'活动详情'等
  */
- export const apiApplyPermission=params=>{
+export const apiApplyPermission=params=>{
 	return post('/user/apply',{...params,source_agent:1})
+}
+
+/**
+ * 收藏
+ * @param collection_type 收藏类型:1-研报; 2-视频社区; 3-微路演视频
+ * @param primary_id //收藏类型主ID(如报告id,视频id)
+ * @param extend_id //扩展ID-如研报章节ID
+ * @param source_agent //操作来源:1-小程序 2-小程序 PC 3-弘则研究公众号 4-Web PC
+ */
+export const apiSetCollect=params=>{
+	return post('/collection/collect',{source_agent:1,...params})
+}
+
+/**
+ * 取消收藏
+ * @param collection_id 收藏ID
+ */
+export const apiCancelCollect=params=>{
+	return post('/collection/cancel',params)
 }

BIN
src/assets/hzyb/collect-icon-s.png


BIN
src/assets/hzyb/collect-icon.png


+ 4 - 1
src/views/hzyb/chart/Detail.vue

@@ -1395,13 +1395,16 @@ const posterParams=computed(()=>{
             </div>
             <img class="icon" src="../../../assets/hzyb/chart/search.png" alt="" @click="handleGoSearch">
             <share-poster 
+                :isSlot="true"
                 :shareData="{
                     type:'chart_detail',
                     code_scene:code_scene,
                     code_page:'pages-chart/chartDetail',
                     data:posterParams
                 }"
-            ></share-poster>
+            >
+                <img class="icon" src="@/assets/hzyb/share-poster-chart-icon.png" alt="">
+            </share-poster>
             <img class="icon" src="../../../assets/hzyb/chart/save.png" alt="" @click="handleSaveChart" v-if="canSave">
             <img class="icon" src="../../../assets/hzyb/chart/refresh.png" alt="" @click="handleRefreshChart">
         </div>

+ 13 - 3
src/views/hzyb/components/SharePoster.vue

@@ -4,7 +4,11 @@ import {apiGetPoster} from '@/api/hzyb/common'
 
 const props=defineProps({
     style:Object,
-    shareData:Object
+    shareData:Object,
+    isSlot:{
+        type:Boolean,
+        default:false
+    }
 })
 
 let show=ref(false)
@@ -33,8 +37,14 @@ const handleCreatePoster=async ()=>{
 
 <template>
     <div class="share-poster-wrap" @touchmove.prevent>
-        <img @click="handleCreatePoster" class="chart-icon" src="@/assets/hzyb/share-poster-chart-icon.png" alt="" v-if="props.shareData.type=='chart_detail'">
-        <img v-else @click="handleCreatePoster" :style="props.style" class="share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
+        <div @click="handleCreatePoster">
+            <template v-if="props.isSlot">
+                <slot></slot>
+            </template>
+            <img v-else @click="handleCreatePoster" :style="props.style" class="share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
+        </div>
+        <!-- <img @click="handleCreatePoster" class="chart-icon" src="@/assets/hzyb/share-poster-chart-icon.png" alt="" v-if="props.shareData.type=='chart_detail'">
+        <img v-else @click="handleCreatePoster" :style="props.style" class="share-icon" src="@/assets/hzyb/share-poster-icon.png"/> -->
 
         <div class="poster-mask" v-if="show||showPoster" @click="showPoster=false" @touchmove.prevent></div>
         <div class="loading-box" v-if="show">

+ 87 - 35
src/views/hzyb/report/ChapterDetail.vue

@@ -18,7 +18,6 @@
             <span style="color: #e3b377; margin-left: 20px" @click="showDisclaimers = true">免责声明</span>
           </div>
         </div>
-        <img class="ppt-icon" style="bottom:185px" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
       </div>
       <div class="rich-content" ref="richConBox">
         <div v-if="info.auth_ok">
@@ -76,9 +75,6 @@
       />
     </div>
 
-    <!-- 返回顶部 -->
-    <img v-if="showToTop&&info.auth_ok" @click="handleBackTop" class="back-top-img" src="@/assets/hzyb/report/back-top.png" mode="aspectFill"/>
-
     <!-- 免责声明 -->
     <van-popup :show="showDisclaimers" @close="showDisclaimers = false" round closeable>
       <div class="disclaimers-box">
@@ -106,19 +102,31 @@
         </div>
     </van-popup>
 
-    <!-- 分享海报 -->
-    <Teleport to="body">
-    <SharePoster
-      :style="{bottom:'125px'}" 
-      :shareData="{
-        type:'report_detail',
-        code_page:'pages-report/chapterDetail',
-        code_scene:code_scene,
-        data:posterParams
-      }" 
-      v-if="info.auth_ok"
-    ></SharePoster>
-    </Teleport>
+    <!-- 右侧悬浮操作栏 -->
+    <div class="right-fix-box">
+      <!-- 收藏 -->
+      <img v-if="info.auth_ok" @click="handleCollect" class="item collect-icon" :src="info.collection_id>0?collectIcons:collectIcon" alt="">
+      <!-- ppt -->
+      <img class="item ppt-icon" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
+      <!-- 分享海报 -->
+      <SharePoster 
+        v-if="info.auth_ok"
+        :isSlot="true"
+        :shareData="{
+          type:'report_detail',
+          code_page:'pages-report/chapterDetail',
+          code_scene:code_scene,
+          data:posterParams
+        }"
+      >
+        <img class="item share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
+      </SharePoster>
+      <!-- 返回顶部 -->
+      <div class="item back-top-img">
+        <img v-if="showToTop&&info.auth_ok" @click="handleBackTop" class="back-top-img" src="@/assets/hzyb/report/back-top.png" mode="aspectFill"/>
+      </div>
+    </div>
+
   </div>
 </van-pull-refresh>
 </template>
@@ -130,12 +138,14 @@ import 'moment/dist/locale/zh-cn'
 moment.locale('zh-cn')
 
 import {apiChapterDetail,apiChapterTickerValue,apiRddpShareImg,apiReportPPtImgs} from '@/api/hzyb/report'
-import {apiApplyPermission,apiUserInfo} from '@/api/hzyb/user'
-import {Popup,Image as VanImage,PullRefresh,Col, Row,Dialog} from 'vant'
+import {apiApplyPermission,apiUserInfo,apiSetCollect,apiCancelCollect} from '@/api/hzyb/user'
+import {Popup,Image as VanImage,PullRefresh,Col, Row,Dialog,Toast} from 'vant'
 import AudioBox from './components/AudioBox.vue'
 import SharePoster from '../components/SharePoster.vue'
 import _ from 'lodash';
 import LeaveMessage from '../components/leaveMessage/index.vue'
+import collectIcon from '@/assets/hzyb/collect-icon.png'
+import collectIcons from '@/assets/hzyb/collect-icon-s.png'
 export default {
   components:{
     [Popup.name]:Popup,
@@ -196,6 +206,9 @@ export default {
 
       userInfo:null,
       shareData:{},//分享的数据传给ppt页
+
+      collectIcon,
+      collectIcons
     };
   },
   beforeCreate(){
@@ -538,6 +551,31 @@ export default {
       setTimeout(() => {
         this.loading=false
       }, 1500);
+    },
+
+    // 收藏
+    handleCollect(){
+            if(this.info.collection_id>0){
+                apiCancelCollect({
+                    collection_id:Number(this.info.collection_id)
+                }).then(res=>{
+                    if(res.code===200){
+                        Toast('取消收藏!')
+                        this.info.collection_id=0
+                    }
+                })
+            }else{
+                apiSetCollect({
+                    collection_type:1,
+                    primary_id:Number(this.info.report_chapter_item.report_id),
+                    extend_id:Number(this.chapterId)
+                }).then(res=>{
+                    if(res.code===200){
+                        Toast('收藏成功!')
+                        this.info.collection_id=res.data
+                    }
+                })
+            }
     }
 
   },
@@ -621,14 +659,6 @@ export default {
             margin-bottom: 20px;
             line-height: 1.5;
         }
-        .ppt-icon{
-            position: fixed;
-            bottom: 250px;
-            right: 34px;
-            width: 100px;
-            height: 100px;
-            z-index: 50;
-        }
     }
 
     .disclaimers-box{
@@ -687,14 +717,6 @@ export default {
       }
     }
 
-    .back-top-img{
-        position: fixed;
-        z-index: 99;
-        width: 100px;
-        height: 100px;
-        right: 34px;
-        bottom: 130px;
-    }
     .chapter-list-wrap {
     background-color: #f5f6fa;
     padding: 34px;
@@ -826,5 +848,35 @@ export default {
     }
   }
 
+  .right-fix-box{
+        position: fixed;
+        z-index: 99;
+        right: 34px;
+        bottom: 130px;
+        .item{
+            margin-top: 10px;
+        }
+        .back-top-img{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .share-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .ppt-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .collect-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+  }
+
 }
 </style>

+ 86 - 36
src/views/hzyb/report/Detail.vue

@@ -63,7 +63,6 @@
                         <span style="color:#E3B377;margin-left:20px" @click="showDisclaimers=true">免责声明</span>
                     </div>
                 </div>
-                <img class="ppt-icon" style="bottom:185px" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
             </div>
 
             <div class="rich-content" style="position: relative;" ref="richConBox">
@@ -88,22 +87,30 @@
                 </div>
             </div>
 
-            <!-- 返回顶部 -->
-            <img v-if="showToTop&&info.auth_ok" @click="handleBackTop" class="back-top-img" src="@/assets/hzyb/report/back-top.png" mode="aspectFill"/>
-
-            <!-- 分享海报 -->
-            <Teleport to="body">
-            <SharePoster 
-                :style="{bottom:'125px'}" 
-                :shareData="{
-                    type:'report_detail',
-                    code_page:'pages-report/reportDetail',
-                    code_scene:code_scene,
-                    data:posterParams
-                }"
-                v-if="info.auth_ok"
-            ></SharePoster>
-            </Teleport>
+            <!-- 右侧悬浮操作栏 -->
+            <div class="right-fix-box">
+                <!-- 收藏 -->
+                <img v-if="info.auth_ok" @click="handleCollect" class="item collect-icon" :src="info.collection_id>0?collectIcons:collectIcon" alt="">
+                <!-- ppt -->
+                <img class="item ppt-icon" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
+                <!-- 分享海报 -->
+                <SharePoster 
+                    v-if="info.auth_ok"
+                    :isSlot="true"
+                    :shareData="{
+                        type:'report_detail',
+                        code_page:'pages-report/reportDetail',
+                        code_scene:code_scene,
+                        data:posterParams
+                    }"
+                >
+                    <img class="item share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
+                </SharePoster>
+                <!-- 返回顶部 -->
+                <div class="item back-top-img">
+                    <img v-show="showToTop&&info.auth_ok" @click="handleBackTop" class="back-top-img" src="@/assets/hzyb/report/back-top.png"/>
+                </div>
+            </div>
         </div>
         
         <!-- 留言点赞模块 -->
@@ -148,12 +155,14 @@ import 'moment/dist/locale/zh-cn'
 moment.locale('zh-cn')
 
 import {apiReportDetail,apiRddpShareImg,apiReportPPtImgs} from '@/api/hzyb/report'
-import {apiApplyPermission,apiUserInfo} from '@/api/hzyb/user'
-import {Popup,Image as VanImage,PullRefresh,Dialog} from 'vant'
+import {apiApplyPermission,apiUserInfo,apiSetCollect,apiCancelCollect} from '@/api/hzyb/user'
+import {Popup,Image as VanImage,PullRefresh,Dialog, Toast} from 'vant'
 import AudioBox from './components/AudioBox.vue'
 import SharePoster from '../components/SharePoster.vue'
 import _ from 'lodash';
 import LeaveMessage from '../components/leaveMessage/index.vue'
+import collectIcon from '@/assets/hzyb/collect-icon.png'
+import collectIcons from '@/assets/hzyb/collect-icon-s.png'
 export default {
     components:{
         [Popup.name]:Popup,
@@ -205,6 +214,9 @@ export default {
 
             userInfo:null,
             shareData:{},//分享的数据传给ppt页
+
+            collectIcon,
+            collectIcons
         }
     },
     beforeCreate(){
@@ -563,6 +575,31 @@ export default {
             }else{
                 return "#009fe6";
             }
+        },
+
+        // 收藏
+        handleCollect(){
+            if(this.info.collection_id>0){
+                apiCancelCollect({
+                    collection_id:Number(this.info.collection_id)
+                }).then(res=>{
+                    if(res.code===200){
+                        Toast('取消收藏!')
+                        this.info.collection_id=0
+                    }
+                })
+            }else{
+                apiSetCollect({
+                    collection_type:1,
+                    primary_id:Number(this.reportId),
+                    extend_id:0
+                }).then(res=>{
+                    if(res.code===200){
+                        Toast('收藏成功!')
+                        this.info.collection_id=res.data
+                    }
+                })
+            }
         }
     }
 }
@@ -662,14 +699,6 @@ export default {
             margin-bottom: 20px;
             line-height: 1.5;
         }
-        .ppt-icon{
-            position: fixed;
-            bottom: 250px;
-            right: 34px;
-            width: 100px;
-            height: 100px;
-            z-index: 50;
-        }
     }
 
     .disclaimers-box{
@@ -728,15 +757,6 @@ export default {
       }
     }
 
-    .back-top-img{
-        position: fixed;
-        z-index: 99;
-        width: 100px;
-        height: 100px;
-        right: 34px;
-        bottom: 130px;
-    }
-
     .chapter-list-wrap{
         .top-box{
             height: 418px;
@@ -849,5 +869,35 @@ export default {
             }
         }
     }
+
+    .right-fix-box{
+        position: fixed;
+        z-index: 99;
+        right: 34px;
+        bottom: 130px;
+        .item{
+            margin-top: 10px;
+        }
+        .back-top-img{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .share-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .ppt-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+        .collect-icon{
+            width: 100px;
+            height: 100px;
+            display: block;
+        }
+    }
 }
 </style>