yukangzhe 3 лет назад
Родитель
Сommit
db24433ed1
3 измененных файлов с 23 добавлено и 8 удалено
  1. 18 3
      pages/forBack/forBack.js
  2. 1 1
      pages/forBack/forBack.wxml
  3. 4 4
      pages/forBack/forBack.wxss

+ 18 - 3
pages/forBack/forBack.js

@@ -27,7 +27,7 @@ Page({
         type: 'select'
       },
     ],
-    curRadioIndex: '-1',
+    curRadioIndex: '0',
     plateList: [
       '我的课表',
       '提交作业',
@@ -39,7 +39,7 @@ Page({
       '调课',
     ],
     plateIndex: 0,
-    radioType: '',
+    radioType: 'school',
     imgList:[]
   },
 
@@ -59,6 +59,13 @@ Page({
 
   uploadTap: function () {
     const that = this
+    if(that.data.imgList.length>=6){
+      wx.showToast({
+        title: '最多上传6张图片',
+        icon: 'none'
+      })
+      return false
+    }
     wx.chooseImage({
       count: 6,
       sourceType: ['album', 'camera'],
@@ -66,7 +73,7 @@ Page({
         wx.showLoading({
           title: '上传中...',
         })
-        for (var i in res.tempFilePaths) {console.log(i)
+        for (var i in res.tempFilePaths) {
           wx.uploadFile({
             filePath: res.tempFilePaths[i],
             name: 'name',
@@ -101,6 +108,14 @@ Page({
     })
   },
 
+  delImg:function(e){
+    const index = e.currentTarget.dataset.index
+    this.data.imgList.splice(index,1)
+    this.setData({
+      imgList: this.data.imgList
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */

+ 1 - 1
pages/forBack/forBack.wxml

@@ -30,7 +30,7 @@
         <view class="new-task-img">
           <image src="{{item.url}}"></image>
         </view>
-        <view class="del-btn">X</view>
+        <view class="del-btn" catchtap="delImg" data-index="{{index}}">X</view>
       </view>
       <view class="upload-btn" bindtap="uploadTap">
         <view style="margin-top:30rpx">

+ 4 - 4
pages/forBack/forBack.wxss

@@ -105,12 +105,12 @@
 }
 
 .upload-btn{
-  width: 139rpx;
+    width: 139rpx;
     height: 139rpx;
     border: 1rpx dashed #ccc;
     text-align: center;
     background: #f8f8f8;
-    margin: 20rpx 0 0;
+    margin: 20rpx 0 20rpx;
     color: #999;
     font-size: 22rpx;
     line-height: 36rpx;
@@ -123,10 +123,10 @@
   color: #FFF;
   background: #cc6031;
   text-align: center;
-  position: fixed;
-  bottom: 60rpx;
+  position: relative;
   left: 50%;
   margin-left: -200rpx;
+  margin-bottom: 60rpx;
   border-radius: 50rpx;
   font-size: 36rpx;
 }