|
@@ -25,6 +25,8 @@ Page({
|
|
|
// 线上录音地址
|
|
|
audioPath: '',
|
|
|
uploadState: false,
|
|
|
+ focusTo: false,
|
|
|
+ focusFrom: false,
|
|
|
// 此id保存模板使用
|
|
|
id: '',
|
|
|
greeting: [],
|
|
@@ -49,6 +51,7 @@ Page({
|
|
|
bits: configure.bgMusicLength[1]
|
|
|
})
|
|
|
this.innerAudioContext = wx.createInnerAudioContext();
|
|
|
+ this.innerAudioContext.src = configure.bgMusic; // 这里可以是录音的临时路径
|
|
|
// 录音授权
|
|
|
wx.getSetting({
|
|
|
success(res) {
|
|
@@ -73,6 +76,7 @@ Page({
|
|
|
wx.chooseMedia({
|
|
|
count: 1,
|
|
|
mediaType: ['image'],
|
|
|
+ sizeType: ['compressed'], // 必须放在 数组里面才有效; original 原图;compressed 压缩图
|
|
|
sourceType: ['album', 'camera'],
|
|
|
camera: 'back',
|
|
|
success: (res) => {
|
|
@@ -97,7 +101,6 @@ Page({
|
|
|
},
|
|
|
play() {
|
|
|
if (this.data.state == 'before') {
|
|
|
- this.innerAudioContext.src = this.data.configure.bgMusic; // 这里可以是录音的临时路径
|
|
|
this.innerAudioContext.play();
|
|
|
this.innerAudioContext.onEnded((res) => {
|
|
|
console.log('音频播放完毕');
|
|
@@ -239,6 +242,19 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ focusInput({
|
|
|
+ currentTarget
|
|
|
+ }) {
|
|
|
+ if (currentTarget.dataset.input == 'from') {
|
|
|
+ this.setData({
|
|
|
+ focusFrom: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ focusTo: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 上传图片
|
|
|
uploadFile(filePath) {
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -353,6 +369,13 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ onShareTimeline() {
|
|
|
+ return {
|
|
|
+ title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
|
|
|
+ query: `uid=${wx.getStorageSync('uid')}&id=${this.data.id}`,
|
|
|
+ imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/xkx_logo.jpg'
|
|
|
+ }
|
|
|
+ },
|
|
|
// 设置时间文案
|
|
|
setDuration(label, s) {
|
|
|
let t = '';
|