tanyanfei 4 gadi atpakaļ
vecāks
revīzija
5e1287a755

+ 2 - 2
app.json

@@ -1,9 +1,9 @@
 {
   "pages": [
-    "pages/number/number",
+    
     "pages/index/index",
     "pages/learning/learning",
-    
+    "pages/number/number",
     "pages/mine/mine",
     "pages/knowledge/knowledge",
     "pages/search/search",

BIN
pages/images/down.png


BIN
pages/images/upup.png


+ 2 - 2
pages/index/index.js

@@ -12,7 +12,7 @@ Page({
     hiddenn: true,//hint_box 提示框 展示隐藏
     nav_text: '',//hint_box 提示框里面的文本
     lb:[],
-    act:3,
+    act:0,
     journals:[],
     organizers:[],
     subjects:[],
@@ -422,7 +422,7 @@ Page({
     })
   },
   onReady: function () {
-    // this.get_height();
+    this.get_height();
   },
   //事件处理函数
   touchstart: function (e) {

+ 2 - 2
pages/index/index.wxml

@@ -119,13 +119,13 @@
               </view>
         </view>
         <scroll-view scroll-y="true" style="height: calc(100vh - 660rpx);">
-            <navigator url="" class="num_list" wx:for='{{journals[0].journals}}'>
+            <navigator url="../number/number?id={{item.id}}" class="num_list" wx:for='{{casci_list}}'>
               <view class="order">{{index+1}}</view>
               <image src="{{item.img}}"></image>
               <view class="j_name">{{item.name}}</view>
               <view class="num">
                 <text>CASCI</text>
-                <text style="color:#0077FF;">1890.98{{item.casci}}</text>
+                <text style="color:#0077FF;">{{item.casci}}</text>
               </view>
             </navigator>
         </scroll-view>

+ 127 - 20
pages/number/number.js

@@ -9,11 +9,15 @@ Page({
    */
   data: {
     info:{},
+    analyse:{},
     day:'',
     ec: {
       // onInit: initChart
       lazyLoad: true
     },
+    page:0,
+    casci:0,
+    act:0
   },
 
   /**
@@ -26,7 +30,7 @@ Page({
     this.setData({
       day: y + '-' + m + '-' + d
     })
-    options.id=2;
+    // options.id=2;
     wx.showNavigationBarLoading()
     wx.request({
       url: host + '/api/casci/detail',
@@ -40,30 +44,108 @@ Page({
           this.setData({
               info:res.data.data
           })
+          this.setChart()
+        }
+
+      }
+    })
+    wx.request({
+      url: host + '/api/casci/analyse',
+      method: 'GET',
+      data: {
+        id: options.id
+      },
+      success: res => {
+        wx.hideNavigationBarLoading()
+        if (res.data.code == 0) {
+          this.setData({
+            analyse: res.data.data
+          })
           
-          var records = res.data.data.days7_casci, xdata = [], ydata = [];
-          if (records.length <= 0) {
-            return;
-          }
-          for (let i = 0; i < records.length; i++) {
-            xdata.push(records[i].name)
-            ydata.push(records[i].value)
-            xdata.push(records[i].name)
-            ydata.push(2500)
-            xdata.push(records[i].name)
-            ydata.push(1800)
-          }
-          // xdata = xdata.reverse()
-          // ydata = ydata.reverse()
-            this.oneComponent = this.selectComponent('#mychart');
-            this.init_one(xdata, ydata)
         }
 
       }
     })
+
   },
-  init_one: function (xdata, ydata) {           //初始化第一个图表
+  checkpage:function(e){
+    this.setData({
+      act: e.target.dataset.id
+    })
+    if (e.target.dataset.id == 0){
+      this.setChart()
+    }
+    if (e.target.dataset.id == 1) {
+      this.setChart1()
+      this.setChart2()
+    }
+  },
+  check:function(e){
+    this.setData({
+      casci:e.target.dataset.id
+    })
+    this.setChart()
     
+  },
+  checknum: function (e) {
+    this.setData({
+      page: e.target.dataset.id
+    })
+    this.setChart2()
+
+  },
+  setChart:function(){
+    var records = [], xdata = [], ydata = [];
+    if (this.data.casci == 0) {
+      records = this.data.info.days7_casci;
+    } else {
+      records = this.data.info.days30_casci;
+    }
+    if (records.length <= 0) {
+      return;
+    }
+    for (let i = 0; i < records.length; i++) {
+      xdata.push(records[i].name)
+      ydata.push(records[i].value)
+    }
+    this.oneComponent = this.selectComponent('#mychart');
+    this.init_one(xdata, ydata)
+  },
+  setChart1: function () {
+    console.log(2333)
+    var records = [], xdata = [], ydata = [];
+    records = this.data.analyse.days7_casci_zhuanfa;
+    if (records.length <= 0) {
+      return;
+    }
+    for (let i = 0; i < records.length; i++) {
+      xdata.push(records[i].name)
+      ydata.push(records[i].value)
+    }
+    this.oneComponent1 = this.selectComponent('#mychart1');
+    this.init_two(xdata, ydata)
+  },
+  setChart2: function () {
+    var records = [], xdata = [], ydata = [];
+    if (this.data.page == 0) {
+      records = this.data.info.days7_casci_read;
+    } else if (this.data.page == 0) {
+      records = this.data.info.days7_casci_zan;
+    }else{
+      records = this.data.info.days7_casci_zhuanfa;
+    }
+    records = this.data.analyse.days7_casci_zhuanfa;
+    if (records.length <= 0) {
+      return;
+    }
+    for (let i = 0; i < records.length; i++) {
+      xdata.push(records[i].name)
+      ydata.push(records[i].value)
+    }
+    this.oneComponent2 = this.selectComponent('#mychart2');
+    this.init_three(xdata, ydata)
+  },
+  init_one: function (xdata, ydata) {           //初始化第一个图表
     this.oneComponent.init((canvas, width, height, dpr) => {
       const chart = echarts.init(canvas, null, {
         width: width,
@@ -73,8 +155,33 @@ Page({
       setOption(chart, xdata, ydata)
       this.chart = chart;
       return chart;
+    }); 
+  },
+  init_two: function (xdata, ydata) {           //初始化第一个图表
+    this.oneComponent1.init((canvas, width, height, dpr) => {
+      const chart = echarts.init(canvas, null, {
+        width: width,
+        height: height,
+        devicePixelRatio: dpr
+      });
+      setOption(chart, xdata, ydata)
+      this.chart = chart;
+      return chart;
+    });
+  },
+  init_three: function (xdata, ydata) {           //初始化第一个图表
+    this.oneComponent2.init((canvas, width, height, dpr) => {
+      const chart = echarts.init(canvas, null, {
+        width: width,
+        height: height,
+        devicePixelRatio: dpr
+      });
+      setOption(chart, xdata, ydata)
+      this.chart = chart;
+      return chart;
     });
   },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -133,7 +240,7 @@ function setOption(chart, xdata, ydata) {
     backgroundColor:'#F1F4F6',
     grid: {
       x: 50,
-      y: 40,
+      y: 30,
       x2: 10,
       y2: 35
     },
@@ -206,4 +313,4 @@ function setOption(chart, xdata, ydata) {
     }]
   };
   chart.setOption(option)
-}
+}

+ 88 - 33
pages/number/number.wxml

@@ -5,41 +5,96 @@
           <view class="name">《{{info.name}}》</view>
           <text class="code"> 微信号:{{info.wxcode}}</text>
           <view class="tab">
-              <text class="active">简介</text>
-              <text>分析</text>
-              <text>资源</text>
+              <text data-id='0' bindtap="checkpage" class="{{act==0?'active':''}}">简介</text>
+              <text data-id='1' bindtap="checkpage" class="{{act==1?'active':''}}">分析</text>
+              <text data-id='2' bindtap="checkpage" class="{{act==2?'active':''}}">资源</text>
           </view>
       </view>
   </view>
 
-  <view>
-      <view class="today">
-          <text>{{day}} CASCI</text>
-          <view>{{info.today_casci}}</view>
-          <text style="color:red;">同比上升{{info.today_casci_up}}</text>
-      </view>
-      <view class="tab1">
-          <view class="active">近7日CASCI趋势</view>
-          <view>近30日CASCI趋势</view>
-      </view>
-      <view class="container" wx:if='{{info.days7_casci.length>0}}'>
-        <ec-canvas id="mychart" canvas-id="mychart-line" ec="{{ ec }}">
-        </ec-canvas>
-      </view>
-      <view class="content">
-        <view>中文名称:{{info.name}}</view>
-        <view>外文名称:{{info.ename}}</view>
-        <view>语种:{{info.languages}}</view>
-        <view>主编:{{info.editor}}</view>
-        <view>主管单位:{{info.corganizers}}</view>
-        <view>办刊单位:{{info.publishingUnit}}</view>
-        <view>创刊时间:{{info.publishingTime}}</view>
-        <view>出版周期:{{info.editor}}</view>
-        <view>国内刊号:{{info.issn}}</view>
-        <view>国际刊号:{{info.domestic}}</view>
-        <view>期刊官网:{{info.website}}</view>
-        <view>编辑部地址:{{info.editorialAddress}}</view>
-        <view>期刊简介:{{info.desc}}</view>
-      </view>
-  </view>
+    <view wx:if='{{act==0}}'>
+        <view class="today">
+            <text>{{day}} CASCI</text>
+            <view>
+                {{info.today_casci}}
+                <image wx:if='{{info.today_casci_up[0]=="-"}}' src="../images/down.png"></image>
+                <image wx:else src="../images/upup.png"></image>
+            </view>
+            <text wx:if='{{info.today_casci_up[0]=="-"}}' style="color:#2DCB83;">同比下降{{info.today_casci_up}}</text>
+            <text wx:else style="color:red;">同比上升{{info.today_casci_up}}</text>
+        </view>
+        <view class="tab1">
+            <view data-id='0' bindtap="check" class="{{casci==0?'active':''}}">近7日CASCI趋势</view>
+            <view data-id='1' bindtap="check" class="{{casci==1?'active':''}}">近30日CASCI趋势</view>
+        </view>
+        <view  class="container">
+          <ec-canvas id="mychart" canvas-id="mychart-line" ec="{{ ec }}">
+          </ec-canvas>
+        </view>
+        <view class="content">
+          <view>中文名称:{{info.name}}</view>
+          <view>外文名称:{{info.ename}}</view>
+          <view>语种:{{info.languages}}</view>
+          <view>主编:{{info.editor}}</view>
+          <view>主管单位:{{info.corganizers}}</view>
+          <view>办刊单位:{{info.publishingUnit}}</view>
+          <view>创刊时间:{{info.publishingTime}}</view>
+          <view>出版周期:{{info.editor}}</view>
+          <view>国内刊号:{{info.issn}}</view>
+          <view>国际刊号:{{info.domestic}}</view>
+          <view>期刊官网:{{info.website}}</view>
+          <view>编辑部地址:{{info.editorialAddress}}</view>
+          <view>期刊简介:{{info.desc}}</view>
+        </view>
+    </view>
+    <view wx:if='{{act == 1}}'>
+        <view style="padding:0 5%;">
+          <view class="today1">
+              <view><text>{{day}}</text> 期刊数据分析</view>
+              <view style="color:#999;">总排名
+                <view style="font-size:36rpx;display:block;">
+                    {{analyse.total_rank}}
+                    <image wx:if='{{analyse.today_casci_up[0]=="-"}}' src="../images/down.png"></image>
+                <image wx:else src="../images/upup.png"></image>
+                </view>
+                
+              </view>
+
+              <view wx:if='{{analyse.today_casci_up[0]=="-"}}' style="color:#2DCB83;line-height:90rpx;">同比下降{{analyse.today_casci_up}}</view>
+              <view wx:else  style="color:red;line-height:90rpx;">同比上升{{analyse.today_casci_up}}</view>
+          </view>
+          <view class="title">近7日总榜排名</view>
+        </view>
+        <view  class="container">
+          <ec-canvas id="mychart1" canvas-id="mychart-line" ec="{{ ec }}">
+          </ec-canvas>
+        </view>
+        <view style="padding:0 5%;">
+            
+            <view class="nums">
+                <view data-id='0' bindtap="checknum" class="{{page==0?'active':''}}">
+                    阅读数
+                    <view data-id='0'>{{analyse.read_num}}</view>
+                    <text data-id='0'>平均111</text>
+                </view>
+                <view data-id='1' bindtap="checknum" class="{{page==1?'active':''}}">
+                    点赞数
+                    <view data-id='1'>{{analyse.read_num}}</view>
+                    <text data-id='1'>平均111</text>
+                </view>
+                <view data-id='2' bindtap="checknum" class="{{page==2?'active':''}}">
+                    转发数
+                    <view data-id='2'>{{analyse.read_num}}</view>
+                    <text data-id='2'>平均111</text>
+                </view>
+            </view>
+            <view wx:if='{{page==0}}' class="title">近7日阅读数</view>
+            <view wx:if='{{page==1}}' class="title">近7日点赞数</view>
+            <view wx:if='{{page==2}}' class="title">近7日转发数</view>
+        </view>
+        <view  class="container">
+          <ec-canvas id="mychart2" canvas-id="mychart-line" ec="{{ ec }}">
+          </ec-canvas>
+        </view>
+    </view>
 </view>

+ 59 - 2
pages/number/number.wxss

@@ -5,7 +5,7 @@ page{
 }
 .top{
   display: flex;
-  padding: 40rpx 80rpx 40rpx 40rpx;
+  padding: 40rpx;
   background: -webkit-linear-gradient(bottom, #F1F4F6, #73BFFF);
 }
 .top>image{
@@ -24,12 +24,13 @@ page{
 .tab{
   margin-top: 50rpx;
   display: flex;
-  justify-content: space-between;
+  /* justify-content: space-between; */
   padding: 0 20rpx;
 }
 .tab text{
   color: #666;
   font-size: 36rpx;
+  margin-right: 30rpx;
 }
 .tab .active{
   color: #3780CD;
@@ -91,4 +92,60 @@ page{
 ec-canvas {
   width: 100%;
   height: 400rpx;
+}
+swiper{
+  height: 70vh;
+  overflow: auto;
+}
+.today1{
+  width: 100%;
+  margin: 20rpx auto;
+  background: #fff;
+  border-radius: 20rpx;
+  padding:30rpx 20rpx 20rpx;
+  display: flex;
+  justify-content: space-between;
+  box-shadow: 0 0 15px rgba(0, 0, 0, .2);
+  text-align: center;
+  
+}
+.today1 view text{
+  display: block;
+}
+.title{
+  margin: 50rpx 0 0;
+  font-size: 36rpx;
+  font-weight: bold;
+}
+.nums{
+  display: flex;
+  justify-content: space-between;
+  text-align: center;
+  margin: 40rpx 0;
+}
+.nums>view{
+  
+  padding: 20rpx;
+  width: 31%;
+  border-radius: 8rpx;
+}
+.nums .active{
+  background: #C5E1FF;
+}
+.nums view view{
+  font-size: 50rpx;
+  font-weight: bold;
+  margin: 10rpx 0;
+}
+.nums view text{
+  font-size: 28rpx;
+  color: #4795FF;
+}
+.today image{
+  width: 20rpx;
+  height: 20rpx;
+}
+.today1 image{
+  width: 20rpx;
+  height: 20rpx;
 }