tanyanfei 3 yıl önce
ebeveyn
işleme
b21940e456

+ 2 - 1
app.json

@@ -1,8 +1,9 @@
 {
 {
 "pages": [
 "pages": [
+  "pages/user/user",
   "pages/homepage/homepage",
   "pages/homepage/homepage",
   "pages/today/today",
   "pages/today/today",
-  "pages/user/user",
+  
   "pages/rethink/rethink",
   "pages/rethink/rethink",
     "pages/message/message",
     "pages/message/message",
     
     

BIN
images/logo.png


+ 15 - 1
pages/homepage/homepage.js

@@ -9,6 +9,7 @@ Page({
    * 页面的初始数据
    * 页面的初始数据
    */
    */
   data: {
   data: {
+    mydata:{},
     date:'2021-11',
     date:'2021-11',
     days:[],
     days:[],
     ec: {
     ec: {
@@ -29,12 +30,17 @@ Page({
     options.id = 9, options.player_id = 3520
     options.id = 9, options.player_id = 3520
     id = options.id, record_id = options.record_id
     id = options.id, record_id = options.record_id
     this.setData({
     this.setData({
+      type:options.type?options.type:'',
       id: id,
       id: id,
       record_id: record_id,
       record_id: record_id,
       player_id: options.player_id ? options.player_id:''
       player_id: options.player_id ? options.player_id:''
     })
     })
+    if(options.type){
+        wx.setNavigationBarTitle({
+          title: '我的主页',
+        })
+    }
     this.getData();
     this.getData();
-    
   },
   },
   getDays(){
   getDays(){
     // match_id   player_id  month: "2021-12"
     // match_id   player_id  month: "2021-12"
@@ -125,6 +131,14 @@ Page({
     })
     })
     this.getDays()
     this.getDays()
   },
   },
+  logout() {
+    wx.removeStorage({
+      key: 'userInfo'
+    })
+    wx.switchTab({
+      url: '../user/user',
+    })
+  },
   next() {
   next() {
     var date = this.data.date.split('-'), y = date[0], m = date[1];
     var date = this.data.date.split('-'), y = date[0], m = date[1];
     if (m < 12) {
     if (m < 12) {

+ 8 - 44
pages/homepage/homepage.wxml

@@ -1,5 +1,5 @@
 <view class="per_top">
 <view class="per_top">
-    <image src="../../images/page1.png" ></image>
+    <image src="{{datas.today_record.avatar}}" ></image>
     <view class="name">
     <view class="name">
       {{datas.today_record.username}}
       {{datas.today_record.username}}
       <view class="fans">
       <view class="fans">
@@ -7,8 +7,11 @@
           <text style="margin-left: 20rpx;">2626</text>关注
           <text style="margin-left: 20rpx;">2626</text>关注
       </view>
       </view>
     </view>
     </view>
+    <block wx:if='{{type!=1}}'>
     <view class="follow" style="width:140rpx;" wx:if='{{is_follow}}' data-action='cancel' bindtap="followPlayer">取消关注</view>
     <view class="follow" style="width:140rpx;" wx:if='{{is_follow}}' data-action='cancel' bindtap="followPlayer">取消关注</view>
     <view class="follow" wx:else  bindtap="followPlayer">+ 关注</view>
     <view class="follow" wx:else  bindtap="followPlayer">+ 关注</view>
+    </block>
+    <navigator class="follow" url="../change/change" wx:else>编辑</navigator>
 </view>
 </view>
 <view class="style">
 <view class="style">
   <view wx:if='{{datas.today_record.style.length>0}}'>
   <view wx:if='{{datas.today_record.style.length>0}}'>
@@ -42,47 +45,6 @@
       <text>胜率</text>{{datas.today_record.win_rate}}(最大回撤 <label class="{{datas.today_record.badest_income[0]=='-' ?'down':'up'}}"> {{datas.today_record.badest_income}} </label>)
       <text>胜率</text>{{datas.today_record.win_rate}}(最大回撤 <label class="{{datas.today_record.badest_income[0]=='-' ?'down':'up'}}"> {{datas.today_record.badest_income}} </label>)
     </view>
     </view>
 </view>
 </view>
-<!-- <view class="player">
-      <view class="name">{{datas.today_record.username}}  <text>{{datas.today_record.badge}}</text>
-      <view style="width:140rpx;" wx:if='{{is_follow}}' data-action='cancel' bindtap="followPlayer">取消关注</view>
-      <view wx:else  bindtap="followPlayer">+关注</view></view>  
-      <view class="infos">
-          <view class="info" wx:if='{{datas.today_record.style.length>0}}'>风格:
-          <label wx:for='{{datas.today_record.style}}' class="tag">{{item}}</label>
-          </view>
-          <view class="info">
-                  排名: <view>{{datas.today_record.group_rank}}
-                  ({{datas.today_record.match_group_name}})</view>
-          </view>
-          <view class="info">
-                  胜率: <view>{{datas.today_record.win_rate}}(最大回撤 <text class="{{datas.today_record.badest_income[0]=='-' ?'down':'up'}}"> {{datas.today_record.badest_income}} </text>)</view>
-          </view>
-          <view class="info">
-                  日期: <view>{{datas.today_record.stock_date}}(今日收益
-               <text  class="{{datas.today_record.today_income[0]=='-' ?'down':'up'}}">{{datas.today_record.today_income}}</text>)</view>
-          </view>
-          <view class="info">
-              今日资产: 
-                <label> {{datas.today_record.today_fund}}w</label>
-              (总收益<text  class="{{datas.today_record.total_income[0]=='-' ?'down':'up'}}"> {{datas.today_record.total_income}}</text>)
-          </view>
-          <view class="info">初始资产:
-                <label>{{datas.today_record.init_fund}}w</label>
-          </view>
-          <view class="bottom" wx:if='{{datas.today_record.today_record.is_markt}}'>
-            开超市
-          </view>
-          <view class="bottom" wx:elif='{{datas.today_record.today_stock_total>0}}'>
-
-              今日持仓 <text>{{datas.today_record.today_stock_total}}W</text>
-              仓位 <text>{{datas.today_record.cangwei}}</text>
-          </view>
-          <view class="bottom" wx:else>
-            空仓
-          </view>
-      </view>          
-</view> -->
-
 <view class="content">
 <view class="content">
     <!-- <view class="title">收益曲线</view> -->
     <!-- <view class="title">收益曲线</view> -->
     <view class="container" wx:if='{{datas.records.length>0}}'>
     <view class="container" wx:if='{{datas.records.length>0}}'>
@@ -152,10 +114,12 @@
                  class="img" src="{{i}}"></image>
                  class="img" src="{{i}}"></image>
     </view>
     </view>
   </view>
   </view>
-  <view class="look_all">
+  <!-- <view class="look_all">
     <navigator hover-class="none" url="../day/day?id={{id}}&player_id={{player_id}}">
     <navigator hover-class="none" url="../day/day?id={{id}}&player_id={{player_id}}">
           查看全部
           查看全部
     </navigator>
     </navigator>
-  </view>
+  </view> -->
 </view>
 </view>
 
 
+<view wx:if="type==1" class="content" style="margin-top: 100rpx;"><view bindtap="logout" class="logout">退出登录</view></view>
+

+ 10 - 0
pages/homepage/homepage.wxss

@@ -269,4 +269,14 @@ picker{
 .up1{
 .up1{
   background: #E90001;
   background: #E90001;
   color: #fff;
   color: #fff;
+}
+.logout{
+  width: 100%;
+  line-height: 88rpx;
+  color: #666;
+  font-size: 32rpx;
+  text-align: center;
+  border: 1px solid rgba(224, 224, 224, 1);
+  border-radius: 8rpx;
+  background: #fff;
 }
 }

+ 2 - 2
pages/today/today.wxml

@@ -7,7 +7,7 @@
           <text style="margin-left: 20rpx;">2626</text>关注
           <text style="margin-left: 20rpx;">2626</text>关注
       </view>
       </view>
     </view>
     </view>
-    <navigator>Ta的主页</navigator>
+    <navigator url="../homepage/homepage?id={{id}}&record_id={{record_id}}&player_id={{player_id}}">Ta的主页</navigator>
 </view>
 </view>
 <view class="per_info">
 <view class="per_info">
     <view class="rank">
     <view class="rank">
@@ -28,7 +28,7 @@
       <block wx:elif='{{datas.today_record.today_stock_total>0}}'>
       <block wx:elif='{{datas.today_record.today_stock_total>0}}'>
         <text class="label">今日持仓</text><text>{{datas.today_record.today_stock_total}}W</text>
         <text class="label">今日持仓</text><text>{{datas.today_record.today_stock_total}}W</text>
       </block>
       </block>
-      <view  wx:else>
+      <view class="label"  wx:else>
             空仓
             空仓
       </view>
       </view>
     </view>
     </view>

+ 93 - 18
pages/user/user.js

@@ -2,7 +2,7 @@
 const app = getApp()
 const app = getApp()
 var host = app.globalData.host;
 var host = app.globalData.host;
 const $api = require('../../utils/api.js').API;
 const $api = require('../../utils/api.js').API;
-
+var logindata={}
 Page({
 Page({
 
 
   /**
   /**
@@ -10,11 +10,15 @@ Page({
    */
    */
   data: {
   data: {
     usercode: '',
     usercode: '',
+    phone:'',
+    phcode:'',
     openid: '',
     openid: '',
     info: {},
     info: {},
     userinfo:{},
     userinfo:{},
     todayinfo:{},
     todayinfo:{},
     todayMoney:'',
     todayMoney:'',
+    status:0,
+    text:'获取验证码'
   },
   },
 
 
   /**
   /**
@@ -22,6 +26,39 @@ Page({
    */
    */
   onLoad: function (options) {
   onLoad: function (options) {
     this.getUserData()
     this.getUserData()
+  },
+  getcode(){
+    if(this.data.phone.length>=11){
+      $api.sendcode({phone:this.data.phone}).then(res=>{
+        this.countdown()
+      })
+    }else{
+      wx.showToast({
+        icon: 'none',
+        title: '请输入正确的手机号',
+      })
+    }
+    
+  },
+  countdown(){
+    var count=60,_this=this;
+    var timer=setInterval(c,1000)
+    function c(){
+      if(count>0){
+        count--;
+        _this.setData({
+          text:count+"s重新发送"
+        })
+      }else{
+        _this.setData({
+          text:'获取验证码'
+        })
+        clearInterval(timer)
+      }
+    }
+    
+    
+    
   },
   },
   getUserData() {
   getUserData() {
     $api.getAuthinfo().then(res=>{
     $api.getAuthinfo().then(res=>{
@@ -30,12 +67,14 @@ Page({
       })
       })
       this.setData({
       this.setData({
         usercode: res.data.data.usercode,
         usercode: res.data.data.usercode,
-        userinfo: res.data.data
+        userinfo: res.data.data,
+        status:3
       })
       })
     })
     })
     .catch(err=>{
     .catch(err=>{
       this.setData({
       this.setData({
-        userinfo: {}
+        userinfo: {},
+        status:0
       })
       })
     })
     })
   },
   },
@@ -49,14 +88,20 @@ Page({
     })
     })
     .catch(err=>{
     .catch(err=>{
       this.setData({
       this.setData({
-        todayinfo: {}
+        todayinfo: {},
+        status:0
       })
       })
     })
     })
   },
   },
 
 
   inputchange(e) {
   inputchange(e) {
     this.setData({
     this.setData({
-      usercode: e.detail.value
+      phone: e.detail.value
+    })
+  },
+  codechange(e) {
+    this.setData({
+      phcode: e.detail.value
     })
     })
   },
   },
   logout() {
   logout() {
@@ -74,13 +119,13 @@ Page({
   /**登陆 */
   /**登陆 */
   login: function () {
   login: function () {
     var _this=this;
     var _this=this;
-    if (!this.data.usercode) {
-      wx.showToast({
-        icon: 'none',
-        title: '请输入用户代码',
-      })
-      return;
-    }
+    // if (!this.data.usercode) {
+    //   wx.showToast({
+    //     icon: 'none',
+    //     title: '请输入用户代码',
+    //   })
+    //   return;
+    // }
     wx.getUserProfile({
     wx.getUserProfile({
       desc: '用于完善会员资料',
       desc: '用于完善会员资料',
       success: res=> {
       success: res=> {
@@ -108,10 +153,13 @@ Page({
                 return;
                 return;
               }
               }
               data.openid = res.data.data.openid;
               data.openid = res.data.data.openid;
-              
+              logindata=data
               $api.login(data)
               $api.login(data)
               .then(res=>{
               .then(res=>{
                 //登录成功
                 //登录成功
+                _this.setData({
+                  status:res.data.data.status
+                })
                 wx.hideLoading();
                 wx.hideLoading();
                 wx.setNavigationBarTitle({
                 wx.setNavigationBarTitle({
                   title: '',
                   title: '',
@@ -127,11 +175,15 @@ Page({
                   key: 'userInfo',
                   key: 'userInfo',
                   data: res.data.data,
                   data: res.data.data,
                 })
                 })
-                _this.getUserData()
+                if(res.data.data.status == 3){
+                  _this.getUserData()
+                  _this.getTodayData()
+                  
+                  // wx.switchTab({
+                  //   url: '../index/index',
+                  // })
+                }
                 
                 
-                wx.switchTab({
-                  url: '../index/index',
-                })
               })
               })
               .catch(err=>{
               .catch(err=>{
                 wx.hideLoading();
                 wx.hideLoading();
@@ -148,7 +200,30 @@ Page({
     })
     })
 
 
   },
   },
-
+  login1(){
+    logindata.phone=this.data.phone
+    logindata.phcode=this.data.phcode
+    $api.login(logindata).then(res=>{
+      if(res.data.code == 0){
+          this.setData({
+            status:3
+          })
+          this.getUserData()
+          this.getTodayData()
+      } 
+    })
+  },
+  login2(){
+    $api.bindphone({phone:this.data.phone,phcode:this.data.phcode}).then(res=>{
+      if(res.data.code == 0){
+          this.setData({
+            status:3
+          })
+          this.getUserData()
+          this.getTodayData()
+      }
+    })
+  },
   onCustomerService(){
   onCustomerService(){
     wx.openCustomerServiceChat({
     wx.openCustomerServiceChat({
       extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcc1bd2a8bddad1dfb'},
       extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcc1bd2a8bddad1dfb'},

+ 34 - 7
pages/user/user.wxml

@@ -1,4 +1,4 @@
-<view class="bg" wx:if='{{userinfo.id}}'>
+<view class="bg" wx:if='{{status == 3}}'>
       <view class="info">
       <view class="info">
         <view class='avatar'>
         <view class='avatar'>
             <image style="width:100%;height:100%;"  src="{{userinfo.avatar}}"></image>
             <image style="width:100%;height:100%;"  src="{{userinfo.avatar}}"></image>
@@ -7,13 +7,13 @@
             <view>{{userinfo.username}}</view>
             <view>{{userinfo.username}}</view>
             <text wx:if='{{userinfo.id}}'>代码:{{usercode}}</text>
             <text wx:if='{{userinfo.id}}'>代码:{{usercode}}</text>
         </view>
         </view>
-        <navigator url="../today/today?id={{todayinfo.match_id}}&record_id={{todayinfo.id}}&player_id={{todayinfo.player_id}}" 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>
       <view class="today">
       <view class="today">
       <navigator hover-class="none"  url="../change/change">
       <navigator hover-class="none"  url="../change/change">
       
       
       <view class="money">
       <view class="money">
-        <text class="{{todayMoney[0]=='-' ?'down':'up'}}">¥{{todayMoney}}  </text>
+        <text class="{{todayMoney[0]=='-' ?'down':'up'}}">{{todayMoney}}  </text>
         <text class="{{todayinfo.today_income[0]=='-' ?'todaydown':'todayup'}}">{{todayinfo.today_income}}</text>
         <text class="{{todayinfo.today_income[0]=='-' ?'todaydown':'todayup'}}">{{todayinfo.today_income}}</text>
         <text class="today_text">今日收益</text>
         <text class="today_text">今日收益</text>
       </view>
       </view>
@@ -27,8 +27,8 @@
       </view>
       </view>
       </navigator>
       </navigator>
       <view class="msg">
       <view class="msg">
-        <view><image mode="widthFix" src="../../images/msg.png"></image>3355</view>
-        <view><image mode="widthFix" src="../../images/zan.png"></image>3355</view>
+        <view><image mode="widthFix" src="../../images/msg.png"></image>{{todayinfo.comments_count}}</view>
+        <view><image mode="widthFix" src="../../images/zan.png"></image>{{todayinfo.zan_count}}</view>
       </view>
       </view>
       </view>
       </view>
       <view class="list" style="padding:0 30rpx;background:#fff;">
       <view class="list" style="padding:0 30rpx;background:#fff;">
@@ -54,15 +54,42 @@
   
   
 </view>
 </view>
 <!-- 未登录 -->
 <!-- 未登录 -->
-<view class="no_login" wx:else>
+<view class="no_login" wx:if='{{status == 0}}'>
     <view class="title">欢迎来到湖南顽主杯实盘大赛</view>
     <view class="title">欢迎来到湖南顽主杯实盘大赛</view>
     <view class='avatar'>
     <view class='avatar'>
             <open-data type="userAvatarUrl">
             <open-data type="userAvatarUrl">
             </open-data>
             </open-data>
     </view>
     </view>
     <view class="login">
     <view class="login">
-        <input bindinput='inputchange' placeholder="请输入您的代码" value="{{usercode}}"></input>
+        <!-- <input bindinput='inputchange' placeholder="请输入您的代码" value="{{usercode}}"></input> -->
         <button bindtap="login">登录</button>
         <button bindtap="login">登录</button>
       </view>
       </view>
       <!-- <button class="contactus" open-type="contact">咨询</button> -->
       <!-- <button class="contactus" open-type="contact">咨询</button> -->
+</view>
+<view class="no_login" wx:if='{{status == 1}}'>
+    <view class="title">欢迎来到湖南顽主杯实盘大赛</view>
+    <view class='avatar'>
+          <image src="../../images/logo.png"></image>
+    </view>
+    <view class="login">
+        <view><input type="number" placeholder-style="color:#999" bindinput='inputchange' placeholder="请输入手机号"></input></view>
+        <view class="yzm">
+          <input type="number" placeholder-style="color:#999" bindinput='codechange' placeholder="请输入验证码"></input>
+          <view bindtap="getcode" wx:if="{{text=='获取验证码'}}">{{text}}</view>
+          <view class="disabled" wx:else>{{text}}</view>
+        </view>
+        <button bindtap="login1">登录</button>
+      </view>
+</view>
+<view class="no_login" wx:if='{{status == 2}}'>
+    <view class="title" style="margin-bottom: 50rpx;">为了账号安全,请先绑定手机号</view>
+    <view class="login">
+        <view><input type="number" placeholder-style="color:#999" bindinput='inputchange' placeholder="请输入手机号"></input></view>
+        <view class="yzm">
+          <input type="number" placeholder-style="color:#999" bindinput='codechange' placeholder="请输入验证码"></input>
+          <view bindtap="getcode" wx:if="{{text=='获取验证码'}}">{{text}}</view>
+          <view class="disabled" wx:else>{{text}}</view>
+        </view>
+        <button bindtap="login2">绑定</button>
+      </view>
 </view>
 </view>

+ 33 - 6
pages/user/user.wxss

@@ -68,27 +68,29 @@ page{
 
 
 .login input{
 .login input{
   width: 100%;
   width: 100%;
-  text-align: center;
-  height: 108rpx;
+  height: 88rpx;
+  text-align: left;
   /* background: #F4F6F8; */
   /* background: #F4F6F8; */
-  font-size: 32rpx;
+  font-size: 30rpx;
   border-radius: 8rpx;
   border-radius: 8rpx;
+  padding: 0 24rpx;
   border: 1px solid #E0E0E0;
   border: 1px solid #E0E0E0;
+  box-sizing: border-box;
 }
 }
 .login button:not([size='mini']){
 .login button:not([size='mini']){
   background: #D94B24;
   background: #D94B24;
   color: #fff;
   color: #fff;
   width: 100%;
   width: 100%;
   margin-top: 48rpx;
   margin-top: 48rpx;
-  height: 108rpx;
-  line-height: 108rpx;
+  height: 88rpx;
+  line-height: 88rpx;
   padding: 0;
   padding: 0;
   font-size: 32rpx;
   font-size: 32rpx;
   border-radius: 8rpx;
   border-radius: 8rpx;
 }
 }
 .no_login{
 .no_login{
   height: 100vh;
   height: 100vh;
-  background: #F4F6F8;
+  background: #fff;
   text-align: center;
   text-align: center;
   padding: 30% 70rpx 0;
   padding: 30% 70rpx 0;
 }
 }
@@ -193,4 +195,29 @@ page{
   border-radius: 8rpx;
   border-radius: 8rpx;
   box-shadow: 0 0 10px 0px rgba(51, 51, 51, 0.1);
   box-shadow: 0 0 10px 0px rgba(51, 51, 51, 0.1);
   overflow: hidden;
   overflow: hidden;
+}
+.no_login .avatar image{
+  width: 160rpx;
+  height: 160rpx;
+}
+.yzm{
+  margin-top: 30rpx;
+  display: flex;
+  justify-content: space-between;
+}
+.yzm input{
+  width: 65%;
+}
+.yzm view{
+  width: 30%;
+  height: 88rpx;
+  color: #D94B24;
+  line-height: 88rpx;
+  border: 1px solid #D94B24;
+  border-radius: 8rpx;
+  font-size: 30rpx;
+}
+.yzm .disabled{
+  color: #999;
+  border-color: #999;
 }
 }

+ 1 - 1
project.config.json

@@ -45,7 +45,7 @@
     },
     },
     "compileType": "miniprogram",
     "compileType": "miniprogram",
     "libVersion": "2.15.0",
     "libVersion": "2.15.0",
-    "appid": "wxb299e10e65157301",
+    "appid": "wx2938132b773c7b5a",
     "projectname": "newwzb_xcx",
     "projectname": "newwzb_xcx",
     "simulatorType": "wechat",
     "simulatorType": "wechat",
     "simulatorPluginLibVersion": {},
     "simulatorPluginLibVersion": {},

+ 7 - 4
utils/api.js

@@ -3,10 +3,11 @@ const POST = 'POST';
 const PUT = 'PUT';
 const PUT = 'PUT';
 const FORM = 'FORM';
 const FORM = 'FORM';
 const DELETE = 'DELETE';
 const DELETE = 'DELETE';
-
-// const baseURL = 'https://wx.scxjc.club';
+// wxb299e10e65157301
+// wx2938132b773c7b5a
+const baseURL = 'https://wx.scxjc.club';
 // const baseURL = 'https://www.hunanwanzhu.com';
 // const baseURL = 'https://www.hunanwanzhu.com';
-const baseURL = 'https://api.hunanwanzhu.com';
+// const baseURL = 'https://api.hunanwanzhu.com';
 
 
 function request(method, url, data) {
 function request(method, url, data) {
   var token='';
   var token='';
@@ -98,7 +99,9 @@ function uploadFile(url, filePath, name, formData, isSubDomain) {
 
 
 const API = {
 const API = {
   getOpenid: (data) => request(GET, `/api/wx/openid`, data),
   getOpenid: (data) => request(GET, `/api/wx/openid`, data),
-  login: (data) => request(POST, `/api/wx/login`, data),
+  login: (data) => request(POST, `/api/wx/v3/login`, data),
+  bindphone: (data) => request(POST, `/api/wx/v3/phone/bind`, data),
+  sendcode: (data) => request(POST, `/api/wx/v3/phone/code`, data),
   getAuthinfo: (data) => request(GET, `/api/wx/authinfo`, data),
   getAuthinfo: (data) => request(GET, `/api/wx/authinfo`, data),
   getEnumList: (data) => request(GET, `/api/wx/v2/enum/list`, data),
   getEnumList: (data) => request(GET, `/api/wx/v2/enum/list`, data),
   getIndex: (data) => request(GET, `/api/wx/index`, data),
   getIndex: (data) => request(GET, `/api/wx/index`, data),