瀏覽代碼

helpgrouplist

许静 5 年之前
父節點
當前提交
6f2935bc06

+ 3
- 2
src/app.js 查看文件

@@ -40,12 +40,13 @@ class App extends Component {
40 40
       }
41 41
     },
42 42
     pages: [
43
+      'pages/person/index',
43 44
       'pages/activity/activity',
44 45
       'pages/shop/index',
45 46
       'pages/project/index',
46
-     
47
+
47 48
       'pages/project/detail/index',
48
-      'pages/person/index',
49
+      
49 50
       'pages/activity/assemblePage',
50 51
       'pages/activity/assistancePage',
51 52
       'pages/person/spread/index',

src/assets/helpgroup/拼团切图/already formed.png → src/assets/helpgroup/group/already formed.png 查看文件


src/assets/helpgroup/拼团切图/group number.png → src/assets/helpgroup/group/group number.png 查看文件


src/assets/helpgroup/拼团切图/team failure.png → src/assets/helpgroup/group/team failure.png 查看文件


src/assets/helpgroup/拼团切图/team success.png → src/assets/helpgroup/group/team success.png 查看文件


src/assets/helpgroup/助力切图/help failure.png → src/assets/helpgroup/help/help failure.png 查看文件


src/assets/helpgroup/助力切图/help success1.png → src/assets/helpgroup/help/success1.png 查看文件


src/assets/helpgroup/助力切图/help success.png → src/assets/helpgroup/help/success2.png 查看文件


+ 251
- 0
src/components/Poster/index.js 查看文件

@@ -0,0 +1,251 @@
1
+import Taro, { Component } from '@tarojs/taro';
2
+import { TaroCanvasDrawer } from '@components/taro-plugin-canvas';
3
+import dayjs from 'dayjs'
4
+import './index.scss'
5
+import {getCanvasConfig} from './util'
6
+/**
7
+ * 文档参考
8
+ * http://taro-ext.jd.com/plugin/view/5d23051670a0f46a87c9785b
9
+ */
10
+export default class Index extends Component {
11
+  static options = {
12
+    addGlobalClass: true
13
+  }
14
+  static defaultProps = {
15
+    data: {}
16
+  }
17
+  state = {
18
+    // 绘制的图片
19
+    shareImage: null,
20
+    canvasStatus: false,
21
+    config: null,
22
+    visible: false,
23
+    basicConfig: {
24
+      width: 640,
25
+      height: 1136,
26
+      backgroundColor: '#ffffff',
27
+      debug: false
28
+    }
29
+  }
30
+  componentWillMount() {
31
+    // this.initConfig()
32
+    getCanvasConfig()
33
+    Taro.showLoading({
34
+      title: '生成中...',
35
+      icon: 'none'
36
+    })
37
+  }
38
+  initConfig() {
39
+    const { data } = this.props
40
+    const { basicConfig } = this.state
41
+    const texts = [
42
+      {
43
+        x: 30,
44
+        y: 820,
45
+        text: data.buildingName,
46
+        fontSize: 36,
47
+        color: 'black',
48
+        baseLine: 'middle',
49
+        lineNum: 2,
50
+        lineHeight: 48,
51
+        // textAlign: 'center',
52
+        width: 560,
53
+        zIndex: 999
54
+      }, {
55
+        x: 30,
56
+        y: 890,
57
+        text: data.price,
58
+        fontSize: 36,
59
+        color: 'red',
60
+        baseLine: 'middle',
61
+        lineNum: 2,
62
+        lineHeight: 48,
63
+        // textAlign: 'center',
64
+        width: 560,
65
+        zIndex: 999
66
+      },
67
+      {
68
+        x: 30,
69
+        y: 1010,
70
+        text: '长按识别小程序码',
71
+        fontSize: 26,
72
+        color: '#999',
73
+        baseLine: 'middle',
74
+        lineHeight: 48,
75
+        width: 200,
76
+        zIndex: 11
77
+      },
78
+      {
79
+        x: 30,
80
+        y: 1065,
81
+        text: '进入',
82
+        fontSize: 26,
83
+        color: '#999',
84
+        baseLine: 'middle',
85
+        lineHeight: 48,
86
+        width: 50,
87
+        zIndex: 11
88
+      },
89
+      {
90
+        x: 100,
91
+        y: 1065,
92
+        text: '橙蕉',
93
+        fontSize: 28,
94
+        color: 'black',
95
+        baseLine: 'middle',
96
+        lineHeight: 48,
97
+        width: 120,
98
+        zIndex: 11
99
+      },
100
+      {
101
+        x: 240,
102
+        y: 1065,
103
+        text: '报名活动',
104
+        fontSize: 26,
105
+        color: '#999',
106
+        baseLine: 'middle',
107
+        lineHeight: 48,
108
+        width: 150,
109
+        zIndex: 11
110
+      },
111
+    ]
112
+    const images = [
113
+      {
114
+        url: data.poster,
115
+        width: 640,
116
+        height: 670,
117
+        y: 0,
118
+        x: 0
119
+      },
120
+      {
121
+        url: data.qrcode,
122
+        width: 160,
123
+        height: 160,
124
+        y: 950,
125
+        x: 450,
126
+        zIndex: 999
127
+      },
128
+      {
129
+        url: data.avatarurl || require('@assets/default-avatar.png'),
130
+        width: 130,
131
+        height: 130,
132
+        y: 630,
133
+        x: 20,
134
+        borderRadius: 130,
135
+        zIndex: 999
136
+      }
137
+    ]
138
+
139
+    const blocks = [
140
+      {
141
+        x: 0,
142
+        y: 936,
143
+        width: 640,
144
+        height: 200,
145
+        backgroundColor: 'rgba(248,248,248,1)',
146
+        zIndex: 1
147
+      }
148
+    ]
149
+    const config = Object.assign(basicConfig, { images, blocks, texts })
150
+    this.setState({
151
+      config,
152
+      canvasStatus: true
153
+    })
154
+  }
155
+
156
+  onCreateSuccess = (result) => {
157
+    const { tempFilePath, errMsg } = result;
158
+    Taro.hideLoading();
159
+    if (errMsg === 'canvasToTempFilePath:ok') {
160
+      this.setState({
161
+        shareImage: tempFilePath,
162
+        canvasStatus: false,
163
+        config: null,
164
+        visible: true
165
+      });
166
+    } else {
167
+      this.setState({
168
+        canvasStatus: false,
169
+        config: null
170
+      });
171
+      Taro.showToast({ icon: 'none', title: errMsg || '出现错误' });
172
+      console.log(errMsg);
173
+      this.hidePoster()
174
+    }
175
+  }
176
+
177
+  onPreview(e) {
178
+    e.stopPropagation()
179
+    e.preventDefault()
180
+    Taro.previewImage({
181
+      current: this.state.shareImage,
182
+      urls: [this.state.shareImage]
183
+    })
184
+  }
185
+
186
+  onCreateFail = (error) => {
187
+    console.log(error);
188
+  }
189
+
190
+  hidePoster(e) {
191
+    Taro.hideLoading();
192
+    this.props.toggle(false)
193
+  }
194
+
195
+  // 保存图片至本地
196
+  saveToAlbum = (e) => {
197
+    e.stopPropagation()
198
+    e.preventDefault()
199
+
200
+    Taro.authorize({ scope: "scope.writePhotosAlbum" }).then(res => {
201
+      console.log('auth:', res)
202
+      Taro.saveImageToPhotosAlbum({
203
+        filePath: this.state.shareImage,
204
+      }).then(res => {
205
+        Taro.showToast({
206
+          title: '保存图片成功',
207
+          icon: 'success',
208
+          duration: 2000,
209
+        });
210
+      })
211
+    }).catch(err => {
212
+      console.log('err:', err)
213
+      Taro.showToast({
214
+        title: '未开启相册权限',
215
+        icon: 'none'
216
+      })
217
+    })
218
+  }
219
+
220
+  render() {
221
+    return (
222
+      <Block>
223
+        {
224
+          this.state.canvasStatus && (
225
+            <TaroCanvasDrawer
226
+              config={this.state.config}
227
+              onCreateSuccess={this.onCreateSuccess}
228
+              onCreateFail={this.onCreateFail}
229
+            />
230
+          )
231
+        }
232
+        {
233
+          this.state.visible && (
234
+            <View className="poster">
235
+              <View className="con">
236
+                <View className="con-head">
237
+                  <Text>保存后分享图片</Text>
238
+                  <Text className="iconfont icon-buoumaotubiao20" onClick={this.hidePoster}></Text>
239
+                </View>
240
+                <View className="con-body">
241
+                  <Image className="result-img" mode="aspectFit" lazy-load src={this.state.shareImage} onClick={this.onPreview}></Image>
242
+                </View>
243
+                <Button className="save-btn" onClick={this.saveToAlbum}>保存海报</Button>
244
+              </View>
245
+            </View>
246
+          )
247
+        }
248
+      </Block>
249
+    )
250
+  }
251
+}

+ 62
- 0
src/components/Poster/index.scss 查看文件

@@ -0,0 +1,62 @@
1
+.poster {
2
+  position: fixed;
3
+  width: 100vw;
4
+  height: 100vh;
5
+  background: rgba(0, 0, 0, 0.6);
6
+  z-index: 999;
7
+  justify-content: space-around;
8
+  display: flex;
9
+  align-items: center;
10
+  flex-direction: column;
11
+  top: 0;
12
+
13
+  .con {
14
+    position: absolute;
15
+    bottom: 0;
16
+    width: 100%;
17
+    padding: 0 60px;
18
+    background: white;
19
+    margin: 0 auto;
20
+    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
21
+    border-top-left-radius: 20px;
22
+    border-top-right-radius: 20px;
23
+
24
+    &-head {
25
+      display: flex;
26
+      justify-content: space-between;
27
+      align-items: center;
28
+      padding: 20px 0;
29
+      font-size: 32px;
30
+      font-weight: bold;
31
+
32
+      .iconfont {
33
+        font-size: 40px;
34
+        color: #545454;
35
+        font-weight: normal;
36
+      }
37
+    }
38
+
39
+    &-body {
40
+      width: 100%;
41
+      // background: #EAEAEA;
42
+      border-radius: 10px;
43
+      padding: 40px 0;
44
+
45
+      .result-img {
46
+        height: 60vh;
47
+        display: block;
48
+        margin: 0 auto;
49
+      }
50
+    }
51
+  }
52
+
53
+  .save-btn {
54
+    margin: 0 auto;
55
+    color: white;
56
+    border: none;
57
+    font-size: 36px;
58
+    background: linear-gradient(90deg, rgba(255, 199, 12, 1) 0%, rgba(255, 65, 65, 1) 100%);
59
+    border-radius: 12px;
60
+    margin: 20px 0;
61
+  }
62
+}

+ 0
- 78
src/components/auth/index.js 查看文件

@@ -1,78 +0,0 @@
1
-import Taro, { Component } from '@tarojs/taro'
2
-import { connect } from '@tarojs/redux'
3
-import * as actions from '@actions/user'
4
-import './index.scss'
5
-
6
-@connect(state => state.user, { ...actions })
7
-export default class Index extends Component {
8
-  config = {
9
-    navigationBarTitleText: '登录'
10
-  }
11
-  state = {}
12
-
13
-  getUserInfo() {
14
-    const { dispatchUpdateUserInfo } = this.props
15
-    const sessionKey = Taro.getStorageSync('sessionKey')
16
-    // 获取用户信息
17
-    Taro.getUserInfo({
18
-      success: res => {
19
-        const payload = Object.assign(res, { sessionKey })
20
-        // const { userInfo: { nickName, gender, country, city, province } } = payload
21
-        // App.zhuge.identify(nickName, {
22
-        //   '昵称': nickName,
23
-        //   '性别': gender == 1 ? '男' : '女',
24
-        //   '国家': country,
25
-        //   '省份': province,
26
-        //   '城市': city
27
-        // })
28
-
29
-        // 用户信息保存至服务器
30
-        dispatchUpdateUserInfo(payload).then(res => {
31
-          this.toPage(true)
32
-        })
33
-      },
34
-      fail: () => {
35
-        this.toPage(false)
36
-      }
37
-    })
38
-  }
39
-
40
-  toPage(succed) {
41
-    const router = Taro.getStorageSync('router')
42
-    const { query, path } = router
43
-
44
-    if (!succed && path === 'pages/signin/index') {
45
-      return
46
-    }
47
-    if (path === 'pages/project/index' || path === 'pages/shop/index' || path === 'pages/person/index') {
48
-      Taro.switchTab({
49
-        url: '/' + path
50
-      })
51
-      return
52
-    }
53
-    Taro.reLaunch({
54
-      url: `/${path}?${query.params}`
55
-    })
56
-  }
57
-
58
-  render() {
59
-    return (
60
-      <View>
61
-        <View className="userinfo">
62
-          <View className="userinfo-avatar">
63
-            <open-data type="userAvatarUrl"></open-data>
64
-          </View>
65
-          <View className="userinfo-name">
66
-            <open-data type="userNickName"></open-data>
67
-          </View>
68
-        </View>
69
-        <View className='line'></View>
70
-        <View className='content'>
71
-          <View>申请获取以下权限</View>
72
-          <Text>获得你的公开信息(昵称,头像等)</Text>
73
-        </View>
74
-        <Button className='bottom' open-type="getUserInfo" lang="zh_CN" onGetUserInfo={this.getUserInfo}>授权登录</Button>
75
-      </View>
76
-    )
77
-  }
78
-}

+ 0
- 78
src/components/auth/index.scss 查看文件

@@ -1,78 +0,0 @@
1
-@import "@styles/theme.scss";
2
-
3
-.header {
4
-  margin: 90px 0 90px 50px;
5
-  border-bottom: 1px solid #ccc;
6
-  text-align: center;
7
-  width: 650px;
8
-  height: 300px;
9
-  line-height: 450px;
10
-
11
-}
12
-
13
-.content {
14
-  // margin-left: 50px;
15
-  margin: 70px 0 90px 0;
16
-  text-align: center;
17
-
18
-  view {
19
-    font-size: 35px;
20
-    color: $text-color;
21
-  }
22
-
23
-  text {
24
-    display: block;
25
-    color: #9d9d9d;
26
-    margin-top: 30px;
27
-  }
28
-}
29
-
30
-.bottom {
31
-  width: 300px;
32
-  border-radius: 80px;
33
-  margin: 70px 225px;
34
-  font-size: 30px;
35
-  color: white;
36
-  background-color: $primary-color;
37
-}
38
-
39
-.line {
40
-  width: 250px;
41
-  margin: 40px 0 0 250px;
42
-  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
43
-}
44
-
45
-.userinfo {
46
-  position: relative;
47
-  width: 750px;
48
-  // height: 400px;
49
-  color: #fff;
50
-  display: flex;
51
-  flex-direction: column;
52
-  align-items: center;
53
-
54
-  .userinfo-avatar {
55
-    overflow: hidden;
56
-    display: block;
57
-    width: 230px;
58
-    height: 230px;
59
-    margin: 20px;
60
-    margin-top: 50px;
61
-    border-radius: 50%;
62
-    border: 4px solid #fff;
63
-    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
64
-  }
65
-
66
-  .userinfo-name {
67
-    color: #000;
68
-    text-align: center;
69
-    font-size: 35px;
70
-  }
71
-
72
-  .userinfo text {
73
-    font-size: 14px;
74
-    background-color: #c0c0c0;
75
-    border-radius: 40%;
76
-  }
77
-
78
-}

+ 4
- 0
src/constants/api.js 查看文件

@@ -91,6 +91,10 @@ export const API_BURIED_POINT = resolvePath('taPersonVisitRecord')
91 91
 
92 92
 // activity
93 93
 export const API_ACTIVITY_LIST = resolvePath('buildingDynamiceList')
94
+//拼团
95
+export const API_GROUP_LIST = resolvePath('taShareRecord')
96
+//助力
97
+export const API_HELP_LIST = resolvePath('helpInitiateRecord')
94 98
 
95 99
 // save activity
96 100
 export const API_ACTIVITY_SAVE = resolvePath('save/buildingDynamiceList')

+ 77
- 7
src/pages/activity/assembleItem/index.js 查看文件

@@ -1,6 +1,8 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2 2
 import './index.scss'
3 3
 import dayjs from 'dayjs'
4
+const helpSuccess = require('@assets/helpgroup/help/success1.png')
5
+const helpFail = require('@assets/helpgroup/fail.png')
4 6
 
5 7
 export default class Item extends Component {
6 8
   static defaultProps = {
@@ -11,17 +13,85 @@ export default class Item extends Component {
11 13
 
12 14
     this.props.onClick(data)
13 15
   }
16
+  state = {
17
+
18
+    leftTime: 0,  // 剩余时间
19
+  }
20
+  componentWillMount(){
21
+    this.updateLeftTime(this.props.data.startDate, this.props.data.endDate)
22
+  }
23
+  // 活动状态
24
+  const ActBeforeStart = 0;
25
+  const ActInProcess = 1;
26
+  const ActFinished = 2;
27
+
28
+  updateLeftTime(startDate, endDate) {
29
+    const st = dayjs(startDate).valueOf()
30
+    const ed = dayjs(endDate).valueOf()
31
+
32
+    this.setState({
33
+      ltTicker: setInterval(() => {
34
+        const nw = dayjs().valueOf()
35
+
36
+        if (st > nw) {
37
+          // 活动未开始
38
+          this.setState({
39
+            leftTime: st - nw,
40
+            actState: ActBeforeStart,
41
+          })
42
+        } else if (ed > nw) {
43
+          // 活动未结束
44
+          this.setState({
45
+            leftTime: ed - nw,
46
+            actState: ActInProcess,
47
+          })
48
+        } else {
49
+          // 活动已结束
50
+          this.clearTicker()
51
+          this.setState({
52
+            leftTime: 0,
53
+            actState: ActFinished,
54
+          })
55
+        }
56
+      }, 1000)
57
+    })
58
+  }
59
+  formateLeftTime() {
60
+    const nd = 1000 * 24 * 60 * 60;
61
+    const nh = 1000 * 60 * 60;
62
+    const nm = 1000 * 60;
63
+    const ns = 1000;
64
+
65
+    const day = Math.floor(this.state.leftTime / nd);
66
+    const hour = Math.floor(this.state.leftTime % nd / nh);
67
+    const min = Math.floor(this.state.leftTime % nd % nh / nm);
68
+    const sec = Math.floor(this.state.leftTime % nd % nh % nm / ns);
69
+
70
+    return `${day}天${hour}小时${min}分${sec}秒`
71
+  }
14 72
   render() {
15 73
     const { data, style } = this.props
16 74
     return (
17 75
       <View className="item" style={style} onClick={this.handleClick.bind(this, data)}>
18
-        <View className="date">{`${dayjs(data.startDate).format('YYYY-MM-DD hh:mm:ss')}`}</View>
19
-        <Image className="pic" src={require('@assets/agent/banner.png')} ></Image>
20
-        <View className="title">{data.title}</View>
21
-        <View className="time">距活动结束:{`${dayjs(data.endDate).format('YYYY-MM-DD hh:mm:ss')}`}</View>
22
-        <View className="hexiaoma">核销码:123456</View>
23
-        <View className="start-date">{`${dayjs(data.startDate).format('YYYY-MM-DD hh:mm:ss')}`}</View>
24
-        <View className={data.isSign ? "alreay-btn" : "btn"}>{data.isSign ? "已参与" : "立即参与"}</View>
76
+        <Image className="pic" src={data.img} ></Image>
77
+        <View className="title">{data.title} {data.status}</View>
78
+        {!data.verification&&
79
+        <View className="time">{this.state.actState === ActInProcess ? '距活动结束:' : '活动已结束'}<Text className="count-time">{this.state.actState != ActFinished ? this.formateLeftTime() : ''}</Text></View>
80
+        }
81
+        {data.verification&&
82
+        <View className="hexiaoma">核销码:{data.verification}</View>
83
+        }
84
+        <View className="start-date">{`${dayjs(data.createDate).format('YYYY-MM-DD hh:mm:ss')}`}</View>
85
+        {data.status==0&&
86
+        <Image className="status-icon" src={helpSuccess} ></Image>
87
+        }
88
+        {data.status==1&&
89
+        <View className="btn">进行中</View>
90
+        }
91
+        {data.status==2&&
92
+        <Image className="status-icon" src={helpFail} ></Image>
93
+        }
94
+        
25 95
       </View>
26 96
 
27 97
     );

+ 26
- 31
src/pages/activity/assembleItem/index.scss 查看文件

@@ -8,12 +8,11 @@
8 8
 }
9 9
 
10 10
 .item {
11
-  border-radius: 10px;
12
-  box-shadow: 0 2px 10px #EAEAEA;
13 11
   overflow: hidden;
14 12
   margin-bottom: 40px;
15
-  padding: 20px;
13
+  padding: 20px 10px;
16 14
   position: relative;
15
+  border-bottom:1px solid #eee;
17 16
   .date{
18 17
     font-size: 24px;
19 18
     margin-bottom: 12px;
@@ -21,7 +20,15 @@
21 20
 
22 21
   .pic {
23 22
     width: 220px;
24
-    height:140px;
23
+    height:160px;
24
+    border-radius: 12px;
25
+  }
26
+  .status-icon{
27
+    width: 120px;
28
+    height: 120px;
29
+    position: absolute;
30
+    right:0;
31
+    top:42px;
25 32
   }
26 33
 
27 34
   .title {
@@ -29,51 +36,39 @@
29 36
     width: 320px;
30 37
     @include text-ellipsis;
31 38
     position: absolute;
32
-    top:60px;
33
-    left:254px;
39
+    top:20px;
40
+    left:264px;
34 41
   }
35 42
 
36 43
   .time {
37
-    margin-top: 15px;
38 44
     font-size: 26px;
39
-    color: #8E8E8E;
45
+    color: #666;
40 46
     position: absolute;
41
-    top:110px;
42
-    left:254px;
47
+    top:90px;
48
+    left:264px;
43 49
   }
44 50
   .hexiaoma{
45 51
     color: $primary-color;
46 52
     font-size: 28px;
47 53
     position: absolute;
48
-    top:110px;
49
-    left:254px;
54
+    top:90px;
55
+    left:264px;
56
+  }
57
+  .count-time{
58
+    color:$primary-color;
50 59
   }
51 60
   .start-date{
52 61
     color: #999;
53 62
     font-size: 26px;
54 63
     position: absolute;
55
-    bottom:20px;
56
-    left:254px;
64
+    bottom:30px;
65
+    left:264px;
57 66
   }
58 67
   }
59 68
 
60 69
   .btn {
61
-    border-radius:30px;
62
-    text-align: center;
63
-    color: red;
64
-    display: block;
65
-    padding: 10px 0;
66
-    position: absolute;
67
-    right:30px;
68
-    bottom:20px;
69
-  }
70
-	.alreay-btn {
71
-	  border-radius:30px;
72
-	  text-align: center;
73
-	  color: red;
74
-	  display: block;
75
-	  padding: 10px 0;
70
+    color: #E35E44;
76 71
     position: absolute;
77
-    right:30px;
78
-    bottom:20px;
72
+    right:10px;
73
+    bottom:30px;
79 74
   }

+ 3
- 3
src/pages/activity/assemblePage.js 查看文件

@@ -1,7 +1,7 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2 2
 import ListView from '@components/ListView'
3 3
 import './index.scss'
4
-import { queryActivityList } from '@services/activity'
4
+import { queryGroupList } from '@services/activity'
5 5
 import AssembleItem from './assembleItem'
6 6
 import { savePoint, updatePoint } from '@services/common'
7 7
 import { connect } from '@tarojs/redux'
@@ -58,7 +58,7 @@ export default class Index extends Component {
58 58
     if (buildingId) {
59 59
       payload.buildingId = buildingId
60 60
     }
61
-    return queryActivityList(payload)
61
+    return queryGroupList(payload)
62 62
   }
63 63
 
64 64
   handleItemClick(item) {
@@ -102,7 +102,7 @@ export default class Index extends Component {
102 102
         className="wrap"
103 103
         needInit
104 104
         isEmpty={isEmpty}
105
-        emptyText="暂无活动~"
105
+        emptyText="暂无拼团活动~"
106 106
         hasMore={hasMore}
107 107
         onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
108 108
         onScrollToLower={fn => this.onScrollToLower(fn)}

+ 99
- 0
src/pages/activity/assistanceItem/index.js 查看文件

@@ -0,0 +1,99 @@
1
+import Taro, { Component } from '@tarojs/taro';
2
+import './index.scss'
3
+import dayjs from 'dayjs'
4
+const helpSuccess = require('@assets/helpgroup/help/success1.png')
5
+const helpFail = require('@assets/helpgroup/fail.png')
6
+
7
+export default class Item extends Component {
8
+  static defaultProps = {
9
+    data: {},
10
+    style: {}
11
+  }
12
+  handleClick(data) {
13
+
14
+    this.props.onClick(data)
15
+  }
16
+  state = {
17
+
18
+    leftTime: 0,  // 剩余时间
19
+  }
20
+  componentWillMount(){
21
+    this.updateLeftTime(this.props.data.startDate, this.props.data.endDate)
22
+  }
23
+  // 活动状态
24
+  const ActBeforeStart = 0;
25
+  const ActInProcess = 1;
26
+  const ActFinished = 2;
27
+
28
+  updateLeftTime(startDate, endDate) {
29
+    const st = dayjs(startDate).valueOf()
30
+    const ed = dayjs(endDate).valueOf()
31
+
32
+    this.setState({
33
+      ltTicker: setInterval(() => {
34
+        const nw = dayjs().valueOf()
35
+
36
+        if (st > nw) {
37
+          // 活动未开始
38
+          this.setState({
39
+            leftTime: st - nw,
40
+            actState: ActBeforeStart,
41
+          })
42
+        } else if (ed > nw) {
43
+          // 活动未结束
44
+          this.setState({
45
+            leftTime: ed - nw,
46
+            actState: ActInProcess,
47
+          })
48
+        } else {
49
+          // 活动已结束
50
+          this.clearTicker()
51
+          this.setState({
52
+            leftTime: 0,
53
+            actState: ActFinished,
54
+          })
55
+        }
56
+      }, 1000)
57
+    })
58
+  }
59
+  formateLeftTime() {
60
+    const nd = 1000 * 24 * 60 * 60;
61
+    const nh = 1000 * 60 * 60;
62
+    const nm = 1000 * 60;
63
+    const ns = 1000;
64
+
65
+    const day = Math.floor(this.state.leftTime / nd);
66
+    const hour = Math.floor(this.state.leftTime % nd / nh);
67
+    const min = Math.floor(this.state.leftTime % nd % nh / nm);
68
+    const sec = Math.floor(this.state.leftTime % nd % nh % nm / ns);
69
+
70
+    return `${day}天${hour}小时${min}分${sec}秒`
71
+  }
72
+  render() {
73
+    const { data, style } = this.props
74
+    return (
75
+      <View className="item" style={style} onClick={this.handleClick.bind(this, data)}>
76
+        <Image className="pic" src={data.img} ></Image>
77
+        <View className="title">{data.title} {data.status}</View>
78
+        {!data.verification&&
79
+        <View className="time">{this.state.actState === ActInProcess ? '距活动结束:' : '活动已结束'}<Text className="count-time">{this.state.actState != ActFinished ? this.formateLeftTime() : ''}</Text></View>
80
+        }
81
+        {data.verification&&
82
+        <View className="hexiaoma">核销码:{data.verification}</View>
83
+        }
84
+        <View className="start-date">{`${dayjs(data.createDate).format('YYYY-MM-DD hh:mm:ss')}`}</View>
85
+        {data.status==0&&
86
+        <Image className="status-icon" src={helpSuccess} ></Image>
87
+        }
88
+        {data.status==1&&
89
+        <View className="btn">进行中</View>
90
+        }
91
+        {data.status==2&&
92
+        <Image className="status-icon" src={helpFail} ></Image>
93
+        }
94
+        
95
+      </View>
96
+
97
+    );
98
+  }
99
+}

+ 74
- 0
src/pages/activity/assistanceItem/index.scss 查看文件

@@ -0,0 +1,74 @@
1
+@import "@styles/theme.scss";
2
+@import "@styles/mixins.scss";
3
+
4
+.flex {
5
+  display: flex;
6
+  justify-content: space-between;
7
+  align-items: center;
8
+}
9
+
10
+.item {
11
+  overflow: hidden;
12
+  margin-bottom: 40px;
13
+  padding: 20px 10px;
14
+  position: relative;
15
+  border-bottom:1px solid #eee;
16
+  .date{
17
+    font-size: 24px;
18
+    margin-bottom: 12px;
19
+  }
20
+
21
+  .pic {
22
+    width: 220px;
23
+    height:160px;
24
+    border-radius: 12px;
25
+  }
26
+  .status-icon{
27
+    width: 120px;
28
+    height: 120px;
29
+    position: absolute;
30
+    right:0;
31
+    top:42px;
32
+  }
33
+
34
+  .title {
35
+    font-size: 30px;
36
+    width: 320px;
37
+    @include text-ellipsis;
38
+    position: absolute;
39
+    top:20px;
40
+    left:264px;
41
+  }
42
+
43
+  .time {
44
+    font-size: 26px;
45
+    color: #666;
46
+    position: absolute;
47
+    top:90px;
48
+    left:264px;
49
+  }
50
+  .hexiaoma{
51
+    color: $primary-color;
52
+    font-size: 28px;
53
+    position: absolute;
54
+    top:90px;
55
+    left:264px;
56
+  }
57
+  .count-time{
58
+    color:$primary-color;
59
+  }
60
+  .start-date{
61
+    color: #999;
62
+    font-size: 26px;
63
+    position: absolute;
64
+    bottom:30px;
65
+    left:264px;
66
+  }
67
+  }
68
+
69
+  .btn {
70
+    color: #E35E44;
71
+    position: absolute;
72
+    right:10px;
73
+    bottom:30px;
74
+  }

+ 6
- 6
src/pages/activity/assistancePage.js 查看文件

@@ -1,8 +1,8 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2 2
 import ListView from '@components/ListView'
3 3
 import './index.scss'
4
-import { queryActivityList } from '@services/activity'
5
-import AssembleItem from './assembleItem'
4
+import { queryHelpList } from '@services/activity'
5
+import AssistanceItem from './assistanceItem'
6 6
 import { savePoint, updatePoint } from '@services/common'
7 7
 import { connect } from '@tarojs/redux'
8 8
 
@@ -58,7 +58,7 @@ export default class Index extends Component {
58 58
     if (buildingId) {
59 59
       payload.buildingId = buildingId
60 60
     }
61
-    return queryActivityList(payload)
61
+    return queryHelpList(payload)
62 62
   }
63 63
 
64 64
   handleItemClick(item) {
@@ -102,7 +102,7 @@ export default class Index extends Component {
102 102
         className="wrap"
103 103
         needInit
104 104
         isEmpty={isEmpty}
105
-        emptyText="暂无活动~"
105
+        emptyText="暂无助力活动~"
106 106
         hasMore={hasMore}
107 107
         onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
108 108
         onScrollToLower={fn => this.onScrollToLower(fn)}
@@ -110,11 +110,11 @@ export default class Index extends Component {
110 110
         <View className="list">
111 111
           {
112 112
             list.map(item => (
113
-              <AssembleItem
113
+              <AssistanceItem
114 114
                 data={item}
115 115
                 key={item.dynamicId}
116 116
                 onClick={this.handleItemClick}>
117
-              </AssembleItem>
117
+              </AssistanceItem>
118 118
             ))
119 119
           }
120 120
         </View>

+ 12
- 12
src/pages/activity/detail/assemble.js 查看文件

@@ -327,54 +327,54 @@ export default class Detail extends Component {
327 327
                     <Text >5人团</Text>
328 328
                   </View>
329 329
 
330
-                  <Image src={require('@assets/agent/banner.png')} className="my__img"></Image>
330
+                  <Image src={require('@assets/shop/banner1.jpg')} className="my__img"></Image>
331 331
 
332 332
                   <View className='tools-main'>
333 333
                     <View className='tools-item'>
334
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
334
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
335 335
                       <Text className='tools-item-txt'>等待拼团</Text>
336 336
                     </View>
337 337
                     <View className='tools-item'>
338
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
338
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
339 339
                       <Text className='tools-item-txt'>等待拼团</Text>
340 340
                     </View>
341 341
                     <View className='tools-item'>
342
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
342
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
343 343
                       <Text className='tools-item-txt'>等待拼团</Text>
344 344
                     </View>
345 345
                     <View className='tools-item'>
346
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
346
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
347 347
                       <Text className='tools-item-txt'>等待拼团</Text>
348 348
                     </View>
349 349
                     <View className='tools-item'>
350
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
350
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
351 351
                       <Text className='tools-item-txt'>等待拼团</Text>
352 352
                     </View>
353 353
                     <View className='tools-item'>
354
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
354
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
355 355
                       <Text className='tools-item-txt'>等待拼团</Text>
356 356
                     </View>
357 357
                     <View className='tools-item'>
358
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
358
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
359 359
                       <Text className='tools-item-txt'>等待拼团</Text>
360 360
                     </View>
361 361
                     <View className='tools-item'>
362
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
362
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
363 363
                       <Text className='tools-item-txt'>等待拼团</Text>
364 364
                     </View>
365 365
                     <View className='tools-item'>
366
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
366
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
367 367
                       <Text className='tools-item-txt'>等待拼团</Text>
368 368
                     </View>
369 369
                     <View className='tools-item'>
370
-                      <Image src={require('@assets/agent/banner.png')} className='tools-item-img'></Image>
370
+                      <Image src={require('@assets/shop/banner1.jpg')} className='tools-item-img'></Image>
371 371
                       <Text className='tools-item-txt'>等待拼团</Text>
372 372
                     </View>
373 373
                   </View>
374 374
                 </View>
375 375
 
376 376
                 <View className="assistance-text">活动说明</View>
377
-                <Image src={require('@assets/agent/banner.png')}style="width:100%"></Image>
377
+                <Image src={require('@assets/shop/banner1.jpg')}style="width:100%"></Image>
378 378
                 <Button className={true ? "assistance-btn" : "nostart-btn"}>{true ? "邀请好友拼团" : "未开始"}</Button>
379 379
               </ScrollView>
380 380
 

+ 1
- 1
src/pages/activity/detail/assistance.js 查看文件

@@ -32,7 +32,7 @@ const HelpInProcess = 1;
32 32
 const HelpSuccess = 0;
33 33
 const HelpFailure = 2;
34 34
 
35
-const defaultAvatar = require('@assets/agent/banner.png')
35
+const defaultAvatar = require('@assets/shop/banner1.jpg')
36 36
 
37 37
 @connect(state => state.user)
38 38
 export default class Detail extends Component {

+ 1
- 1
src/pages/agent/become/index.js 查看文件

@@ -114,7 +114,7 @@ export default class Index extends Component {
114 114
     const { userInfo: { person: { phone } } } = this.props
115 115
     return (
116 116
       <View className='page'>
117
-        <Image src={require('@assets/agent/banner.png')} className='banner' mode='widthFix'></Image>
117
+        <Image src={require('@assets/shop/banner1.jpg')} className='banner' mode='widthFix'></Image>
118 118
         <View className='become_agent'>
119 119
           <View className='agent_type'>
120 120
             <Text className='agent_title'>经纪人类型</Text>

+ 32
- 24
src/pages/project/banner/index.js 查看文件

@@ -19,30 +19,38 @@ export default class SwiperBanner extends Component {
19 19
   render() {
20 20
     const { list, style, indicatorDots, current } = this.props
21 21
     return (
22
-      <View className='home-banner' style={style}>
23
-        <Swiper
24
-          className='home-banner__swiper'
25
-          circular
26
-          autoplay
27
-          indicatorDots={indicatorDots}
28
-          indicatorActiveColor='rgb(178, 42, 49)'
29
-        >
30
-          {list.map((item, index) => (
31
-            <SwiperItem
32
-              key={index}
33
-              onClick={this.onBannerClick.bind(this, item)}
34
-              className='home-banner__swiper-item'
35
-            >
36
-              <Image
37
-                mode="widthFix"
38
-                style={style}
39
-                className='home-banner__swiper-item-img'
40
-                src={item.image || item.url}
41
-              />
42
-            </SwiperItem>
43
-          ))}
44
-        </Swiper>
45
-      </View>
22
+      <swiper indicator-dots="false"
23
+      >
24
+        {/* <block wx: for="{{ background }}" wx:key="*this"> */}
25
+        <swiper-item>
26
+          <view class="swiper-item {{item}}"></view>
27
+        </swiper-item>
28
+        {/* </block> */}
29
+      </swiper >
30
+      //   <View className='home-banner' style={style}>
31
+      //     <Swiper
32
+      //       className='home-banner__swiper'
33
+      //       circular
34
+      //       autoplay
35
+      //       indicatorDots={indicatorDots}
36
+      //       indicatorActiveColor='rgb(178, 42, 49)'
37
+      //     >
38
+      //       {list.map((item, index) => (
39
+      //         <SwiperItem
40
+      //           key={index}
41
+      //           onClick={this.onBannerClick.bind(this, item)}
42
+      //           className='home-banner__swiper-item'
43
+      //         >
44
+      //           <Image
45
+      //             mode="widthFix"
46
+      //             style={style}
47
+      //             className='home-banner__swiper-item-img'
48
+      //             src={item.image || item.url}
49
+      //           />
50
+      //         </SwiperItem>
51
+      //       ))}
52
+      //     </Swiper>
53
+      //   </View>
46 54
     )
47 55
   }
48 56
 }

+ 2
- 2
src/pages/project/detail/index.js 查看文件

@@ -731,7 +731,7 @@ export default class Index extends Component {
731 731
           newsList.length > 0 && (
732 732
             <View className="activity">
733 733
               <View className="title">助力活动</View>
734
-              <Image src={require('@assets/agent/banner.png')} className="activity-img"></Image>
734
+              <Image src={require('@assets/shop/banner1.jpg')} className="activity-img"></Image>
735 735
             </View>
736 736
           )
737 737
         }
@@ -746,7 +746,7 @@ export default class Index extends Component {
746 746
           newsList.length > 0 && (
747 747
             <View className="activity">
748 748
               <View className="title">拼团活动</View>
749
-              <Image src={require('@assets/agent/banner.png')} className="activity-img"></Image>
749
+              <Image src={require('@assets/shop/banner1.jpg')} className="activity-img"></Image>
750 750
             </View>
751 751
           )
752 752
         }

+ 12
- 0
src/services/activity.js 查看文件

@@ -11,6 +11,8 @@ import {
11 11
   API_HELP_DETAIL,
12 12
   API_HELP_CREATE,
13 13
   API_HELP_FRIEND,
14
+  API_HELP_LIST,
15
+  API_GROUP_LIST
14 16
 } from '@constants/api'
15 17
 
16 18
 /**
@@ -31,6 +33,16 @@ export const addActivityShareNum = id => fetch({ url: `${API_ACTIVITY_SHARE}/${i
31 33
  * @param {*} payload
32 34
  */
33 35
 export const queryActivityList = payload => fetch({ url: API_ACTIVITY_LIST, payload })
36
+/**
37
+ * 获取拼团列表
38
+ * @param {*} payload
39
+ */
40
+export const queryGroupList = payload => fetch({ url: API_GROUP_LIST, payload })
41
+/**
42
+ * 获取助力列表
43
+ * @param {*} payload
44
+ */
45
+export const queryHelpList = payload => fetch({ url: API_HELP_LIST, payload })
34 46
 
35 47
 /**
36 48
  * 已收藏活动列表