// 1 năm trước cách đây
mục cha
commit
7b1099ebf9

+ 13 - 11
api/activity.js

@@ -1,15 +1,17 @@
 import {
-    request
+  request
 } from "../utils/request";
 module.exports = {
-    // 获取贺卡列表
-    getActivityList: data => request('/card/activity', 'get', data),
-    // 获取贺卡详情
-    getActivityInfo: data => request(`/card/activity/template/${data}`, 'get'),
-    // 获取贺卡作品
-    getMyActivity: data => request('/card/activity/my', 'get', data),
-    // 点赞
-    thumbsUp: data => request(`/card/activity/like/${data}`, 'get'),
-    // 删除作品
-    deleteActivity: data => request(`card/activity/delete/${data}`, 'get'),
+  // 获取贺卡列表
+  getActivityList: data => request('/card/activity', 'get', data),
+  // 获取贺卡详情
+  getActivityInfo: data => request(`/card/activity/template/${data}`, 'get'),
+  // 获取贺卡作品
+  getMyActivity: data => request('/card/activity/my', 'get', data),
+  // 保存贺卡
+  saveActivity: data => request('/card/activity', 'post', data),
+  // 点赞
+  thumbsUp: data => request(`/card/activity/like/${data}`, 'get'),
+  // 删除作品
+  deleteActivity: data => request(`card/activity/delete/${data}`, 'get'),
 }

+ 2 - 6
app.json

@@ -1,9 +1,9 @@
 {
     "pages": [
-        "pages/greeting/index",
-        "pages/activityList/index",
+      "pages/activityList/index",
         "pages/activityDet/index",
         "pages/index/index",
+        "pages/greeting/index",
         "pages/login/login",
         "pages/my/index",
         "pages/userWorks/index",
@@ -25,14 +25,10 @@
         "pages/mycollection/mycollection",
         "pages/user/walletDetails/walletDetails",
         "pages/myworks/myworks",
-        "pages/vipPage/vip/vip",
-        "pages/vipPage/vipCode/vipCode",
-        "pages/vipPage/wechat/wechat",
         "pages/activity/index/index",
         "pages/activity/rule/rule",
         "pages/activity/strategy/strategy",
         "pages/activity/priceList/priceList",
-        "pages/vipActivity/vipActivity",
         "pages/product/product",
         "pages/activity/goodList/goodList"
     ],

+ 0 - 2
app.wxss

@@ -52,6 +52,4 @@ text {
     width: 375px;
     height: 300px;
     position: absolute;
-    left: -999rpx;
-    top: -9999rpx;
 }

+ 1 - 1
component/activityPop/index.js

@@ -23,7 +23,7 @@ Component({
         jumpDet() {
             this.close()
             wx.navigateTo({
-                url: '/pages/activityDet/index',
+                url: '/pages/activityList/index',
             })
         }
     }

+ 226 - 46
pages/activityDet/index.js

@@ -1,55 +1,235 @@
 import {
-    getActivityInfo
+  getActivityInfo,
+  saveActivity
 } from '~/api/activity'
+/*微信录音*/
+let recorderManager = wx.getRecorderManager();
 Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        state: true,
-        tens: 2,
-        bits: 0,
-        configure: {}
-    },
-    async onLoad(options) {
-        let configure = await getActivityInfo(options.id)
-        console.log(configure);
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    state: false,
+    tens: 3,
+    bits: 0,
+    fromWidth: 100,
+    toWidth: 100,
+    configure: {},
+    avatar: '',
+    percent: 0,
+    tempFilePath: '',
+    uploadState: false,
+    // 此id保存模板使用
+    id: ''
+  },
+  async onLoad(options) {
+    let configure = await getActivityInfo(options.id)
+    console.log(configure);
+    this.setData({
+      configure,
+      avatar: configure.photoText,
+      toWidth: '',
+      fromWidth: configure.fromText.length * configure.fromFontSize,
+      toWidth: configure.toText.length * configure.toFontSize,
+      id: options.id,
+      // 是否更改过头像
+      changeAvatarFlag: false
+    })
+  },
+  setInput({
+    currentTarget
+  }) {
+    console.log(currentTarget.dataset.info);
+  },
+  changeAvatar: function (e) {
+    const {
+      avatarUrl
+    } = e.detail
+    wx.uploadFile({
+      url: 'https://reader-api.ai160.com/file/upload',
+      filePath: avatarUrl,
+      name: '头像',
+      header: {
+        uid: wx.getStorageSync('uid')
+      },
+      success: (res) => {
+        const newAvatar = JSON.parse(res.data).data;
         this.setData({
-            configure
+          changeAvatarFlag: true,
+          avatar: newAvatar
         })
-    },
-    play() {
-        let dsq
-        if (!this.data.state) {
-            this.setData({
-                state: true
-            })
-            let countDown = 20
-            // 一分钟倒计时
-            dsq = setInterval(item => {
-                if (countDown == 1) {
-                    clearInterval(dsq)
-                }
-                if (countDown % 10 == 0) {
-                    this.setData({
-                        tens: --this.data.tens,
-                        bits: 9
-                    })
-                } else {
-                    this.setData({
-                        bits: --this.data.bits
-                    })
-                }
-                --countDown
-            }, 1000)
+      }
+    })
+  },
+  play() {
+    return
+    let dsq
+    if (!this.data.state) {
+      this.setData({
+        state: true
+      })
+      let countDown = 30
+      // 倒计时
+      dsq = setInterval(item => {
+        if (countDown == 1) {
+          clearInterval(dsq)
+        }
+        if (countDown % 10 == 0) {
+          this.setData({
+            tens: --this.data.tens,
+            bits: 9
+          })
         } else {
-            clearInterval(dsq)
-            this.setData({
-                state: false,
-                tens: 2,
-                bits: 0
-            })
+          this.setData({
+            bits: --this.data.bits
+          })
+        }
+        --countDown
+      }, 1000)
+      const options = {
+        sampleRate: 44100, //采样率
+        numberOfChannels: 1, //录音通道数
+        encodeBitRate: 192000, //编码码率
+        format: 'mp3', //音频格式,有效值aac/mp3
+        frameSize: 50 //指定帧大小,单位 KB
+      };
+      //开始录音,在开始录音回调中feed音频片
+      recorderManager.start(options);
+      //监听录音结束事件
+      recorderManager.onStop((res) => {
+        console.log('录音结束', res);
+        this.setData({
+          tempFilePath: res.tempFilePath,
+        });
+        this.uploadAudio(res.tempFilePath)
+      });
+    } else {
+      console.log('结束');
+      clearInterval(dsq)
+      recorderManager.stop();
+      this.setData({
+        state: false,
+        tens: 3,
+        bits: 0
+      })
+    }
+  },
+  uploadAudio(recordSource) {
+    wx.uploadFile({
+      url: 'https://reader-api.ai160.com//file/upload',
+      filePath: recordSource,
+      name: '朗读录音',
+      header: {
+        uid: wx.getStorageSync('uid')
+      },
+      success: (res) => {
+        const formateRes = JSON.parse(res.data);
+        let audioPath = formateRes.data;
+        console.log(formateRes);
+        // this.shareWorks(audioPath);
+      }
+    })
+  },
+  bindKeyInput: function (e) {
+    console.log(e);
+    if (e.currentTarget.dataset.type == 'from') {
+      this.setData({
+        fromWidth: e.detail.cursor * this.data.configure.fromFontSize,
+        'configure.fromText': e.detail.value
+      })
+    } else if (e.currentTarget.dataset.type == 'to') {
+      this.setData({
+        toWidth: e.detail.cursor * this.data.configure.toFontSize,
+        'configure.toText': e.detail.value
+      })
+    }
+
+    /*    this.setData({
+         inputValue: e.detail.value
+       }) */
+  },
+  // 生成活动图片
+  createActivityImg() {
+    return new Promise((resolve, reject) => {
+    let context = wx.createSelectorQuery();
+    context
+      .select('#share')
+      .fields({
+        node: true,
+        size: true
+      }).exec((res) => {
+        const canvas = res[0].node;
+        const ctx = canvas.getContext('2d');
+        const dpr = wx.getSystemInfoSync().pixelRatio;
+        canvas.width = res[0].width * dpr;
+        canvas.height = res[0].height * dpr;
+        ctx.scale(dpr, dpr);
+        let avatar = canvas.createImage();
+        wx.getImageInfo({
+          src: this.data.avatar,
+          success: function (res) {
+            console.log(res);
+            avatar.src = res.path
+          },
+        });
+        avatar.onload = () => {
+          ctx.drawImage(avatar, this.data.configure.templateBase.photoLeft / 2, this.data.configure.templateBase.photoTop / 2, this.data.configure.templateBase.photoWidth / 2, this.data.configure.templateBase.photoHeight / 2);
+          let bgImg = canvas.createImage();
+          wx.getImageInfo({
+            src: this.data.configure.bgImg,
+            success: function (res) {
+              bgImg.src = res.path
+            },
+          });
+          bgImg.onload = () => {
+            ctx.drawImage(bgImg, 0, 0, 375, 300);
+            ctx.font = `${this.data.configure.fromFontSize/2}px PingFang`;
+            ctx.fillText(this.data.configure.toText, this.data.configure.templateBase.toLeft / 2, this.data.configure.templateBase.toTop / 2 + this.data.configure.fromFontSize / 2)
+            ctx.fillText(this.data.configure.fromText, this.data.configure.templateBase.fromLeft / 2, this.data.configure.templateBase.fromTop / 2 + this.data.configure.toFontSize / 2)
+            console.log(this.data.configure.toText, this.data.configure.templateBase.toLeft / 2, this.data.configure.templateBase.toTop / 2);
+            console.log(this.data.configure.fromText, this.data.configure.templateBase.fromLeft / 2, this.data.configure.templateBase.fromTop / 2);
+          }
         }
+        setTimeout(() => {
+          wx.canvasToTempFilePath({
+            canvas: canvas,
+            success(res) {
+              console.log(res);
+              resolve({
+                title: '请欣赏我的课文朗读作品,点赞+评论。',
+                path: `/pages/index/index`,
+                imageUrl: res.tempFilePath
+              })
+            },
+            fail(res) {
+              reject()
+            }
+          }, this)
+        }, 1000)
+      })
+    })
+  },
+  onShareAppMessage({
+    from,
+  }) {
+    if (from == 'button') {
+      const promise = new Promise(resolve => {
+        this.createActivityImg().then(res => {
+          resolve(res)
+        })
+      })
+      return {
+        title: '请欣赏我的课文朗读作品,点赞+评论。',
+        path: `/pages/index/index?readId`,
+        imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png',
+        promise
+      }
+    } else {
+      return {
+        title: '课文朗读,从未如此有趣。',
+        path: `/pages/index/index?&uid=${wx.getStorageSync('uid')}`,
+        imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png'
+      }
     }
+  }
 })

+ 2 - 1
pages/activityDet/index.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+    "usingComponents": {},
+    "enablePullDownRefresh": false
 }

+ 159 - 37
pages/activityDet/index.less

@@ -1,40 +1,162 @@
 .activityDet {
-    .header {
-        width: 100%;
-        height: 600rpx;
-        background-color: wheat;
-    }
-
-    .btnsBox {
-        position: relative;
-        text-align: center;
-        background-color: skyblue;
-        font-size: 0rpx;
-
-        .send {
-            width: 290rpx;
-            height: 80rpx;
-        }
-
-        .countDown {
-            position: absolute;
-            right: 30rpx;
-            top: 0px;
-            bottom: 0px;
-            margin: auto;
-            display: flex;
-            align-items: center;
-            color: #FD3545;
-            font-size: 22rpx;
-            font-weight: bold;
-
-            .countBox {
-                padding: 10rpx;
-                border-radius: 10rpx;
-                margin: 0rpx 4rpx;
-                color: white;
-                background-image: linear-gradient(180deg, #FF7079 0%, #FE3D44 100%);
-            }
-        }
+  width: 100vw;
+  min-height: 100vh;
+  background-color: #f2f6fc;
+
+  .header {
+    width: 100%;
+    height: 600rpx;
+    overflow: hidden;
+
+    .templateImg {
+      position: relative;
+      width: 100%;
+      height: 100%;
+      z-index: 2;
+    }
+
+    .toBox {
+      position: absolute;
+      display: flex;
+      align-items: center;
+      z-index: 3;
+
+      .text {
+        min-width: 80rpx;
+        color: white;
+        padding: 0rpx 4rpx;
+        z-index: 0rpx;
+        border: 2rpx dashed white;
+      }
+
+      image {
+        width: 22rpx;
+        height: 26rpx;
+        margin-left: 8rpx;
+        z-index: 1;
+      }
+    }
+
+    .avatar {
+      position: absolute;
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+      justify-content: flex-end;
+      z-index: 3;
+
+      .tips {
+        width: 150rpx;
+        font-size: 24rpx;
+        padding: 4rpx 20rpx;
+        border-radius: 50rpx;
+        color: white;
+        background-color: rgba(0, 0, 0, 0.4);
+      }
+    }
+
+
+    .avatarImg {
+      position: absolute;
+      display: block;
+    }
+
+  }
+
+  .btnsBox {
+    position: relative;
+    text-align: center;
+    background-color: skyblue;
+    font-size: 0rpx;
+
+    .send {
+      width: 290rpx;
+      height: 80rpx;
+    }
+
+    .countDown {
+      position: absolute;
+      right: 30rpx;
+      top: 0px;
+      bottom: 0px;
+      margin: auto;
+      display: flex;
+      align-items: center;
+      color: #FD3545;
+      font-size: 22rpx;
+      font-weight: bold;
+
+      .countBox {
+        padding: 10rpx;
+        border-radius: 10rpx;
+        margin: 0rpx 4rpx;
+        color: white;
+        background-image: linear-gradient(180deg, #FF7079 0%, #FE3D44 100%);
+      }
+    }
+  }
+
+  .music {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0rpx 20rpx;
+    font-size: 0rpx;
+    box-sizing: border-box;
+
+    .playAuido {
+      width: 200rpx;
+      height: 74rpx;
+    }
+
+    .share {
+      width: 480rpx;
+      height: 74rpx;
+      line-height: 74rpx;
+      color: white;
+      font-size: 30rpx;
+      background: url('http://reader-wx.ai160.com/images/reader/card/share.png')no-repeat;
+      background-size: 100% 100%;
+    }
+  }
+
+  .blessing {
+    margin-top: 100rpx;
+
+    .title {
+      margin: 0 auto;
+      width: 500rpx;
+      text-align: left;
+    }
+
+    .content {
+      margin: 25rpx auto 0rpx;
+      width: 500rpx;
+      text-indent: 3em;
+    }
+  }
+
+  .maskBox {
+    position: fixed;
+    top: 0rpx;
+    right: 0rpx;
+    bottom: 0rpx;
+    left: 0rpx;
+    margin: auto;
+    padding: 71rpx 30rpx 30rpx;
+    box-sizing: border-box;
+    width: 290rpx;
+    height: 290rpx;
+    border-radius: 30rpx;
+    color: white;
+    background-color: rgba(0, 0, 0, 0.8);
+    text-align: center;
+    font-size: 30rpx;
+
+    .speedProgress {
+      margin: 20rpx 0rpx 60rpx;
+      border-radius: 50rpx;
+      overflow: hidden;
     }
+  }
 }

+ 61 - 11
pages/activityDet/index.wxml

@@ -1,12 +1,62 @@
 <view class="activityDet">
-    <view class="header"></view>
-    <view class="btnsBox">
-        <image
-            src="{{state?'http://reader-wx.ai160.com/images/reader/card/send_blessings.png':'http://reader-wx.ai160.com/images/reader/card/show_off.png'}}"
-            class="send" bindtap="play" />
-        <view class="countDown" wx:if="{{state}}">
-            倒计时:<view class="countBox">{{tens}}</view>
-            <view class="countBox">{{bits}}</view>秒
-        </view>
-    </view>
-</view>
+  <view class="header">
+    <image src="{{configure.bgImg}}" class="templateImg" />
+    <view class="toBox" style="top:{{configure.templateBase.fromTop}}rpx;left: {{configure.templateBase.fromLeft}}rpx;">
+      <input value="{{configure.fromText}}" class="text" maxlength='8'
+        style="color:{{configure.fromColor}};font-size: {{configure.fromFontSize}}rpx;border-color: {{configure.fromColor}}60;width: {{fromWidth}}rpx;"
+        bindinput="bindKeyInput" data-type='from' />
+      <image src="/static/image/edit_new.png" />
+    </view>
+    <view class="toBox" style="top:{{configure.templateBase.toTop}}rpx;left: {{configure.templateBase.toLeft}}rpx;">
+      <input value="{{configure.toText}}" class="text" maxlength='8'
+        style="color:{{configure.toColor}};font-size: {{configure.toFontSize}}rpx;border-color: {{configure.toColor}}60;width: {{toWidth}}rpx;"
+        bindinput="bindKeyInput" data-type='to' />
+      <image src="/static/image/edit_new.png" />
+    </view>
+    <button class="avatar resetBtn" open-type="chooseAvatar" bind:chooseavatar="changeAvatar"
+      style="top:{{configure.templateBase.photoTop}}rpx;left: {{configure.templateBase.photoLeft}}rpx;width: {{configure.templateBase.photoWidth}}rpx;height:{{configure.templateBase.photoHeight}}rpx">
+      <view class="tips" wx:if="{{!changeAvatarFlag}}">点击更换图片</view>
+    </button>
+    <image class="avatarImg"
+      style="top:{{configure.templateBase.photoTop}}rpx;left: {{configure.templateBase.photoLeft}}rpx;width: {{configure.templateBase.photoWidth}}rpx;height:{{configure.templateBase.photoHeight}}rpx"
+      src="{{avatar}}"></image>
+  </view>
+  <!-- 录制控制区域 -->
+  <view class="btnsBox" wx:if="{{tempFilePath==''}}">
+    <!--  <image
+      src="{{state?'http://reader-wx.ai160.com/images/reader/card/send_blessings.png':'http://reader-wx.ai160.com/images/reader/card/show_off.png'}}"
+      class="send" bindtap="play" /> -->
+    <!-- <button class="resetBtn mangeL-box" bindtap="createActivityImg"> -->
+    <button class="resetBtn mangeL-box" open-type="share">
+      <view class="icon-name">分享</view>
+    </button>
+    <view class="countDown" wx:if="{{state}}">
+      倒计时:<view class="countBox">{{tens}}</view>
+      <view class="countBox">{{bits}}</view>秒
+    </view>
+  </view>
+  <!-- 试听与分享控制区域 -->
+  <view class="music" wx:if="{{!state&&tempFilePath!=''}}">
+    <image
+      src="{{state?'http://reader-wx.ai160.com/images/reader/card/audition.png':'http://reader-wx.ai160.com/images/reader/card/audition.png'}}"
+      class="playAuido" bindtap="play" />
+    <button class="resetBtn share" open-type="share">
+      发送给亲爱的爸爸妈妈
+    </button>
+    <!-- http://reader-wx.ai160.com/images/reader/card/share.png -->
+  </view>
+  <!-- 祝福语 -->
+  <view class="blessing">
+    <view class="title">
+      祝福语:
+    </view>
+    <view class="content">{{configure.greeting}}</view>
+  </view>
+  <!-- 上传进度 -->
+  <view class="maskBox" catchtap="true" wx:if="{{uploadState}}">
+    <view>0%</view>
+    <progress percent="{{percent}}" class="speedProgress" stroke-width="10" activeColor="#C3F166" />
+    <view>祝福生成中</view>
+  </view>
+</view>
+<canvas id='share' type="2d"> </canvas>

+ 107 - 1
pages/activityDet/index.wxss

@@ -1,7 +1,57 @@
+.activityDet {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: #f2f6fc;
+}
 .activityDet .header {
   width: 100%;
   height: 600rpx;
-  background-color: wheat;
+  overflow: hidden;
+}
+.activityDet .header .templateImg {
+  position: relative;
+  width: 100%;
+  height: 100%;
+  z-index: 2;
+}
+.activityDet .header .toBox {
+  position: absolute;
+  display: flex;
+  align-items: center;
+  z-index: 3;
+}
+.activityDet .header .toBox .text {
+  min-width: 80rpx;
+  color: white;
+  padding: 0rpx 4rpx;
+  z-index: 0rpx;
+  border: 2rpx dashed white;
+}
+.activityDet .header .toBox image {
+  width: 22rpx;
+  height: 26rpx;
+  margin-left: 8rpx;
+  z-index: 1;
+}
+.activityDet .header .avatar {
+  position: absolute;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: flex-end;
+  z-index: 3;
+}
+.activityDet .header .avatar .tips {
+  width: 150rpx;
+  font-size: 24rpx;
+  padding: 4rpx 20rpx;
+  border-radius: 50rpx;
+  color: white;
+  background-color: rgba(0, 0, 0, 0.4);
+}
+.activityDet .header .avatarImg {
+  position: absolute;
+  display: block;
 }
 .activityDet .btnsBox {
   position: relative;
@@ -32,3 +82,59 @@
   color: white;
   background-image: linear-gradient(180deg, #FF7079 0%, #FE3D44 100%);
 }
+.activityDet .music {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 0rpx 20rpx;
+  font-size: 0rpx;
+  box-sizing: border-box;
+}
+.activityDet .music .playAuido {
+  width: 200rpx;
+  height: 74rpx;
+}
+.activityDet .music .share {
+  width: 480rpx;
+  height: 74rpx;
+  line-height: 74rpx;
+  color: white;
+  font-size: 30rpx;
+  background: url('http://reader-wx.ai160.com/images/reader/card/share.png') no-repeat;
+  background-size: 100% 100%;
+}
+.activityDet .blessing {
+  margin-top: 100rpx;
+}
+.activityDet .blessing .title {
+  margin: 0 auto;
+  width: 500rpx;
+  text-align: left;
+}
+.activityDet .blessing .content {
+  margin: 25rpx auto 0rpx;
+  width: 500rpx;
+  text-indent: 3em;
+}
+.activityDet .maskBox {
+  position: fixed;
+  top: 0rpx;
+  right: 0rpx;
+  bottom: 0rpx;
+  left: 0rpx;
+  margin: auto;
+  padding: 71rpx 30rpx 30rpx;
+  box-sizing: border-box;
+  width: 290rpx;
+  height: 290rpx;
+  border-radius: 30rpx;
+  color: white;
+  background-color: rgba(0, 0, 0, 0.8);
+  text-align: center;
+  font-size: 30rpx;
+}
+.activityDet .maskBox .speedProgress {
+  margin: 20rpx 0rpx 60rpx;
+  border-radius: 50rpx;
+  overflow: hidden;
+}

+ 60 - 59
pages/activityList/index.js

@@ -1,63 +1,64 @@
 import {
-    getActivityList
+  getActivityList
 } from '~/api/activity'
 Page({
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        banner: '',
-        cardActivityList: [],
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-        this.getActivityList()
-    },
-    async getActivityList() {
-        let {
-            banner,
-            cardActivityList
-        } = await getActivityList()
-        cardActivityList.forEach(item => {
-            item.currentIndex = 0
-        })
-        console.log(cardActivityList);
-        this.setData({
-            cardActivityList,
-            banner
-        })
-    },
-    // 换一换
-    changeTemplate({
-        currentTarget
-    }) {
-        let index = currentTarget.dataset.index
-        let item = currentTarget.dataset.item
-        let nextIndex = item.currentIndex
-        if (item.currentIndex < item.templateTypeList.length - 1) {
-            nextIndex = ++item.currentIndex
-        } else {
-            nextIndex = 0
-        }
-        this.setData({
-            [`cardActivityList[${index}].currentIndex`]: nextIndex
-        })
-    },
-    toRecording({
-        currentTarget
-    }) {
-        let index = currentTarget.dataset.index
-        let target = this.data.cardActivityList[index]
-        let id = target.templateTypeList[target.currentIndex].id
-        wx.navigateTo({
-            url: `/pages/activityDet/index?id=${id}`,
-        })
-    },
-    jumpMyGreeing() {
-        wx.navigateTo({
-            url: '/pages/greeting/index',
-        })
-    },
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    banner: '',
+    cardActivityList: [],
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.getActivityList()
+  },
+  async getActivityList() {
+    let {
+      banner,
+      cardActivityList
+    } = await getActivityList()
+    cardActivityList.forEach(item => {
+      item.currentIndex = 0
+    })
+    console.log(cardActivityList);
+    this.setData({
+      cardActivityList,
+      banner
+    })
+  },
+  // 换一换
+  changeTemplate({
+    currentTarget
+  }) {
+    let index = currentTarget.dataset.index
+    let item = currentTarget.dataset.item
+    let nextIndex = item.currentIndex
+    if (item.currentIndex < item.templateList.length - 1) {
+      nextIndex = ++item.currentIndex
+    } else {
+      nextIndex = 0
+    }
+    this.setData({
+      [`cardActivityList[${index}].currentIndex`]: nextIndex
+    })
+  },
+  toRecording({
+    currentTarget
+  }) {
+    let index = currentTarget.dataset.index
+    let target = this.data.cardActivityList[index]
+    let id = target.templateList[target.currentIndex].id
+
+    wx.navigateTo({
+      url: `/pages/activityDet/index?id=${id}`,
+    })
+  },
+  jumpMyGreeing() {
+    wx.navigateTo({
+      url: '/pages/greeting/index',
+    })
+  },
 })

+ 14 - 15
pages/activityList/index.wxml

@@ -1,18 +1,17 @@
 <view class="aDet" style="background-color: {{banner.bgColor}};">
-    <image src="{{banner.icon}}" class="headImg" />
-    <view class="body">
-        <view class="template" style="background-image:url({{item.bgImg}}) ;" wx:for="{{cardActivityList}}" wx:key="id">
-            <image src="{{item.templateTypeList[item.currentIndex].bgImg}}" class="content" />
-            <view class="btns">
-                <image src="http://reader-wx.ai160.com/images/reader/card/change.png" class="changeBtn"
-                    data-index='{{index}}' data-item='{{item}}' bindtap="changeTemplate" />
-                <image src="http://reader-wx.ai160.com/images/reader/card/record_blessings2.png" class="recording"
-                    data-index='{{index}}' bindtap="toRecording" />
-            </view>
-        </view>
-    </view>
-    <view class="footerBox">
-        <image src="http://reader-wx.ai160.com/images/reader/card/my_card.png" class="goGreeting"
-            bindtap="jumpMyGreeing" />
+  <image src="{{banner.icon}}" class="headImg" />
+  <view class="body">
+    <view class="template" style="background-image:url({{item.bgImg}}) ;" wx:for="{{cardActivityList}}" wx:key="id">
+      <image src="{{item.templateList[item.currentIndex].demoImg}}" class="content" />
+      <view class="btns">
+        <image src="http://reader-wx.ai160.com/images/reader/card/change.png" class="changeBtn" data-index='{{index}}'
+          data-item='{{item}}' bindtap="changeTemplate" />
+        <image src="http://reader-wx.ai160.com/images/reader/card/record_blessings2.png" class="recording"
+          data-index='{{index}}' bindtap="toRecording" />
+      </view>
     </view>
+  </view>
+  <view class="footerBox">
+    <image src="http://reader-wx.ai160.com/images/reader/card/my_card.png" class="goGreeting" bindtap="jumpMyGreeing" />
+  </view>
 </view>

+ 0 - 1
pages/user/myEdit/myEdit.wxml

@@ -1,4 +1,3 @@
-<!-- <StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" /> -->
 <view style="background:#f7f7f7;overflow: hidden;height: 100%">
     <button class="avatar-wrapper resetBtn" open-type="chooseAvatar" bind:chooseavatar="changeAvatar">
         <image class="avatar" src="{{user.avatar}}"></image>

+ 0 - 132
pages/vipActivity/vipActivity.js

@@ -1,132 +0,0 @@
-// pages/vipActivity/vipActivity.js
-import httpRequestApi from '../../utils/APIClient';
-const app = getApp()
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        peopleNumData: [],
-        isIOS: app.globalData.isIOS,
-        date: ''
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function(options) {
-        this.getVipData();
-        this.getHelp();
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function() {
-        this.getVipData();
-        this.getHelp();
-        wx.showNavigationBarLoading() //在标题栏中显示加载
-            //模拟加载
-        setTimeout(function() {
-            wx.hideNavigationBarLoading() //完成停止加载
-            wx.stopPullDownRefresh() //停止下拉刷新
-        }, 1000);
-    },
-    /**
-     * 点击分享e
-     */
-    shareRead(e) {
-        this.triggerEvent('openShare', e)
-        this.shareDialog = this.selectComponent("#share-dialog");
-        const user = wx.getStorageSync('user');
-        const type = this.data.isIOS ? 'ios' : 'iphone';
-        const data = {
-            avatar: user.avatar,
-            name: user.nickName,
-            uid: user.uid,
-            type,
-            path: `pages/index/index`
-        }
-        this.setData({
-            noScroll: 'noScroll'
-        })
-        this.shareDialog.share(data);
-    },
-    onShareAppMessage: function(res) {
-        if (res.from === 'button') {
-            const type = this.data.isIOS ? 'ios' : 'iphone';
-            const user = wx.getStorageSync('user');
-            return {
-                title: `${user.nickName}邀请你一起来朗读课文`,
-                path: `/pages/index/index?type=${type}&uid=${user.uid}`,
-                imageUrl: 'http://reader-wx.ai160.com/images/reader/pay/share_read_bg.png'
-            }
-        }
-    },
-    // 获取会员信息
-    getVipData() {
-        httpRequestApi.getAuthActivity().success(res => {
-            if (!res.data.data) {
-                wx.setStorageSync('vip', false)
-                wx.setStorageSync('date', '')
-            } else {
-                wx.setStorageSync('vip', true)
-                wx.setStorageSync('date', res.data.data)
-                this.setData({
-                    date: res.data.data
-                })
-            }
-        }).fail(error => {
-            console.log(error)
-        })
-    },
-    // 获取帮助的人
-    getHelp() {
-        if (this.data.isIOS) {
-            httpRequestApi.getHelpNum().success(res => {
-                this.setData({
-                    peopleNumData: res.data.data.list
-                })
-            }).fail(error => {
-                console.log(error)
-            })
-        } else {
-            httpRequestApi.getOrderNum().success(res => {
-                this.setData({
-                    peopleNumData: res.data.data.list
-                })
-            }).fail(error => {
-                console.log(error)
-            })
-        }
-    }
-})

+ 0 - 5
pages/vipActivity/vipActivity.json

@@ -1,5 +0,0 @@
-{
-  "usingComponents": {
-    "shareDialog": "/component/share/share"
-  }
-}

+ 0 - 38
pages/vipActivity/vipActivity.wxml

@@ -1,38 +0,0 @@
-<!--pages/vipActivity/vipActivity.wxml-->
-<wxs src="../../utils/filter.wxs" module="filters"/>
-<view class="vip-activity">
-  <view class="vip-activity-con">
-    <view class="vip-rule">
-      <image class="vip-rule-bg" src="http://reader-wx.ai160.com/images/reader/pay/{{date ? 'vip_explain' : 'no_vip'}}.png" />
-      <text class="expire-date">{{date && filters.formatDate(date) + '到期'}}</text>
-      <view class="plase-rule">
-        <text>邀请规则:</text>
-        <text class="rule-con">{{isIOS ? '每分享3位好友助力,即可获得1月朗读会员' : '邀请1位好友付费成功,即可免费获得1月朗读会员'}}</text>
-      </view>
-    </view>
-    <image class="plase-friend-bg" src="http://reader-wx.ai160.com/images/reader/pay/please_friend.png" />
-    <view class="friend" wx:if="{{peopleNumData.length > 0}}">
-      <view class="friend-title {{isIOS ? 'ios-title' : ''}}">
-        <text >好友</text>
-        <text class="name-title">昵称</text>
-        <text >{{isIOS ? '助力日期' : '会员权益'}}</text>
-      </view>
-      <view class="friend-message" wx:for="{{peopleNumData}}" wx:key="{{item.user.uid}}">
-        <image class="friend-head" src="{{item.user.avatar}}" />
-        <view class="{{isIOS ? 'ios-name' : 'name'}}">
-          <text style="font-weight: 500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.user.nickName}}</text>
-          <text class="friend-date" hidden="{{isIOS}}">购买日期:{{filters.formatDate(item.orderInfo.gmtCreated)}}</text>
-        </view>
-        <text class="{{isIOS ? 'ios-friend-time' : 'friend-time'}}">{{isIOS ? filters.formatDate(item.userHelp.gmtCreated) : '+1个月'}}</text>
-      </view>
-    </view>
-    <view wx:else class="no-data">
-        <image src="http://reader-wx.ai160.com/images/reader/pay/no_one.png" />
-    </view>
-  </view>
-  <view class="vip-go-read" bindtap="shareRead">
-    <text>快喊小伙伴,一起来读课文吧!</text>
-  </view>
-</view>
-<shareDialog id="share-dialog" shareType='readActivity' bindShareDialogClose="shareDialogClose" bindaddShareAmount="addShareAmount" shareId="{{id}}" />
-<canvas canvas-id="myCanvas" style="width:300px; height: 525px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>

+ 0 - 161
pages/vipActivity/vipActivity.wxss

@@ -1,161 +0,0 @@
-/* pages/vipActivity/vipActivity.wxss */
-.vip-activity {
-  width: 100%;
-  height: 100%;
-  padding: 0 14rpx;
-  box-sizing: border-box;
-  background: #EEEEEE;
-  overflow: scroll;
-}
-.vip-activity-con {
-  width: 100%;
-  margin-bottom: 160rpx;
-}
-.vip-activity-con .vip-rule {
-  position: relative;
-  width: 100%;
-  height: 300rpx;
-  margin-top: 20rpx;
-}
-.vip-rule-bg {
-  width: 100%;
-  height: 100%;
-}
-.expire-date {
-  position: absolute;
-  left: 350rpx;
-  top: 40rpx;
-  font-size: 28rpx;
-  color: #6E4008;
-  font-weight: 500;
-}
-.plase-rule {
-  position: absolute;
-  top: 136rpx;
-  left: 46rpx;
-}
-.plase-rule text {
-  display: block;
-  font-size: 30rpx;
-  color: #FE6A00;
-}
-.plase-rule .rule-con {
-  color: #000;
-  font-size: 28rpx;
-  box-shadow: -1px 5px 5px -3px #FFE150;
-  margin-top: 20rpx;
-}
-.plase-friend-bg {
-  width: 392rpx;
-  height: 34rpx;
-  margin: 30rpx auto;
-  display: block;
-}
-.vip-activity-con .friend {
-  width: 100%;
-  background: #fff;
-  display: flex;
-  flex-direction: column;
-  border-radius: 20rpx;
-}
-.vip-activity-con .no-data {
-    margin-top: 150rpx;
-}
-.vip-activity-con .no-data image {
-  width: 263rpx;
-  height: 240rpx;
-  display: block;
-  margin: 0 auto;
-}
-
-.vip-activity-con .friend-title {
-  display: flex;
-  justify-content: space-between;
-  width: 100%;
-  padding: 0 14rpx 0 42rpx;
-  box-sizing: border-box;
-  margin: 26rpx 0;
-  font-weight: 500;
-  color: #333333;
-  font-size: 36rpx;
-}
-.vip-activity-con .ios-title {
-  padding: 0 59rpx 0 42rpx;
-}
-.vip-activity-con .friend .name-title {
-  width: 340rpx;
-}
-.vip-activity-con .ios-title .name-title {
-  width: 280rpx;
-}
-.friend-message {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  width: 100%;
-  padding: 0 37rpx 0 24rpx;
-  box-sizing: border-box;
-  margin-bottom: 30rpx;
-}
-.friend-message .friend-head {
-  width: 80rpx;
-  height: 80rpx;
-  border-radius: 50%;
-}
-.friend-message .name {
-  display: flex;
-  flex-direction: column;
-  width: 375rpx;
-}
-.friend-message .name text {
-  width: 375rpx;
-  height: 40rpx;
-  overflow:hidden;
-  text-overflow:ellipsis;
-  white-space:nowrap;
-}
-.friend-message .ios-name {
-  display: flex;
-  flex-direction: column;
-  width: 240rpx;
-  height: 40rpx;
-}
-.friend-message .friend-time {
-  font-size: 36rpx;
-  color: #FE6A00;
-}
-.friend-message .ios-friend-time {
-  font-size: 32rpx;
-  color: #333;
-}
-.friend-message .text {
-  color: #333333;
-  font-size: 36rpx;
-}
-.friend-message .friend-date {
-  color: #666;
-  font-size: 25rpx;
-}
-.vip-go-read {
-  position: fixed;
-  left: 0;
-  bottom: 0;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  width: 100%;
-  height: 139rpx;
-  background: #fff;
-  box-shadow: 0px -5px 4px 0px rgba(0, 0, 0, 0.11);
-}
-.vip-go-read text {
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  width: 607rpx;
-  height: 80rpx;
-  background: #FF9900;
-  color: #fff;
-  font-size: 40rpx;
-  border-radius: 40rpx;
-}

+ 30 - 0
project.config.json

@@ -0,0 +1,30 @@
+{
+    "appid": "wx8961a3e5512f307c",
+    "projectname": "render",
+    "compileType": "miniprogram",
+    "libVersion": "2.27.3",
+    "packOptions": {
+        "ignore": [],
+        "include": []
+    },
+    "setting": {
+        "urlCheck": false,
+        "coverView": true,
+        "es6": true,
+        "postcss": true,
+        "minified": true,
+        "showShadowRootInWxmlPanel": true,
+        "packNpmRelationList": [],
+        "ignoreUploadUnusedFiles": true,
+        "compileHotReLoad": true,
+        "babelSetting": {
+            "ignore": [],
+            "disablePlugins": [],
+            "outputPath": ""
+        }
+    },
+    "editorSetting": {
+        "tabIndent": "insertSpaces",
+        "tabSize": 4
+    }
+}

+ 85 - 0
project.private.config.json

@@ -0,0 +1,85 @@
+{
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "/pages/index/index",
+                    "pathName": "/pages/index/index",
+                    "query": "readId=103127012&uid=621993583e41481fbf7af7b355387eca",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "作品",
+                    "pathName": "pages/social/works/works",
+                    "query": "id=1548160250807513&title=【识字1】春夏秋冬",
+                    "scene": "1012"
+                },
+                {
+                    "name": "分享团",
+                    "pathName": "pages/groupPage/group-details/group-details",
+                    "query": "productId=1550459447432909",
+                    "scene": 1012
+                },
+                {
+                    "name": "公众号进入",
+                    "pathName": "pages/index/index",
+                    "query": "",
+                    "scene": 1020,
+                    "referrerInfo": {}
+                },
+                {
+                    "name": "公众号文章进入",
+                    "pathName": "pages/index/index",
+                    "query": "",
+                    "scene": 1058
+                },
+                {
+                    "name": "小红花兑换页面",
+                    "pathName": "pages/social/prize/prize",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "有问题朗读页面",
+                    "pathName": "pages/social/works/works",
+                    "query": "id=1553402613620097&title=【课文7】怎么都快乐",
+                    "scene": null
+                },
+                {
+                    "name": "活动页面",
+                    "pathName": "pages/activity/index/index",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "活动分享进入",
+                    "pathName": "pages/index/index",
+                    "query": "readId=1615468601012143&activity=true",
+                    "scene": null
+                },
+                {
+                    "name": "pages/product/product",
+                    "pathName": "pages/product/product",
+                    "query": "",
+                    "scene": null
+                },
+                {
+                    "name": "用户分享进入",
+                    "pathName": "pages/index/index",
+                    "query": "sid=621993583e41481fbf7af7b355387eca",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/activityDet/index",
+                    "query": "id=50",
+                    "launchMode": "default",
+                    "scene": null
+                }
+            ]
+        }
+    }
+}

BIN
static/vip/crown.png


BIN
static/vip/discount.png


BIN
static/vip/idcard.png


BIN
static/vip/product_bg.png


BIN
static/vip/small_crown.png


BIN
static/vip/wechat_bg.png