tanyanfei il y a 3 ans
Parent
commit
7609f88dfb

+ 47 - 18
pages/index/index.js

@@ -192,11 +192,11 @@ Page({
       })
       wx.hideNavigationBarLoading()
     })
-    $api.getHotsellList({ stock_date: stock_date }).then(res => {
-      this.setData({
-        hotsellList: res.data.data.list
-      })
-    })
+    // $api.getHotsellList({ stock_date: stock_date }).then(res => {
+    //   this.setData({
+    //     hotsellList: res.data.data.list
+    //   })
+    // })
     $api.getChoice().then(res=>{
       this.setData({
         myList: res.data.data.list
@@ -207,17 +207,31 @@ Page({
       this.setData({
         cur:e.target.dataset.id
       })
-
       switch(e.target.dataset.id){
         case 0:
+          if (this.data.followList.length>0){
+            return
+          }
           this.getFollow()
         case 1:
+          if (this.data.hotbuyList) {
+            return
+          }
           this.getHot()
         case 2:
+          if (this.data.hotFollowList.length > 0) {
+            return
+          }
           this.getHotFollowList()
         case 3:
+          if (this.data.winList.length > 0) {
+            return
+          }
           this.getWin()
         case 4:
+          if (this.data.championList) {
+            return
+          }
           this.getData()
       }
   },
@@ -240,18 +254,33 @@ Page({
           cur: e.detail.current
         })
 
-        switch(e.detail.current){
-          case 0:
-            this.getFollow()
-          case 1:
-            this.getHot()
-          case 2:
-            this.getHotFollowList()
-          case 3:
-            this.getWin()
-          case 4:
-            this.getData()
-        }
+      switch (e.target.dataset.id) {
+        case 0:
+          if (this.data.followList.length > 0) {
+            return
+          }
+          this.getFollow()
+        case 1:
+          if (this.data.hotbuyList) {
+            return
+          }
+          this.getHot()
+        case 2:
+          if (this.data.hotFollowList.length > 0) {
+            return
+          }
+          this.getHotFollowList()
+        case 3:
+          if (this.data.winList.length > 0) {
+            return
+          }
+          this.getWin()
+        case 4:
+          if (this.data.championList) {
+            return
+          }
+          this.getData()
+      }
     }
   
 

+ 3 - 3
pages/index/index.wxml

@@ -77,19 +77,19 @@
                               <text class="rank" wx:if='{{index>2}}'>{{index+1}}</text>
                               <view class="gp-name">{{item.stock_name}}</view>
                               <view class="num"> <text>{{item.count}}</text> 人持仓</view>
-                              <view class="comment"><text>留言 1200 条</text>|<text>跟踪 908 人</text></view>
+                             <view class="comment"><text>留言 {{item.comments_count}} 条</text>|<text>跟踪 {{item.choice_count}} 人</text></view>
                           </navigator>
                           <navigator hover-class="none" url="../stock/stock?date={{date}}&type=1"  class="more">查看更多 <image mode="widthFix" src="../../images/right_icon.png"></image></navigator>
                         </view>
                         <view wx:if='{{hot==1}}'>
-                          <navigator hover-class="none" url="../stock/stock?id={{item.id}}&date={{date}}" class="gp" wx:for='{{myList}}'>
+                          <navigator hover-class="none" url="../stock/stock?id={{item.stock_id}}&date={{date}}" class="gp" wx:for='{{myList}}'>
                               <!-- <image wx:if='{{index==0}}' mode="widthFix" src="../../images/1.png"></image>
                               <image wx:if='{{index==1}}' mode="widthFix" src="../../images/2.png"></image>
                               <image wx:if='{{index==2}}' mode="widthFix" src="../../images/3.png"></image> -->
                               <text class="rank">{{index+1}}</text>
                               <view class="gp-name">{{item.stock_name}}</view>
                               <view class="num"> <text>{{item.count}}</text> 人持仓</view>
-                              <view class="comment"><text>留言 1200 条</text>|<text>跟踪 908 人</text></view>
+                              <view class="comment"><text>留言 {{item.comments_count}} 条</text>|<text>跟踪 {{item.choice_count}} 人</text></view>
                           </navigator>
                           <view class="loading" wx:if='{{!myList}}'>暂无数据</view>
                         </view>

+ 12 - 2
pages/stock/stock.js

@@ -15,7 +15,8 @@ Page({
     cur:0,
     text:'留下你的观点',
     comment:'',
-    list:[]
+    list:[],
+    myList:[]
   },
 
   /**
@@ -30,6 +31,11 @@ Page({
     if (options.id){
       this.setData({id:options.id})
       this.getComment()
+      $api.getChoice({ stock_id:options.id}).then(res => {
+        this.setData({
+          myList: res.data.data.list
+        })
+      })
       $api.getAuthinfo().then(res=>{
         this.setData({
           role: res.data.data.role
@@ -73,7 +79,6 @@ Page({
     })
   },
   sendmsg(){
-    console.log(233)
     var data={
       stock_id:this.data.id,
       cotent:this.data.comment,
@@ -97,6 +102,11 @@ Page({
       wx.showToast({
         title: '加入成功',
       })
+      var info=this.data.info;
+      info.choiced=1
+      this.setData({
+        info: info
+      })
     })
   },
   tab(e){

+ 14 - 3
pages/stock/stock.wxml

@@ -6,13 +6,16 @@
 </view>
 
 <view wx:if='{{id}}'>
-  <view class="stock_name">{{info.name}} <text wx:if='{{info.code}}'>{{info.code}}</text><view bindtap="choice">加入自选</view></view>
+  <view class="stock_name">{{info.name}} <text wx:if='{{info.code}}'>{{info.code}}</text>
+  <view wx:if='{{!info.choiced}}' bindtap="choice">加入自选</view>
+  <view wx:else>我的自选</view>
+  </view>
   <!-- <image wx:if='{{info.img}}' mode="withFix" src="{{info.img}}"></image>
   <view wx:if='{{info.desc}}' class="desc">{{info.desc}}</view> -->
   <view class="tab">
       <view bindtap="tab" data-id='0' class="{{cur==0?'act':''}}">留言 {{comment_count}} <text></text></view>
-      <view bindtap="tab"   data-id='1' class="{{cur==1?'act':''}}">今日持仓 {{info.user_num}}<text></text></view>
-      <view bindtap="tab"   data-id='2' class="{{cur==2?'act':''}}">跟踪<text></text></view>
+      <view bindtap="tab"   data-id='1' class="{{cur==1?'act':''}}">今日持仓 {{list.length}}<text></text></view>
+      <view bindtap="tab"   data-id='2' class="{{cur==2?'act':''}}">跟踪 {{myList.length}}<text></text></view>
   </view>
   <scroll-view bindtap="blur"  scroll-y='{{true}}' style="height:calc(100vh - 380rpx);background: #fff;padding: 30rpx;">
     <view class="content" wx:if='{{cur==0}}'>
@@ -54,6 +57,14 @@
             </view>
           </navigator>
       </view>
+      <view wx:if='{{cur==2}}'>
+      <view class="_list" wx:for="{{myList}}">
+          <image src="{{item.user_avatar}}" ></image>
+            <view class="msg">
+                <text class="_name" style="line-height:60rpx;">{{item.user_name}}</text>
+            </view>
+        </view>
+      </view>
   </scroll-view>
 
   <view class="post" wx:if="{{role==2}}">

+ 6 - 4
pages/today/today.js

@@ -42,18 +42,17 @@ Page({
       })
     })
     this.getData();
-    this.getzan()
-    this.getComment()
+    
   },
   getzan(){
-    $api.getZanCount({record_id:record_id}).then(res=>{
+    $api.getZanCount({record_id:this.data.record_id}).then(res=>{
       this.setData({
         zan_count:res.data.data
       })
     })
   },
   getComment(){
-    $api.getComment({record_id:record_id}).then(res=>{
+    $api.getComment({record_id:this.data.record_id}).then(res=>{
       if(res.data.code == 0){
           this.setData({
             comment_list:res.data.data.list,
@@ -120,6 +119,7 @@ Page({
         player_id: res.data.data.today_record.player_id,
         followers:res.data.data.followers,
         fans:res.data.data.fans,
+        record_id: res.data.data.today_record.id,
         ec: {
           onInit: initChart
         },
@@ -130,6 +130,8 @@ Page({
       records = res.data.data.records
       today_stock = res.data.data.today_record.today_stock
       this.getDays()
+      this.getzan()
+      this.getComment()
       wx.hideNavigationBarLoading()
     })
     .catch(err=>{

+ 21 - 0
pages/user/user.js

@@ -237,6 +237,27 @@ Page({
       success(res) {}
     })
   },
+  fundchange(e) {
+    this.setData({
+      init_fund: e.detail.value
+    })
+  },
+  save() {
+    if (!this.data.init_fund) {
+      wx.showToast({
+        icon: 'none',
+        title: '请输入初始资金',
+      })
+      return;
+    }
+    $api.initfund({ init_fund: this.data.init_fund}).then(res=>{
+      wx.showToast({
+        title: '提交成功',
+      })
+      this.getUserData()
+    })
+
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 14 - 2
pages/user/user.wxml

@@ -7,9 +7,9 @@
             <view>{{userinfo.username}}</view>
             <text wx:if='{{userinfo.id}}'>代码:{{usercode}}</text>
         </view>
-        <navigator url="../homepage/homepage?id={{todayinfo.match_id}}&record_id={{todayinfo.id}}&player_id={{todayinfo.player_id}}&type=1" class="mine">我的主页</navigator>
+        <navigator  url="../homepage/homepage?id={{todayinfo.match_id}}&record_id={{todayinfo.id}}&player_id={{todayinfo.player_id}}&type=1" class="mine">我的主页</navigator>
       </view>
-      <view class="today">
+      <view  wx:if='{{todayinfo.match_id}}' class="today">
       <navigator hover-class="none"  url="../change/change">
       
       <view class="money">
@@ -31,6 +31,8 @@
         <view><image mode="widthFix" src="../../images/zan.png"></image>{{todayinfo.zan_count}}</view>
       </view>
       </view>
+
+
       <view class="list" style="padding:0 30rpx;background:#fff;">
         <navigator hover-class="none"  class="item">
             咨询顽主
@@ -95,4 +97,14 @@
         </view>
         <button bindtap="login2">绑定</button>
       </view>
+</view>
+
+
+<view class="modal" wx:if='{{userinfo.need_fill}}'>
+  <view class="fund_modal">
+    <view>请先输入初始资金</view>
+    <input type='digit' bindinput="fundchange"></input>
+    <text>W</text>
+    <button bindtap="save">确定</button>
+  </view>
 </view>

+ 36 - 0
pages/user/user.wxss

@@ -220,4 +220,40 @@ page{
 .yzm .disabled{
   color: #999;
   border-color: #999;
+}
+
+
+.modal{
+  position: fixed;
+  width: 100%;
+  height: 100vh;
+  background: rgba(0,0,0,.5);
+  top: 0;
+  left: 0;
+  z-index: 99;
+}
+.fund_modal{
+  width: 80%;
+  padding: 50rpx;
+  /* height: 20vh; */
+  background: #fff;
+  border-radius: 16rpx;
+  margin: 30vh auto;
+  text-align: center;
+  position: relative;
+}
+.fund_modal view{
+  font-size: 30rpx;
+  
+}
+.fund_modal input{
+  border: 1px solid #ccc;
+  height: 80rpx;
+  border-radius: 8rpx;
+  margin: 20rpx 0;
+}
+.fund_modal text{
+  position: absolute;
+  right: 65rpx;
+  top: 40%;
 }

+ 55 - 55
project.config.json

@@ -1,57 +1,57 @@
 {
-  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-  "packOptions": {
-    "ignore": [],
-    "include": []
-  },
-  "setting": {
-    "urlCheck": true,
-    "es6": true,
-    "enhance": true,
-    "postcss": true,
-    "preloadBackgroundData": false,
-    "minified": true,
-    "newFeature": true,
-    "coverView": true,
-    "nodeModules": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": true,
-    "scopeDataCheck": false,
-    "uglifyFileName": false,
-    "checkInvalidKey": true,
-    "checkSiteMap": true,
-    "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "lazyloadPlaceholderEnable": false,
-    "useMultiFrameRuntime": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
-    },
-    "useIsolateContext": false,
-    "userConfirmedBundleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "minifyWXSS": true,
-    "disableUseStrict": false,
-    "minifyWXML": true,
-    "showES6CompileOption": false,
-    "useCompilerPlugins": false,
-    "ignoreUploadUnusedFiles": true,
-    "useStaticServer": true
-  },
-  "compileType": "miniprogram",
-  "libVersion": "2.15.0",
-  "appid": "wx2938132b773c7b5a",
-  "projectname": "newwzb_xcx",
-  "simulatorType": "wechat",
-  "simulatorPluginLibVersion": {},
-  "editorSetting": {
-    "tabIndent": "insertSpaces",
-    "tabSize": 2
-  },
-  "condition": {}
+	"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+	"packOptions": {
+		"ignore": [],
+		"include": []
+	},
+	"setting": {
+		"urlCheck": true,
+		"es6": true,
+		"enhance": true,
+		"postcss": true,
+		"preloadBackgroundData": false,
+		"minified": true,
+		"newFeature": true,
+		"coverView": true,
+		"nodeModules": false,
+		"autoAudits": false,
+		"showShadowRootInWxmlPanel": true,
+		"scopeDataCheck": false,
+		"uglifyFileName": false,
+		"checkInvalidKey": true,
+		"checkSiteMap": true,
+		"uploadWithSourceMap": true,
+		"compileHotReLoad": false,
+		"lazyloadPlaceholderEnable": false,
+		"useMultiFrameRuntime": true,
+		"useApiHook": true,
+		"useApiHostProcess": true,
+		"babelSetting": {
+			"ignore": [],
+			"disablePlugins": [],
+			"outputPath": ""
+		},
+		"useIsolateContext": false,
+		"userConfirmedBundleSwitch": false,
+		"packNpmManually": false,
+		"packNpmRelationList": [],
+		"minifyWXSS": true,
+		"disableUseStrict": false,
+		"minifyWXML": true,
+		"showES6CompileOption": false,
+		"useCompilerPlugins": false,
+		"ignoreUploadUnusedFiles": true,
+		"useStaticServer": true
+	},
+	"compileType": "miniprogram",
+	"libVersion": "2.15.0",
+	"appid": "wx2938132b773c7b5a",
+	"projectname": "newwzb_xcx",
+	"simulatorType": "wechat",
+	"simulatorPluginLibVersion": {},
+	"editorSetting": {
+		"tabIndent": "insertSpaces",
+		"tabSize": 2
+	},
+	"condition": {}
 }

+ 1 - 1
utils/api.js

@@ -148,7 +148,7 @@ const API = {
   update: (data) => request(PUT, `/api/wx/v3/user/fund/modify`, data),
   getChoice: (data) => request(GET, `/api/wx/v3/user/choice/list`, data),
   addchoice: (data) => request(POST, `/api/wx/v3/user/choice`, data),
-  
+  initfund: (data) => request(PUT, `/api/wx/player/fund`, data),
   
   
 };