소스 검색

研报报告详情分享修改

jwyu 2 년 전
부모
커밋
d535415021
5개의 변경된 파일73개의 추가작업 그리고 29개의 파일을 삭제
  1. 1 1
      .env.development
  2. 1 1
      .env.test
  3. 4 3
      src/api/hzyb/report.js
  4. 22 4
      src/views/hzyb/report/ChapterDetail.vue
  5. 45 20
      src/views/hzyb/report/Detail.vue

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
-VITE_APP_BASE_URL="/xcx_h5"
+VITE_APP_BASE_URL="/xcx_h5/"
 VITE_APP_OUTDIR="raiwechat_link_h5"
 
 VITE_APP_CYGX_BASEAPIURL="http://8.136.199.33:8500/api"

+ 1 - 1
.env.test

@@ -1,4 +1,4 @@
-VITE_APP_BASE_URL="/xcx_h5"
+VITE_APP_BASE_URL="/xcx_h5/"
 VITE_APP_OUTDIR="raiwechat_link_h5"
 
 VITE_APP_CYGX_BASEAPIURL="http://8.136.199.33:8500/api"

+ 4 - 3
src/api/hzyb/report.js

@@ -37,9 +37,10 @@ export const apiChapterTickerValue=params=>{
 }
 
 /**
- * 日度点评分享图片
- * @param title
+ * 报告详情分享图片
+ * @param source (目前写死的)rddp_share_img
+ * @param pars json字符串类型参数{title:图片上的富文本,time_format:时间(没啥用),background_img:背景图}
  */
 export const apiRddpShareImg=params=>{
-    return post('/report/detail/rddp_share_img',params)
+    return post('/report/detail/rddp_share_img',{source:'rddp_share_img',...params})
 }

+ 22 - 4
src/views/hzyb/report/ChapterDetail.vue

@@ -130,7 +130,7 @@ import moment from 'moment'
 import 'moment/dist/locale/zh-cn'
 moment.locale('zh-cn')
 
-import {apiChapterDetail,apiChapterTickerValue} from '@/api/hzyb/report'
+import {apiChapterDetail,apiChapterTickerValue,apiRddpShareImg} from '@/api/hzyb/report'
 import {apiApplyPermission} from '@/api/hzyb/user'
 import {Popup,Image as VanImage,PullRefresh,Col, Row} from 'vant'
 import AudioBox from './components/AudioBox.vue'
@@ -274,12 +274,30 @@ export default {
         this.title=`【第${res.data.report_chapter_item.stage}期 | ${res.data.report_chapter_item.classify_name_first} | ${res.data.report_chapter_item.type_name}】${res.data.report_chapter_item.title}(${moment(res.data.report_chapter_item.publish_time).format('MMDD')})`
 
         //向小程序发送分享数据
-        //处理分享标题
-        const shareTitle=`【${res.data.report_chapter_item.classify_name_first} | ${res.data.report_chapter_item.type_name}】${res.data.report_chapter_item.title}(${moment(res.data.report_chapter_item.publish_time).format('MMDD')})`
+        let shareTitle='',shareImg='',imgText='';
+        const shareTime=moment(res.data.report_chapter_item.publish_time).format('MMDD')
+        if(res.data.report_chapter_item.abstract){
+          shareTitle=res.data.report_chapter_item.abstract
+          imgText=`第${res.data.report_chapter_item.stage}期 | ${res.data.report_chapter_item.title}(${shareTime})`
+        }else{
+          shareTitle=res.data.report_chapter_item.title
+          imgText=`<div style="font-size:50px">${moment(res.data.report_chapter_item.publish_time).format('YYYY/MM/DD')}</div><div>第${res.data.report_chapter_item.stage}期 | ${res.data.report_chapter_item.classify_name_first} | ${res.data.report_chapter_item.type_name} </div>`
+        }
+        const rddpImgRes=await apiRddpShareImg({
+            pars:JSON.stringify({
+                title:imgText,
+                time_format:moment(res.data.report_chapter_item.publish_time).format('YYYY/MM/DD'),
+                background_img:res.data.report_chapter_item.share_bg_img
+            })
+        })
+        if(rddpImgRes.code===200){
+            shareImg=rddpImgRes.data
+        }
         wx.miniProgram.postMessage({ 
           data: {
             title:shareTitle,
-            chapterId:this.chapterId
+            chapterId:this.chapterId,
+            shareImg:shareImg
           } 
         });
       }

+ 45 - 20
src/views/hzyb/report/Detail.vue

@@ -291,32 +291,57 @@ export default {
                 //处理分享标题
                 let shareTitle=''
                 let shareImg=''
+                let imgText=''//分享图上需要显示的内容
+                
                 const shareTime=moment(res.data.report_info.publish_time).format('MMDD')
-                if(['晨报','周报'].includes(res.data.report_info.classify_name_first)){
-                    shareTitle=`【${res.data.report_info.classify_name_first}】${res.data.report_info.title}(${shareTime})`
+                //需求修改
+                // if(['晨报','周报'].includes(res.data.report_info.classify_name_first)){
+                //     shareTitle=`【${res.data.report_info.classify_name_first}】${res.data.report_info.title}(${shareTime})`
+                // }else{
+                //     // 专栏类报告
+                //     if(res.data.report_show_type==2){
+                //         const abstract=res.data.report_info.abstract?`:${res.data.report_info.abstract}`:''
+                //         if(res.data.report_info.classify_name_second==res.data.report_info.title){
+                //             shareTitle=`${res.data.report_info.title}(${shareTime})${abstract}`
+                //         }else{
+                //             shareTitle=`【${res.data.report_info.classify_name_second}】${res.data.report_info.title}(${shareTime})`
+                //         }
+                //     }else{
+                //         shareTitle=`【${res.data.report_info.classify_name_second}】${res.data.report_info.title}(${shareTime})`
+                //     }
+                // }
+                // // 日度点评
+                // if(res.data.report_info.classify_name_first==='日度点评'){
+                //     shareTitle=res.data.report_info.abstract||'FICC日度点评'
+                //     const rddpImgRes=await apiRddpShareImg({
+                //         title:`【第${res.data.report_info.stage}期】${res.data.report_info.title}(${shareTime})`
+                //     })
+                //     if(rddpImgRes.code===200){
+                //         shareImg=rddpImgRes.data
+                //     }
+                // }
+
+                if(res.data.report_info.abstract){
+                    shareTitle=res.data.report_info.abstract
+                    imgText=`【第${res.data.report_info.stage}期】${res.data.report_info.title}(${shareTime})`
                 }else{
-                    // 专栏类报告
-                    if(res.data.report_show_type==2){
-                        const abstract=res.data.report_info.abstract?`:${res.data.report_info.abstract}`:''
-                        if(res.data.report_info.classify_name_second==res.data.report_info.title){
-                            shareTitle=`${res.data.report_info.title}(${shareTime})${abstract}`
-                        }else{
-                            shareTitle=`【${res.data.report_info.classify_name_second}】${res.data.report_info.title}(${shareTime})`
-                        }
-                    }else{
-                        shareTitle=`【${res.data.report_info.classify_name_second}】${res.data.report_info.title}(${shareTime})`
+                    shareTitle=res.data.report_info.title
+                    imgText=`<div style="font-size:50px">${moment(res.data.report_info.publish_time).format('YYYY/MM/DD')}</div><div>第${res.data.report_info.stage}期 | ${res.data.report_info.classify_name_second}</div>`
+                    if(['晨报','周报'].includes(res.data.report_info.classify_name_first)){
+                        imgText=`<div style="font-size:50px">${moment(res.data.report_info.publish_time).format('YYYY/MM/DD')}</div><div>第${res.data.report_info.stage}期 | ${res.data.report_info.classify_name_first} </div>`
                     }
                 }
-                // 日度点评
-                if(res.data.report_info.classify_name_first==='日度点评'){
-                    shareTitle=res.data.report_info.abstract||'FICC日度点评'
-                    const rddpImgRes=await apiRddpShareImg({
-                        title:`【第${res.data.report_info.stage}期】${res.data.report_info.title}(${shareTime})`
+                const rddpImgRes=await apiRddpShareImg({
+                    pars:JSON.stringify({
+                        title:imgText,
+                        time_format:moment(res.data.report_info.publish_time).format('YYYY/MM/DD'),
+                        background_img:res.data.report_info.share_bg_img
                     })
-                    if(rddpImgRes.code===200){
-                        shareImg=rddpImgRes.data
-                    }
+                })
+                if(rddpImgRes.code===200){
+                    shareImg=rddpImgRes.data
                 }
+
                 wx.miniProgram.postMessage({ 
                     data: {
                         title:shareTitle,