Sfoglia il codice sorgente

添加五一活动

黎海 2 anni fa
parent
commit
cfe8005557

+ 1 - 1
app_list.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "taroConfig": {
3
-    "version": "1.4.1",
3
+    "version": "1.4.2",
4 4
     "desc": "更改人物动漫化"
5 5
   },
6 6
   "app_list": [

+ 1 - 1
package.json

@@ -81,7 +81,7 @@
81 81
         "webpack": "5.69.0"
82 82
     },
83 83
     "taroConfig": {
84
-        "version": "1.4.1",
84
+        "version": "1.4.2",
85 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 - 0
src/app.config.js

@@ -34,6 +34,8 @@ export default defineAppConfig({
34 34
         "pages/point/index",//新手指引
35 35
         "pages/real/index",//资讯
36 36
         "pages/realDetail/index",//资讯
37
+        "pages/comicActivity/index",//人物动漫画活动页
38
+        "pages/comicActivityDetail/index",//人物动漫画活动详情页
37 39
       ]
38 40
     },
39 41
     

+ 1 - 1
src/moduleA/pages/communityDetail/index.jsx

@@ -39,7 +39,7 @@ export default class Task extends Component {
39 39
   onShareAppMessage = (res) => {
40 40
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
41 41
     if (process.env.TARO_ENV == 'tt') {
42
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
42
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
43 43
     }
44 44
     let shareData = {
45 45
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/darwDetailIndex/index.jsx

@@ -64,7 +64,7 @@ export default class Task extends Component {
64 64
   onShareAppMessage = (res) => {
65 65
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
66 66
     if (process.env.TARO_ENV == 'tt') {
67
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
67
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
68 68
     }
69 69
     let shareData = {
70 70
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/earnPoints/index.jsx

@@ -38,7 +38,7 @@ export default class Task extends Component {
38 38
   onShareAppMessage = (res) => {
39 39
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
40 40
     if (process.env.TARO_ENV == 'tt') {
41
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
41
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
42 42
     }
43 43
     let shareData = {
44 44
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/invite/index.jsx

@@ -39,7 +39,7 @@ export default class Task extends Component {
39 39
   onShareAppMessage = (res) => {
40 40
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
41 41
     if (process.env.TARO_ENV == 'tt') {
42
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
42
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
43 43
     }
44 44
     let shareData = {
45 45
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/shareCnt/index.jsx

@@ -36,7 +36,7 @@ export default class Mine extends Component {
36 36
   onShareAppMessage = (res) => {
37 37
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
38 38
     if (process.env.TARO_ENV == 'tt') {
39
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
39
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
40 40
     }
41 41
     let shareData = {
42 42
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/upload/index.jsx

@@ -59,7 +59,7 @@ export default class Mine extends Component {
59 59
   onShareAppMessage = (res) => {
60 60
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
61 61
     if (process.env.TARO_ENV == 'tt') {
62
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
62
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
63 63
     }
64 64
     let shareData = {
65 65
       title: tool.shareTitle,

+ 1 - 1
src/moduleA/pages/wallet/index.jsx

@@ -34,7 +34,7 @@ export default class Mine extends Component {
34 34
   onShareAppMessage = (res) => {
35 35
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
36 36
     if (process.env.TARO_ENV == 'tt') {
37
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
37
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
38 38
     }
39 39
     let shareData = {
40 40
       title: tool.shareTitle,

+ 117 - 21
src/moduleB/pages/comic/index.jsx

@@ -17,7 +17,8 @@ export default class collection extends Component {
17 17
     jumpurl: '',//广告id
18 18
     task_id: 0,//任务id
19 19
     repeat: 0,//广告次数
20
-    drawTaskId:0,//任务id
20
+    drawTaskId: 0,//任务id
21
+    is_week: 0,//是否是周卡
21 22
   }
22 23
 
23 24
   componentWillMount () {
@@ -77,7 +78,7 @@ export default class collection extends Component {
77 78
   updateButton () {
78 79
     if (!this.state.isImage) {
79 80
       this.upLode()
80
-    } else if (this.state.creatInfo.wallet_status == 0) {
81
+    } else if ( this.state.creatInfo.is_week == 0) {
81 82
       this.playVideoGeneratePictures()
82 83
     } else {
83 84
       this.generatePictures()
@@ -89,7 +90,7 @@ export default class collection extends Component {
89 90
     Taro.chooseMedia({
90 91
       count: 1, // 默认
91 92
       sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
92
-      mediaType:['image'],
93
+      mediaType: ['image'],
93 94
       sourceType: ['album', 'camera'],
94 95
       success: function (res) {
95 96
         console.log(res, 'res');
@@ -98,12 +99,20 @@ export default class collection extends Component {
98 99
           Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
99 100
           return
100 101
         }
102
+        let base64Img = Taro.getFileSystemManager().readFileSync(file, 'base64')
101 103
         Taro.showLoading({
102
-          title: '图片上传中',
104
+          title: '图片检测中...',
103 105
         })
104
-        Taro.hideLoading()
105
-        Taro.navigateTo({
106
-          url: `/moduleA/pages/upload/index?image=${file}`
106
+        api.imageDetection({ img_data: base64Img }).then(item=>{
107
+          if (item.code==200) {
108
+            Taro.hideLoading()
109
+            Taro.navigateTo({
110
+              url: `/moduleA/pages/upload/index?image=${file}`
111
+            })
112
+          }else{
113
+            Taro.hideLoading()
114
+            Taro.showToast({ title: item.msg, icon: 'none' })
115
+          }
107 116
         })
108 117
       }
109 118
     })
@@ -134,12 +143,12 @@ export default class collection extends Component {
134 143
     api.drawGcImg({ img_url: this.state.consultImg, style_id: this.state.creatInfo.models[this.state.modelIndex].id }).then(res => {
135 144
       if (res.code == 200) {
136 145
         this.setState({
137
-          drawTaskId:res.data.task_id
138
-        },()=>{
139
-          console.log(res.data.task_id,'res.data.task_id');
146
+          drawTaskId: res.data.task_id
147
+        }, () => {
148
+          console.log(res.data.task_id, 'res.data.task_id');
140 149
           this.playVideo()
141 150
         })
142
-       
151
+
143 152
       } else {
144 153
         Taro.hideLoading()
145 154
         Taro.showToast({ icon: 'none', title: res.msg })
@@ -189,7 +198,7 @@ export default class collection extends Component {
189 198
           url: `/moduleB/pages/comicDetail/index?task_id=${that.state.drawTaskId}`
190 199
         })
191 200
       } else {
192
-       
201
+
193 202
       }
194 203
     }
195 204
     // 监听视频播放完成
@@ -260,7 +269,7 @@ export default class collection extends Component {
260 269
   onShareAppMessage = (res) => {
261 270
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
262 271
     if (process.env.TARO_ENV == 'tt') {
263
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
272
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
264 273
     }
265 274
     let shareData = {
266 275
       title: tool.shareTitle,
@@ -279,13 +288,90 @@ export default class collection extends Component {
279 288
       modelIndex: index,
280 289
     })
281 290
   }
291
+  //充值
292
+  toOrder () {
293
+    let that = this
294
+    if (process.env.TARO_ENV === 'tt') {
295
+      Taro.showLoading({
296
+        title: '加载中...',
297
+      })
298
+      api.ttCreateOrder({ pay_info_id: this.state.creatInfo.shop_id }).then(res => {
299
+        if (res.code == 200) {
300
+          Taro.hideLoading()
301
+          tt.pay({
302
+            orderInfo: {
303
+              order_id: res.data.order_id,
304
+              order_token: res.data.order_token
305
+            },
306
+            service: 5,
307
+            success (item) {
308
+              if (item.code == 0) {
309
+                Taro.showToast({
310
+                  title: '购买成功',
311
+                  icon: 'none',
312
+                  duration: 2000
313
+                })
314
+                that.getDrawGcImgIndex()
315
+                setTimeout(() => {
316
+                  that.getDrawGcImgIndex()
317
+                }, 2000);
318
+                // 支付成功处理逻辑,只有res.code=0时,才表示支付成功
319
+                // 但是最终状态要以商户后端结果为准
320
+              }
321
+            },
322
+            fail (item) {
323
+              // 调起收银台失败处理逻辑
324
+            },
325
+          });
326
+        }
327
+      })
328
+    } else if (process.env.TARO_ENV === 'weapp') {
329
+      Taro.getSystemInfo({
330
+        success: function (res) {
331
+          Taro.showLoading({
332
+            title: '加载中...',
333
+          })
334
+          api.createOrder({ shop_id: that.state.creatInfo.shop_id }).then(res => {
335
+            if (res.code == 200) {
336
+              Taro.hideLoading()
337
+              Taro.requestPayment({
338
+                timeStamp: res.data.timeStamp,
339
+                nonceStr: res.data.nonceStr,
340
+                package: res.data.package,
341
+                signType: res.data.signType,
342
+                paySign: res.data.paySign,
343
+                success: function (res) {
344
+                  // console.log(res);
345
+                  //添加2s延迟在刷新数据
346
+                  setTimeout(() => {
347
+                    that.getDrawGcImgIndex()
348
+                    Taro.showToast({
349
+                      title: '购买成功',
350
+                      icon: 'none',
351
+                      duration: 2000
352
+                    })
353
+                  }, 2000);
354
+                },
355
+                fail: function (err) {
356
+                  try {
357
+                    const res = Taro.getSystemInfoSync()
358
+                    console.log(res, 'iphone=====');
359
+                  } catch (e) {
360
+                  }
361
+                }
362
+              })
363
+            }
364
+          })
365
+        }
366
+      })
367
+    }
368
+  }
282 369
 
283 370
   render () {
284 371
     return (
285 372
       <View className='mine'>
286 373
         <View className='banner'>
287 374
           <View className='banner-content'>
288
-
289 375
             <Image className='content-img'
290 376
               mode='aspectFit'
291 377
               src={this.state.consultImg}
@@ -296,13 +382,11 @@ export default class collection extends Component {
296 382
             }
297 383
           </View>
298 384
           <View className='banner-tips'>绝美的动漫头像,上传图片一键生成</View>
299
-
300 385
         </View>
301 386
         {
302 387
           this.state.creatInfo.models &&
303 388
           <View className='model-list'>
304 389
             {
305
-
306 390
               !this.state.isOpen ?
307 391
                 this.state.creatInfo.models.slice(0, 6).map((item, index) => (
308 392
                   <View className='model-info'
@@ -348,18 +432,30 @@ export default class collection extends Component {
348 432
             </View>
349 433
           </View>
350 434
         }
351
-        <View className='update' onClick={e => (tool.throttle(this.updateButton()), 2000)}>
352
-          <View className={!this.state.isImage?'update-button':'update-button update-active'}
353
-          style={!this.state.isImage?'background: linear-gradient(90deg, #038EFF, #3342FF);':'background: linear-gradient(90deg, #1cbd67, #13c027);'}
435
+        <View className='update'>
436
+          {
437
+            this.state.isImage && this.state.creatInfo.is_week == 0 &&
438
+            <View className='result-recharge-button update-active'
439
+              onClick={e => (tool.throttle(this.toOrder()), 2000)}
440
+            >
441
+              <View className='result-recharge-button-content'>
442
+                <View className='result-recharge-button-top'>无广告急速制作</View>
443
+                <View className='result-recharge-button-bottom'>一周/{this.state.creatInfo.money_week / 100}元</View>
444
+              </View>
445
+            </View>
446
+          }
447
+          <View className='update-button'
448
+            onClick={e => (tool.throttle(this.updateButton()), 2000)}
449
+            style={!this.state.isImage ? 'background: linear-gradient(90deg, #038EFF, #3342FF);' : 'background: linear-gradient(90deg, #1cbd67, #13c027);'}
354 450
           >
355 451
             <Image className='update-img' src={!this.state.isImage ? 'http://video-img.fyshark.com/1681719589061%E7%BB%98%E7%94%BB%402x.png' : 'http://video-img.fyshark.com/1681719637510%E5%9B%BE%E7%89%87%402x.png'}></Image>
356
-            {!this.state.isImage ? '上传图片' : this.state.creatInfo.wallet_status == 0 ? '点击看广告绘制图片' : '点击绘制 (当前点券充足,前往绘制吧)'}
452
+            {!this.state.isImage ? '上传图片' : this.state.creatInfo.is_week == 0 ? '点击看广告绘制图片' : '点击绘制'}
357 453
           </View>
454
+
358 455
         </View>
359 456
         <View className='tip-img'>
360 457
           <Image className='ps-image' src='http://video-img.fyshark.com/1681720619915%E4%B8%8B%E5%9B%BE.png'></Image>
361 458
         </View>
362
-
363 459
       </View>
364 460
     )
365 461
   }

+ 47 - 12
src/moduleB/pages/comic/index.less

@@ -126,24 +126,43 @@
126 126
   .update {
127 127
     margin-top: 40px;
128 128
 
129
-    /* 定义动画 */
130
-    @keyframes shrink {
131
-      0%, 100% {
132
-        transform: translateY(0) scale(1);
133
-      }
134
-      50% {
135
-        transform: translateY(0px) scale(0.95);
129
+    .result-recharge-button {
130
+      background: linear-gradient(90deg, #C367DE, #3342FF);
131
+      border-radius: 46px;
132
+      width: 100%;
133
+      height: 94px;
134
+      display: flex;
135
+      align-items: center;
136
+      justify-content: center;
137
+
138
+      .result-recharge-button-content {
139
+
140
+        .result-recharge-button-top {
141
+          font-size: 32px;
142
+          font-family: PingFang SC;
143
+          font-weight: bold;
144
+          text-align: center;
145
+          color: #FFFFFF;
146
+          line-height: 40px;
147
+        }
148
+
149
+        .result-recharge-button-bottom {
150
+          font-size: 24px;
151
+          font-family: PingFang SC;
152
+          font-weight: bold;
153
+          text-align: center;
154
+          color: rgba(255, 255, 255, .7);
155
+          line-height: 40px;
156
+        }
136 157
       }
137
-    }
138 158
 
139
-    /* 应用动画 */
140
-    .update-active {
141
-      animation: shrink 1.2s ease-in-out infinite;
142 159
     }
143 160
 
161
+   
162
+
144 163
     .update-button {
164
+      margin-top: 40px;
145 165
       background: linear-gradient(90deg, #038EFF, #3342FF);
146
-
147 166
       border-radius: 46px;
148 167
       width: 100%;
149 168
       height: 94px;
@@ -161,6 +180,9 @@
161 180
         display: block;
162 181
       }
163 182
     }
183
+    .update-button:active{
184
+      opacity: 0.5;
185
+    }
164 186
   }
165 187
 
166 188
   .tip-img {
@@ -175,5 +197,18 @@
175 197
     }
176 198
   }
177 199
 
200
+ /* 定义动画 */
201
+ @keyframes shrink {
202
+  0%, 100% {
203
+    transform: translateY(0) scale(1);
204
+  }
205
+  50% {
206
+    transform: translateY(0px) scale(0.95);
207
+  }
208
+}
178 209
 
210
+/* 应用动画 */
211
+.update-active {
212
+  animation: shrink 1.2s ease-in-out infinite;
213
+}
179 214
 }

+ 5 - 0
src/moduleB/pages/comicActivity/index.config.js

@@ -0,0 +1,5 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '人物动漫化',
3
+  enableShareAppMessage: true,
4
+  enableShareTimeline: true ,
5
+})

+ 455 - 0
src/moduleB/pages/comicActivity/index.jsx

@@ -0,0 +1,455 @@
1
+import { Component } from 'react'
2
+import { View, Text, Button, Image, scrollView, Input } from '@tarojs/components'
3
+import * as api from '../../../service/index'
4
+import tool from '../../../common/tool'
5
+import Taro, { } from '@tarojs/taro'
6
+import './index.less'
7
+
8
+export default class collection extends Component {
9
+  state = {
10
+    consultImg: '',
11
+    sizeIndex: 0,
12
+    mass: 0,
13
+    modelIndex: 0,
14
+    isImage: false,
15
+    isOpen: false,
16
+    jumpurl: '',//广告id
17
+    task_id: 0,//任务id
18
+    repeat: 0,//广告次数
19
+    drawTaskId: 0,//任务id
20
+    is_week: 0,//是否是周卡用户
21
+    models: {},//活动数据
22
+  }
23
+
24
+  componentWillMount () {
25
+    this.getCoinTaskAd()
26
+    this.getDraw51ImgIndex()
27
+  }
28
+  componentDidShow () {
29
+    //接收裁剪图片
30
+    let pages = Taro.getCurrentPages();
31
+    let currentPage = pages[pages.length - 1]; // 获取当前页面
32
+    console.log(currentPage, 'currentPage');
33
+    if (process.env.TARO_ENV == 'weapp') {
34
+      if (currentPage.__data__.consultImg) { // 获取值
35
+        this.setState({
36
+          consultImg: currentPage.__data__.consultImg,
37
+          sizeIndex: currentPage.__data__.sizeIndex,
38
+          isImage: true
39
+        })
40
+        currentPage.__data__.consultImg = ''
41
+      }
42
+    } else if (process.env.TARO_ENV == 'tt') {
43
+      if (currentPage.data.consultImg) { // 获取值
44
+        this.setState({
45
+          consultImg: currentPage.data.consultImg,
46
+          sizeIndex: currentPage.data.sizeIndex,
47
+          isImage: true
48
+        })
49
+        currentPage.data.consultImg = ''
50
+      }
51
+    }
52
+  }
53
+  getDraw51ImgIndex () {
54
+    api.getDraw51ImgIndex().then(res => {
55
+      if (res.code == 200) {
56
+        this.setState({
57
+          is_week: res.data.is_week,
58
+          models: res.data.models[0],
59
+          consultImg: res.data.models[0].img
60
+        })
61
+      }
62
+    })
63
+  }
64
+  getCoinTaskAd () {
65
+    api.getCoinTaskAd().then(res => {
66
+      if (res.code == 200) {
67
+        this.setState({
68
+          jumpurl: res.data[0].jumpurl,//广告id
69
+          task_id: res.data[0].id,//任务id
70
+          repeat: res.data[0].repeat
71
+        })
72
+      }
73
+    })
74
+  }
75
+  changeOpen () {
76
+    this.setState({
77
+      isOpen: !this.state.isOpen
78
+    })
79
+  }
80
+  //上传图片
81
+  upLode () {
82
+    let that = this
83
+    Taro.chooseMedia({
84
+      count: 1, // 默认
85
+      sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
86
+      mediaType: ['image'],
87
+      sourceType: ['album', 'camera'],
88
+      success: function (res) {
89
+        console.log(res, 'res');
90
+        const file = res.tempFiles[0].tempFilePath
91
+        if (res.tempFiles[0].size > 2000000) {
92
+          Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
93
+          return
94
+        }
95
+        let base64Img = Taro.getFileSystemManager().readFileSync(file, 'base64')
96
+        Taro.showLoading({
97
+          title: '图片检测中...',
98
+        })
99
+        api.imageDetection({ img_data: base64Img }).then(item=>{
100
+          if (item.code==200) {
101
+            Taro.hideLoading()
102
+            Taro.navigateTo({
103
+              url: `/moduleA/pages/upload/index?image=${file}`
104
+            })
105
+          }else{
106
+            Taro.hideLoading()
107
+            Taro.showToast({ title: item.msg, icon: 'none' })
108
+          }
109
+        })
110
+      }
111
+    })
112
+  }
113
+  //画图
114
+  generatePictures () {
115
+    if (!this.state.isImage) {
116
+      Taro.showToast({ title: '请先上传图片', icon: 'none' })
117
+      return
118
+    }
119
+    api.drawGcImg({ img_url: this.state.consultImg, style_id: this.state.creatInfo.models[this.state.modelIndex].id }).then(res => {
120
+      if (res.code == 200) {
121
+        Taro.navigateTo({
122
+          url: `/moduleB/pages/comicDetail/index?task_id=${res.data.task_id}`
123
+        })
124
+      } else {
125
+        Taro.hideLoading()
126
+        Taro.showToast({ icon: 'none', title: res.msg })
127
+      }
128
+    })
129
+  }
130
+  //看广告画图
131
+  playVideoGeneratePictures () {
132
+
133
+    if (!this.state.isImage) {
134
+      Taro.showToast({ title: '请先上传图片', icon: 'none' })
135
+      return
136
+    }
137
+    api.drawGcImg({ img_url: this.state.consultImg, style_id: this.state.models.style_id }).then(res => {
138
+      if (res.code == 200) {
139
+        if (this.state.is_week == 1) {
140
+          Taro.navigateTo({
141
+            url: `/moduleB/pages/comicActivityDetail/index?task_id=${res.data.task_id}`
142
+          })
143
+        } else {
144
+          this.setState({
145
+            drawTaskId: res.data.task_id
146
+          }, () => {
147
+            this.playVideo()
148
+
149
+          })
150
+        }
151
+
152
+      } else {
153
+        Taro.hideLoading()
154
+        Taro.showToast({ icon: 'none', title: res.msg })
155
+      }
156
+    })
157
+  }
158
+
159
+  //观看广告
160
+  playVideo () {
161
+    if (process.env.TARO_ENV == 'tt') {
162
+      this.playVideoTT()
163
+    } else {
164
+      this.playVideoWeapp()
165
+    }
166
+  }
167
+  //抖音激励广告
168
+  playVideoTT () {
169
+    let that = this
170
+    Taro.showLoading({
171
+      title: '加载中...',
172
+    })
173
+    const videoAd = tt.createRewardedVideoAd({ adUnitId: this.state.jumpurl });
174
+    videoAd.show()
175
+    videoAd.onError((err) => {
176
+      Taro.hideLoading()
177
+      switch (err.errCode) {
178
+        case 1004:
179
+          // 无合适的广告
180
+          break;
181
+        default:
182
+        // 更多请参考错误码文档
183
+      }
184
+    });
185
+    try {
186
+      if (videoAd.closeHandler) {
187
+        videoAd.offClose(videoAd.closeHandler);
188
+        console.log("videoAd.offClose卸载成功");
189
+      }
190
+    } catch (e) {
191
+      console.log("videoAd.offClose 卸载失败");
192
+      console.error(e);
193
+    }
194
+    videoAd.closeHandler = function (data) {
195
+      Taro.hideLoading()
196
+      if (data.isEnded) {
197
+        Taro.navigateTo({
198
+          url: `/moduleB/pages/comicActivityDetail/index?task_id=${that.state.drawTaskId}`
199
+        })
200
+      } else {
201
+
202
+      }
203
+    }
204
+    // 监听视频播放完成
205
+    videoAd.onClose(videoAd.closeHandler);
206
+  }
207
+  //激励广告
208
+  playVideoWeapp () {
209
+    // 在页面中定义激励视频广告
210
+    let adUnitId = this.state.jumpurl
211
+    // 在页面中定义激励视频广告
212
+    let videoAd = null
213
+    let that = this
214
+    console.log(videoAd, 'videoAd');
215
+    // 在页面onLoad回调事件中创建激励视频广告实例
216
+    if (wx.createRewardedVideoAd) {
217
+      videoAd = wx.createRewardedVideoAd({
218
+        adUnitId: adUnitId
219
+      })
220
+      videoAd.onLoad(() => { })
221
+      videoAd.onError((err) => { })
222
+      try {
223
+        if (videoAd.closeHandler) {
224
+          videoAd.offClose(videoAd.closeHandler);
225
+          console.log("videoAd.offClose卸载成功");
226
+        }
227
+      } catch (e) {
228
+        console.log("videoAd.offClose 卸载失败");
229
+        console.error(e);
230
+      }
231
+      videoAd.closeHandler = function (res) {
232
+        // 用户点击了【关闭广告】按钮
233
+        if (res && res.isEnded || res === undefined) {
234
+          // 正常播放结束,可以下发游戏奖励
235
+          Taro.navigateTo({
236
+            url: `/moduleB/pages/comicActivityDetail/index?task_id=${that.state.drawTaskId}`
237
+          })
238
+        } else {
239
+          //提前关闭小程序
240
+        }
241
+      };
242
+      videoAd.onClose(videoAd.closeHandler);
243
+    }
244
+
245
+    // 用户触发广告后,显示激励视频广告
246
+    if (videoAd) {
247
+      videoAd.show().catch(() => {
248
+        // 失败重试
249
+        videoAd.load()
250
+          .then(() => videoAd.show())
251
+          .catch(err => {
252
+            Taro.showToast({
253
+              title: '暂无广告',
254
+              icon: 'none',
255
+              duration: 2000
256
+            })
257
+            console.log('激励视频 广告显示失败')
258
+          })
259
+      })
260
+    }
261
+
262
+  }
263
+  deleteImg () {
264
+    this.setState({
265
+      consultImg: 'http://video-img.fyshark.com/1681721632520%E4%B8%8A.png',
266
+      isImage: false,
267
+    })
268
+  }
269
+  onShareAppMessage = (res) => {
270
+    let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
271
+    if (process.env.TARO_ENV == 'tt') {
272
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
273
+    }
274
+    let shareData = {
275
+      title: tool.shareTitle,
276
+      path: path,
277
+      imageUrl: tool.shareImg
278
+    }
279
+    return shareData;
280
+  }
281
+  changeMass (e) {
282
+    this.setState({
283
+      mass: e
284
+    })
285
+  }
286
+  selectModel (item, index) {
287
+    this.setState({
288
+      modelIndex: index,
289
+    })
290
+  }
291
+  //充值
292
+  toOrder () {
293
+    let that = this
294
+    if (process.env.TARO_ENV === 'tt') {
295
+      Taro.showLoading({
296
+        title: '加载中...',
297
+      })
298
+      api.ttCreateOrder({ pay_info_id: this.state.models.shop_id }).then(res => {
299
+        if (res.code == 200) {
300
+          Taro.hideLoading()
301
+          tt.pay({
302
+            orderInfo: {
303
+              order_id: res.data.order_id,
304
+              order_token: res.data.order_token
305
+            },
306
+            service: 5,
307
+            success (item) {
308
+              if (item.code == 0) {
309
+                Taro.showToast({
310
+                  title: '购买成功',
311
+                  icon: 'none',
312
+                  duration: 2000
313
+                })
314
+                that.getDraw51ImgIndex()
315
+                setTimeout(() => {
316
+                  that.getDraw51ImgIndex()
317
+                }, 2000);
318
+                // 支付成功处理逻辑,只有res.code=0时,才表示支付成功
319
+                // 但是最终状态要以商户后端结果为准
320
+              }
321
+            },
322
+            fail (item) {
323
+              // 调起收银台失败处理逻辑
324
+            },
325
+          });
326
+        }
327
+      })
328
+    } else if (process.env.TARO_ENV === 'weapp') {
329
+      Taro.getSystemInfo({
330
+        success: function (res) {
331
+          Taro.showLoading({
332
+            title: '加载中...',
333
+          })
334
+          api.createOrder({ shop_id: that.state.models.shop_id }).then(res => {
335
+            if (res.code == 200) {
336
+              Taro.hideLoading()
337
+              Taro.requestPayment({
338
+                timeStamp: res.data.timeStamp,
339
+                nonceStr: res.data.nonceStr,
340
+                package: res.data.package,
341
+                signType: res.data.signType,
342
+                paySign: res.data.paySign,
343
+                success: function (res) {
344
+                  // console.log(res);
345
+                  //添加2s延迟在刷新数据
346
+                  setTimeout(() => {
347
+                    that.getDraw51ImgIndex()
348
+                    Taro.showToast({
349
+                      title: '购买成功',
350
+                      icon: 'none',
351
+                      duration: 2000
352
+                    })
353
+                  }, 2000);
354
+                },
355
+                fail: function (err) {
356
+                  try {
357
+                    const res = Taro.getSystemInfoSync()
358
+                    console.log(res, 'iphone=====');
359
+                  } catch (e) {
360
+                  }
361
+                }
362
+              })
363
+            }
364
+          })
365
+        }
366
+      })
367
+    }
368
+  }
369
+  toComic () {
370
+    Taro.navigateTo({
371
+      url: `/moduleB/pages/comic/index`
372
+    })
373
+  }
374
+
375
+  render () {
376
+    return (
377
+      <View className='mine'>
378
+        {
379
+          !this.state.isImage ?
380
+            <View className='before-painting'>
381
+              <View className='title'>
382
+                <Image className='title-img' src='http://video-img.fyshark.com/1682475695399title.png'></Image>
383
+              </View>
384
+              <View className='banner'>
385
+                <View className='banner-content'>
386
+                  <Image className='content-img'
387
+                    mode='aspectFit'
388
+                    src={this.state.consultImg}
389
+                  ></Image>
390
+                </View>
391
+                <View className='step'>
392
+                  <Image className='step-img' src='http://video-img.fyshark.com/1682475185108123.png'>
393
+                  </Image>
394
+                </View>
395
+              </View>
396
+              <View className='update' >
397
+                <View className='update-button-more'
398
+                  onClick={e => (this.toComic())}
399
+                >
400
+                  更多风格
401
+                </View>
402
+                <View className='update-button'
403
+                  onClick={e => (this.upLode())}
404
+                >
405
+                  上传图片
406
+                </View>
407
+              </View>
408
+
409
+            </View>
410
+            :
411
+            <View className='after-painting'>
412
+              <View className='result-banner'>
413
+                <View className='result-banner-content'>
414
+                  <Image className='result-content-img'
415
+                    mode='widthFix'
416
+                    src={this.state.consultImg}
417
+                  ></Image>
418
+                  {
419
+                    this.state.isImage &&
420
+                    <Image className='delete' src='http://video-img.fyshark.com/1680147210173guanbi.png' onClick={e => (this.deleteImg())}></Image>
421
+                  }
422
+                </View>
423
+              </View>
424
+              <View className='after-tips'>照片已上传,还差最后一步</View>
425
+              <View className='result-update' >
426
+                {
427
+                  this.state.is_week == 0 &&
428
+                  <View className='result-recharge-button update-active'
429
+                    onClick={e => (tool.throttle(this.toOrder()), 2000)}
430
+                  >
431
+                    <View className='result-recharge-button-content'>
432
+                      <View className='result-recharge-button-top'>无广告急速制作</View>
433
+                      <View className='result-recharge-button-bottom'>一周/{this.state.models.money_week / 100}元</View>
434
+                    </View>
435
+                  </View>
436
+                }
437
+                <View className='result-update-button'
438
+                  onClick={e => (tool.throttle(this.playVideoGeneratePictures()), 2000)}
439
+                >
440
+                  {
441
+                    this.state.is_week == 0 &&
442
+                    <Image className='result-update-img' src='http://video-img.fyshark.com/1682414441783aghidjnl.png'></Image>
443
+                  }
444
+                  {
445
+                    this.state.is_week == 1 ? '开始制作' : '看广告免费制作'
446
+                  }
447
+
448
+                </View>
449
+              </View>
450
+            </View>
451
+        }
452
+      </View>
453
+    )
454
+  }
455
+}

+ 248 - 0
src/moduleB/pages/comicActivity/index.less

@@ -0,0 +1,248 @@
1
+.mine {
2
+  padding: 48px 20px;
3
+  min-height: 100vh;
4
+  background-color: #041129;
5
+
6
+  .before-painting {
7
+    padding: 0 20px;
8
+  }
9
+
10
+  .title {
11
+    width: 100%;
12
+    display: flex;
13
+    justify-content: center;
14
+
15
+    .title-img {
16
+      width: 500px;
17
+      height: 120px;
18
+    }
19
+  }
20
+
21
+  .banner {
22
+    position: relative;
23
+    margin-top: 60px;
24
+
25
+    .banner-content {
26
+      position: relative;
27
+      left: 50%;
28
+      transform: translateX(-50%);
29
+      width: 100%;
30
+      height: 730px;
31
+
32
+      .content-img {
33
+        width: 100%;
34
+        height: 100%;
35
+      }
36
+
37
+      .delete {
38
+        position: absolute;
39
+        right: -20px;
40
+        top: -20px;
41
+        width: 40px;
42
+        height: 40px;
43
+      }
44
+    }
45
+
46
+
47
+    .banner-tips {
48
+      margin-top: 20px;
49
+      text-align: center;
50
+      font-size: 28px;
51
+      font-family: PingFang SC;
52
+      font-weight: bold;
53
+      color: #FDFDFD;
54
+      line-height: 40px;
55
+    }
56
+  }
57
+
58
+  .step {
59
+    margin-top: 60px;
60
+    width: 100%;
61
+    display: flex;
62
+    justify-content: center;
63
+
64
+    .step-img {
65
+      width: 536px;
66
+      height: 76px;
67
+    }
68
+  }
69
+
70
+  .update {
71
+    margin-top: 40px;
72
+    width: 100%;
73
+    display: flex;
74
+    justify-content: space-between;
75
+    .update-button-more{
76
+      width: 206px;
77
+      height: 94px;
78
+      display: flex;
79
+      justify-content: center;
80
+      align-items: center;
81
+      background: #2C2C2C;
82
+      border-radius: 46px;
83
+      font-size: 32px;
84
+      font-family: PingFang SC;
85
+      font-weight: bold;
86
+      color: #FDFDFD;
87
+    }
88
+
89
+    .update-button {
90
+      width: 418px;
91
+      height: 94px;
92
+      background: linear-gradient(90deg, #0F83FE, #01FBCD);
93
+      display: flex;
94
+      justify-content: center;
95
+      align-items: center;
96
+      font-size: 32px;
97
+      border-radius: 46px;
98
+      font-family: PingFang SC;
99
+      font-weight: bold;
100
+      color: #FDFDFD;
101
+
102
+    }
103
+
104
+    .update-button:active {
105
+      opacity: 0.5;
106
+    }
107
+  }
108
+
109
+  .tip-img {
110
+    margin-top: 54px;
111
+    width: 100%;
112
+    display: flex;
113
+    justify-content: center;
114
+
115
+    .ps-image {
116
+      width: 566px;
117
+      height: 194px;
118
+    }
119
+  }
120
+
121
+  .after-painting {
122
+    padding: 0 60px;
123
+
124
+    .result-banner {
125
+      position: relative;
126
+      margin-top: 20px;
127
+
128
+      .result-banner-content {
129
+        position: relative;
130
+        left: 50%;
131
+        transform: translateX(-50%);
132
+        width: 440px;
133
+
134
+        .result-content-img {
135
+          width: 100%;
136
+          min-height: 440px;
137
+        }
138
+
139
+        .delete {
140
+          position: absolute;
141
+          right: -20px;
142
+          top: -20px;
143
+          width: 40px;
144
+          height: 40px;
145
+        }
146
+      }
147
+
148
+      .banner-tips {
149
+        margin-top: 20px;
150
+        text-align: center;
151
+        font-size: 28px;
152
+        font-family: PingFang SC;
153
+        font-weight: bold;
154
+        color: #FDFDFD;
155
+        line-height: 40px;
156
+      }
157
+    }
158
+
159
+    .after-tips {
160
+      margin-top: 60px;
161
+      text-align: center;
162
+      font-size: 36px;
163
+      font-family: PingFang SC;
164
+      font-weight: bold;
165
+      color: #FFFFFF;
166
+    }
167
+
168
+    .result-update {
169
+      margin-top: 40px;
170
+
171
+      .result-recharge-button {
172
+        background: linear-gradient(90deg, #C367DE, #3342FF);
173
+        border-radius: 46px;
174
+        width: 100%;
175
+        height: 94px;
176
+        display: flex;
177
+        align-items: center;
178
+        justify-content: center;
179
+
180
+        .result-recharge-button-content {
181
+
182
+          .result-recharge-button-top {
183
+            font-size: 32px;
184
+            font-family: PingFang SC;
185
+            font-weight: bold;
186
+            text-align: center;
187
+            color: #FFFFFF;
188
+            line-height: 40px;
189
+          }
190
+
191
+          .result-recharge-button-bottom {
192
+            font-size: 24px;
193
+            font-family: PingFang SC;
194
+            font-weight: bold;
195
+            text-align: center;
196
+            color: rgba(255, 255, 255, .7);
197
+            line-height: 40px;
198
+          }
199
+        }
200
+
201
+      }
202
+
203
+      .result-update-button {
204
+        margin-top: 38px;
205
+        border-radius: 46px;
206
+        width: 100%;
207
+        height: 94px;
208
+        display: flex;
209
+        align-items: center;
210
+        justify-content: center;
211
+        font-size: 28px;
212
+        font-family: PingFang SC;
213
+        font-weight: bold;
214
+        color: #FDFDFD;
215
+        border: 2px solid #FFFFFF;
216
+
217
+        .result-update-img {
218
+          width: 52px;
219
+          height: 52px;
220
+          display: block;
221
+          margin-right: 10px;
222
+        }
223
+      }
224
+
225
+      .result-update-button:active {
226
+        opacity: 0.5;
227
+      }
228
+    }
229
+  }
230
+
231
+  /* 定义动画 */
232
+  @keyframes shrink {
233
+
234
+    0%,
235
+    100% {
236
+      transform: translateY(0) scale(1);
237
+    }
238
+
239
+    50% {
240
+      transform: translateY(0px) scale(0.95);
241
+    }
242
+  }
243
+
244
+  /* 应用动画 */
245
+  .update-active {
246
+    animation: shrink 1.2s ease-in-out infinite;
247
+  }
248
+}

+ 5 - 0
src/moduleB/pages/comicActivityDetail/index.config.js

@@ -0,0 +1,5 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '人物动漫化详情',
3
+  enableShareAppMessage: true,
4
+  enableShareTimeline: true ,
5
+})

+ 392 - 0
src/moduleB/pages/comicActivityDetail/index.jsx

@@ -0,0 +1,392 @@
1
+import { Component } from 'react'
2
+import { View, Text, Button, Image, ScrollView, Input } from '@tarojs/components'
3
+import * as api from '../../../service/index'
4
+import tool from '../../../common/tool'
5
+import Taro, { getCurrentInstance } from '@tarojs/taro'
6
+import './index.less'
7
+
8
+export default class collection extends Component {
9
+  $instance = getCurrentInstance()
10
+  state = {
11
+    jumpurl: '',//广告id
12
+    task_id: 0,//任务id
13
+    repeat: 0,//广告次数
14
+    current: 0,
15
+    interval: null,
16
+    draw_status: 0,
17
+    draw_infos: [],
18
+    que_cnt: 0,
19
+    default_img: '',
20
+    wallet_balance: 0,//用户当前余额
21
+    is_week: 0,//是否是会员
22
+  }
23
+
24
+  componentWillMount () {
25
+
26
+  }
27
+  componentDidShow () {
28
+    let routers = this.$instance.router.params
29
+    this.getCoinTaskAd()
30
+    api.unlockGcImg({ task_id: routers.task_id }).then(res => {
31
+      console.log('解锁');
32
+      if (res.code == 200) {
33
+        this.getDrawTaskStatus(routers.task_id)
34
+      }
35
+    })
36
+  }
37
+  //页面销毁之前调用
38
+  componentWillUnmount () {
39
+    //避免服务器攻击
40
+    clearInterval(this.state.interval)
41
+  }
42
+  getCoinTaskAd () {
43
+    api.getCoinTaskAd().then(res => {
44
+      if (res.code == 200) {
45
+        this.setState({
46
+          jumpurl: res.data[0].jumpurl,//广告id
47
+          task_id: res.data[0].id,//任务id
48
+          repeat: res.data[0].repeat
49
+        })
50
+      }
51
+    })
52
+  }
53
+  //解锁成功
54
+  unlockGcImg (item, index) {
55
+    console.log('解锁002');
56
+    api.unlockGcImg({ task_id: item.task_id }).then(res => {
57
+      if (res.code == 200) {
58
+        this.setState({
59
+          current: index
60
+        })
61
+        this.getDrawTaskStatus(item.task_id)
62
+      }
63
+    })
64
+  }
65
+
66
+  selectedLabel (item, index) {
67
+    let that = this
68
+    console.log(item, 'itemitem');
69
+    if (item.unlock_status == 0) {
70
+      if (this.state.is_week == 0) {
71
+
72
+        Taro.showModal({
73
+          title: '提示',
74
+          content: '是否观看广告解锁?',
75
+          success: function (res) {
76
+            if (res.confirm) {
77
+              if (item.status == 4) {
78
+                that.generatePictures(item, index)
79
+              }
80
+              that.playVideo(item, index)
81
+            } else if (res.cancel) {
82
+              console.log('用户点击取消')
83
+            }
84
+          }
85
+        })
86
+      } else {
87
+        Taro.showToast({
88
+          title: '解锁成功',
89
+          icon: 'none',
90
+          duration: 2000
91
+        })
92
+        that.unlockGcImg(item, index)
93
+      }
94
+    } else {
95
+      this.setState({
96
+        current: index
97
+      })
98
+    }
99
+
100
+  }
101
+  //观看广告
102
+  playVideo (item, index) {
103
+    if (process.env.TARO_ENV == 'tt') {
104
+      this.playVideoTT(item, index)
105
+    } else {
106
+      this.playVideoWeapp(item, index)
107
+    }
108
+  }
109
+  //抖音激励广告
110
+  playVideoTT (item, index) {
111
+    let that = this
112
+    Taro.showLoading({
113
+      title: '加载中...',
114
+    })
115
+    const videoAd = tt.createRewardedVideoAd({ adUnitId: this.state.jumpurl });
116
+    videoAd.show()
117
+    videoAd.onError((err) => {
118
+      Taro.hideLoading()
119
+      switch (err.errCode) {
120
+        case 1004:
121
+          // 无合适的广告
122
+          break;
123
+        default:
124
+        // 更多请参考错误码文档
125
+      }
126
+    });
127
+    try {
128
+      if (videoAd.closeHandler) {
129
+        videoAd.offClose(videoAd.closeHandler);
130
+        console.log("videoAd.offClose卸载成功");
131
+      }
132
+    } catch (e) {
133
+      console.log("videoAd.offClose 卸载失败");
134
+      console.error(e);
135
+    }
136
+    videoAd.closeHandler = function (data) {
137
+      Taro.hideLoading()
138
+      if (data.isEnded) {
139
+        Taro.showToast({
140
+          title: '解锁成功',
141
+          icon: 'none',
142
+          duration: 2000
143
+        })
144
+        that.unlockGcImg(item, index)
145
+      } else {
146
+        that.getDrawTaskStatus(item.task_id)
147
+        Taro.showToast({
148
+          title: '解锁失败',
149
+          icon: 'none',
150
+          duration: 2000
151
+        })
152
+      }
153
+    }
154
+    // 监听视频播放完成
155
+    videoAd.onClose(videoAd.closeHandler);
156
+  }
157
+  //激励广告
158
+  playVideoWeapp (item, index) {
159
+    console.log(item, 'guanggao');
160
+    // 在页面中定义激励视频广告
161
+    let adUnitId = this.state.jumpurl
162
+    // 在页面中定义激励视频广告
163
+    let videoAd = null
164
+    let that = this
165
+    // 在页面onLoad回调事件中创建激励视频广告实例
166
+    if (wx.createRewardedVideoAd) {
167
+      videoAd = wx.createRewardedVideoAd({
168
+        adUnitId: adUnitId
169
+      })
170
+      videoAd.onLoad(() => {
171
+      })
172
+      videoAd.onError((err) => { })
173
+      try {
174
+        if (videoAd.closeHandler) {
175
+          videoAd.offClose(videoAd.closeHandler);
176
+          console.log("videoAd.offClose卸载成功");
177
+        }
178
+      } catch (e) {
179
+        console.log("videoAd.offClose 卸载失败");
180
+        console.error(e);
181
+      }
182
+      videoAd.closeHandler = function (res) {
183
+        Taro.hideLoading()
184
+        // 用户点击了【关闭广告】按钮
185
+        if (res && res.isEnded || res === undefined) {
186
+          // 正常播放结束,可以下发游戏奖励
187
+          Taro.showToast({
188
+            title: '解锁成功',
189
+            icon: 'none',
190
+            duration: 2000
191
+          })
192
+          console.log(item, '关闭');
193
+          that.unlockGcImg(item, index)
194
+        } else {
195
+          console.log(item, '关闭1');
196
+          //提前关闭小程序
197
+          that.getDrawTaskStatus(item.task_id)
198
+          Taro.showToast({
199
+            title: '解锁失败',
200
+            icon: 'none',
201
+            duration: 2000
202
+          })
203
+        }
204
+      };
205
+      videoAd.onClose(videoAd.closeHandler);
206
+
207
+    }
208
+
209
+    // 用户触发广告后,显示激励视频广告
210
+    if (videoAd) {
211
+      videoAd.show().catch(() => {
212
+        // 失败重试
213
+        videoAd.load()
214
+          .then(() => videoAd.show())
215
+          .catch(err => {
216
+            Taro.showToast({
217
+              title: '暂无广告',
218
+              icon: 'none',
219
+              duration: 2000
220
+            })
221
+            console.log('激励视频 广告显示失败')
222
+          })
223
+      })
224
+    }
225
+
226
+  }
227
+  //画画
228
+  generatePictures (item, index) {
229
+    console.log(item, '画画');
230
+    api.drawGcImgTask({ task_id: item.task_id }).then(res => {
231
+      if (res.code == 200) {
232
+        this.getDrawTaskStatus(item.task_id)
233
+      }
234
+    })
235
+  }
236
+  getDrawTaskStatus (task_id) {
237
+    api.getDrawTaskStatusGc({ task_id: task_id }).then(res => {
238
+      //定时器不要轻易改,避免造成服务器攻击
239
+      if (res.code == 200) {
240
+        let draw_infos = res.data.draw_infos
241
+        // if (res.data.draw_status != 2) {
242
+        //   let params = {}
243
+        //   params['img'] = res.data.default_img
244
+        //   params['id'] = -1
245
+        //   draw_infos.push(params)
246
+        // }
247
+        console.log(draw_infos, 'draw_infos');
248
+        if (res.data.draw_status != 2 && res.data.que_cnt > 1) {
249
+          this.state.interval = setInterval(() => {
250
+            clearInterval(this.state.interval)
251
+            this.getDrawTaskStatus(task_id)
252
+          }, 1000 * 10)
253
+        } else if (res.data.draw_status != 2 && res.data.que_cnt <= 1) {
254
+          clearInterval(this.state.interval)
255
+          this.state.interval = setInterval(() => {
256
+            this.getDrawTaskStatus(task_id)
257
+          }, 1000 * 5)
258
+        } else {
259
+          clearInterval(this.state.interval)
260
+        }
261
+        this.setState({
262
+          draw_status: res.data.draw_status,
263
+          que_cnt: res.data.que_cnt,
264
+          draw_infos: draw_infos,
265
+          is_week:res.data.is_week,
266
+          wallet_balance: res.data.wallet_balance
267
+        })
268
+      }
269
+    })
270
+  }
271
+
272
+  download () {
273
+    this.downImg()
274
+  }
275
+  // 鉴权操作 判断是否有保存到相册的权限
276
+  // 有就直接下载 没有就弹窗提示给权限
277
+  downImg () {
278
+    Taro.getSetting({
279
+      success: res => {
280
+        if (!res.authSetting['scope.writePhotosAlbum']) {
281
+          Taro.authorize({
282
+            scope: 'scope.writePhotosAlbum',
283
+            success: () => {
284
+              this.doSaveImg()
285
+            },
286
+            fail: () => {
287
+              this.openConfirm()
288
+            }
289
+          })
290
+        } else {
291
+          this.doSaveImg()
292
+        }
293
+      }
294
+    })
295
+  }
296
+  // 生成临时路径 保存图片到手机
297
+  doSaveImg () {
298
+    Taro.downloadFile({
299
+      url: this.state.draw_infos[this.state.current].img,
300
+      success: res => {
301
+        Taro.saveImageToPhotosAlbum({
302
+          filePath: res.tempFilePath,
303
+          success: () => {
304
+            Taro.showToast({ title: '已保存到相册', icon: 'success' })
305
+          },
306
+          fail: () => {
307
+            Taro.showToast({ title: '保存失败', icon: 'none' })
308
+          }
309
+        })
310
+      }
311
+    })
312
+  }
313
+  // 权限弹窗
314
+  openConfirm () {
315
+    Taro.showModal({
316
+      content: '检测到您没有打开小程序相册权限,是否取设置打开?',
317
+      showCancel: true,
318
+      success: res => {
319
+        if (res.confirm) {
320
+          // 打开权限
321
+          Taro.openSetting({
322
+            success: res => {
323
+              this.doSaveImg()
324
+            }
325
+          })
326
+        }
327
+      }
328
+    })
329
+  }
330
+  toIndex () {
331
+    Taro.reLaunch({
332
+      url: `/pages/index/index`
333
+    })
334
+  }
335
+  previewImage () {
336
+    Taro.previewImage({
337
+      current: this.state.draw_infos[this.state.current].img, // 当前显示图片的http链接  
338
+      urls: [`${this.state.draw_infos[this.state.current].img}`] // 需要预览的图片http链接列表  
339
+    })
340
+  }
341
+
342
+
343
+  render () {
344
+    return (
345
+      <View className='mine'>
346
+        {
347
+          this.state.draw_infos.length > 0 &&
348
+          <View className='banner'>
349
+            <View className='banner-content'>
350
+              <Image className='content-img'
351
+                mode='aspectFit'
352
+                onClick={e => (this.previewImage())}
353
+                src={this.state.draw_infos[this.state.current].img}
354
+              ></Image>
355
+            </View>
356
+          </View>
357
+        }
358
+        <ScrollView
359
+          className='recharge'
360
+          scrollX
361
+        >
362
+          {
363
+            this.state.draw_infos.map((item, index) => (
364
+              <View className='recharge-info'
365
+                key={index}
366
+                onClick={e => (this.selectedLabel(item, index))}>
367
+                <Image className='recharge-image' mode='aspectFit' src={item.img}></Image>
368
+                {
369
+                  item.unlock_status == 0 &&
370
+                  <View className='lock'>
371
+                    <View className='lock-content'>
372
+                      <Image className='lock-img' src='http://video-img.fyshark.com/1681733630830%E8%A7%A3%E9%94%81%402x.png'></Image>
373
+                      <View className='lock-title'>{item.model_name}</View>
374
+                    </View>
375
+                  </View>
376
+                }
377
+              </View>
378
+            ))
379
+          }
380
+        </ScrollView>
381
+        <View className='tips'>作品可在「绘画作品」中查看</View>
382
+        {/* <View className='send'>
383
+          <View className='sendTT'>一键发抖音</View>
384
+        </View> */}
385
+        <View className='control'>
386
+          <View className='download' onClick={e => (this.download())}>保存图片</View>
387
+          <View className='toIndex' onClick={e => (this.toIndex())}>前往探索更多玩法</View>
388
+        </View>
389
+      </View>
390
+    )
391
+  }
392
+}

+ 216 - 0
src/moduleB/pages/comicActivityDetail/index.less

@@ -0,0 +1,216 @@
1
+.mine {
2
+  padding: 1px 40px;
3
+  min-height: 100vh;
4
+  position: relative;
5
+  background-color: #041129;
6
+
7
+
8
+  .banner {
9
+    position: relative;
10
+    border-radius: 20px;
11
+    width: 100%;
12
+
13
+    .banner-content {
14
+      position: relative;
15
+      border-radius: 20px;
16
+      left: 50%;
17
+      transform: translateX(-50%);
18
+      width: 100%;
19
+      height: 740px;
20
+    }
21
+
22
+    .content-img {
23
+      // background-color: #545353;
24
+      border-radius: 20px;
25
+      width: 100%;
26
+      height: 100%;
27
+    }
28
+
29
+    .content-wait {
30
+      border-radius: 20px;
31
+      position: absolute;
32
+      top: 0;
33
+      left: 0;
34
+      width: 100%;
35
+      height: 100%;
36
+      background: rgba(0, 0, 0, 0.6);
37
+
38
+      .wait-date {
39
+        margin-top: 12px;
40
+        margin-left: 16px;
41
+        font-size: 36px;
42
+        font-family: PingFang SC;
43
+        font-weight: bold;
44
+        color: #FFFFFF;
45
+      }
46
+
47
+      .wait-middle {
48
+        position: absolute;
49
+        top: 50%;
50
+        left: 50%;
51
+        transform: translate(-50%, -50%);
52
+        font-size: 40px;
53
+        font-family: PingFang SC;
54
+        font-weight: 800;
55
+        color: #FFFFFF;
56
+      }
57
+
58
+      .wait-bottom {
59
+        width: 100%;
60
+        position: absolute;
61
+        bottom: 40px;
62
+        left: 0;
63
+        font-size: 40px;
64
+        font-family: PingFang SC;
65
+        font-weight: 500;
66
+        color: #FFFFFF;
67
+
68
+        .wait-num {
69
+          text-align: center;
70
+        }
71
+
72
+        .wait-get-num {
73
+          text-align: center;
74
+          margin-top: 16px;
75
+          text-decoration: underline
76
+        }
77
+      }
78
+    }
79
+
80
+  }
81
+
82
+  .recharge {
83
+    margin-top: 30px;
84
+    width: 100%;
85
+    white-space: nowrap;
86
+
87
+    .recharge-info {
88
+      position: relative;
89
+      border-radius: 10px;
90
+      margin-right: 20px;
91
+      display: inline-block;
92
+
93
+      .recharge-image {
94
+        width: 130px;
95
+        height: 230px;
96
+        display: block;
97
+        background-color: #545353;
98
+        border-radius: 10px;
99
+      }
100
+
101
+      .lock {
102
+        border-radius: 10px;
103
+        position: absolute;
104
+        top: 0;
105
+        left: 0;
106
+        width: 100%;
107
+        height: 100%;
108
+        background: rgba(0, 0, 0, 0.6);
109
+
110
+
111
+        .lock-content {
112
+          position: relative;
113
+          top: 50%;
114
+          transform: translateY(-50%);
115
+
116
+          .lock-img {
117
+            position: relative;
118
+            left: 50%;
119
+            transform: translateX(-50%);
120
+            width: 36px;
121
+            display: block;
122
+            height: 36px;
123
+          }
124
+
125
+          .lock-title {
126
+            text-align: center;
127
+            margin-top: 10px;
128
+            font-size: 26px;
129
+            font-family: PingFang SC;
130
+            font-weight: 500;
131
+            color: #FFFFFF;
132
+          }
133
+        }
134
+      }
135
+    }
136
+
137
+  }
138
+
139
+  .tips {
140
+    margin-top: 30px;
141
+    font-size: 26px;
142
+    font-family: PingFang SC;
143
+    font-weight: 500;
144
+    color: #c7c5c5;
145
+    text-align: center;
146
+  }
147
+
148
+  .send {
149
+    width: 100%;
150
+    display: flex;
151
+    justify-content: center;
152
+  }
153
+
154
+  .sendTT {
155
+    margin-top: 100px;
156
+    width: 460px;
157
+    height: 80px;
158
+    line-height: 80px;
159
+    text-align: center;
160
+    font-size: 28px;
161
+    font-family: PingFang SC;
162
+    font-weight: 500;
163
+    color: #FFFFFF;
164
+    background: linear-gradient(90deg, #1cbd67, #13c027);
165
+    border-radius: 14px;
166
+  }
167
+
168
+  /* 定义动画 */
169
+  @keyframes shrink {
170
+
171
+    0%,
172
+    100% {
173
+      transform: translateY(0) scale(1);
174
+    }
175
+
176
+    50% {
177
+      transform: translateY(0px) scale(0.95);
178
+    }
179
+  }
180
+
181
+  /* 应用动画 */
182
+  .sendTT {
183
+    animation: shrink 1.2s ease-in-out infinite;
184
+  }
185
+
186
+  .control {
187
+    width: 100%;
188
+    margin-top: 100px;
189
+    display: flex;
190
+    justify-content: space-between;
191
+    align-items: center;
192
+    font-size: 28px;
193
+    font-family: PingFang SC;
194
+    font-weight: 500;
195
+    color: #FFFFFF;
196
+
197
+    .download {
198
+      width: 260px;
199
+      height: 80px;
200
+      line-height: 80px;
201
+      text-align: center;
202
+      background: linear-gradient(90deg, #038EFF, #3342FF);
203
+      border-radius: 14px;
204
+    }
205
+
206
+    .toIndex {
207
+      width: 260px;
208
+      height: 80px;
209
+      line-height: 80px;
210
+      text-align: center;
211
+      background: linear-gradient(90deg, #038EFF, #3342FF);
212
+      border-radius: 14px;
213
+    }
214
+  }
215
+
216
+}

+ 23 - 12
src/moduleB/pages/comicDetail/index.jsx

@@ -18,6 +18,7 @@ export default class collection extends Component {
18 18
     que_cnt: 0,
19 19
     default_img: '',
20 20
     wallet_balance: 0,//用户当前余额
21
+    is_week: 0,//是否是会员
21 22
   }
22 23
 
23 24
   componentWillMount () {
@@ -66,20 +67,29 @@ export default class collection extends Component {
66 67
     let that = this
67 68
     console.log(item, 'itemitem');
68 69
     if (item.unlock_status == 0) {
69
-      Taro.showModal({
70
-        title: '提示',
71
-        content: '是否观看广告解锁?',
72
-        success: function (res) {
73
-          if (res.confirm) {
74
-            if (item.status == 4) {
75
-              that.generatePictures(item, index)
70
+      if (this.state.is_week == 0) {
71
+        Taro.showModal({
72
+          title: '提示',
73
+          content: '是否观看广告解锁?',
74
+          success: function (res) {
75
+            if (res.confirm) {
76
+              if (item.status == 4) {
77
+                that.generatePictures(item, index)
78
+              }
79
+              that.playVideo(item, index)
80
+            } else if (res.cancel) {
81
+              console.log('用户点击取消')
76 82
             }
77
-            that.playVideo(item, index)
78
-          } else if (res.cancel) {
79
-            console.log('用户点击取消')
80 83
           }
81
-        }
82
-      })
84
+        })
85
+      } else {
86
+        Taro.showToast({
87
+          title: '解锁成功',
88
+          icon: 'none',
89
+          duration: 2000
90
+        })
91
+        that.unlockGcImg(item, index)
92
+      }
83 93
     } else {
84 94
       this.setState({
85 95
         current: index
@@ -250,6 +260,7 @@ export default class collection extends Component {
250 260
         this.setState({
251 261
           draw_status: res.data.draw_status,
252 262
           que_cnt: res.data.que_cnt,
263
+          is_week: res.data.is_week,
253 264
           draw_infos: draw_infos,
254 265
           wallet_balance: res.data.wallet_balance
255 266
         })

+ 13 - 5
src/moduleB/pages/faceChanging/index.jsx

@@ -36,7 +36,7 @@ export default class collection extends Component {
36 36
   onShareAppMessage = (res) => {
37 37
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
38 38
     if (process.env.TARO_ENV == 'tt') {
39
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
39
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
40 40
     }
41 41
     let shareData = {
42 42
       title: tool.shareTitle,
@@ -112,12 +112,20 @@ export default class collection extends Component {
112 112
           Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
113 113
           return
114 114
         }
115
+        let base64Img = Taro.getFileSystemManager().readFileSync(file, 'base64')
115 116
         Taro.showLoading({
116
-          title: '图片上传中',
117
+          title: '图片检测中...',
117 118
         })
118
-        Taro.hideLoading()
119
-        Taro.navigateTo({
120
-          url: `/moduleA/pages/upload/index?image=${file}`
119
+        api.imageDetection({ img_data: base64Img }).then(item=>{
120
+          if (item.code==200) {
121
+            Taro.hideLoading()
122
+            Taro.navigateTo({
123
+              url: `/moduleA/pages/upload/index?image=${file}`
124
+            })
125
+          }else{
126
+            Taro.hideLoading()
127
+            Taro.showToast({ title: item.msg, icon: 'none' })
128
+          }
121 129
         })
122 130
       }
123 131
     })

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

@@ -211,7 +211,7 @@ export default class Task extends Component {
211 211
   onShareAppMessage = (res) => {
212 212
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
213 213
     if (process.env.TARO_ENV == 'tt') {
214
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
214
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
215 215
     }
216 216
     let shareData = {
217 217
       title: tool.shareTitle,

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

@@ -126,7 +126,7 @@ export default class Task extends Component {
126 126
   onShareAppMessage = (res) => {
127 127
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
128 128
     if (process.env.TARO_ENV == 'tt') {
129
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
129
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
130 130
     }
131 131
     let shareData = {
132 132
       title: tool.shareTitle,

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

@@ -679,7 +679,7 @@ export default class collection extends Component {
679 679
   onShareAppMessage = (res) => {
680 680
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
681 681
     if (process.env.TARO_ENV == 'tt') {
682
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
682
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
683 683
     }
684 684
     let shareData = {
685 685
       title: tool.shareTitle,

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

@@ -16,7 +16,7 @@ export default class Task extends Component {
16 16
   onShareAppMessage = (res) => {
17 17
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
18 18
     if (process.env.TARO_ENV == 'tt') {
19
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
19
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
20 20
     }
21 21
     let shareData = {
22 22
       title: tool.shareTitle,

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

@@ -63,7 +63,7 @@ export default class Task extends Component {
63 63
   onShareAppMessage = (res) => {
64 64
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
65 65
     if (process.env.TARO_ENV == 'tt') {
66
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
66
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
67 67
     }
68 68
     let shareData = {
69 69
       title: tool.shareTitle,

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

@@ -31,7 +31,7 @@ export default class Task extends Component {
31 31
   onShareAppMessage = (res) => {
32 32
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
33 33
     if (process.env.TARO_ENV == 'tt') {
34
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
34
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
35 35
     }
36 36
     let shareData = {
37 37
       title: tool.shareTitle,

+ 1 - 1
src/pages/activity/index.jsx

@@ -55,7 +55,7 @@ export default class collection extends Component {
55 55
   onShareAppMessage = (res) => {
56 56
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
57 57
     if (process.env.TARO_ENV == 'tt') {
58
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
58
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
59 59
     }
60 60
     let shareData = {
61 61
       title: tool.shareTitle,

+ 15 - 4
src/pages/index/index.jsx

@@ -83,7 +83,7 @@ export default class Mine extends Component {
83 83
   onShareAppMessage = (res) => {
84 84
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
85 85
     if (process.env.TARO_ENV == 'tt') {
86
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
86
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
87 87
     }
88 88
     let shareData = {
89 89
       title: tool.shareTitle,
@@ -583,9 +583,20 @@ export default class Mine extends Component {
583 583
           Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
584 584
           return
585 585
         }
586
-        Taro.hideLoading()
587
-        Taro.navigateTo({
588
-          url: `/moduleA/pages/upload/index?image=${file}`
586
+        let base64Img = Taro.getFileSystemManager().readFileSync(file, 'base64')
587
+        Taro.showLoading({
588
+          title: '图片检测中...',
589
+        })
590
+        api.imageDetection({ img_data: base64Img }).then(item=>{
591
+          if (item.code==200) {
592
+            Taro.hideLoading()
593
+            Taro.navigateTo({
594
+              url: `/moduleA/pages/upload/index?image=${file}`
595
+            })
596
+          }else{
597
+            Taro.hideLoading()
598
+            Taro.showToast({ title: item.msg, icon: 'none' })
599
+          }
589 600
         })
590 601
       }
591 602
     })

+ 1 - 1
src/pages/mine/index.jsx

@@ -19,7 +19,7 @@ export default class Mine extends Component {
19 19
   onShareAppMessage = (res) => {
20 20
     let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
21 21
     if (process.env.TARO_ENV == 'tt') {
22
-      path = `/pages/index/index?c=channel_name&s=douyinguazai`
22
+      path = `/moduleB/pages/comic/index?c=channel_name&s=neibuguazai`
23 23
     }
24 24
     let shareData = {
25 25
       title: tool.shareTitle,

+ 23 - 9
src/service/index.js

@@ -249,21 +249,35 @@ export const getDrawTaskStatusGc = data =>
249 249
     method: 'POST',
250 250
     data,
251 251
   });
252
-  //人物动漫化解锁
252
+//人物动漫化解锁
253 253
 export const unlockGcImg = data =>
254
-Request({
255
-  url: '/api/unlock_gc_img',
256
-  method: 'POST',
257
-  data,
258
-});
259
-  //人物动漫化解锁
260
-  export const drawGcImgTask = data =>
254
+  Request({
255
+    url: '/api/unlock_gc_img',
256
+    method: 'POST',
257
+    data,
258
+  });
259
+//人物动漫化解锁
260
+export const drawGcImgTask = data =>
261 261
   Request({
262 262
     url: '/api/draw_gc_img_task',
263 263
     method: 'POST',
264 264
     data,
265 265
   });
266
-  
266
+//人物动漫化活动
267
+export const getDraw51ImgIndex = data =>
268
+  Request({
269
+    url: '/api/get_draw_51_img_index',
270
+    method: 'POST',
271
+    data,
272
+  });
273
+//图片检测
274
+export const imageDetection = data =>
275
+  Request({
276
+    url: '/api/image_detection',
277
+    method: 'POST',
278
+    data,
279
+  });
280
+
267 281
 
268 282
 
269 283