// преди 1 година
родител
ревизия
0a3de76965
променени са 9 файла, в които са добавени 126 реда и са изтрити 80 реда
  1. 2 2
      app.wxss
  2. 19 5
      pages/activityDet/index.js
  3. 1 1
      pages/activityDet/index.wxml
  4. 73 59
      pages/activityList/index.js
  5. 4 4
      pages/greeting/index.js
  6. 6 4
      pages/greeting/index.less
  7. 1 1
      pages/greeting/index.wxml
  8. 6 4
      pages/greeting/index.wxss
  9. 14 0
      project.private.config.json

+ 2 - 2
app.wxss

@@ -52,8 +52,8 @@ text {
   width: 375px;
   height: 300px;
   position: absolute;
-  left: -9999rpx;
-  top: -9999rpx;
+  /* left: -9999rpx;
+  top: -9999rpx; */
 }
 
 /* 转圈动画 */

+ 19 - 5
pages/activityDet/index.js

@@ -290,13 +290,27 @@ Page({
                         bgImg.src = this.data.configure.bgImg
                         bgImg.onload = () => {
                             ctx.drawImage(bgImg, 0, 0, 375, 300);
-                            ctx.fillStyle = `${this.data.configure.toColor}`;
                             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.fillStyle = `${this.data.configure.toColor}`;
+                            let toLeft = 0
+                            if (this.data.configure.toTextAlign == 'left') {
+                                toLeft = this.data.configure.templateBase.toLeft / 2
+                            } else if (this.data.configure.toTextAlign == 'right') {
+                                toLeft = this.data.configure.templateBase.toLeft / 2 + (this.data.configure.templateBase.toWidth / 2 - ctx.measureText(this.data.configure.toText).width)
+                            } else if (this.data.configure.toTextAlign == 'center') {
+                                toLeft = this.data.configure.templateBase.toLeft / 2 + ((this.data.configure.templateBase.toWidth / 2 - ctx.measureText(this.data.configure.toText).width) / 2)
+                            }
+                            ctx.fillText(this.data.configure.toText, toLeft, this.data.configure.templateBase.toTop / 2 + this.data.configure.fromFontSize / 2)
                             ctx.fillStyle = `${this.data.configure.fromColor}`;
-                            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);
+                            let fromLeft = 0
+                            if (this.data.configure.fromTextAlign == 'left') {
+                                fromLeft = this.data.configure.templateBase.fromLeft / 2
+                            } else if (this.data.configure.fromTextAlign == 'right') {
+                                fromLeft = this.data.configure.templateBase.fromLeft / 2 + (this.data.configure.templateBase.fromWidth / 2 - ctx.measureText(this.data.configure.fromText).width)
+                            } else if (this.data.configure.fromTextAlign == 'center') {
+                                fromLeft = this.data.configure.templateBase.fromLeft / 2 + ((this.data.configure.templateBase.fromWidth / 2 - ctx.measureText(this.data.configure.fromText).width) / 2)
+                            }
+                            ctx.fillText(this.data.configure.fromText, fromLeft, this.data.configure.templateBase.fromTop / 2 + this.data.configure.toFontSize / 2)
                             setTimeout(() => {
                                 wx.canvasToTempFilePath({
                                     canvas: canvas,

+ 1 - 1
pages/activityDet/index.wxml

@@ -37,7 +37,7 @@
     <!-- 录制控制区域 -->
     <view class="btnsBox" wx:if="{{state!='after'}}">
         <image wx:if="{{state=='before'}}" src="http://reader-wx.ai160.com/images/reader/card/play_1.png" class="send"
-            bindtap="play" />
+            bindtap="uploadActivity" />
         <view class="recordingBox" wx:if="{{state=='process'}}">
             <image class="readingNow" src="/static/index/readingNow.gif" />
             <image src="http://reader-wx.ai160.com/images/reader/card/play_3.png" class="send" bindtap="play" />

+ 73 - 59
pages/activityList/index.js

@@ -1,64 +1,78 @@
 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.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
+    /**
+     * 页面的初始数据
+     */
+    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',
-    })
-  },
+        wx.navigateTo({
+            url: `/pages/activityDet/index?id=${id}`,
+        })
+    },
+    jumpMyGreeing() {
+        wx.navigateTo({
+            url: '/pages/greeting/index',
+        })
+    },
+    onShareAppMessage() {
+        return {
+            title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
+            path: `/pages/activityList/index?uid=${wx.getStorageSync('uid')}`,
+            imageUrl: 'http://reader-wx.ai160.com/images/reader/card/share-new-activity.png'
+        }
+    },
+    onShareTimeline() {
+        return {
+            title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
+            query: `uid=${wx.getStorageSync('uid')}`,
+            imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/xkx_logo.jpg'
+        }
+    },
 })

+ 4 - 4
pages/greeting/index.js

@@ -215,8 +215,8 @@ Page({
         target,
         from,
     }) {
-        let shareInfo = target.dataset.item
         if (from == 'button') {
+            let shareInfo = target.dataset.item
             const promise = new Promise(resolve => {
                 this.createActivityImg(shareInfo).then(res => {
                     resolve(res)
@@ -233,9 +233,9 @@ Page({
             }
         } else {
             return {
-                title: '课文朗读,从未如此有趣。',
-                path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
-                imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png'
+                title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
+                path: `/pages/activityList/index?uid=${wx.getStorageSync('uid')}`,
+                imageUrl: 'http://reader-wx.ai160.com/images/reader/card/share-new-activity.png'
             }
         }
     },

+ 6 - 4
pages/greeting/index.less

@@ -1,7 +1,7 @@
 .greetingBox {
     width: 100vw;
     min-height: 100vh;
-    padding: 26rpx 20rpx;
+    padding: 26rpx 20rpx 130rpx;
     background-color: #fcd9927c;
     box-sizing: border-box;
 
@@ -123,12 +123,14 @@
 
     .footerBox {
         width: 100%;
+        height: 130rpx;
+        display: flex;
+        align-items: center;
+        justify-content: center;
         position: fixed;
         left: 0px;
         bottom: 0px;
-        padding: 20rpx 0rpx;
-        text-align: center;
-        background-color: white;
+        background-color: rgb(255, 255, 255);
 
         image {
             width: 535rpx;

+ 1 - 1
pages/greeting/index.wxml

@@ -43,7 +43,7 @@
       </view>
     </view>
   </view>
-  <view class="footerBox" wx:if="{{!isMy}}">
+  <view class="footerBox">
       <image src="http://reader-wx.ai160.com/images/reader/card/callback.png" bindtap="jumpIndex"/>
   </view>
 </view>

+ 6 - 4
pages/greeting/index.wxss

@@ -1,7 +1,7 @@
 .greetingBox {
   width: 100vw;
   min-height: 100vh;
-  padding: 26rpx 20rpx;
+  padding: 26rpx 20rpx 130rpx;
   background-color: #fcd9927c;
   box-sizing: border-box;
 }
@@ -102,12 +102,14 @@
 }
 .greetingBox .footerBox {
   width: 100%;
+  height: 130rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
   position: fixed;
   left: 0px;
   bottom: 0px;
-  padding: 20rpx 0rpx;
-  text-align: center;
-  background-color: white;
+  background-color: #ffffff;
 }
 .greetingBox .footerBox image {
   width: 535rpx;

+ 14 - 0
project.private.config.json

@@ -16,6 +16,20 @@
                     "query": "uid=9db2bedb2b9b47c5b0358bb9bec39145&cardId=1673601638964582",
                     "launchMode": "default",
                     "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/activityList/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/activityDet/index",
+                    "query": "id=51",
+                    "launchMode": "default",
+                    "scene": null
                 }
             ]
         }