Jelajahi Sumber

作品上传样式调整

bayi 2 tahun lalu
induk
melakukan
14618dac83
3 mengubah file dengan 20 tambahan dan 21 penghapusan
  1. 3 4
      components/uploadFile/index.js
  2. 15 15
      components/uploadFile/index.wxml
  3. 2 2
      pages/pkResult/index.js

+ 3 - 4
components/uploadFile/index.js

@@ -31,8 +31,8 @@ Component({
    */
   data: {
     tempFilePath: '',
-    uploadFlag: false,
     uploadSuccess: false,
+    uploadFlag: false,
     // 是否上传过
     uploadState: false,
     percent: 0,
@@ -46,8 +46,7 @@ Component({
         return
       }
       this.setData({
-        uploadFlag: true,
-        uploadState: true
+        uploadFlag: true
       })
       const uploadTask = wx.uploadFile({
         url: 'https://reader-api.ai160.com//file/upload',
@@ -61,6 +60,7 @@ Component({
           let audioPath = formateRes.data;
           this.uploadWorks(audioPath);
           this.setData({
+            uploadState: true,
             uploadSuccess: true,
           })
         },
@@ -94,7 +94,6 @@ Component({
         res = await publishRankWorks(data)
       }
       wx.setStorageSync('shareVideoId', res.id)
-      console.log(res, 'rrrrrrrr');
       let _data = this.data.readDetail
       await postWorksScore({
         "userReadId": res.id,

+ 15 - 15
components/uploadFile/index.wxml

@@ -1,20 +1,20 @@
-<view class="btn" bindtap="upload">上传作品</view>
+<view class="btn" bindtap="upload" wx:if="{{!uploadState}}">上传作品</view>
 <view class="uploadBox" wx:if="{{uploadFlag}}">
-    <view class="upload">
-        <view class="speed">{{percent}}%</view>
-        <progress percent="{{percent}}" class="speedProgress" stroke-width="10" activeColor="#C3F166" />
-        <view>作品上传中</view>
-    </view>
+  <view class="upload">
+    <view class="speed">{{percent}}%</view>
+    <progress percent="{{percent}}" class="speedProgress" stroke-width="10" activeColor="#C3F166" />
+    <view>作品上传中</view>
+  </view>
 </view>
 <!-- 上传成功 -->
 <view class="successBox " catchtap="cancelMask" wx:if="{{uploadSuccess}}">
-    <view class="success" catchtap="true">
-        <image src="/static/lan.png" class="icon" mode="" />
-        <view class="tips1">作品上传成功</view>
-        <view class="tips2">快去分享你的作品</view>
-        <view class="tips2">召唤小伙伴点赞评论!</view>
-        <button class="resetBtn shareBtn" open-type="share" catchtap="cancelMask">
-            分享作品
-        </button>
-    </view>
+  <view class="success" catchtap="true">
+    <image src="/static/lan.png" class="icon" mode="" />
+    <view class="tips1">作品上传成功</view>
+    <view class="tips2">快去分享你的作品</view>
+    <view class="tips2">召唤小伙伴点赞评论!</view>
+    <button class="resetBtn shareBtn" open-type="share" catchtap="cancelMask">
+      分享作品
+    </button>
+  </view>
 </view>

+ 2 - 2
pages/pkResult/index.js

@@ -132,7 +132,7 @@ Page({
         url: `/pages/reading/index?videoId=${this.data.victory.userRead.exampleId}&readingType=pk`,
       })
     } else {
-      wx.redirectTo({
+      wx.switchTab({
         url: `/pages/index/index`,
       })
     }
@@ -214,7 +214,7 @@ Page({
                     success: (res) => {
                       let userName = this.data.pkRecord.userReadId == this.data.victory.userRead.id ? this.data.victory.user.nickName || this.data.victory.user.eid : this.data.defeated.user.nickName || this.data.defeated.user.eid
                       if (userName.length > 4) {
-                        userName = userName.slice(0, 4)+'...'
+                        userName = userName.slice(0, 4) + '...'
                       }
                       resolve({
                         title: `我挑战了${userName}的作品,这场比拼真精彩!点击加入战局!`,