bayi 2 jaren geleden
bovenliggende
commit
1699101bcd
6 gewijzigde bestanden met toevoegingen van 57 en 6 verwijderingen
  1. 23 0
      pages/chat/index.js
  2. 11 1
      pages/chat/index.less
  3. 3 2
      pages/chat/index.wxml
  4. 10 1
      pages/chat/index.wxss
  5. 8 0
      pages/comment/index.js
  6. 2 2
      pages/comment/index.wxml

+ 23 - 0
pages/chat/index.js

@@ -24,4 +24,27 @@ Page({
       url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
     })
   },
+  chooseImage() {
+    wx.chooseImage({
+      count: 1, // 可选择的图片数量
+      sizeType: ['compressed'], // 压缩图片
+      sourceType: ['album', 'camera'], // 来源:相册或相机
+      success: (res) => {
+        // 将选择的图片上传到服务器
+        this.uploadImage(res.tempFilePaths[0]);
+      }
+    })
+  },
+  uploadImage(imagePath) {
+    wx.uploadFile({
+      url: 'https://reader-api.ai160.com/file/upload',
+      filePath: imagePath,
+      header: {
+        uid: wx.getStorageSync('uid')
+      },
+      success: (res) => {
+        console.log(res.data);
+      }
+    })
+  }
 })

+ 11 - 1
pages/chat/index.less

@@ -1,4 +1,5 @@
 .chat {
+  min-height: 100vh;
   background-color: white;
 
   .content {
@@ -64,8 +65,17 @@
       background-color: white;
     }
 
+    .sendImg {
+      width: 32rpx;
+      height: 32rpx;
+      border: 4rpx solid #3DD076;
+      margin: 0rpx 24rpx;
+      padding: 10rpx;
+      border-radius: 50%;
+    }
+
     .submit {
-      padding: 14rpx 30rpx;
+      padding: 14rpx 10rpx 14rpx 0rpx;
       color: #0091FF;
       font-size: 38rpx;
     }

+ 3 - 2
pages/chat/index.wxml

@@ -1,16 +1,17 @@
 <view class="chat">
   <view class="content">
-    <view class="base someone" wx:for="{{5}}" wx:key="index">
+    <view class="base someone" wx:for="{{2}}" wx:key="index">
       <image src="/static/star.png" class="avatar" bindtap="jumpUserInfo" data-uid='{{index}}' />
       <view class="message">获取系统信息。由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 wx.getSystemInfoAsync。</view>
     </view>
-    <view class="base self" wx:for="{{5}}" wx:key="index">
+    <view class="base self" wx:for="{{2}}" wx:key="index">
       <view class="message">获取系统信息。由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 wx.getSystemInfoAsync。</view>
       <image src="/static/star.png" class="avatar" />
     </view>
   </view>
   <view class="inputBox {{isIos?'iosPadding':''}}">
     <input class="input" bindinput="bindKeyInput" value="{{value}}" placeholder="我有话说..." />
+    <image src="/static/follow_3.png" class="sendImg" bindtap="chooseImage" />
     <view class="submit" bindtap="sendReply">发送</view>
   </view>
 </view>

+ 10 - 1
pages/chat/index.wxss

@@ -1,4 +1,5 @@
 .chat {
+  min-height: 100vh;
   background-color: white;
 }
 .chat .content {
@@ -52,8 +53,16 @@
   border-radius: 10rpx;
   background-color: white;
 }
+.chat .inputBox .sendImg {
+  width: 32rpx;
+  height: 32rpx;
+  border: 4rpx solid #3DD076;
+  margin: 0rpx 24rpx;
+  padding: 10rpx;
+  border-radius: 50%;
+}
 .chat .inputBox .submit {
-  padding: 14rpx 30rpx;
+  padding: 14rpx 10rpx 14rpx 0rpx;
   color: #0091FF;
   font-size: 38rpx;
 }

+ 8 - 0
pages/comment/index.js

@@ -54,4 +54,12 @@ Page({
       url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
     })
   },
+  jumpWork({
+    currentTarget
+  }) {
+    console.log(currentTarget);
+    wx.navigateTo({
+      url: `/pages/userWorks/index?id=${currentTarget.dataset.id}`,
+    })
+  },
 })

+ 2 - 2
pages/comment/index.wxml

@@ -1,6 +1,6 @@
 <view class="commentPage">
-  <view class="notes" wx:for="{{list}}" wx:key="index">
-    <image src="{{item.user.avatar}}" class="avatar" data-uid='{{item.user.uid}}' bindtap="jumpUserInfo" />
+  <view class="notes" wx:for="{{list}}" wx:key="index" data-id='{{item.userRead.id}}' bindtap="jumpWork">
+    <image src="{{item.user.avatar}}" class="avatar" data-uid='{{item.user.uid}}' catchtap="jumpUserInfo" />
     <view class="body">
       <view class="nickName">{{item.user.nickName||item.user.eid}}</view>
       <view class="date">