jwyu 3 years ago
parent
commit
4540239072
6 changed files with 255 additions and 186 deletions
  1. 26 0
      api/report.js
  2. 24 54
      pages-buy/detail.vue
  3. 71 21
      pages-report/chapterDetail.vue
  4. 86 43
      pages-report/reportDetail.vue
  5. 8 63
      pages/buy/buy.vue
  6. 40 5
      pages/report/report.vue

+ 26 - 0
api/report.js

@@ -0,0 +1,26 @@
+// 报告模块
+
+import { httpGet, httpPost } from "@/utils/request.js";
+
+/**
+ * 研报详情
+ * @param report_id 
+ */
+export const apiReportDetail=params=>{
+    return httpGet('/report/detail',params)
+}
+
+/**
+ * 章节详情
+ * @param report_chapter_id
+ */
+export const apiChapterDetail=params=>{
+    return httpGet('/report/chapter/detail',params)
+}
+
+/**
+ * 研报首页顶部权限菜单
+ */
+export const apiReportIndexPageAuthList=()=>{
+    return httpGet('/company/getPermissionList',{})
+}

+ 24 - 54
pages-buy/detail.vue

@@ -1,9 +1,9 @@
 <template>
     <scroll-view scroll-y="true" :scroll-into-view="scrollViewId" @scrolltoupper="onScrollTop" style="height: 100vh;">
         <view class="list">
-            <view class="item" v-for="item in list" :key="item.report_id" :id="`msg${item.report_id}`" @click="goDetail(item)">
+            <view class="item" v-for="item in list" :key="item" :id="`msg${item.report_id}${item.activity_id}`" >
                 <view class="msg-time">{{formatMsgTime(item.time)}}</view>
-                <view class="content">
+                <view class="content" @click="goDetail(item)">
                     <view class="top-img" :style="'backgroundImage:url('+item.img_url+')'">
                         <text class="name">{{item.top_name}}</text>
                     </view>
@@ -27,70 +27,43 @@ export default {
             activity_id:0,
             page:1,
             pageSize:20,
-            list:[
-                {
-				"report_id": 1742,
-				"activity_id": 0,
-				"classify_id_first": 84,
-				"classify_name_first": "周报",
-				"classify_id_second": 0,
-				"classify_name_second": "",
-				"title": "迁移测试周报1【美债收益率“迷之跳水”】",
-				"content": "【第2期|FICC】迁移测试周报1【美债收益率“迷之跳水”】",
-				"stage": 2,
-				"time": "2022-03-09T13:19:14+08:00",
-				"img_url": "",
-				"top_name": "迁移测试周报1【美债收益率“迷之跳水”】"
-			},
-			{
-				"report_id": 1751,
-				"activity_id": 252,
-				"classify_id_first": 84,
-				"classify_name_first": "周报",
-				"classify_id_second": 0,
-				"classify_name_second": "",
-				"title": "迁移测试周报1",
-				"content": "【第2期|FICC】迁移测试周报1",
-				"stage": 2,
-				"time": "2022-03-08T00:00:00+08:00",
-				"img_url": "",
-				"top_name": "迁移测试周报1"
-			},
-			{
-				"report_id": 1748,
-				"activity_id": 0,
-				"classify_id_first": 84,
-				"classify_name_first": "周报",
-				"classify_id_second": 0,
-				"classify_name_second": "",
-				"title": "迁移测试周报1",
-				"content": "【第2期|FICC】迁移测试周报1",
-				"stage": 2,
-				"time": "2022-03-08T00:00:00+08:00",
-				"img_url": "",
-				"top_name": "迁移测试周报1"
-			}
-            ]
+            list:[],
+            finished:false
         }
     },
     onLoad(options) {
         this.classify_id_first=options.classify_id_first
         this.activity_id=options.activity_id
-        this.getDetail()
+        uni.setNavigationBarTitle({
+			title: options.activity_id!=0?'电话会':options.name
+		})
+        this.getList()
     },
     methods: {
-        async getDetail(){
+        async getList(){
             const res=await apiBuyDetail({
                 classify_id_first:Number(this.classify_id_first),
                 activity_id:Number(this.activity_id),
                 current_index:this.page,
                 page_size:this.pageSize
             })
-
+            if(res.code===200){
+                let arr=res.data.list||[]
+                this.$nextTick(()=>{
+					this.scrollViewId=`msg${res.data.list[0].report_id}${res.data.list[0].activity_id}`
+				})
+                let temarr=JSON.parse(JSON.stringify(arr))
+                this.list=[...temarr.reverse(),...this.list]
+                if(res.data.paging.is_end){
+                    this.finished=true
+                }
+            }
         },
 
         onScrollTop(){
-            
+            if(this.finished) return
+			this.page++
+			this.getList()
         },
 
         // 格式化消息时间
@@ -148,7 +121,7 @@ export default {
             if(item.activity_id){
                 uni.navigateTo({url: '/pages-activity/detail?id=' + item.activity_id })
             }else{
-                uni.navigateTo({url:'/pages-report/reportDetail'})
+                uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.report_id})
             }
         }
     }
@@ -163,9 +136,6 @@ page{
 </style>
 <style lang="scss" scoped>
 .list{
-    // min-height: 100vh;
-    // flex-direction: column;
-    // justify-content: flex-end;
     .item{
         padding: 34rpx;
         .msg-time{

+ 71 - 21
pages-report/chapterDetail.vue

@@ -1,10 +1,10 @@
 <template>
-  <view class="chapter-detail-page">
+  <view class="chapter-detail-page" v-if="info">
     <view class="main-box">
-      <view class="title">【第1期 | 原油周报】关注中美贸易政策</view>
+      <view class="title">【第1期 | 原油周报】{{info.report_chapter_item.title}}</view>
       <view class="flex time">
         <text>FICC团队</text>
-        <text>2021.11.18 08:40:00</text>
+        <text>{{formatTime(info.report_chapter_item.publish_time)}}</text>
       </view>
       <view class="flex audio-wrap">
         <image src="" mode="aspectFill" />
@@ -19,30 +19,18 @@
       </view>
 
       <view class="rich-content">
-        <mp-html :content="html" />
+        <mp-html :content="info.report_chapter_item.content" />
       </view>
     </view>
     <!-- 章节详情底部快速切换 -->
     <view class="chapter-list-wrap">
       <view class="top-text">更多</view>
       <van-row gutter="10">
-        <van-col span="6">
-          <view class="item"></view>
-        </van-col>
-        <van-col span="6">
-          <view class="item"></view>
-        </van-col>
-        <van-col span="6">
-          <view class="item"></view>
-        </van-col>
-        <van-col span="6">
-          <view class="item"></view>
-        </van-col>
-        <van-col span="6">
-          <view class="item"></view>
-        </van-col>
-        <van-col span="6">
-          <view class="item"></view>
+        <van-col span="6" v-for="item in info.report_chapter_menu_list" :key="item.report_chapter_id">
+          <view :class="['item',item.report_chapter_id==chapterId&&'active']" @click="handleChapterChange(item)">
+            <image :src="item.report_chapter_type_thumb" mode="aspectFill"/>
+            <text>{{item.report_chapter_type_name}}</text>
+          </view>
         </van-col>
       </van-row>
     </view>
@@ -68,21 +56,54 @@
 </template>
 
 <script>
+const moment=require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
+import {apiChapterDetail} from '@/api/report'
 export default {
   data() {
     return {
       showDisclaimers: false, //显示免责声明
       html: "<h1>Hello World!</h1>",
+      chapterId:0,
+      info:null,
     };
   },
+  onLoad(options) {
+    this.chapterId=options.chapterId
+    this.getDetail()
+  },
   methods: {
+    async getDetail(){
+      const res=await apiChapterDetail({report_chapter_id:Number(this.chapterId)})
+      if(res.code===200){
+        this.info=res.data
+      }
+    },
+
     handleBackTop() {
       uni.pageScrollTo({ scrollTop: 0 });
     },
+
+    formatTime(time){
+      return moment(time).format('YYYY-MM-DD HH:mm:ss')
+    },
+
+    handleChapterChange(item){
+      this.chapterId=item.report_chapter_id
+      this.info=null
+      this.getDetail()
+      this.handleBackTop()
+    }
   },
 };
 </script>
 
+<style>
+page{
+  padding-bottom: 0;
+}
+</style>
+
 <style lang="scss" scoped>
 .chapter-detail-page {
   .main-box{
@@ -136,6 +157,7 @@ export default {
 
     .rich-content{
         line-height: 1.7;
+        font-size: 32rpx;
     }
 
     .back-top-img{
@@ -177,6 +199,34 @@ export default {
       background-color: #fff;
       height: 160rpx;
       margin-bottom: 20rpx;
+      text-align: center;
+      color: #C0CFDA;
+      font-size: 24rpx;
+      padding-top: 20rpx;
+      border-radius: 8rpx;
+      overflow: hidden;
+      image{
+        width: 88rpx;
+        height: 88rpx;
+        display: block;
+        margin-left: auto;
+        margin-right: auto;
+      }
+    }
+    .active{
+      border: 1px solid #E3B377;
+      position: relative;
+      &::before{
+        content: '';
+        display: block;
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 0;
+        height: 0;
+        border-top: 46rpx solid #E3B377;
+        border-right: 46rpx solid transparent;
+      } 
     }
   }
 }

+ 86 - 43
pages-report/reportDetail.vue

@@ -1,17 +1,48 @@
 <template>
-    <view class="report-detail-page">
+    <view class="report-detail-page" v-if="info">
+        <!-- 晨报、周报章节 -->
+        <view class="chapter-list-wrap" v-if="['晨报','周报'].includes(info.report_info.classify_name_first)">
+            <view class="top-box" :style="'background-image:url(' + info.report_info.banner_url + ')'">
+                <view class="title">{{info.report_info.classify_name_first}}</view>
+                <view class="sub-title">{{info.report_info.title}}</view>
+                <view class="flex top-bot">
+                    <view class="flex time-box">
+                        <view class="day">{{formatChapterTime(info.report_info.publish_time,'day')}}</view>
+                        <view>
+                            <view>{{formatChapterTime(info.report_info.publish_time,'week')}}</view>
+                            <view>{{formatChapterTime(info.report_info.publish_time,'year-month')}}</view>
+                        </view>
+                    </view>
+                    <view class="num">第{{info.report_info.stage}}期</view>
+                </view>
+            </view>
+            <view class="list-box">
+                <view class="flex item" v-for="item in chapterList" :key="item.report_chapter_id" @click="goChapterDetail(item)">
+                    <image class="img" :src="item.banner_url" mode="aspectFill" />
+                    <view class="con">
+                        <view class="title">
+                            {{item.report_chapter_type_name}} 
+                            <text class="tag" v-for="tag in item.trend.split(',')" :key="tag">{{tag}}</text>
+                        </view>
+                        <view class="van-multi-ellipsis--l2 sub-title">{{item.title}}</view>
+                        <view class="update-time">更新至:{{formatChapterTime(item.publish_time,'year-month-day')}}</view>
+                    </view>
+                </view>
+            </view>
+        </view>
+
         <!-- 报告详情 -->
-        <view class="main-box" v-if="false">
-            <view class="title">【第1期 | 原油周报】关注中美贸易政策</view>
+        <view class="main-box" v-else>
+            <view class="title">【第{{info.report_info.stage}}期|{{info.report_info.classify_name_second}}】{{info.report_info.title}}</view>
             <view class="flex time">
-                <text>FICC团队</text>
-                <text>2021.11.18   08:40:00</text>
+                <text>{{info.report_info.author}}</text>
+                <text>{{formatTime(info.report_info.publish_time)}}</text>
             </view>
             <view class="flex audio-wrap">
                 <image src="" mode="aspectFill"/>
                 <view>
-                    <view>关注中美贸易政策变化</view>
-                    <view style="color:#999999">1分31秒</view>
+                    <view>{{info.report_info.video_name}}</view>
+                    <view style="color:#999999">{{info.report_info.video_play_seconds|formatVoiceTime}}</view>
                 </view>
             </view>
             <view class="tips">
@@ -20,39 +51,12 @@
             </view>
 
             <view class="rich-content">
-                <mp-html :content="html"/>
-            </view>
-        </view>
-        <!-- 晨报、周报章节 -->
-        <view class="chapter-list-wrap">
-            <view class="top-box">
-                <view class="title">晨报</view>
-                <view class="sub-title">鲍威尔调控市场加息预期</view>
-                <view class="flex top-bot">
-                    <view class="flex time-box">
-                        <view class="day">14</view>
-                        <view>
-                            <view>周三</view>
-                            <view>2022-03</view>
-                        </view>
-                    </view>
-                    <view class="num">第249期</view>
-                </view>
+                <mp-html :content="info.report_info.content"/>
             </view>
-            <view class="list-box">
-                <view class="flex item" v-for="item in 7" :key="item" @click="goChapterDetail">
-                    <image class="img" src="" mode="aspectFill" />
-                    <view class="con">
-                        <view class="title">宏观 <text class="tag">谨慎</text></view>
-                        <view class="van-multi-ellipsis--l2 sub-title">非美市场供应端呈不稳定性</view>
-                        <view class="update-time">更新至:2022-01-12</view>
-                    </view>
-                </view>
-            </view>
-        </view>
 
-        <!-- 返回顶部 -->
-        <image @click="handleBackTop" class="back-top-img" src="./static/back-top.png" mode="aspectFill"/>
+            <!-- 返回顶部 -->
+            <image v-if="" @click="handleBackTop" class="back-top-img" src="./static/back-top.png" mode="aspectFill"/>
+        </view> 
 
         <!-- 免责声明 -->
         <van-popup :show="showDisclaimers" @close="showDisclaimers=false" round closeable>
@@ -68,21 +72,58 @@
 </template>
 
 <script>
+const moment=require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
+import {apiReportDetail} from '@/api/report'
 export default {
     data () {
         return {
             showDisclaimers:false,//显示免责声明
-            html:'<h1>Hello World!</h1>'
+            html:'<h1>Hello World!</h1>',
+            reportId:0,
+            info:null,
+            chapterList:[]
         }
     },
-
+    onLoad(options) {
+        this.reportId=options.reportId
+        this.getDetail()
+    },
     methods: {
+        async getDetail(){
+            const res=await apiReportDetail({report_id:Number(this.reportId)})
+            if(res.code===200){
+                this.info=res.data
+                this.chapterList=res.data.report_chapter_list
+                uni.setNavigationBarTitle({ title: res.data.report_info.classify_name_first })
+            }
+        },
+
         handleBackTop(){
             uni.pageScrollTo({ scrollTop: 0 })
         },
 
-        goChapterDetail(){
-            uni.navigateTo({ url: '/pages-report/chapterDetail' })
+        goChapterDetail(item){
+            uni.navigateTo({ url: '/pages-report/chapterDetail?chapterId='+item.report_chapter_id })
+        },
+
+        formatTime(time){
+            return moment(time).format('YYYY-MM-DD HH:mm:ss')
+        },
+
+        formatChapterTime(time,type){
+            if(type==='day'){
+                return moment(time).format('DD')
+            }
+            if(type==='week'){
+                return moment(time).format('dddd')
+            }
+            if(type==='year-month'){
+                return moment(time).format('YYYY-MM')
+            }
+            if(type==='year-month-day'){
+                return moment(time).format('YYYY-MM-DD')
+            }
         }
     }
 }
@@ -141,6 +182,7 @@ export default {
 
     .rich-content{
         line-height: 1.7;
+        font-size: 32rpx;
     }
 
     .back-top-img{
@@ -156,6 +198,7 @@ export default {
         .top-box{
             height: 418rpx;
             background-color: rgba($color: #000000, $alpha: 0.7);
+            background-size: cover;
             color: #fff;
             position: relative;
             .title{
@@ -205,7 +248,7 @@ export default {
                 .img{
                     width: 112rpx;
                     height: 112rpx;
-                    background-color: #f5f5f5;
+                    // background-color: #f5f5f5;
                     flex-shrink: 0;
                     margin-right: 20rpx;
                 }

+ 8 - 63
pages/buy/buy.vue

@@ -3,7 +3,7 @@
     <view class="list-wrap">
       <view class="flex item" v-for="item in list" :key="item.report_id" @click="goDetail(item)">
         <view class="img">
-          <text class="num" v-if="item.stage">{{item.stage}}</text>
+          <text class="num" v-if="item.unread">{{item.unread}}</text>
         </view>
         <view class="content-box">
           <view class="van-ellipsis title">{{item.title}}</view>
@@ -11,6 +11,7 @@
         </view>
         <view class="time">{{item.time|showTime}}</view>
       </view>
+      <view style="color:#999;margin:40rpx 0;text-align:center">- 已经到底了 -</view>
     </view>
   </view>
 </template>
@@ -39,78 +40,22 @@ export default {
   },
   data () {
     return {
-      list:[
-       {
-			"report_id": 1631,
-			"report_chapter_id": 0,
-			"activity_id": 0,
-			"classify_id_first": 75,
-			"classify_name_first": "双周报",
-			"classify_id_second": 76,
-			"classify_name_second": "橡胶双周报",
-			"title": "橡胶双周报",
-			"content": "【第1期|FICC| 橡胶双周报】双周报",
-			"stage": 1,
-			"time": "2022-03-09T13:19:13+08:00",
-			"unread": 3
-		},
-		{
-			"report_id": 0,
-			"report_chapter_id": 0,
-			"activity_id": 253,
-			"classify_id_first": 0,
-			"classify_name_first": "",
-			"classify_id_second": 0,
-			"classify_name_second": "",
-			"title": "防守打法发水电费",
-			"content": "主讲:秦钏",
-			"stage": 0,
-			"time": "2022-03-09T09:59:47+08:00",
-			"unread": 0
-		},
-		{
-			"report_id": 836,
-			"report_chapter_id": 0,
-			"activity_id": 0,
-			"classify_id_first": 52,
-			"classify_name_first": "行业调研",
-			"classify_id_second": 53,
-			"classify_name_second": "寻根知本",
-			"title": "寻根知本(10月第一期)",
-			"content": "【第1期|FICC| 寻根知本】行业调研",
-			"stage": 1,
-			"time": "2022-03-03T14:18:24+08:00",
-			"unread": 4
-		},
-		{
-			"report_id": 1073,
-			"report_chapter_id": 0,
-			"activity_id": 0,
-			"classify_id_first": 56,
-			"classify_name_first": "权益研报",
-			"classify_id_second": 57,
-			"classify_name_second": "近期路演精华",
-			"title": "短保早餐行业龙头商业模式分析",
-			"content": "【第1期|FICC| 近期路演精华】权益研报",
-			"stage": 1,
-			"time": "2022-03-02T15:41:29+08:00",
-			"unread": 1
-		}
-      ]
+      list:[]
     }
   },
-  onLoad(){},
   onShow() {
-    // this.getList()
+    this.getList()
   },
   methods: {
     async getList(){
       const res=await apiBuyList()
-
+      if(res.code===200){
+        this.list=res.data
+      }
     },
 
     goDetail(item){
-      uni.navigateTo({ url: `/pages-buy/detail?classify_id_first=${item.classify_id_first}&activity_id=${item.activity_id}` })
+      uni.navigateTo({ url: `/pages-buy/detail?classify_id_first=${item.classify_id_first}&activity_id=${item.activity_id}&name=${item.classify_name_first}` })
     }
   }
 }

+ 40 - 5
pages/report/report.vue

@@ -11,9 +11,9 @@
     <!-- 分类 -->
     <view class="type-wrap">
       <view class="flex first-type-box">
-        <view class="item" v-for="item in 4" :key="item">
-          <image src="" mode="aspectFill"/>
-          <view>宏观经济</view>
+        <view class="item" v-for="(item,index) in topFirstList" :key="item.classify_name" @click="handleClickTopFirst(item,index)">
+          <image :src="selectTopFirstId==item.classify_name?item.select_icon_url:item.icon_url" mode="aspectFill"/>
+          <view>{{item.classify_name}}</view>
         </view>
         <view class="item" @click="goClassify">
           <image src="@/static/report-menu.png" mode="aspectFill"/>
@@ -22,8 +22,11 @@
 
       </view>
       <view class="flex sub-type-box">
-        <view class="item active">宏观经济</view>
-        <view class="item">利率债</view>
+        <view 
+          :class="['item',item.chart_permission_id==selectTopSubId&&'active']" 
+          v-for="item in topSubList" :key="item.chart_permission_id"
+          @click="handleClickTopSub(item)"
+        >{{item.chart_permission_name}}</view>
       </view>
     </view>
     </van-sticky>
@@ -50,6 +53,7 @@
 </template>
 
 <script>
+import {apiReportIndexPageAuthList} from '@/api/report'
 export default {
   data () {
     return {
@@ -58,6 +62,11 @@ export default {
         paddingTop:40+'px',
         paddingBottom:'4px'
       },
+
+      topFirstList:[],
+      selectTopFirstId:0,
+      topSubList:[],
+      selectTopSubId:0,
       
       list:[
         {
@@ -104,6 +113,7 @@ export default {
   },
   onLoad(){ 
     this.initNavBar()
+    this.getTopAuthList()
   },
   methods: {
     initNavBar(){
@@ -115,6 +125,29 @@ export default {
       }
     },
 
+    //顶部权限数据
+    async getTopAuthList(){
+      const res=await apiReportIndexPageAuthList()
+      if(res.code===200){
+        this.topFirstList=res.data
+        this.selectTopFirstId=this.topFirstList[0].classify_name
+        this.topSubList=this.topFirstList[0].list
+        this.selectTopSubId=this.topSubList[0].chart_permission_id
+      }
+    },
+
+    //点击顶部一级分类
+    handleClickTopFirst(item,index){
+      this.selectTopFirstId=item.classify_name
+      this.topSubList=this.topFirstList[index].list
+      this.selectTopSubId=this.topSubList[0].chart_permission_id
+    },
+
+    //点击顶部耳机分类
+    handleClickTopSub(item){
+      this.selectTopSubId=item.chart_permission_id
+    },
+
     // 跳转分类
     goClassify(){
       uni.navigateTo({ url: '/pages-report/classify' })
@@ -199,9 +232,11 @@ export default {
     margin-top: 40rpx;
     font-size: 28rpx;
     color: #666666;
+    overflow-x: auto;
     .item{
       padding-bottom: 16rpx;
       margin-right: 50rpx;
+      flex-shrink: 0;
     }
     .active{
       color: #E3B377;