|
@@ -3,6 +3,9 @@ import {
|
|
getShareText,
|
|
getShareText,
|
|
saveActivity
|
|
saveActivity
|
|
} from '~/api/activity'
|
|
} from '~/api/activity'
|
|
|
|
+import {
|
|
|
|
+ actionRecord
|
|
|
|
+} from '~/api/global'
|
|
/*微信录音*/
|
|
/*微信录音*/
|
|
let recorderManager = wx.getRecorderManager();
|
|
let recorderManager = wx.getRecorderManager();
|
|
let dsq
|
|
let dsq
|
|
@@ -57,7 +60,6 @@ Page({
|
|
this.setData({
|
|
this.setData({
|
|
configure,
|
|
configure,
|
|
avatar: configure.photoText,
|
|
avatar: configure.photoText,
|
|
- toWidth: '',
|
|
|
|
fromWidth: configure.fromText.length * configure.fromFontSize,
|
|
fromWidth: configure.fromText.length * configure.fromFontSize,
|
|
toWidth: configure.toText.length * configure.toFontSize,
|
|
toWidth: configure.toText.length * configure.toFontSize,
|
|
id: options.id,
|
|
id: options.id,
|
|
@@ -65,6 +67,25 @@ Page({
|
|
tens: configure.bgMusicLength[0],
|
|
tens: configure.bgMusicLength[0],
|
|
bits: configure.bgMusicLength[1]
|
|
bits: configure.bgMusicLength[1]
|
|
})
|
|
})
|
|
|
|
+ this.innerAudioContext = wx.createInnerAudioContext();
|
|
|
|
+ // 录音授权
|
|
|
|
+ wx.getSetting({
|
|
|
|
+ success(res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ if (!res.authSetting['scope.record']) {
|
|
|
|
+ wx.authorize({
|
|
|
|
+ scope: 'scope.record',
|
|
|
|
+ success() {
|
|
|
|
+ // 用户已经同意小程序使用录音功能,后续调用接口不会弹窗询问
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ await actionRecord({
|
|
|
|
+ action: 'NEW_YEAR_ACTIVITY_CHOOSE_TEMPLATE',
|
|
|
|
+ targetContent: options.id
|
|
|
|
+ })
|
|
},
|
|
},
|
|
async changeAvatar(e) {
|
|
async changeAvatar(e) {
|
|
const {
|
|
const {
|
|
@@ -78,7 +99,6 @@ Page({
|
|
},
|
|
},
|
|
play() {
|
|
play() {
|
|
if (this.data.state == 'before') {
|
|
if (this.data.state == 'before') {
|
|
- this.innerAudioContext = wx.createInnerAudioContext();
|
|
|
|
this.innerAudioContext.src = this.data.configure.bgMusic; // 这里可以是录音的临时路径
|
|
this.innerAudioContext.src = this.data.configure.bgMusic; // 这里可以是录音的临时路径
|
|
this.innerAudioContext.play();
|
|
this.innerAudioContext.play();
|
|
this.innerAudioContext.onEnded((res) => {
|
|
this.innerAudioContext.onEnded((res) => {
|
|
@@ -181,6 +201,10 @@ Page({
|
|
greetingCard,
|
|
greetingCard,
|
|
uploadState: false
|
|
uploadState: false
|
|
})
|
|
})
|
|
|
|
+ await actionRecord({
|
|
|
|
+ action: 'NEW_YEAR_ACTIVITY_GENERATE_TEMPLATE',
|
|
|
|
+ targetContent: this.data.id
|
|
|
|
+ })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
playUserAudio() {
|
|
playUserAudio() {
|
|
@@ -295,6 +319,9 @@ Page({
|
|
from,
|
|
from,
|
|
}) {
|
|
}) {
|
|
if (from == 'button') {
|
|
if (from == 'button') {
|
|
|
|
+ actionRecord({
|
|
|
|
+ action: 'NEW_YEAR_ACTIVITY_SEND_BLESSING',
|
|
|
|
+ })
|
|
const promise = new Promise(resolve => {
|
|
const promise = new Promise(resolve => {
|
|
this.createActivityImg().then(res => {
|
|
this.createActivityImg().then(res => {
|
|
resolve(res)
|
|
resolve(res)
|