Explorar el Código

Merge branch 'master' into yb3.3

jwyu hace 2 años
padre
commit
b44f20f1ac

+ 23 - 0
api/common.js

@@ -29,4 +29,27 @@ export const apiGetPermissionList=params=>{
 // 获取手机号
 export const apiGetWechatPhone=params=>{
     return httpPost('/wechat/getEncryptInfo',params)
+}
+
+/**
+ * 获取海报
+ * @param code_page 分享海报小程序页面地址
+ * @param code_scene 小程序页面参数
+ * @param source 来源 activity_detail(活动详情) activity_list(活动列表)
+ *                    special_column_list(专栏列表) special_column_detail(专栏详情)
+ *                    report_list(报告列表) report_detail(报告详情)
+ *                    chart_list(图库列表) chart_detail(图库详情)
+ * @param version 
+ * @param pars 生成海报需要的页面参数
+ */
+export const apiGetPoster=params=>{
+    return httpPost('/public/get_share_poster',{version:'3.0',...params})
+}
+
+/**
+ * 获取通过海报二维码扫码进入的页面所需要的参数
+ * @param scene_key
+ */
+export const apiGetSceneToParams=params=>{
+    return httpGet('/public/get_suncode_scene',params)
 }

+ 113 - 0
components/sharePoster/sharePoster.vue

@@ -0,0 +1,113 @@
+<template>
+    <view class="share-poster-wrap" :catchtouchmove="false">
+        <image @click="handleCreatePoster" :style="style" class="share-icon" src="@/static/share-poster-icon.png" mode="aspectFill"/>
+
+        <view class="poster-mask" v-if="show||showPoster" @click="showPoster=false"></view>
+        <view class="loading-box" v-if="show">
+            <image class="load-img" src="../../static/loading.png" mode="aspectFill" />
+            <view>海报生成中...</view>
+        </view>
+        <image v-if="showPoster" class="poster-img" :src="posterImg" mode="widthFix" show-menu-by-longpress />
+  </view>
+</template>
+
+<script>
+import {apiGetPoster} from '@/api/common'
+export default {
+    // shareData.type 分享页面: 
+    //activity_detail(活动详情) activity_list(活动列表) special_column_list(专栏列表) special_column_detail(专栏详情) 
+    //report_list(报告列表) report_detail(报告详情) chart_list(图库列表) chart_detail(图库详情)
+    props:{
+        style:null,
+        shareData:null,
+    },
+    data () {
+        return {
+            loading:false,
+            show:false,
+            posterImg:'',
+            showPoster:false
+        }
+    },
+    methods: {
+        async handleCreatePoster(){
+            this.show=true
+            
+            const res=await apiGetPoster({
+                code_page:this.shareData.code_page,
+                code_scene:this.shareData.code_scene,
+                source:this.shareData.type,
+                pars:JSON.stringify(this.shareData.data)
+            })
+            if(res.code==200){
+                this.posterImg=res.data
+                this.show=false
+                this.showPoster=true
+            }else{
+                this.show=false 
+            }
+        }
+    }
+
+}
+</script>
+
+<style lang="scss" scoped>
+.share-poster-wrap{
+    .share-icon{
+        position: fixed;
+        bottom: 100rpx;
+        right: 34rpx;
+        z-index: 50;
+        width: 76rpx;
+        height: 76rpx;
+    }
+    .poster-mask{
+        position: fixed;
+        left: 0;
+        top: 0;
+        right: 0;
+        bottom: 0;
+        background: rgba(0, 0, 0, 0.4);
+        z-index: 998;
+    }
+    .loading-box{
+        background-color: #fff;
+        position: fixed;
+        left: 50%;
+        top: 50%;
+        z-index: 999;
+        transform: translate(-50%,-50%);
+        width: 417rpx;
+        height: 261rpx;
+        text-align: center;
+        padding-top: 80rpx;
+        font-size: 32rpx;
+        font-weight: bold;
+        .load-img{
+            width: 91rpx;
+            height: 91rpx;
+            animation: circle 1s linear infinite;
+        }
+        @keyframes circle {
+            0%{
+                transform: rotateZ(0);
+            }
+            100%{
+                transform: rotateZ(360deg);
+            }
+        }
+    }
+    .poster-img{
+        width: 90vw;
+        display: block;
+        position: fixed;
+        left: 50%;
+        top: 50%;
+        z-index: 999;
+        transform: translate(-50%,-50%);
+        border-radius: 16rpx;
+    }
+}
+
+</style>

+ 68 - 6
pages-activity/detail.vue

@@ -161,6 +161,17 @@
                 </view>
             </view>
         </van-popup>
+
+        <!-- 分享海报 -->
+        <sharePoster 
+            :style="{bottom:'250rpx'}" 
+            :shareData="{
+                type:'activity_detail',
+                code_page:'pages-activity/detail',
+                code_scene:code_scene,
+                data:shareParams
+            }"
+        ></sharePoster>
     </view>
 </template>
 
@@ -174,9 +185,16 @@ import {
     apiActivityRegister,
     apiActivityCancelRegister
 } from "@/api/activity";
+import {apiGetSceneToParams} from '@/api/common'
 import {baseApiUrl} from '@/utils/config.js'
+import sharePoster from '../components/sharePoster/sharePoster.vue'
+const moment=require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
 export default {
     name: "ActivityDetail",
+    components: {
+        sharePoster
+    },
     computed: {
       isFirstAudio(){
           if(this.audioList.length>0){
@@ -188,6 +206,21 @@ export default {
               return this.activeAudioUrl==this.audioList[this.audioList.length-1].voiceUrl
           }
       },
+      shareParams(){ //生成海报数据
+        if(this.info){
+            let obj={
+                activity_title:this.info.activityTypeName+'电话会',
+                activity_speaker:this.info.speaker,
+                activity_time:this.formatActivityTime(this.info.startTime,this.info.endTime),
+                activity_avatar:this.info.speakerHeadPic
+            }   
+            return obj
+        }
+        
+      },
+      code_scene(){//生成海报的小程序页面参数
+        return  JSON.stringify({id:this.id})
+      }
     },
     data() {
         return {
@@ -211,9 +244,14 @@ export default {
         };
     },
     onLoad(options) {
-        this.id = options.id;
-        this.getDetail();
-        this.getAudios()
+        if(options.scene){
+            this.init(options.scene)
+        }else{
+            this.id = options.id;
+            this.getDetail();
+            this.getAudios()
+        }
+        
     },
     onUnload(){
         // 存一次
@@ -250,6 +288,22 @@ export default {
         }
     },
     methods: {
+        async init(e){
+            const res=await apiGetSceneToParams({scene_key:e})
+            if(res.code==200){
+                const obj=JSON.parse(res.data)
+                this.id=obj.id 
+                this.getDetail()
+                this.getAudios()
+            }
+        },
+        formatActivityTime(start,end){
+            const week=moment(start).format('dddd');
+            const day=moment(start).format('YYYY-MM-DD');
+            const startTime=moment(start).format('HH:mm');
+            const endTime=moment(end).format('HH:mm');
+            return `${day} ${startTime}-${endTime} ${week}`
+        },
         // 点击音频项
         handleClickAudioItem(item){
             // 点击同一个音频
@@ -392,9 +446,17 @@ export default {
             const res = await apiActivityDetail({ activity_id: Number(this.id) });
             // 无权限
             if (res.code === 403) {
-                uni.redirectTo({
-                    url: "/pages-activity/noAuthority?data=" + JSON.stringify(res.data),
-                });
+                // 如果是pc进入的 则不跳转 
+                //防止无权限用户在pc点击分享的或者识别的二维码,没法正常跳转到pc页
+                uni.getSystemInfo({
+                    success:(e)=>{
+                        if (e.windowWidth < 700){
+                            uni.redirectTo({
+                                url: "/pages-activity/noAuthority?data=" + JSON.stringify(res.data),
+                            });
+                        }
+                    }
+                })
                 return;
             }
             if (res.code === 200) {

+ 5 - 1
pages-applyPermission/applyResult.vue

@@ -11,7 +11,11 @@
 export default {
   methods: {
     handleBack(){
-      uni.navigateBack();
+      uni.navigateBack({
+        fail:()=>{
+          uni.switchTab({ url: '/pages/report/report' })
+        }
+      })
     }
   }
 }

+ 62 - 4
pages-chart/chartDetail.vue

@@ -1,18 +1,76 @@
 <template>
-  <web-view :src="url"></web-view>
+  <web-view :src="url" @message="handleGetMessage"></web-view>
 </template>
 
 <script>
 import {h5BaseUrl} from '../utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
     data () {
         return {
-            url:''
+            url:'',
+            msgObj:{},//{title:分享的标题,shareImg:分享的图片,params:页面参数}
+
         }
     },
     onLoad(options) {
-        const timestamp=new Date().getTime()
-        this.url=`${h5BaseUrl}/hzyb/chart/detail?ChartInfoId=${options.chartInfoId}&token=${this.$store.state.user.token}&searchVal=${options.searchVal}&MyChartId=${options.MyChartId}&MyChartClassifyId=${options.MyChartClassifyId}&timestamp=${timestamp}`
+        this.init(options)
+        // const timestamp=new Date().getTime()
+        // this.url=`${h5BaseUrl}/hzyb/chart/detail?ChartInfoId=${options.chartInfoId}&token=${this.$store.state.user.token}&searchVal=${options.searchVal}&MyChartId=${options.MyChartId}&MyChartClassifyId=${options.MyChartClassifyId}&timestamp=${timestamp}`
+    },
+    onShareAppMessage() {
+        let paramsStr=''
+        for(const key in this.msgObj.params){
+            if(!paramsStr){
+                paramsStr=`${key}=${this.msgObj.params[key]}`
+            }else{
+                paramsStr=`${paramsStr}&${key}=${this.msgObj.params[key]}`
+            }
+        }
+        return {
+            title:this.msgObj.title||'ETA图库',
+            path:`/pages-chart/chartDetail?${paramsStr}&from=share`,
+            imageUrl:this.msgObj.shareImg||''
+        }
+    },
+
+    methods: {
+        async init(options){
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code==200){
+                    options=JSON.parse(res.data)
+                }
+            }
+
+            const queryObj={
+                ChartInfoId:options.chartInfoId,
+                searchVal:encodeURIComponent(options.searchVal),//避免在链接中带有中文字符,在 iOS 中会有打开白屏的问题,建议加一下 encodeURIComponent
+                MyChartId:options.MyChartId,
+                MyChartClassifyId:options.MyChartClassifyId,
+                from:options.from||'',
+                token:this.$store.state.user.token||uni.getStorageSync("token"),
+                timestamp:new Date().getTime(),//防止缓存
+            }
+            console.log('要处理的参数',queryObj);
+            let queryObjStr=''
+            for (const key in queryObj) {
+                if(!queryObjStr){
+                    queryObjStr=`${key}=${queryObj[key]}`
+                }else{
+                    queryObjStr=`${queryObjStr}&${key}=${queryObj[key]}`
+                }
+            }
+            console.log('拼接字符串:',queryObjStr);
+            this.url=`${h5BaseUrl}/hzyb/chart/detail?${queryObjStr}#wechat_redirect`
+        },
+
+        // 获取到用户点击转发时从h5页面传来的参数
+        handleGetMessage(e){
+            const data=e.detail.data[e.detail.data.length-1]
+            console.log('h5传来的数据',data);
+            this.msgObj=data
+        }
     }
 }
 </script>

+ 18 - 5
pages-report/chapterDetail.vue

@@ -4,6 +4,7 @@
 
 <script>
 import {h5BaseUrl} from '@/utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
   data() {
     return {
@@ -12,11 +13,7 @@ export default {
     };
   },
   onLoad(options) {
-    let chapterId=options.chapterId
-    let fromPage=options.fromPage||''
-    const timestamp=new Date().getTime()
-    const token=this.$store.state.user.token
-    this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+    this.init(options)
   },
   onShareAppMessage() {
     return {
@@ -25,6 +22,22 @@ export default {
     }
   },
   methods: {
+    async init(options){
+      if(options.scene){
+        const res=await apiGetSceneToParams({scene_key:options.scene})
+        if(res.code==200){
+          const obj=JSON.parse(res.data)
+          options.chapterId=obj.chapterId
+        }
+      }
+
+      let chapterId=options.chapterId
+      let fromPage=options.fromPage||''
+      const timestamp=new Date().getTime()
+      const token=this.$store.state.user.token
+      this.url=`${h5BaseUrl}/hzyb/report/chapterdetail?chapterId=${chapterId}&fromPage=${fromPage}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+    },
+
     handleGetMessage(e){
       const data=e.detail.data[e.detail.data.length-1]
       console.log('h5传来的数据',data);

+ 22 - 4
pages-report/reportDetail.vue

@@ -4,6 +4,7 @@
 
 <script>
 import {h5BaseUrl} from '@/utils/config'
+import {apiGetSceneToParams} from '@/api/common'
 export default {
     data () {
         return {
@@ -12,10 +13,8 @@ export default {
         }
     },
     onLoad(options) {
-        let reportId=options.reportId
-        const timestamp=new Date().getTime()
-        const token=this.$store.state.user.token
-        this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+        this.init(options)
+        
     },
     onShareAppMessage() {
         return {
@@ -24,6 +23,25 @@ export default {
         }
     },
     methods: {
+        async init(options){
+            console.log('options',options);
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code==200){
+                    console.log(res);
+                    const obj=JSON.parse(res.data)
+                    console.log(obj);
+                    options.reportId=obj.reportId
+                    console.log(options);
+                }
+            }
+
+            let reportId=options.reportId
+            const timestamp=new Date().getTime()
+            const token=this.$store.state.user.token
+            this.url=`${h5BaseUrl}/hzyb/report/detail?reportId=${reportId}&token=${token}&timestamp=${timestamp}#wechat_redirect`
+        },
+
         handleGetMessage(e){
             const data=e.detail.data[e.detail.data.length-1]
             console.log('h5传来的数据',data);

+ 66 - 7
pages-report/reportList.vue

@@ -56,13 +56,26 @@
 
     <!-- 音频弹窗 -->
     <audioBox v-if="showAudioPop"></audioBox>
+
+    <!-- 分享海报 -->
+    <sharePoster 
+      :style="{bottom:'140rpx'}" 
+      :shareData="{
+        type:'report_list',
+        code_page:'pages-report/reportList',
+        code_scene:code_scene,
+        data:shareParams
+      }"></sharePoster>
   </view>
 </template>
 
 <script>
 import searchBox from "./components/searchBox.vue";
 import audioBox from './components/audioBox.vue'
+import sharePoster from '@/components/sharePoster/sharePoster.vue'
 import {apiReportList,apiSubClassifyList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
+const moment=require('@/utils/moment-with-locales.min')
 export default {
   computed: {
     showAudioPop(){//是否显示音频弹窗
@@ -73,6 +86,35 @@ export default {
     },
     curAudioPaused(){//当前音频是否暂停状态
       return this.$store.state.report.audioData.paused
+    },
+    shareParams(){
+      let obj={
+        list_title:this.classifyName,
+        img_1:'',
+        title_1:'',
+        abstract_1:'',
+        time_1:'',
+        img_2:'',
+        title_2:'',
+        abstract_2:'',
+        time_2:'',
+      }
+      if(this.list[0]){
+        obj.img_1=this.list[0].report_img_url
+        obj.title_1=this.list[0].title 
+        obj.abstract_1=this.list[0].classify_name_second
+        obj.time_1=`${this.list[0].stage}期 | ${moment(this.list[0].publish_time).format('YYYY.MM.DD')}`
+      }
+      if(this.list[1]){
+        obj.img_2=this.list[1].report_img_url
+        obj.title_2=this.list[1].title 
+        obj.abstract_2=this.list[1].classify_name_second
+        obj.time_2=`${this.list[1].stage}期 | ${moment(this.list[1].publish_time).format('YYYY.MM.DD')}`
+      }
+      return obj
+    },
+    code_scene(){
+      return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
     }
   },
   components: {
@@ -97,12 +139,17 @@ export default {
     };
   },
   onLoad(options) {
-    this.classifyId=options.classifyId
-    this.classifyName=decodeURIComponent(options.classifyName)
-    // 设置title
-    uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
-    this.getList()
-    this.getClassifyList()
+    if(options.scene){
+      this.init(options.scene)
+    }else{
+      this.classifyId=options.classifyId
+      this.classifyName=decodeURIComponent(options.classifyName)
+      // 设置title
+      uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
+      this.getList()
+      this.getClassifyList()
+    }
+    
   },
   onPullDownRefresh() {
     this.page=1
@@ -125,6 +172,18 @@ export default {
     }
   },
   methods: {
+    async init(e){
+      const res=await apiGetSceneToParams({scene_key:e})
+      if(res.code==200){
+        const obj=JSON.parse(res.data)
+        this.classifyId=obj.classifyId
+        this.classifyName=decodeURIComponent(obj.classifyName)
+        uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
+        this.getList()
+        this.getClassifyList()
+      }
+    },
+
     //获取研报列表
     async getList(){
       const res=await apiReportList({
@@ -245,7 +304,7 @@ page{
     border-bottom: 1px solid #EDEDED;
     .img {
       width: 120rpx;
-      height: 160rpx;
+      height: 180rpx;
       background-color: #f5f5f5;
       flex-shrink: 0;
       margin-right: 20rpx;

+ 46 - 4
pages-report/specialColumn/detail.vue

@@ -42,12 +42,25 @@
 
         <!-- 音频弹窗 -->
         <audioBox v-if="showAudioPop"></audioBox>
+
+        <!-- 分享海报 -->
+        <sharePoster
+            :style="{bottom:'140rpx'}" 
+            :shareData="{
+                type:'special_column_detail',
+                code_page:'pages-report/specialColumn/detail',
+                code_scene:code_scene,
+                data:shareParams
+            }"
+        ></sharePoster>
     </view>
 </template>
 
 <script>
 import {apiSpecialColumnDetail,apiSpecialColumnReportList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
 import audioBox from '../components/audioBox.vue'
+import sharePoster from '@/components/sharePoster/sharePoster.vue'
 export default {
     computed: {
         showAudioPop(){//是否显示音频弹窗
@@ -58,10 +71,24 @@ export default {
         },
         curAudioPaused(){//当前音频是否暂停状态
             return this.$store.state.report.audioData.paused
+        },
+        shareParams(){
+            if(this.info){
+                let obj={
+                    report_avatar:this.info.avatar_img_url,
+                    report_title:this.info.classify_name_second,
+                    report_abstract:this.info.abstract
+                }
+                return obj
+            }
+        },
+        code_scene(){
+            return JSON.stringify({columnId:this.columnId})
         }
     },
     components: {
-        audioBox
+        audioBox,
+        sharePoster
     },
     data () {
         return {
@@ -76,9 +103,14 @@ export default {
         }
     },
     onLoad(options) {
-        this.columnId=options.columnId
-        this.getDetail()
-        this.getList()
+        if(options.scene){
+            this.init(options.scene)
+        }else{
+            this.columnId=options.columnId
+            this.getDetail()
+            this.getList()
+        }
+        
     },
     onPullDownRefresh() {
         this.getDetail()
@@ -102,6 +134,16 @@ export default {
         }
     },
     methods: {
+        async init(e){
+            const res=await apiGetSceneToParams({scene_key:e})
+            if(res.code==200){
+                const obj=JSON.parse(res.data)
+                this.columnId=obj.columnId 
+                this.getDetail()
+                this.getList()
+            }
+        },
+
         async getDetail(){
             const res=await apiSpecialColumnDetail({classify_id_second:Number(this.columnId)})
             if(res.code===200){

+ 78 - 9
pages-report/specialColumn/list.vue

@@ -10,21 +10,73 @@
           <image class="avatar" :src="item.home_img_url" mode="aspectFill" lazy-load></image>
           <view class="content">
             <view class="title">{{item.classify_name_second}}</view>
-            <view class="van-ellipsis author">
-              <text style="margin-right:20rpx">{{item.report_author}}</text>
-              <text class="vip-text" v-if="item.vip_title">{{item.vip_title}}</text>
-              <text v-else>{{item.author_descript}}</text>
+            <view class="flex author">
+              <text style="margin-right:20rpx;flex-shrink: 0;">{{item.report_author}}</text>
+              <text class="van-ellipsis vip-text" v-if="item.vip_title">{{item.vip_title}}</text>
+              <text class="van-ellipsis" v-else>{{item.author_descript}}</text>
             </view>
           </view>
         </view>
       </view>
+
+      <!-- 分享海报 -->
+      <sharePoster 
+        :style="{bottom:'140rpx'}" 
+        :shareData="{
+          type:'special_column_list',
+          code_page:'pages-report/specialColumn/list',
+          code_scene:code_scene,
+          data:shareParams
+        }"
+      ></sharePoster>
       
     </view>
 </template>
 
 <script>
 import {apiSpecialColumnList} from '@/api/report'
+import {apiGetSceneToParams} from '@/api/common'
+import sharePoster from '@/components/sharePoster/sharePoster.vue'
 export default {
+  components: {
+    sharePoster
+  },
+  computed: {
+    shareParams(){
+      let obj={
+        list_title:this.classifyName,
+        stage_1:'',
+        avatar_1:'',
+        title_1:'',
+        author_1:'',
+        tag_1:'',
+        stage_2:'',
+        avatar_2:'',
+        title_2:'',
+        author_2:'',
+        tag_2:'',
+      }
+      if(this.list[0]){
+        obj.stage_1=this.list[0].stage.toString()
+        obj.avatar_1=this.list[0].home_img_url
+        obj.title_1=this.list[0].classify_name_second
+        obj.author_1=this.list[0].report_author
+        obj.tag_1=this.list[0].author_descript
+      }
+      if(this.list[1]){
+        obj.stage_2=this.list[1].stage.toString()
+        obj.avatar_2=this.list[1].home_img_url
+        obj.title_2=this.list[1].classify_name_second
+        obj.author_2=this.list[1].report_author
+        obj.tag_2=this.list[1].author_descript
+      }
+      return obj
+
+    },
+    code_scene(){
+      return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
+    }
+  },
   data () {
     return {
       classifyId:0,
@@ -35,11 +87,16 @@ export default {
     }
   },
   onLoad(options) {
-    this.classifyId=options.classifyId
-    // 设置title
-    this.classifyName=decodeURIComponent(options.classifyName)
-    uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
-    this.getList()
+    if(options.scene){
+      this.init(options.scene)
+    }else{
+      this.classifyId=options.classifyId
+      // 设置title
+      this.classifyName=decodeURIComponent(options.classifyName)
+      uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
+      this.getList()
+    }
+    
   },
   onPullDownRefresh() {
     this.list=[]
@@ -55,6 +112,17 @@ export default {
     }
   },
   methods: {
+    async init(e){
+      const res=await apiGetSceneToParams({scene_key:e})
+      if(res.code==200){
+        const obj=JSON.parse(res.data)
+        this.classifyId=obj.classifyId
+        this.classifyName=decodeURIComponent(obj.classifyName)
+        uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
+        this.getList()
+      }
+    },
+
     async getList(){
       this.finished=false
       const res=await apiSpecialColumnList({classify_id_first:Number(this.classifyId)})
@@ -128,6 +196,7 @@ page{
         .author{
           font-size: 28rpx;
           font-weight: 400;
+          align-items: center;
           .vip-text{
             display: inline-block;
             background-color: #FAF7EE;

+ 66 - 3
pages/activity/activity.vue

@@ -102,7 +102,11 @@
                 </view>
             </view>
         </view>
-        <van-empty description="暂无数据" v-if="list.length===0&&finished" />
+        <view class="report-empty-box" v-if="list.length===0&&finished">
+            <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
+            <view>暂无活动</view>
+        </view>
+        <!-- <van-empty description="暂无数据" v-if="list.length===0&&finished" /> -->
 
         <!-- 弹窗 -->
         <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
@@ -179,7 +183,18 @@
                 </view>
             </view>
         </van-popup>
-  
+
+        <!-- 分享海报 -->
+        <sharePoster 
+            :style="{bottom:'250rpx'}" 
+            :shareData="{
+                type:'activity_list',
+                code_page:'pages/activity/activity',
+                code_scene:'',
+                data:shareParams
+            }"
+            v-if="showPoster"
+        ></sharePoster>
     </view>
 </template>
 
@@ -193,7 +208,13 @@ import {
     apiActivityAudios
 } from '@/api/activity'
 import {apiApplyPermission,apiUserInfo} from '@/api/user'
+import sharePoster from '../../components/sharePoster/sharePoster.vue'
+const moment=require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
 export default {
+    components: {
+        sharePoster
+    },
     computed: {
         isFirstAudio(){
             if(!this.currentAudioMsg.audioCurrentUrl){
@@ -210,6 +231,38 @@ export default {
             if(this.currentAudioMsg.list.length>0){
                 return this.currentAudioMsg.audioCurrentUrl==this.currentAudioMsg.list[this.currentAudioMsg.list.length-1].voiceUrl
             }
+        },
+
+        shareParams(){ //生成海报数据
+            let obj={
+                list_title:this.tabActive === '1'?'线上会议':'线下沙龙',
+                status_1:'',
+                avatar_1:'',
+                title_1:'',
+                speaker_1:'',
+                time_1:'',
+                status_2:'',
+                avatar_2:'',
+                title_2:'',
+                speaker_2:'',
+                time_2:'',
+            }
+            if(this.list[0]){
+                obj.status_1=this.list[0].activityState==1?'未开始':this.list[0].activityState==2?'进行中':'已结束'
+                obj.avatar_1=this.list[0].speakerHeadPic
+                obj.title_1=this.list[0].activityTypeName
+                obj.speaker_1=this.list[0].speaker
+                obj.time_1=this.formatActivityTime(this.list[0].startTime,this.list[0].endTime)
+            }
+            if(this.list[1]){
+                obj.status_2=this.list[1].activityState==1?'未开始':this.list[1].activityState==2?'进行中':'已结束'
+                obj.avatar_2=this.list[1].speakerHeadPic
+                obj.title_2=this.list[1].activityTypeName
+                obj.speaker_2=this.list[1].speaker
+                obj.time_2=this.formatActivityTime(this.list[1].startTime,this.list[1].endTime)
+            }
+
+            return obj
         }
     },
     watch: {
@@ -257,6 +310,8 @@ export default {
                 audioTime:0,//当前音频时间
                 audioCurrentUrl:'',//当前音频地址
             },
+
+            showPoster:true
         }
     },
     onLoad() {
@@ -266,6 +321,7 @@ export default {
         this.addEventListenerRegister()
     },
     onShow() {
+        this.showPoster=true
         if(this.$store.state.activity.activityListPageRefresh){
             if(this.isInit) return
             this.allRefresh()
@@ -283,10 +339,10 @@ export default {
 		})
     },
     onHide(){
+        this.showPoster=false
         this.pupData.show=false
         this.currentAudioMsg.show=false
         // 存一次音频信息
-        
         uni.setStorageSync('audioMsg', JSON.stringify(this.currentAudioMsg))
     },
     onUnload(){
@@ -314,6 +370,13 @@ export default {
     },
 
     methods: {
+        formatActivityTime(start,end){
+            const week=moment(start).format('dddd');
+            const day=moment(start).format('YYYY-MM-DD');
+            const startTime=moment(start).format('HH:mm');
+            const endTime=moment(end).format('HH:mm');
+            return `${day} ${startTime}-${endTime} ${week}`
+        },
         // 初始化音频状态
         initAudio(){
             console.log('音频src',this.globalBgMusic.src);

+ 43 - 1
pages/chart/chart.vue

@@ -48,6 +48,18 @@
         ></drag>
       </view>
       
+
+      <!-- 分享海报 -->
+      <sharePoster 
+        :style="{bottom:'250rpx'}" 
+        :shareData="{
+          type:'chart_list',
+          code_page:'pages/chart/chart',
+          code_scene:'',
+          data:shareParams
+        }"
+        v-if="showPoster"
+      ></sharePoster>
     </view>
 
     <!-- 无权限 -->
@@ -92,18 +104,42 @@
           </view>
         </view>
       </van-popup>
+
+    
 </template>
 
 <script>
 import chartItem from './component/chartItem.vue'
 import dragSorts from '../../components/chartClassifyItem/HM-dragSorts.vue'
 import noAuth from './component/noAuth.vue'
+import sharePoster from '../../components/sharePoster/sharePoster.vue'
 import {apiChartList,apiChartClassifyList,apiChartMove,apiClassifyMove} from '@/api/chart'
 export default {
     components: {
       'chart-item':chartItem,
       dragSorts,
-      noAuth
+      noAuth,
+      sharePoster
+    },
+    computed: {
+      shareParams(){//生成海报要的数据
+        let obj={
+          list_title:'ETA图库',
+          title_1:'',
+          img_1:'',
+          title_2:'',
+          img_2:'',
+        }
+        if(this.list[0]){
+          obj.title_1=this.list[0].ChartName
+          obj.img_1=this.list[0].ChartImage
+        }
+        if(this.list[1]){
+          obj.title_2=this.list[1].ChartName
+          obj.img_2=this.list[1].ChartImage
+        }
+        return obj
+      }
     },
     data() {
         return {
@@ -126,6 +162,8 @@ export default {
 
           hasAuth:true,//是否有权限
           noAuthData:null,//没有权限时传给无权限组件的值
+
+          showPoster:true
         }
     },
     onLoad() {
@@ -133,11 +171,15 @@ export default {
       this.addEventListenerSelectClassify()
     },
     onShow() {
+      this.showPoster=true
       this.getClassifyList()
       // if(!this.hasAuth){
       //   this.getClassifyList()
       // }
     },
+    onHide() {
+      this.showPoster=false
+    },
     onUnload(){
       uni.$off('classifyPageSelect')
     },

+ 18 - 0
pages/chart/component/noAuth.vue

@@ -40,6 +40,7 @@ export default {
             if(!this.info) return
             // 该客户为冻结、试用暂停状态;该客户为正式、试用、永续状态,但联系人图表权限未开启或禁用
             if(this.info.type==='contact'){
+                this.handleAutoApply()
                 return 1
             }
             if(this.info.type==='expired'){
@@ -62,6 +63,23 @@ export default {
             })
         },
 
+        handleAutoApply(){
+            if(!this.info.customer_info.has_apply){
+                if(this.info.customer_info.status=='冻结'||(this.info.customer_info.status=='试用'&&this.info.customer_info.is_suspend==1)){
+                    apiApplyPermission({
+                        company_name:this.info.customer_info.company_name,
+                        real_name:this.info.customer_info.name,
+                        source:3,
+                        from_page:'图库列表'
+                    }).then(res=>{
+                        if(res.code===200){
+                            console.log('主动申请成功');
+                        }
+                    }) 
+                }
+            }
+        },
+
         handleApply(){
             if(this.info.customer_info.status=='流失'){
                 apiApplyPermission({

BIN
static/loading.png


BIN
static/share-poster-icon.png


+ 8 - 5
utils/request.js

@@ -78,12 +78,15 @@ const refreshToken=async (url,params,method,resolve)=>{
 let LOADINGCOUNT = 0;// 请求数
 const http=(url,params,method)=>{
 	// 设置loading
-	if (LOADINGCOUNT === 0) {
-	  uni.showLoading({
-	  	title:'加载中...'
-	  })
+	if(url!='/public/get_share_poster'){
+		if (LOADINGCOUNT === 0) {
+			uni.showLoading({
+				title:'加载中...'
+			})
+		}
+		LOADINGCOUNT++;
 	}
-	LOADINGCOUNT++;
+	
 	
 	return new Promise((resolve,reject)=>{
 		uni.request({