xjc пре 2 година
родитељ
комит
da0ad4d786
6 измењених фајлова са 48 додато и 37 уклоњено
  1. 12 2
      pages/message/message.js
  2. 16 17
      pages/message/message.wxml
  3. 1 1
      pages/message/message.wxss
  4. 5 5
      pages/style/style.js
  5. 13 12
      pages/style/style.wxml
  6. 1 0
      utils/api.js

+ 12 - 2
pages/message/message.js

@@ -9,7 +9,8 @@ Page({
      * 页面的初始数据
      */
     data: {
-        focus:false
+        focus:false,
+        scrollTop:0
     },
 
     /**
@@ -61,7 +62,16 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-      
+      let that = this;
+      wx.createSelectorQuery().select("#messageScroll").boundingClientRect(function(rect){
+        wx.pageScrollTo({
+          scrollTop:rect.height,
+          duration:100
+        })
+        that.setData({
+          scrollTop:rect.height - that.data.scrollTop
+        })
+      }).exec()
     },
 
     /**

+ 16 - 17
pages/message/message.wxml

@@ -1,20 +1,19 @@
-<view class="list" wx:for="{{list}}">
-    <view class="me" wx:if='{{item.user_id}}'>
-        <image src="{{item.user_avatar}}" ></image>
-        <view class="content">{{item.content}}</view>
-    </view>
-    <view class="wz" wx:else>
-        <image src="../../images/wz.jpg" ></image>
-        <view>
-            <text class="name">顽主</text>
-            <view class="content">{{item.reply_content}}</view>
+<view id="messageScroll">
+    <view class="list" wx:for="{{list}}" >
+        <view class="me" wx:if='{{item.user_id}}'>
+            <image src="{{item.user_avatar}}" ></image>
+            <view class="content">{{item.content}}</view>
+        </view>
+        <view class="wz" wx:else>
+            <image src="../../images/wz.jpg" ></image>
+            <view>
+                <text class="name">顽主</text>
+                <view class="content">{{item.reply_content}}</view>
+            </view>
         </view>
     </view>
-</view>
-
-
-
-<view class="post">
-    <input confirm-type='send' bindconfirm='post' value="{{comment}}" placeholder-style="color:#999" maxlength="500" bindinput="inputchange" type="text" placeholder="我要咨询"/>
-    <button bindtap="post">提交</button>
+    <view class="post">
+        <input confirm-type='send' bindconfirm='post' value="{{comment}}" placeholder-style="color:#999" maxlength="500" bindinput="inputchange" type="text" placeholder="我要咨询"/>
+        <button bindtap="post">提交</button>
+    </view>
 </view>

+ 1 - 1
pages/message/message.wxss

@@ -5,7 +5,7 @@ page{
 }
 .list{
     position: relative;
-    margin-bottom: 24rpx;
+    margin-bottom: 56rpx;
 }
 .post{
     position: fixed;

+ 5 - 5
pages/style/style.js

@@ -80,10 +80,10 @@ Page({
         })
         const tempFilePaths = res.tempFiles
         for (let i = 0; i < tempFilePaths.length; i++) {
-          $api.upload(tempFilePaths[i].path,'file').then(res=>{
+          $api.uploadAvatar(tempFilePaths[i].path,'file').then(res=>{
               wx.hideLoading()
               if(res.code == 0){
-                form.account_img=res.data.url;
+                form.avatar=res.data.url;
                 this.setData({
                   form: form
                 })
@@ -103,13 +103,13 @@ Page({
   },
   preview(){
     wx.previewImage({
-      urls: [this.data.form.account_img],
-      current: this.data.form.account_img
+      urls: [this.data.form.avatar],
+      current: this.data.form.avatar
     })
   },
   del(){
     let form = this.data.form;
-    form.account_img ='';
+    form.avatar ='';
     this.setData({
       form: form
     })

+ 13 - 12
pages/style/style.wxml

@@ -1,4 +1,15 @@
 <wxs src="../../utils/tool.wxs" module="tool"></wxs>
+<view class="item">
+  <label>头像</label>
+  <view class="tags">
+      <image class="account_img" wx:if='{{form.avatar}}' bindtap="preview" src="{{form.avatar}}"></image>
+      <icon wx:if='{{form.avatar}}' bindtap="del" class="icon-small" type="cancel" size="25"></icon>
+      <view wx:else class="upload" bindtap="uploadImg">
+          <image mode="widthFix" src="../../images/img.png"></image>
+            上传头像
+      </view>
+  </view>
+</view>
 <view class="item" wx:if="{{form.is_player==1}}"> 
    <label>参赛名</label>
    <view class="tags"> 
@@ -18,7 +29,7 @@
   </view>
 </view>
 
-<view class="title">请选择你的操作风格</view>
+<view class="title">操作风格</view>
 <view wx:if='{{arr1.length>0}}'>
 <view class="item">
   <label>周期</label>
@@ -53,16 +64,6 @@
       <view style="color:red;font-size:23rpx;">比赛期间有资金进出请联系QQ客服除权,再提交作业</view> -->
   <!-- </view> -->
 <!-- </view> -->
-<!-- <view class="item">
-  <label>账户截图</label>
-  <view class="tags">
-      <image class="account_img" wx:if='{{form.account_img}}' bindtap="preview" src="{{form.account_img}}"></image>
-      <icon wx:if='{{form.account_img}}' bindtap="del" class="icon-small" type="cancel" size="25"></icon>
-      <view wx:else class="upload" bindtap="uploadImg">
-          <image mode="widthFix" src="../../images/img.png"></image>
-            上传图片
-      </view>
-  </view>
-</view> -->
+
 <button bindtap="post" class="post_btn">确定</button>
 </view>

+ 1 - 0
utils/api.js

@@ -118,6 +118,7 @@ const API = {
   getSellStock: (data) => request(GET, `/api/wx/v2/hot/stock/sell/players`, data),
   getChampionlList: (data) => request(GET, `/api/wx/v2/champion/article/list`, data),
   upload: (filePath, name) => uploadFile(`/api/wx/uploadfile`, filePath, name),
+  uploadAvatar: (filePath, name) => uploadFile(`/api/wx/uploadavatar`, filePath, name),
   updateStyle: (data) => request(PUT, `/api/wx/v2/mine/style`, data),
   getMyStyle: (data) => request(GET, `/api/wx/v2/mine/style`, data),
   getMyFollow: (data) => request(GET, `/api/wx/v2/user/follow/list`, data),