Ver código fonte

添加活动视频效果

黎海 2 anos atrás
pai
commit
989362f3e3

+ 2 - 2
app_list.json

@@ -1,7 +1,7 @@
1 1
 {
2 2
   "taroConfig": {
3
-    "version": "1.4.9",
4
-    "desc": "更改人物动漫化"
3
+    "version": "1.5.3",
4
+    "desc": "更改绘画详情页"
5 5
   },
6 6
   "app_list": [
7 7
     {

+ 4 - 0
config/index.js

@@ -30,6 +30,10 @@ const config = {
30 30
   },
31 31
   copy: {
32 32
     patterns: [
33
+      {
34
+        from: 'src/native-pages',
35
+        to: 'dist/native-pages'
36
+      }
33 37
     ],
34 38
     options: {
35 39
     }

+ 2 - 2
package.json

@@ -81,7 +81,7 @@
81 81
         "webpack": "5.69.0"
82 82
     },
83 83
     "taroConfig": {
84
-        "version": "1.4.9",
85
-        "desc": "更改人物动漫化"
84
+        "version": "1.5.3",
85
+        "desc": "更改绘画详情页"
86 86
     }
87 87
 }

+ 2 - 2
src/api/config.js

@@ -1,7 +1,7 @@
1 1
 // 配置请求对象
2 2
 // 本地调试 dev 开发阶段
3
-export const baseUrl = "https://test-openai.fyshark.com";//测试
4
-// export const baseUrl = "https://openai.fyshark.com";//正式
3
+// export const baseUrl = "https://test-openai.fyshark.com";//测试
4
+export const baseUrl = "https://openai.fyshark.com";//正式
5 5
 // product 阶段
6 6
 // https://www.fastmock.site/mock/3f112f6cb2f621fc9c2dd6a14be19f38/beers/
7 7
 // 设计模式

+ 2 - 1
src/app.config.js

@@ -5,7 +5,8 @@ export default defineAppConfig({
5 5
     'pages/index/index',
6 6
     "pages/mine/index",
7 7
     'pages/collection/index',
8
-    "pages/activity/index"
8
+    "pages/activity/index",
9
+    "native-pages/index/index"
9 10
   ],
10 11
   subpackages: [
11 12
     {

+ 2 - 2
src/moduleB/pages/comic/index.jsx

@@ -306,7 +306,7 @@ export default class collection extends Component {
306 306
   }
307 307
   //充值
308 308
   toOrder () {
309
-    if (this.state.isIos) {
309
+    if (this.state.creatInfo.ios_status==0) {
310 310
       Taro.showToast({
311 311
         title: 'ios暂不支持充值',
312 312
         icon: 'none',
@@ -464,7 +464,7 @@ export default class collection extends Component {
464 464
             >
465 465
               <View className='result-recharge-button-content'>
466 466
                 <View className='result-recharge-button-top'>【限时抢购】无广告!</View>
467
-                <View className='result-recharge-button-bottom'>9.9元→{this.state.models.money_week / 100}元/周!
467
+                <View className='result-recharge-button-bottom'>9.9元→{this.state.creatInfo.money_week / 100}元/周!
468 468
                 </View>
469 469
               </View>
470 470
             </View>

+ 1 - 1
src/moduleB/pages/comicActivity/index.jsx

@@ -288,7 +288,7 @@ export default class collection extends Component {
288 288
   }
289 289
   //充值
290 290
   toOrder () {
291
-    if (this.state.isIos) {
291
+    if (this.state.models.ios_status==0) {
292 292
       Taro.showToast({
293 293
         title: 'ios暂不支持充值',
294 294
         icon: 'none',

+ 2 - 3
src/moduleB/pages/comicActivityCurrent/index.jsx

@@ -131,7 +131,6 @@ export default class collection extends Component {
131 131
   }
132 132
   //看广告画图
133 133
   playVideoGeneratePictures () {
134
-
135 134
     if (!this.state.isImage) {
136 135
       Taro.showToast({ title: '请先上传图片', icon: 'none' })
137 136
       return
@@ -292,7 +291,7 @@ export default class collection extends Component {
292 291
   }
293 292
   //充值
294 293
   toOrder () {
295
-    if (this.state.isIos) {
294
+    if (this.state.models.ios_status==0) {
296 295
       Taro.showToast({
297 296
         title: 'ios暂不支持充值',
298 297
         icon: 'none',
@@ -402,7 +401,7 @@ export default class collection extends Component {
402 401
                   ></Image> */}
403 402
                    <Video
404 403
                     className='album_swiper_video'
405
-                    src={'http://video-img.fyshark.com/16832726796725%E6%9C%885%E6%97%A5(1).mp4'}
404
+                    src={this.state.models.video_url}
406 405
                     showCenterPlayBtn={false}
407 406
                     showPlayBtn={false}
408 407
                     showFullscreenBtn={false}

+ 15 - 67
src/moduleB/pages/comicActivityCurrentDetail/index.jsx

@@ -342,63 +342,11 @@ export default class collection extends Component {
342 342
       urls: [`${this.state.draw_infos[this.state.current].img}`] // 需要预览的图片http链接列表  
343 343
     })
344 344
   }
345
-  onUploadDouyinVideo  () {
346
-    // 通过 uploadOptions 可以拿到 button target 上的一些信息
347
-    // 如这里的 demo 可以拿到 id: "1",hello: "world"
348
-    console.log("onUploadDouyinVideoOptions: ", uploadOptions);
349
-
350
-    // 可以利用异步能力配合其他 API 获取必要的字段信息
351
-    const videoPath = this.chooseVideo();
352
-    console.log("videoPath:", videoPath);
353
-    // 返回值(文档中称之为 uploadParams)将被当作发布参数传入视频发布器,发布视频
354
-    return {
355
-      videoPath,
356
-      stickersConfig: {
357
-        text: [
358
-          {
359
-            text: "这是文字贴图",
360
-            color: "#ffffff",
361
-            fontSize: 28,
362
-            scale: 1,
363
-            x: 0.5,
364
-            y: 0.5,
365
-          },
366
-        ],
367
-      },
368
-      success: function (callback) {
369
-        // 只有当发布成功且挂载成功时,success callback 才会有 videoId
370
-        console.log("success: ", callback);
371
-      },
372
-      fail: function (callback) {
373
-        console.log("fail: ", callback);
374
-      },
375
-      complete: function (callback) {
376
-        console.log("complete: ", callback);
377
-      },
378
-    };
379
-  }
380
-  // chooseVideo () {
381
-  //   return new Promise((resolve) => {
382
-  //     tt.chooseVideo({
383
-  //       sourceType: ["album", "camera"],
384
-  //       compressed: true,
385
-  //       success: (res) => {
386
-  //         resolve(res.tempFilePath);
387
-  //       },
388
-  //       fail: (err) => {
389
-  //         let errType = err.errMsg.includes("chooseVideo:fail cancel")
390
-  //           ? "取消选择"
391
-  //           : "选择失败";
392
-  //         tt.showModal({
393
-  //           title: errType,
394
-  //           content: err.errMsg,
395
-  //           showCancel: false,
396
-  //         });
397
-  //         resolve("");
398
-  //       },
399
-  //     });
400
-  //   });
401
-  // }
345
+  onUploadDouyinVideo = async () => {
346
+    Taro.navigateTo({
347
+      url: `/native-pages/index/index?videoUrl=http://video-img.fyshark.com/16833402744695%E6%9C%885%E6%97%A5(1).mp4`
348
+    })
349
+  };
402 350
 
403 351
 
404 352
   render () {
@@ -443,16 +391,16 @@ export default class collection extends Component {
443 391
         {/* <View className='send'>
444 392
           <View className='sendTT'>一键发抖音</View>
445 393
         </View> */}
446
-        <View className='control'>
447
-          <View className='download' onClick={e => (this.download())}>保存图片</View>
448
-          <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
449
-        </View>
450
-        <Button openType="uploadDouyinVideo">
451
-          uploadDouyinVideo
452
-        </Button>
453
-        <button open-type="uploadDouyinVideo" id="1" data-hello="world">
454
-          发布
455
-        </button>
394
+        {
395
+          this.state.draw_infos.length > 0 && this.state.draw_infos[this.state.current].status == 2 &&
396
+          <View className='control'>
397
+            <View className='download' onClick={e => (this.download())}>保存图片</View>
398
+            <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
399
+          </View>
400
+        }
401
+        {/* <Button open-type="uploadDouyinVideo" className='upload-button' onClick={this.onUploadDouyinVideo}>
402
+          上传抖音视频
403
+        </Button> */}
456 404
       </View>
457 405
     )
458 406
   }

+ 8 - 5
src/moduleB/pages/comicActivityDetail/index.jsx

@@ -265,7 +265,7 @@ export default class collection extends Component {
265 265
           draw_status: res.data.draw_status,
266 266
           que_cnt: res.data.que_cnt,
267 267
           draw_infos: draw_infos,
268
-          is_week:res.data.is_week,
268
+          is_week: res.data.is_week,
269 269
           wallet_balance: res.data.wallet_balance
270 270
         })
271 271
       }
@@ -385,10 +385,13 @@ export default class collection extends Component {
385 385
         {/* <View className='send'>
386 386
           <View className='sendTT'>一键发抖音</View>
387 387
         </View> */}
388
-        <View className='control'>
389
-          <View className='download' onClick={e => (this.download())}>保存图片</View>
390
-          <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
391
-        </View>
388
+        {
389
+          this.state.draw_infos.length > 0 && this.state.draw_infos[this.state.current].status == 2 &&
390
+          <View className='control'>
391
+            <View className='download' onClick={e => (this.download())}>保存图片</View>
392
+            <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
393
+          </View>
394
+        }
392 395
       </View>
393 396
     )
394 397
   }

+ 3 - 0
src/moduleB/pages/comicDetail/index.jsx

@@ -397,10 +397,13 @@ export default class collection extends Component {
397 397
         {/* <View className='send'>
398 398
           <View className='sendTT'>一键发抖音</View>
399 399
         </View> */}
400
+        {
401
+          this.state.draw_infos.length > 0 && this.state.draw_infos[this.state.current].status==2&&
400 402
         <View className='control'>
401 403
           <View className='download' onClick={e => (this.download())}>保存图片</View>
402 404
           <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
403 405
         </View>
406
+        }
404 407
       </View>
405 408
     )
406 409
   }

+ 100 - 0
src/native-pages/index/index.js

@@ -0,0 +1,100 @@
1
+// index.js
2
+Page({
3
+  data: {
4
+    videoUrl:'',
5
+  },
6
+   onLoad(options){
7
+    console.log(options,'pages');
8
+    this.setData({
9
+      videoUrl: options.videoUrl
10
+    })
11
+    console.log(this.data.videoUrl,'videoUrl');
12
+  },
13
+  // onUploadDouyinVideo 和 onLoad 等其他钩子同级
14
+  async onUploadDouyinVideo (uploadOptions) {
15
+    // 通过 uploadOptions 可以拿到 button target 上的一些信息
16
+    // 如这里的 demo 可以拿到 id: "1",hello: "world"
17
+    console.log("onUploadDouyinVideoOptions: ", uploadOptions);
18
+
19
+    // 可以利用异步能力配合其他 API 获取必要的字段信息
20
+    const videoPath = await this.chooseVideo();
21
+    console.log("videoPath:", videoPath);
22
+    // 返回值(文档中称之为 uploadParams)将被当作发布参数传入视频发布器,发布视频
23
+    return {
24
+      videoPath,
25
+      titleConfig: {
26
+        title: "视频标题",
27
+        mentionMarkers: [
28
+          {
29
+            start: 0,
30
+            openId: "标题里要 @ 的人",
31
+          },
32
+        ],
33
+        hashtagMarkers: [
34
+          {
35
+            start: 0,
36
+            hashtag: "标题里要 # 的话题",
37
+          },
38
+        ],
39
+      },
40
+      extra: {
41
+        anchor: {
42
+          anchorType: "app",
43
+          title: "【点击测试】AI绘画小程序",
44
+          path: "/moduleB/pages/comicActivityCurrent/index?style_id=37&c=tta3fed5433cc1e78401&s=05061053770",
45
+        },
46
+      },
47
+      success: function (callback) {
48
+        // 只有当发布成功且挂载成功时,success callback 才会有 videoId
49
+        console.log("success: ", callback);
50
+      },
51
+      fail: function (callback) {
52
+        console.log("fail: ", callback);
53
+      },
54
+      complete: function (callback) {
55
+        console.log("complete: ", callback);
56
+      },
57
+    };
58
+  },
59
+  chooseVideo () {
60
+    return new Promise((resolve) => {
61
+      tt.chooseVideo({
62
+        sourceType: ["album", "camera"],
63
+        compressed: true,
64
+        success: (res) => {
65
+          resolve(res.tempFilePath);
66
+        },
67
+        fail: (err) => {
68
+          let errType = err.errMsg.includes("chooseVideo:fail cancel")
69
+            ? "取消选择"
70
+            : "选择失败";
71
+          tt.showModal({
72
+            title: errType,
73
+            content: err.errMsg,
74
+            showCancel: false,
75
+          });
76
+          resolve("");
77
+        },
78
+      });
79
+    });
80
+  },
81
+  navigateBack () {
82
+    tt.navigateBack({
83
+      delta: 1,
84
+      success (res) {
85
+        console.log('success执行了', res);
86
+      },
87
+      fail (err) {
88
+        console.log('fail执行了', err);
89
+        tt.showModal({
90
+          title: "返回上一页失败",
91
+          content: "第一个页面不能 navigate back",
92
+          showCancel: false
93
+        });
94
+      },
95
+      complete (res) {
96
+        console.log('complete执行了', res);
97
+      }
98
+    });
99
+  },
100
+});

+ 3 - 0
src/native-pages/index/index.json

@@ -0,0 +1,3 @@
1
+{
2
+    "usingComponents": {}
3
+}

+ 16 - 0
src/native-pages/index/index.ttml

@@ -0,0 +1,16 @@
1
+<view class="intro">
2
+  <view class="banner-content" hover-class="none" hover-stop-propagation="false">
3
+    <video class='album_swiper_video' src="{{videoUrl}}" showCenterPlayBtn="{{false}}" showPlayBtn="{{false}}"
4
+      showFullscreenBtn="{{false}}" autoplay objectFit='cover' loop controls="{{false}}" x5-video-player-type='h5-page'
5
+      webkit-playsinline='true' x5-playsinline='true' x5-video-orientation='portraint'></video>
6
+  </view>
7
+  <view class="console" hover-class="none" hover-stop-propagation="false">
8
+    <view class="back" type="primary" bindtap="navigateBack">返回上一页</view>
9
+    <button class="" open-type="uploadDouyinVideo">
10
+      <image class="douyin-logo" src="http://video-img.fyshark.com/1683353853830%E6%8A%96%E9%9F%B3.png"
11
+        mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="">
12
+      </image>
13
+      保存视频并发布
14
+    </button>
15
+  </view>
16
+</view>

+ 29 - 0
src/native-pages/index/index.ttss

@@ -0,0 +1,29 @@
1
+.intro {
2
+  padding: 48px 20px;
3
+  min-height: 100vh;
4
+  background-color: #041129;
5
+}
6
+.banner-content {
7
+  position: relative;
8
+  left: 50%;
9
+  transform: translateX(-50%);
10
+  width: 100%;
11
+  height: 700px;
12
+}
13
+.album_swiper_video {
14
+  width: 100%;
15
+  height: 100%;
16
+}
17
+.console{
18
+  width: 100%;
19
+  display: flex;
20
+  justify-content: space-between;
21
+  align-items: center;
22
+}
23
+.back{
24
+
25
+}
26
+.douyin-logo{
27
+  width: 60px;
28
+  height: 60px;
29
+}