黎海 1 рік тому
батько
коміт
b1c1277981

+ 5 - 0
package-lock.json

@@ -18458,6 +18458,11 @@
18458 18458
                 "xtend": "^4.0.0"
18459 18459
             }
18460 18460
         },
18461
+        "taro-cropper": {
18462
+            "version": "1.2.3",
18463
+            "resolved": "https://registry.npmjs.org/taro-cropper/-/taro-cropper-1.2.3.tgz",
18464
+            "integrity": "sha512-pW8/39KU2BfSwA6EZ7GYU0dKfDAa3Nf1vk2keh3lCY7LM9yLYdW6fb7ufGBSDYpTkDnxdjw5IKznN3LCGER0cA=="
18465
+        },
18461 18466
         "taro-css-to-react-native": {
18462 18467
             "version": "3.5.7",
18463 18468
             "resolved": "https://registry.npmjs.org/taro-css-to-react-native/-/taro-css-to-react-native-3.5.7.tgz",

+ 2 - 1
package.json

@@ -57,7 +57,8 @@
57 57
         "@vant/weapp": "^1.10.14",
58 58
         "postcss": "^8.2.1",
59 59
         "react": "^18.0.0",
60
-        "react-dom": "^18.0.0"
60
+        "react-dom": "^18.0.0",
61
+        "taro-cropper": "^1.2.3"
61 62
     },
62 63
     "devDependencies": {
63 64
         "@babel/core": "^7.8.0",

+ 18 - 10
src/app.config.js

@@ -3,11 +3,8 @@ import Taro from '@tarojs/taro'
3 3
 export default defineAppConfig({
4 4
   pages: [
5 5
     'pages/index/index',
6
-    'pages/collection/index',
7
-    "pages/darwDetail/index",
8
-    "pages/communityDetail/index",
9
-    "pages/earnPoints/index",
10 6
     "pages/mine/index",
7
+    'pages/collection/index',
11 8
     "pages/activity/index"
12 9
   ],
13 10
   subpackages: [
@@ -18,8 +15,19 @@ export default defineAppConfig({
18 15
         "pages/invite/index",
19 16
         "pages/wallet/index",
20 17
         "pages/shareCnt/index",
18
+        "pages/upload/index",//图片裁剪页面
19
+        "pages/darwDetail/index",
20
+        "pages/communityDetail/index",
21
+        "pages/earnPoints/index",
21 22
       ]
22 23
     },
24
+    // {
25
+    //   root: "moduleB",
26
+    //   name: "分包B",
27
+    //   pages: [
28
+       
29
+    //   ]
30
+    // },
23 31
     
24 32
   ],
25 33
   window: {
@@ -48,12 +56,12 @@ export default defineAppConfig({
48 56
         selectedIconPath: "images/nav/play_pin.png",
49 57
         text: "创作"
50 58
       },
51
-      // {
52
-      //   pagePath: "pages/activity/index",
53
-      //   iconPath: "images/nav/task.png",
54
-      //   selectedIconPath: "images/nav/task_pin.png",
55
-      //   text: "活动"
56
-      // },
59
+      {
60
+        pagePath: "pages/activity/index",
61
+        iconPath: "images/nav/task.png",
62
+        selectedIconPath: "images/nav/task_pin.png",
63
+        text: "活动"
64
+      },
57 65
       {
58 66
         pagePath: "pages/mine/index",
59 67
         iconPath: "images/nav/my.png",

+ 0 - 3
src/app.js

@@ -15,9 +15,6 @@ class App extends Component {
15 15
     }
16 16
   }
17 17
   onLaunch () {
18
-    // if (wx.getStorageSync('channel_name') == '') {
19
-    //   wx.setStorageSync('channel_name', "channel_name")
20
-    // }
21 18
 
22 19
     // 保持屏幕常亮
23 20
     Taro.setKeepScreenOn({

src/pages/communityDetail/index.config.js → src/moduleA/pages/communityDetail/index.config.js


+ 10 - 10
src/pages/communityDetail/index.jsx

@@ -1,9 +1,9 @@
1 1
 import { Component } from 'react'
2 2
 import { View, Swiper, SwiperItem, Image, Textarea } from '@tarojs/components'
3 3
 import Taro, { getCurrentInstance } from '@tarojs/taro'
4
-import tool from '../../common/tool'
5
-import TaroCanvasDrawer from '../../component/taro-plugin-canvas';
6
-import * as api from '../../service/index'
4
+import tool from '../../../common/tool'
5
+import TaroCanvasDrawer from '../../../component/taro-plugin-canvas';
6
+import * as api from '../../../service/index'
7 7
 import './index.less'
8 8
 
9 9
 export default class Task extends Component {
@@ -50,7 +50,7 @@ export default class Task extends Component {
50 50
     /// 获取到base64Data
51 51
     var base64Data = dataurl;
52 52
     /// 通过微信小程序自带方法将base64转为二进制去除特殊符号,再转回base64
53
-    base64Data = wx.arrayBufferToBase64(wx.base64ToArrayBuffer(base64Data));
53
+    base64Data = Taro.arrayBufferToBase64(Taro.base64ToArrayBuffer(base64Data));
54 54
     /// 拼接请求头,data格式可以为image/png或者image/jpeg等,看需求
55 55
     const base64ImgUrl = "data:image/png;base64," + base64Data;
56 56
 
@@ -60,9 +60,9 @@ export default class Task extends Component {
60 60
     for (let i = 0; i < base64ImgData.length; i++) {
61 61
       view[i] = base64ImgData.charCodeAt(i);
62 62
     }
63
-    const fileStream = wx.base64ToArrayBuffer(base64ImgData);
64
-    const filePath = wx.env.USER_DATA_PATH + '/test.png';
65
-    wx.getFileSystemManager().writeFile({
63
+    const fileStream = Taro.base64ToArrayBuffer(base64ImgData);
64
+    const filePath = Taro.env.USER_DATA_PATH + '/test.png';
65
+    Taro.getFileSystemManager().writeFile({
66 66
       filePath: filePath,
67 67
       data: fileStream,
68 68
       encoding: 'binary',
@@ -205,14 +205,14 @@ export default class Task extends Component {
205 205
         config: {}
206 206
       }, () => {
207 207
         Taro.hideLoading();
208
-        wx.showShareImageMenu({
208
+        Taro.showShareImageMenu({
209 209
           path: tempFilePath
210 210
         })
211 211
         //画图成功之后打开分享
212
-        // wx.downloadFile({
212
+        // Taro.downloadFile({
213 213
         //   url: this.state.shareImage,
214 214
         //   success: (res) => {
215
-        //     wx.showShareImageMenu({
215
+        //     Taro.showShareImageMenu({
216 216
         //       path: res.tempFilePath
217 217
         //     })
218 218
         //   }

src/pages/communityDetail/index.less → src/moduleA/pages/communityDetail/index.less


src/pages/darwDetail/index.config.js → src/moduleA/pages/darwDetail/index.config.js


+ 10 - 10
src/pages/darwDetail/index.jsx

@@ -1,9 +1,9 @@
1 1
 import { Component } from 'react'
2 2
 import { View, Swiper, SwiperItem, Image, Textarea, Canvas, Button } from '@tarojs/components'
3 3
 import Taro, { getCurrentInstance, CanvasContext } from '@tarojs/taro'
4
-import tool from '../../common/tool'
5
-import TaroCanvasDrawer from '../../component/taro-plugin-canvas';
6
-import * as api from '../../service/index'
4
+import tool from '../../../common/tool'
5
+import TaroCanvasDrawer from '../../../component/taro-plugin-canvas';
6
+import * as api from '../../../service/index'
7 7
 import './index.less'
8 8
 
9 9
 export default class Task extends Component {
@@ -58,7 +58,7 @@ export default class Task extends Component {
58 58
     /// 获取到base64Data
59 59
     var base64Data = dataurl;
60 60
     /// 通过微信小程序自带方法将base64转为二进制去除特殊符号,再转回base64
61
-    base64Data = wx.arrayBufferToBase64(wx.base64ToArrayBuffer(base64Data));
61
+    base64Data = Taro.arrayBufferToBase64(Taro.base64ToArrayBuffer(base64Data));
62 62
     /// 拼接请求头,data格式可以为image/png或者image/jpeg等,看需求
63 63
     const base64ImgUrl = "data:image/png;base64," + base64Data;
64 64
 
@@ -68,9 +68,9 @@ export default class Task extends Component {
68 68
     for (let i = 0; i < base64ImgData.length; i++) {
69 69
       view[i] = base64ImgData.charCodeAt(i);
70 70
     }
71
-    const fileStream = wx.base64ToArrayBuffer(base64ImgData);
72
-    const filePath = wx.env.USER_DATA_PATH + '/test.png';
73
-    wx.getFileSystemManager().writeFile({
71
+    const fileStream = Taro.base64ToArrayBuffer(base64ImgData);
72
+    const filePath = Taro.env.USER_DATA_PATH + '/test.png';
73
+    Taro.getFileSystemManager().writeFile({
74 74
       filePath: filePath,
75 75
       data: fileStream,
76 76
       encoding: 'binary',
@@ -356,16 +356,16 @@ export default class Task extends Component {
356 356
         isFill: false,
357 357
         config: {}
358 358
       }, () => {
359
-        wx.showShareImageMenu({
359
+        Taro.showShareImageMenu({
360 360
           path: tempFilePath
361 361
         })
362 362
       })
363 363
        //画图成功之后打开分享
364
-      //  wx.downloadFile({
364
+      //  Taro.downloadFile({
365 365
       //   url: tempFilePath,
366 366
       //   success: (res) => {
367 367
       //     console.log('打开分享');
368
-      //     wx.showShareImageMenu({
368
+      //     Taro.showShareImageMenu({
369 369
       //       path: res.tempFilePath
370 370
       //     })
371 371
       //   }

src/pages/darwDetail/index.less → src/moduleA/pages/darwDetail/index.less


src/pages/earnPoints/index.config.js → src/moduleA/pages/earnPoints/index.config.js


+ 2 - 2
src/pages/earnPoints/index.jsx

@@ -1,8 +1,8 @@
1 1
 import { Component } from 'react'
2 2
 import { View, Swiper, SwiperItem, Image, Textarea, Text, ScrollView, RichText } from '@tarojs/components'
3 3
 import Taro, { getCurrentInstance } from '@tarojs/taro'
4
-import tool from '../../common/tool'
5
-import * as api from '../../service/index'
4
+import tool from '../../../common/tool'
5
+import * as api from '../../../service/index'
6 6
 import './index.less'
7 7
 
8 8
 export default class Task extends Component {

src/pages/earnPoints/index.less → src/moduleA/pages/earnPoints/index.less


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

@@ -51,7 +51,7 @@ export default class Task extends Component {
51 51
     /// 获取到base64Data
52 52
     var base64Data = dataurl;
53 53
     /// 通过微信小程序自带方法将base64转为二进制去除特殊符号,再转回base64
54
-    base64Data = wx.arrayBufferToBase64(wx.base64ToArrayBuffer(base64Data));
54
+    base64Data = Taro.arrayBufferToBase64(Taro.base64ToArrayBuffer(base64Data));
55 55
     /// 拼接请求头,data格式可以为image/png或者image/jpeg等,看需求
56 56
     const base64ImgUrl = "data:image/png;base64," + base64Data;
57 57
 
@@ -61,9 +61,9 @@ export default class Task extends Component {
61 61
     for (let i = 0; i < base64ImgData.length; i++) {
62 62
       view[i] = base64ImgData.charCodeAt(i);
63 63
     }
64
-    const fileStream = wx.base64ToArrayBuffer(base64ImgData);
65
-    const filePath = wx.env.USER_DATA_PATH + '/test.png';
66
-    wx.getFileSystemManager().writeFile({
64
+    const fileStream = Taro.base64ToArrayBuffer(base64ImgData);
65
+    const filePath = Taro.env.USER_DATA_PATH + '/test.png';
66
+    Taro.getFileSystemManager().writeFile({
67 67
       filePath: filePath,
68 68
       data: fileStream,
69 69
       encoding: 'binary',
@@ -223,11 +223,11 @@ export default class Task extends Component {
223 223
 
224 224
       })
225 225
       //画图成功之后打开分享
226
-      //  wx.downloadFile({
226
+      //  Taro.downloadFile({
227 227
       //   url: tempFilePath,
228 228
       //   success: (res) => {
229 229
       //     console.log('打开分享');
230
-      //     wx.showShareImageMenu({
230
+      //     Taro.showShareImageMenu({
231 231
       //       path: res.tempFilePath
232 232
       //     })
233 233
       //   }
@@ -274,7 +274,7 @@ export default class Task extends Component {
274 274
   }
275 275
   //分享
276 276
   shareImage () {
277
-    wx.showShareImageMenu({
277
+    Taro.showShareImageMenu({
278 278
       path: this.state.shareImage
279 279
     })
280 280
   }

+ 5 - 0
src/moduleA/pages/upload/index.config.js

@@ -0,0 +1,5 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '裁剪图片',
3
+  enableShareAppMessage: true,
4
+  enableShareTimeline: true ,
5
+})

+ 134 - 0
src/moduleA/pages/upload/index.jsx

@@ -0,0 +1,134 @@
1
+import React, { Component } from 'react'
2
+import { View, Text, Button, Image, ScrollView, Input } from '@tarojs/components'
3
+import Taro, { getCurrentInstance } from '@tarojs/taro'
4
+import TaroCropper from 'taro-cropper';
5
+import tool from '../../../common/tool'
6
+import * as api from '../../../service/index'
7
+
8
+import './index.less'
9
+
10
+export default class Mine extends Component {
11
+  $instance = getCurrentInstance()
12
+  inputRef = React.createRef();
13
+  state = {
14
+    src: '',
15
+    cutImagePath: '',
16
+    cropperWidth: 500,
17
+    cropperHeight: 500,
18
+    imgSize: [],
19
+    sizeIndex: 0
20
+  }
21
+
22
+  componentDidShow () {
23
+    let routers = this.$instance.router.params
24
+    this.setState({
25
+      src: routers.image
26
+    })
27
+    console.log(routers, 'routers');
28
+    this.getDrawIndex()
29
+  }
30
+  getDrawIndex () {
31
+    api.getDrawIndex().then(res => {
32
+      if (res.code == 200) {
33
+        this.setState({
34
+          imgSize: res.data.img_size,
35
+        }, () => {
36
+          let routers = this.$instance.router.params
37
+          console.log(routers, 'rou');
38
+          if (routers.task_id) {
39
+            Taro.showLoading({
40
+              title: '加载中',
41
+            })
42
+            this.getDrawTaskStatus()
43
+          }
44
+        })
45
+      }
46
+    })
47
+  }
48
+  changeMeasurement (item, index) {
49
+    let cropperHeight = 500
50
+    console.log(item);
51
+    let sizeList = item.name.split(":")
52
+    cropperHeight = 500 * sizeList[1] / sizeList[0]
53
+    console.log(cropperHeight, 'cropperHeight');
54
+    this.setState({
55
+      sizeIndex: index,
56
+      cropperHeight: cropperHeight
57
+    })
58
+  }
59
+  onShareAppMessage = (res) => {
60
+    let shareData = {
61
+      title: tool.shareTitle,
62
+      path: `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`,
63
+      imageUrl: tool.shareImg
64
+    }
65
+    return shareData;
66
+  }
67
+  onCut(e){
68
+    Taro.showLoading({
69
+      title: '加载中...',
70
+    })
71
+    let base64Img = Taro.getFileSystemManager().readFileSync(e, 'base64')
72
+    api.uploadImg({ img_data: base64Img }).then(res => {
73
+      if (res.code == 200) {
74
+        // 传裁剪图片到上个页面
75
+        var pages = Taro.getCurrentPages(); //获取当前页面栈
76
+        if (pages.length >1) {
77
+          var beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
78
+          console.log(beforePage,'beforePage');
79
+          beforePage.setData({
80
+            //返回参数 ps:这里我打印出beforePage只有一个setData能调用到
81
+            consultImg: res.data,
82
+            sizeIndex:this.state.sizeIndex
83
+          },()=>{
84
+            Taro.hideLoading()
85
+            Taro.navigateBack({delta: 1}); //返回上一个页面
86
+          })
87
+        }
88
+      }
89
+    })
90
+    console.log(e,'cut');
91
+  }
92
+  onCancel(e){
93
+    Taro.navigateBack({delta: 1})
94
+  }
95
+
96
+  componentDidMount () { }
97
+
98
+  render () {
99
+    return (
100
+      <View className='wallet'>
101
+        <ScrollView
102
+          className='measurement-list'
103
+          showScrollbar
104
+          scrollX
105
+        >
106
+          {
107
+            this.state.imgSize.map((item, index) => (
108
+              <View className='measurement-info' style={this.state.sizeIndex == index ? 'border: 2px solid #0F84EC;' : ''} key={index} onClick={e => (this.changeMeasurement(item, index))}>
109
+                <Image className='measurement-img' src={item.img}></Image>
110
+                <View className='measurement-title'>{item.name}</View>
111
+              </View>
112
+            ))
113
+          }
114
+        </ScrollView>
115
+        <View className='index'>
116
+          <TaroCropper
117
+            id='taro-cropper'
118
+            src={this.state.src}
119
+            // src='https://video-h5.fyshark.com/tmp/10581_168007502299.png'
120
+            cropperWidth={this.state.cropperWidth}
121
+            cropperHeight={this.state.cropperHeight}
122
+            height={'1300'}
123
+            hideCancelText={false}
124
+            themeColor='#1084EC'
125
+            onCut={res => {
126
+              this.onCut(res)
127
+            }}
128
+            onCancel={e => (this.onCancel(e))}
129
+          />
130
+        </View>
131
+      </View>
132
+    )
133
+  }
134
+}

+ 35 - 0
src/moduleA/pages/upload/index.less

@@ -0,0 +1,35 @@
1
+.wallet{
2
+  min-height: 100vh;
3
+  background-color: rgb(0 0 0);
4
+}
5
+.measurement-list {
6
+  display: flex;
7
+  flex-wrap: wrap;
8
+
9
+  .measurement-info {
10
+    position: relative;
11
+    display: inline-block;
12
+    margin: 0 20px;
13
+    width: 116px;
14
+    box-sizing: border-box;
15
+    height: 116px;
16
+    background-color: rgba(5, 5, 5, 0.5);
17
+    border-radius: 16px;
18
+  }
19
+
20
+  .measurement-img {
21
+    margin-top: 22px;
22
+    position: relative;
23
+    left: 50%;
24
+    transform: translateX(-50%);
25
+    width: 48px;
26
+    height: 48px;
27
+  }
28
+
29
+  .measurement-title {
30
+    text-align: center;
31
+    font-family: PingFangSC-Regular;
32
+    font-size: 20px;
33
+    color: #0F84EC;
34
+  }
35
+}

+ 1 - 1
src/pages/activity/index.config.js

@@ -1,5 +1,5 @@
1 1
 export default definePageConfig({
2
-  navigationBarTitleText: '社区',
2
+  navigationBarTitleText: '活动',
3 3
   enableShareAppMessage: true,
4 4
   enableShareTimeline: true ,
5 5
 })

+ 72 - 125
src/pages/activity/index.jsx

@@ -7,150 +7,97 @@ import './index.less'
7 7
 
8 8
 export default class collection extends Component {
9 9
   state = {
10
-    tableIndex: 0,
11
-    total: false,
12
-    page: 1,
13
-    page_size: 20,
14
-    cardinalInfos: [],//基数
15
-    evenInfos: [],//偶数
16
-    type: 'hot',//hot:热门,time:最新
10
+    consultImg: 'http://video-img.fyshark.com/1680144082044%E7%BC%96%E7%BB%84.png',
11
+    sizeIndex: 0,
12
+    isImage: false
17 13
   }
18 14
 
19 15
   componentWillMount () {
20
-    // this.setInit(1, 'hot')
21 16
   }
22
-  componentDidShow(){
23
-    this.setInit(1, 'hot')
24
-  }
25
-  setInit (page, type) {
26
-    this.setState({
27
-      total: false,//是否加载完
28
-      page: 1,
29
-      page_size: 20,
30
-      cardinalInfos: [],//基数
31
-      evenInfos: [],//偶数
32
-    })
33
-    this.getHubList(page, type)
34
-  }
35
-  onShareAppMessage = (res) => {
36
-    let shareData = {
37
-      title:tool.shareTitle,
38
-      path: `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`,
39
-      imageUrl: tool.shareImg
17
+  componentDidShow () {
18
+    //接收裁剪图片
19
+    let pages = Taro.getCurrentPages();
20
+    let currentPage = pages[pages.length - 1]; // 获取当前页面
21
+    if (currentPage.__data__.consultImg) { // 获取值
22
+      this.setState({
23
+        consultImg: currentPage.__data__.consultImg,
24
+        sizeIndex: currentPage.__data__.sizeIndex,
25
+        isImage: true
26
+      })
40 27
     }
41
-    return shareData;
42 28
   }
43
-
44
-  getHubList (page, type) {
45
-    let params = {
46
-      page: page,
47
-      page_size: this.state.page_size,
48
-      otype: type
49
-    }
50
-    Taro.showLoading({
51
-      title: '加载中',
52
-    })
53
-    api.getHubList(params).then(res => {
54
-      if (res.code == 200) {
55
-        Taro.hideLoading()
56
-        let _evenInfos = res.data.filter((item, index) => {
57
-          return index % 2 == 1
29
+  upLode () {
30
+    let that = this
31
+    Taro.chooseMedia({
32
+      count: 1, // 默认
33
+      sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
34
+      sourceType: ['album', 'camera'],
35
+      success: function (res) {
36
+        console.log(res, 'res');
37
+        const file = res.tempFiles[0].tempFilePath
38
+        if (res.tempFiles[0].size > 2000000) {
39
+          Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
40
+          return
41
+        }
42
+        Taro.showLoading({
43
+          title: '图片上传中',
58 44
         })
59
-        let _cardinalInfos = res.data.filter((item, index) => {
60
-          return index % 2 == 0
61
-        })
62
-        console.log(_cardinalInfos, '_cardinalInfos');
63
-        let cardinalInfos = this.state.cardinalInfos.concat(_cardinalInfos)
64
-        let evenInfos = this.state.evenInfos.concat(_evenInfos)
65
-        this.setState({
66
-          cardinalInfos: cardinalInfos,//基数
67
-          evenInfos: evenInfos,//偶数
68
-          total: res.data.length < 20 ? true : false
45
+        Taro.hideLoading()
46
+        Taro.navigateTo({
47
+          url: `/moduleA/pages/upload/index?image=${file}`
69 48
         })
70 49
       }
71 50
     })
72 51
   }
73
-  onReachBottom () {
74
-    if (!this.state.total) {
75
-      this.setState({
76
-        page: this.state.page + 1
77
-      })
78
-      this.getHubList((this.state.page + 1), this.state.type)
52
+  generatePictures () {
53
+    if (!this.state.isImage) {
54
+      Taro.showToast({ title: '请先上传图片', icon: 'none' })
55
+      return
79 56
     }
80
-  }
81
-  componentDidHide () { }
82
-  changeTab (index) {
83
-    let _type = index == 0 ? 'hot' : 'time'
84
-    this.setState({
85
-      tableIndex: index,
86
-      type: _type
87
-    })
88
-    this.setInit(1, _type)
89
-  }
90
-  detail (item, index) {
91
-    console.log(item, 'item');
92
-    Taro.navigateTo({
93
-      url: `/pages/communityDetail/index?task_id=${item.id}`
57
+    api.drawGcImg({ img_url: this.state.consultImg }).then(res => {
58
+      if (res.code == 200) {
59
+        Taro.navigateTo({
60
+          url: `/moduleA/pages/darwDetail/index?task_id=${res.data.task_id}`
61
+        })
62
+      }else {
63
+        Taro.hideLoading()
64
+        Taro.showModal({
65
+          title: '您的余额不足',
66
+          content: '是否前往获取点券?',
67
+          success: function (res) {
68
+            if (res.confirm) {
69
+              Taro.navigateTo({
70
+                url: `/moduleA/pages/earnPoints/index`
71
+              })
72
+            } else if (res.cancel) {
73
+              console.log('用户点击取消')
74
+            }
75
+          }
76
+        })
77
+      }
94 78
     })
95 79
   }
96 80
 
97 81
   render () {
98 82
     return (
99 83
       <View className='mine'>
100
-        <View className='table'>
101
-          <View className='table-info' onClick={e => (this.changeTab(0))} style={this.state.tableIndex == 0 ? 'font-size: 20px;color: #FFFFFF;border-bottom: 4px solid #0F84EC;' : ''}>热门</View>
102
-          <View className='table-info' onClick={e => (this.changeTab(1))} style={this.state.tableIndex == 1 ? 'font-size: 20px;color: #FFFFFF;border-bottom: 4px solid #0F84EC;' : ''}>最新</View>
84
+        <View className='title'>人物动漫化</View>
85
+        <View className='content' onClick={e => (this.upLode())}>
86
+          <Image className='content-img'
87
+            mode='aspectFit'
88
+            src={this.state.consultImg}
89
+          ></Image>
90
+          {
91
+            !this.state.isImage &&
92
+            <View className='add-content'>
93
+              <Image className='add-img' src='http://video-img.fyshark.com/1680144257329%2B.png'></Image>
94
+              <View className='add-tips'>上传图片</View>
95
+            </View>
96
+          }
103 97
         </View>
104
-        <View className='image-list'>
105
-          <View className='list-left'>
106
-            {
107
-              this.state.cardinalInfos.map((item, index) => (
108
-                <View className='image-info' key={index} onClick={e => (this.detail(item, index))}>
109
-                  <View className='info-top'>
110
-                    <Image className='info-img' lazyLoad mode='widthFix' src={item.img}></Image>
111
-                  </View>
112
-                  <View className='info-bottom'>
113
-                    <View className='info-name'></View>
114
-                    <View className='info-tips'>
115
-                      <View className='info-tips-left'>
116
-                        <Image className='info-head-img' src={item.user_info.head_img}></Image>
117
-                        <View className='info-sampling'>{tool.ellipsis(item.user_info.user_name, 8)}</View>
118
-                      </View>
119
-                      <View className='info-tips-right'>
120
-                        <Image className='info-like-img' src={item.has_like == 0 ? 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1679296882735.png' : 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1679296893058.png'}></Image>
121
-                        <View className='like-num'>{item.like_cnt}</View>
122
-                      </View>
123
-                    </View>
124
-                  </View>
125
-                </View>
126
-              ))
127
-            }
128
-          </View>
129
-          <View className='list-right'>
130
-            {
131
-              this.state.evenInfos.map((item, index) => (
132
-                <View className='image-info' key={index} onClick={e => (this.detail(item, index))}>
133
-                  <View className='info-top'>
134
-                    <Image className='info-img' lazyLoad mode='widthFix' src={item.img}></Image>
135
-                  </View>
136
-                  <View className='info-bottom'>
137
-                    <View className='info-name'></View>
138
-                    <View className='info-tips'>
139
-                      <View className='info-tips-left'>
140
-                        <Image className='info-head-img' src={item.user_info.head_img}></Image>
141
-                        <View className='info-sampling'>{tool.ellipsis(item.user_info.user_name, 8)}</View>
142
-                      </View>
143
-                      <View className='info-tips-right'>
144
-                        <Image className='info-like-img' src={item.has_like == 0 ? 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1679296882735.png' : 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1679296893058.png'}></Image>
145
-                        <View className='like-num'>{item.like_cnt}</View>
146
-                      </View>
147
-                    </View>
148
-                  </View>
149
-                </View>
150
-              ))
151
-            }
152
-          </View>
153
-
98
+        <View className='img-tips'>绝美的动漫头像,上传图片一件生成</View>
99
+        <View className='generate-pictures' onClick={e => (this.generatePictures(e))} >
100
+          生成图片(消耗2点券)
154 101
         </View>
155 102
       </View>
156 103
     )

+ 55 - 79
src/pages/activity/index.less

@@ -3,93 +3,69 @@
3 3
   min-height: 100vh;
4 4
   background-color: #041129;
5 5
 
6
-  .table {
7
-    display: flex;
8
-    .table-info {
9
-      font-family: PingFangSC-Regular;
10
-      font-size: 32px;
11
-      color: rgba(255, 255, 255, .75);
12
-      letter-spacing: 0;
13
-      height: 60px;
14
-      line-height: 60px;
15
-      padding: 0 10px;
16
-      margin-right: 20px;
17
-    }
6
+  .title {
7
+    margin-top: 48px;
8
+    font-family: PingFangSC-Regular;
9
+    font-size: 32px;
10
+    color: #FFFFFF;
18 11
   }
19 12
 
20
-  .image-list {
21
-    margin-top: 50px;
22
-    display: flex;
23
-    justify-content: space-between;
24
-
25
-    .list-left {
26
-      width: 330px;
27
-    }
28
-
29
-    .list-right {
30
-      width: 330px;
31
-    }
13
+  .content {
14
+    position: relative;
15
+    margin-top: 20px;
32 16
 
33
-    .image-info {
34
-      margin-top: 20px;
35
-      border-radius: 8px;
36
-      border: 2px solid rgba(15, 132, 236, 1);
17
+    .add-content {
18
+      position: absolute;
19
+      left: 50%;
20
+      top: 50%;
21
+      transform: translate(-50%,-50%);
22
+      // display: flex;
23
+      // justify-content: center;
37 24
 
38
-      .info-top {
39
-        width: 100%;
40
-
41
-        .info-img {
42
-          width: 100%;
43
-          min-height: 360px;
44
-          display: block;
45
-        }
25
+      .add-img {
26
+        position: relative;
27
+        left: 50%;
28
+        transform: translateX(-50%);
29
+        width: 80px;
30
+        height: 80px;
46 31
       }
47 32
 
48
-      .info-bottom {
49
-        padding: 20px 22px;
50
-
51
-        .info-name {
52
-          font-family: PingFangSC-Medium;
53
-          font-size: 28px;
54
-          color: #FFFFFF;
55
-        }
56
-
57
-        .info-tips {
58
-          margin-top: 8px;
59
-          display: flex;
60
-          justify-content: space-between;
61
-          align-items: center;
62
-          font-family: PingFangSC-Regular;
63
-          font-size: 20px;
64
-          color: rgba(255, 255, 255, .75);
65
-
66
-          .info-tips-left {
67
-            display: flex;
68
-            align-items: center;
69
-          }
70
-
71
-          .info-tips-right {
72
-            display: flex;
73
-            align-items: center;
74
-          }
33
+      .add-tips {
34
+        margin-top: 12px;
35
+        font-family: PingFangSC-Regular;
36
+        font-size: 28px;
37
+        color: #FFFFFF;
38
+        text-align: center;
39
+      }
40
+    }
75 41
 
76
-          .info-head-img {
77
-            width: 32px;
78
-            height: 32px;
79
-          }
42
+    .content-img {
43
+      width: 100%;
44
+      max-height: 760px;
45
+    }
46
+  }
80 47
 
81
-          .info-sampling {
82
-            margin-left: 8px;
83
-          }
48
+  .generate-pictures {
49
+    width: 382px;
50
+    height: 96px;
51
+    border-radius: 96px;
52
+    line-height: 96px;
53
+    text-align: center;
54
+    position: fixed;
55
+    bottom: 40px;
56
+    left: 50%;
57
+    z-index: 100;
58
+    transform: translateX(-50%);
59
+    background-image: linear-gradient(-49deg, #5D81FF 0%, #0F84EC 100%);
60
+    font-family: PingFangSC-Regular;
61
+    font-size: 28px;
62
+    color: #FFFFFF;
63
+  }
84 64
 
85
-          .info-like-img {
86
-            margin-left: 10px;
87
-            width: 28px;
88
-            height: 24px;
89
-            margin-right: 10px;
90
-          }
91
-        }
92
-      }
93
-    }
65
+  .img-tips {
66
+    margin-top: 20px;
67
+    font-family: PingFangSC-Regular;
68
+    font-size: 24px;
69
+    color: #FFFFFF;
94 70
   }
95 71
 }

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

@@ -90,7 +90,7 @@ export default class collection extends Component {
90 90
   detail (item, index) {
91 91
     console.log(item, 'item');
92 92
     Taro.navigateTo({
93
-      url: `/pages/communityDetail/index?task_id=${item.id}`
93
+      url: `/moduleA/pages/communityDetail/index?task_id=${item.id}`
94 94
     })
95 95
   }
96 96
 

+ 42 - 18
src/pages/index/index.jsx

@@ -32,11 +32,19 @@ export default class Mine extends Component {
32 32
   }
33 33
 
34 34
   componentDidShow () {
35
+    //接收裁剪图片
36
+    let pages = Taro.getCurrentPages();
37
+    let currentPage = pages[pages.length - 1]; // 获取当前页面
38
+    if (currentPage.__data__.consultImg) { // 获取值
39
+      this.setState({
40
+        consultImg: currentPage.__data__.consultImg,
41
+        sizeIndex: currentPage.__data__.sizeIndex
42
+      })
43
+    }
35 44
     this.getDrawIndex()
36 45
     this.getWxTemplate()
37 46
     this.getTagsDev()
38 47
   }
39
-
40 48
   componentDidMount () {
41 49
 
42 50
   }
@@ -203,6 +211,13 @@ export default class Mine extends Component {
203 211
     })
204 212
   }
205 213
   changeMeasurement (item, index) {
214
+    if (this.state.consultImg.length > 0) {
215
+      Taro.showToast({
216
+        title: `您已选择图尺寸`,
217
+        icon: 'error',
218
+      });
219
+      return
220
+    }
206 221
     this.setState({
207 222
       sizeIndex: index
208 223
     })
@@ -307,14 +322,23 @@ export default class Mine extends Component {
307 322
         Taro.hideLoading()
308 323
         this.subscribe(res.data.task_id)
309 324
         Taro.navigateTo({
310
-          url: `/pages/darwDetail/index?task_id=${res.data.task_id}`
325
+          url: `/moduleA/pages/darwDetail/index?task_id=${res.data.task_id}`
311 326
         })
312 327
       } else {
313 328
         Taro.hideLoading()
314
-        Taro.showToast({
315
-          title: res.msg,
316
-          icon: 'error',
317
-        });
329
+        Taro.showModal({
330
+          title: '您的余额不足',
331
+          content: '是否前往获取点券?',
332
+          success: function (res) {
333
+            if (res.confirm) {
334
+              Taro.navigateTo({
335
+                url: `/moduleA/pages/earnPoints/index`
336
+              })
337
+            } else if (res.cancel) {
338
+              console.log('用户点击取消')
339
+            }
340
+          }
341
+        })
318 342
       }
319 343
     })
320 344
     // }, 1000)
@@ -384,21 +408,18 @@ export default class Mine extends Component {
384 408
           Taro.showToast({ title: '图片大小不能超过2M', icon: 'none' })
385 409
           return
386 410
         }
387
-        Taro.showLoading({
388
-          title: '图片上传中',
389
-        })
390
-        let base64Img = Taro.getFileSystemManager().readFileSync(file, 'base64')
391
-        api.uploadImg({ img_data: base64Img }).then(res => {
392
-          if (res.code == 200) {
393
-            Taro.hideLoading()
394
-            that.setState({
395
-              consultImg: res.data
396
-            })
397
-          }
411
+        Taro.hideLoading()
412
+        Taro.navigateTo({
413
+          url: `/moduleA/pages/upload/index?image=${file}`
398 414
         })
399 415
       }
400 416
     })
401 417
   }
418
+  deleteImg(){
419
+    this.setState({
420
+      consultImg:''
421
+    })
422
+  }
402 423
 
403 424
   render () {
404 425
     return (
@@ -528,7 +549,10 @@ export default class Mine extends Component {
528 549
                   +
529 550
                 </View>
530 551
                 :
531
-                <Image className='consult-img' mode='aspectFit' onClick={e => (this.upLode())} src={this.state.consultImg}></Image>
552
+                <View className='consult-model'>
553
+                  <Image className='consult-img' mode='aspectFit' onClick={e => (this.upLode())} src={this.state.consultImg}></Image>
554
+                  <Image className='delete' src='http://video-img.fyshark.com/1680147210173guanbi.png' onClick={e=>(this.deleteImg())}></Image>
555
+                </View>
532 556
             }
533 557
           </View>
534 558
           <View className='draw-title'>色彩丰富度</View>

+ 28 - 9
src/pages/index/index.less

@@ -82,7 +82,8 @@
82 82
       text-align: center;
83 83
 
84 84
     }
85
-    .layout-content{
85
+
86
+    .layout-content {
86 87
       padding-bottom: 120px;
87 88
     }
88 89
 
@@ -92,7 +93,8 @@
92 93
       z-index: 1000;
93 94
       transform: translateX(-50%);
94 95
       left: 50%;
95
-      .selection-botton{
96
+
97
+      .selection-botton {
96 98
         padding: 0 38px;
97 99
         height: 80px;
98 100
         line-height: 80px;
@@ -395,23 +397,40 @@
395 397
     font-size: 28px;
396 398
     color: #FFFFFF;
397 399
   }
398
-  .consult{
400
+
401
+  .consult {
399 402
     margin-top: 20px;
400
-    .consult-content{
403
+
404
+    .consult-content {
401 405
       width: 222px;
402 406
       height: 218px;
403
-      border: 1px dashed rgba(255,255,255,.4);
407
+      border: 1px dashed rgba(255, 255, 255, .4);
404 408
       background: url(http://video-img.fyshark.com/1679900121628%E8%BE%B9%E8%A7%92.png);
405 409
       background-size: 100% 100%;
406 410
       display: flex;
407 411
       justify-content: center;
408 412
       align-items: center;
409 413
       font-size: 48px;
410
-      color: rgba(15,132,236,1);
414
+      color: rgba(15, 132, 236, 1);
411 415
     }
412
-    .consult-img{
413
-      width: 222px;
414
-      height: 218px;
416
+
417
+    .consult-model {
418
+      position: relative;
419
+      display: inline-block;
420
+      border: 1px dashed rgba(255, 255, 255, .4);
421
+
422
+      .consult-img {
423
+        width: 222px;
424
+        height: 218px;
425
+      }
426
+      .delete{
427
+        position: absolute;
428
+        position: absolute;
429
+        right: -20px;
430
+        top: -20px;
431
+        width: 40px;
432
+        height: 40px;
433
+      }
415 434
     }
416 435
   }
417 436
 }

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

@@ -136,11 +136,11 @@ export default class Mine extends Component {
136 136
     } else {
137 137
       if (this.state.type == 1) {
138 138
         Taro.navigateTo({
139
-          url: `/pages/communityDetail/index?task_id=${item.id}`
139
+          url: `/moduleA/pages/communityDetail/index?task_id=${item.id}`
140 140
         })
141 141
       }else{
142 142
         Taro.navigateTo({
143
-          url: `/pages/darwDetail/index?task_id=${item.task_id}&img_id=${item.id}`
143
+          url: `/moduleA/pages/darwDetail/index?task_id=${item.task_id}&img_id=${item.id}`
144 144
         })
145 145
       }
146 146
     }
@@ -229,7 +229,7 @@ export default class Mine extends Component {
229 229
 
230 230
   getEarnPoints () {
231 231
     Taro.navigateTo({
232
-      url: `/pages/earnPoints/index`
232
+      url: `/moduleA/pages/earnPoints/index`
233 233
     })
234 234
   }
235 235
   wallet(){

+ 7 - 1
src/service/index.js

@@ -165,7 +165,13 @@ Request({
165 165
   method: 'POST',
166 166
   data,
167 167
 });
168
-
168
+  //获取用户分销明细
169
+  export const drawGcImg = data =>
170
+  Request({
171
+    url: '/api/draw_gc_img',
172
+    method: 'POST',
173
+    data,
174
+  });
169 175
 
170 176
 
171 177