757 lines
25 KiB
JavaScript
Executable File
757 lines
25 KiB
JavaScript
Executable File
// var t = getApp(), a = wx.getRecorderManager(), , i = requirePlugin("chooseLocation"), s = {
|
|
// latitude: 39.90877,
|
|
// longitude: 116.39695
|
|
// };
|
|
|
|
|
|
const app = getApp()
|
|
const recorderManager = wx.getRecorderManager()
|
|
var e = wx.createInnerAudioContext();
|
|
const chooseLocation = requirePlugin('chooseLocation');
|
|
var location = {
|
|
latitude: 39.90877,
|
|
longitude: 116.39695
|
|
}; //默认坐标点
|
|
|
|
Page({
|
|
data: {
|
|
maringHeight: app.globalData.CustomBar,
|
|
fieldList: [{
|
|
type: "text"
|
|
}, {
|
|
type: "video"
|
|
}, {
|
|
type: "audio"
|
|
}, {
|
|
type: "map"
|
|
}, {
|
|
type: "select"
|
|
}, {
|
|
type: "textarea"
|
|
}, {
|
|
type: "link"
|
|
}, {
|
|
type: "photo"
|
|
}],
|
|
valueList: [],
|
|
isShowInput: !1,
|
|
isShowPhoto: !1,
|
|
isShowVideo: !1,
|
|
isShowLink: !1,
|
|
isShowSelect: !1,
|
|
isShowAudio: !1,
|
|
curTextValue: "",
|
|
curLinkText: "",
|
|
isShowEdit: !1,
|
|
currentIndex: -1,
|
|
photoList: [],
|
|
videoList: [],
|
|
curSelPhotoDisplay: "1",
|
|
curVideoDisplay: "1",
|
|
curTextAlign: "1",
|
|
curFieldTypeIndex: 0,
|
|
curFieldType: "text",
|
|
selDirection: "1",
|
|
isInsert: !1,
|
|
topBoxHeight: 100,
|
|
audioFile: null,
|
|
audioDuration: 0,
|
|
isRecording: !1,
|
|
speedStep: 5,
|
|
sourceType: "add",
|
|
insertIndex: -1,
|
|
optionsList: [{
|
|
id: "1",
|
|
name: "选项一",
|
|
isSel: !1
|
|
}, {
|
|
id: "2",
|
|
name: "选项二",
|
|
isSel: !1
|
|
}, {
|
|
id: "3",
|
|
name: "选项三",
|
|
isSel: !1
|
|
}, {
|
|
id: "4",
|
|
name: "选项四",
|
|
isSel: !1
|
|
}, {
|
|
id: "5",
|
|
name: "选项五",
|
|
isSel: !1
|
|
}]
|
|
},
|
|
onLoad: function (t) {
|
|
this.setData({
|
|
columnId: t.id
|
|
}), this.checkPermission(), this.countBoxHeight();
|
|
},
|
|
countBoxHeight: function () {
|
|
var t = this, a = wx.createSelectorQuery();
|
|
a.select("#top-box").boundingClientRect(), a.exec(function (a) {
|
|
t.setData({
|
|
topBoxHeight: a[0].height + 7
|
|
});
|
|
});
|
|
},
|
|
onShow: function () {
|
|
var t = this;
|
|
if (null != chooseLocation.getLocation()) {
|
|
var a = chooseLocation.getLocation(), e = {
|
|
type: "map"
|
|
};
|
|
e.value = a, "add" == t.data.sourceType ? t.data.valueList.push(e) : t.data.valueList.splice(t.data.currentIndex, "edit" == t.data.sourceType ? 1 : 0, e),
|
|
t.setData({
|
|
valueList: t.data.valueList
|
|
});
|
|
}
|
|
wx.getSetting({
|
|
withSubscriptions: !0,
|
|
success: function (a) {
|
|
var e = a.authSetting["scope.record"];
|
|
t.setData({
|
|
isAuthAudio: e
|
|
});
|
|
}
|
|
});
|
|
},
|
|
showType: function (t) {
|
|
switch (t.currentTarget.dataset.type) {
|
|
case "text":
|
|
case "textarea":
|
|
this.setData({
|
|
isShowInput: !0
|
|
});
|
|
break;
|
|
|
|
case "video":
|
|
this.chooseVideo();
|
|
break;
|
|
|
|
case "audio":
|
|
this.checkRecordPermission();
|
|
break;
|
|
|
|
case "photo":
|
|
this.chooseImg();
|
|
break;
|
|
|
|
case "map":
|
|
this.doChooseLocation();
|
|
break;
|
|
|
|
case "select":
|
|
this.setData({
|
|
isShowSelect: !0
|
|
});
|
|
break;
|
|
|
|
case "link":
|
|
this.setData({
|
|
isShowLink: !0
|
|
});
|
|
}
|
|
},
|
|
chooseImg: function () {
|
|
var t = this;
|
|
wx.chooseImage({
|
|
count: 9,
|
|
sourceType: ["album", "camera"],
|
|
success: function (a) {
|
|
console.log(a), a.tempFilePaths.forEach(function (a) {
|
|
var e = {};
|
|
e.path = a, t.data.photoList.push(e);
|
|
}), t.setData({
|
|
photoList: t.data.photoList,
|
|
isShowPhoto: !0
|
|
});
|
|
},
|
|
fail: function (t) {
|
|
-1 == t.errMsg.indexOf("fail cancel") && wx.showToast({
|
|
title: "请重新选择",
|
|
icon: "error"
|
|
});
|
|
}
|
|
});
|
|
},
|
|
chooseVideo: function () {
|
|
var t = this;
|
|
wx.chooseMedia({
|
|
count: 9,
|
|
mediaType: ["video"],
|
|
sourceType: ["album", "camera"],
|
|
maxDuration: 60,
|
|
success: function (a) {
|
|
a.tempFiles.forEach(function (a) {
|
|
var e = {};
|
|
e.path = a.tempFilePath, e.coverPath = a.thumbTempFilePath, t.data.videoList.push(e);
|
|
}), t.setData({
|
|
videoList: t.data.videoList,
|
|
isShowVideo: !0
|
|
});
|
|
},
|
|
fail: function (t) {
|
|
-1 == t.errMsg.indexOf("fail cancel") && wx.showToast({
|
|
title: "请重新选择",
|
|
icon: "error"
|
|
});
|
|
}
|
|
});
|
|
},
|
|
showEditBox: function (t) {
|
|
var a = t.currentTarget.dataset.idx;
|
|
this.data.currentIndex == a ? this.setData({
|
|
currentIndex: -1
|
|
}) : this.setData({
|
|
currentIndex: a
|
|
});
|
|
},
|
|
chooseDirection: function (t) {
|
|
var a = t.currentTarget.dataset.idx;
|
|
this.setData({
|
|
selDirection: a
|
|
});
|
|
},
|
|
choosePhotoDisplay: function (t) {
|
|
var a = t.currentTarget.dataset.type;
|
|
this.setData({
|
|
curSelPhotoDisplay: a
|
|
});
|
|
},
|
|
chooseVideoDisplay: function (t) {
|
|
var a = t.currentTarget.dataset.type;
|
|
this.setData({
|
|
curVideoDisplay: a
|
|
});
|
|
},
|
|
chooseTextAlign: function (t) {
|
|
var a = t.currentTarget.dataset.type;
|
|
this.setData({
|
|
curTextAlign: a
|
|
});
|
|
},
|
|
chooseFieldType: function (t) {
|
|
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.type;
|
|
this.setData({
|
|
curFieldTypeIndex: a,
|
|
curFieldType: e
|
|
});
|
|
},
|
|
confirmPhoto: function () {
|
|
if (this.data.photoList.length > 0) {
|
|
var t = [];
|
|
this.data.photoList.forEach(function (a) {
|
|
var e = {};
|
|
e.path = a.path, t.push(e);
|
|
});
|
|
var a = {
|
|
type: "photo"
|
|
};
|
|
a.valueList = t, a.displayType = this.data.curSelPhotoDisplay, "add" == this.data.sourceType ? this.data.valueList.push(a) : this.data.valueList.splice(this.data.currentIndex, "edit" == this.data.sourceType ? 1 : 0, a),
|
|
this.setData({
|
|
valueList: this.data.valueList,
|
|
photoList: [],
|
|
curSelPhotoDisplay: 1,
|
|
isShowPhoto: !1
|
|
});
|
|
} else wx.showToast({
|
|
title: "请选择图片",
|
|
icon: "error"
|
|
});
|
|
},
|
|
confirmVideo: function () {
|
|
if (this.data.videoList.length > 0) {
|
|
var t = [];
|
|
this.data.videoList.forEach(function (a) {
|
|
var e = {};
|
|
e.path = a.path, e.coverPath = a.coverPath, t.push(e);
|
|
});
|
|
var a = {
|
|
type: "video"
|
|
};
|
|
a.valueList = t, a.displayType = this.data.curVideoDisplay, "add" == this.data.sourceType ? this.data.valueList.push(a) : this.data.valueList.splice(this.data.currentIndex, "edit" == this.data.sourceType ? 1 : 0, a),
|
|
this.setData({
|
|
valueList: this.data.valueList,
|
|
videoList: [],
|
|
curVideoDisplay: 1,
|
|
isShowVideo: !1,
|
|
currentIndex: -1,
|
|
sourceType: "add"
|
|
});
|
|
} else wx.showToast({
|
|
title: "请选择视频",
|
|
icon: "error"
|
|
});
|
|
},
|
|
doInsert: function () {
|
|
var t = -1;
|
|
switch (t = 1 == this.data.selDirection ? this.data.currentIndex : ++this.data.currentIndex,
|
|
this.setData({
|
|
insertIndex: t,
|
|
sourceType: "insert",
|
|
isInsert: !1
|
|
}), this.data.curFieldType) {
|
|
case "text":
|
|
case "textarea":
|
|
this.setData({
|
|
isShowInput: !0
|
|
});
|
|
break;
|
|
|
|
case "video":
|
|
this.chooseVideo();
|
|
break;
|
|
|
|
case "audio":
|
|
this.checkRecordPermission();
|
|
break;
|
|
|
|
case "photo":
|
|
this.chooseImg();
|
|
break;
|
|
|
|
case "map":
|
|
this.doChooseLocation();
|
|
break;
|
|
|
|
case "select":
|
|
this.setData({
|
|
isShowSelect: !0
|
|
});
|
|
break;
|
|
|
|
case "link":
|
|
this.setData({
|
|
isShowLink: !0
|
|
});
|
|
}
|
|
},
|
|
hideEditBox: function () {
|
|
this.setData({
|
|
currentIndex: -1
|
|
});
|
|
},
|
|
onClose: function () {
|
|
this.setData({
|
|
isShowInput: !1,
|
|
isShowLink: !1,
|
|
isShowSelect: !1,
|
|
sourceType: "add"
|
|
});
|
|
},
|
|
inputWatch: function (t) {
|
|
this.setData({
|
|
curTextValue: t.detail.value
|
|
});
|
|
},
|
|
inputLink: function (t) {
|
|
this.setData({
|
|
curLinkText: t.detail.value
|
|
});
|
|
},
|
|
doConfirmLink: function () {
|
|
if ("" == this.data.curLinkText) wx.showToast({
|
|
title: "请输入链接",
|
|
icon: "error"
|
|
}); else {
|
|
var t = {
|
|
type: "link"
|
|
};
|
|
t.value = this.data.curLinkText, "add" == this.data.sourceType ? this.data.valueList.push(t) : this.data.valueList.splice(this.data.currentIndex, "edit" == this.data.sourceType ? 1 : 0, t),
|
|
this.setData({
|
|
valueList: this.data.valueList,
|
|
curLinkText: "",
|
|
isShowLink: !1
|
|
});
|
|
}
|
|
},
|
|
doConfirmInput: function () {
|
|
if ("" == this.data.curTextValue) wx.showToast({
|
|
title: "请输入内容",
|
|
icon: "error"
|
|
}); else {
|
|
var t = {
|
|
type: "text"
|
|
};
|
|
t.value = this.data.curTextValue;
|
|
var a = "left";
|
|
switch (this.data.curTextAlign) {
|
|
case "1":
|
|
a = "left";
|
|
break;
|
|
|
|
case "2":
|
|
a = "center";
|
|
break;
|
|
|
|
case "3":
|
|
a = "right";
|
|
}
|
|
t.textAlign = a, "add" == this.data.sourceType ? this.data.valueList.push(t) : this.data.valueList.splice(this.data.currentIndex, "edit" == this.data.sourceType ? 1 : 0, t),
|
|
this.setData({
|
|
valueList: this.data.valueList,
|
|
curTextValue: "",
|
|
isShowInput: !1,
|
|
curTextAlign: "1"
|
|
});
|
|
}
|
|
},
|
|
checkPermission: function () {
|
|
var t = this;
|
|
wx.getSetting({
|
|
success: function (a) {
|
|
var e = a.authSetting["scope.record"];
|
|
void 0 === e ? wx.authorize({
|
|
scope: "scope.record",
|
|
success: function () {
|
|
t.setData({
|
|
isAuthAudio: !0
|
|
});
|
|
},
|
|
fail: function () {
|
|
t.setData({
|
|
isAuthAudio: !1
|
|
});
|
|
}
|
|
}) : e || t.openSetting();
|
|
}
|
|
});
|
|
},
|
|
openSetting: function () {
|
|
wx.showModal({
|
|
title: "提示",
|
|
content: "发布内容需要您授权录音权限.",
|
|
success: function (t) {
|
|
t.confirm && wx.openSetting({
|
|
withSubscriptions: !0
|
|
});
|
|
}
|
|
});
|
|
},
|
|
viewPhoto: function (t) {
|
|
var a = t.currentTarget.dataset.url;
|
|
wx.previewImage({
|
|
urls: [a]
|
|
});
|
|
},
|
|
delPhoto: function (t) {
|
|
var a = this;
|
|
wx.showModal({
|
|
title: "提示",
|
|
content: "确定要删除该图片吗?",
|
|
cancelText: "取消",
|
|
confirmText: "确定",
|
|
success: function (e) {
|
|
e.confirm && (a.data.photoList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
|
photoList: a.data.photoList
|
|
}));
|
|
}
|
|
});
|
|
},
|
|
viewVideo: function (t) {
|
|
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.index, i = this.data.valueList[e].valueList[a].path, s = {};
|
|
s.url = i, s.type = "video", wx.previewMedia({
|
|
sources: [s]
|
|
});
|
|
},
|
|
delVideo: function (t) {
|
|
var a = this, e = t.currentTarget.dataset.index;
|
|
wx.showModal({
|
|
title: "提示",
|
|
content: "确定要删除该视频吗?",
|
|
success: function (t) {
|
|
t.confirm && (a.data.videoList.splice(e, 1), a.setData({
|
|
videoList: a.data.videoList
|
|
}));
|
|
}
|
|
});
|
|
},
|
|
doChooseLocation: function (t) {
|
|
var a = JSON.stringify(s);
|
|
wx.navigateTo({
|
|
url: "plugin://chooseLocation/index?key=".concat("HVDBZ-KJGKF-DNMJR-JHEWI-H2HN7-23BMS", "&referer=").concat("市域自治与互助", "&location=").concat(a, "&category=").concat("生活服务,娱乐休闲")
|
|
});
|
|
},
|
|
editItem: function (t) {
|
|
var a = t.currentTarget.dataset.index;
|
|
switch (this.setData({
|
|
sourceType: "edit"
|
|
}), this.data.valueList[a].type) {
|
|
case "text":
|
|
case "textarea":
|
|
var e = "1";
|
|
e = "left" == this.data.valueList[a].textAlign ? "1" : "center" == this.data.valueList[a].textAlign ? "2" : "3",
|
|
this.setData({
|
|
isShowInput: !0,
|
|
curTextValue: this.data.valueList[a].value,
|
|
curTextAlign: e
|
|
});
|
|
break;
|
|
|
|
case "video":
|
|
this.setData({
|
|
curVideoDisplay: this.data.valueList[a].displayType,
|
|
videoList: this.data.valueList[a].valueList,
|
|
isShowVideo: !0
|
|
});
|
|
break;
|
|
|
|
case "audio":
|
|
this.checkRecordPermission();
|
|
break;
|
|
|
|
case "photo":
|
|
this.setData({
|
|
curSelPhotoDisplay: this.data.valueList[a].displayType,
|
|
photoList: this.data.valueList[a].valueList,
|
|
isShowPhoto: !0
|
|
});
|
|
break;
|
|
|
|
case "map":
|
|
s.latitude = this.data.valueList[a].value.latitude, s.longitude = this.data.valueList[a].value.longitude,
|
|
this.doChooseLocation();
|
|
break;
|
|
|
|
case "select":
|
|
break;
|
|
|
|
case "link":
|
|
this.setData({
|
|
curLinkText: this.data.valueList[a].value,
|
|
isShowLink: !0
|
|
});
|
|
}
|
|
},
|
|
insertItem: function (t) {
|
|
this.setData({
|
|
isInsert: !this.data.isInsert
|
|
});
|
|
},
|
|
delItem: function (t) {
|
|
var a = this;
|
|
wx.showModal({
|
|
title: "提示",
|
|
content: "确定要删除该条数据吗?",
|
|
success: function (t) {
|
|
t.confirm && (a.data.valueList.splice(a.data.currentIndex, 1), a.setData({
|
|
valueList: a.data.valueList,
|
|
currentIndex: -1
|
|
}));
|
|
}
|
|
});
|
|
},
|
|
chooseTags: function (t) {
|
|
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.item;
|
|
this.data.optionsList[a].isSel = !e.isSel, this.setData({
|
|
optionsList: this.data.optionsList
|
|
});
|
|
},
|
|
doConfirmSel: function () {
|
|
var t = [];
|
|
this.data.optionsList.forEach(function (a) {
|
|
a.isSel && t.push(a);
|
|
});
|
|
var a = {
|
|
type: "select"
|
|
};
|
|
a.valueList = t, this.data.valueList.push(a), this.data.optionsList.forEach(function (t) {
|
|
t.isSel = !1;
|
|
}), this.setData({
|
|
valueList: this.data.valueList,
|
|
isShowSelect: !1,
|
|
optionsList: this.data.optionsList
|
|
});
|
|
},
|
|
doConfirmAudio: function () {
|
|
this.data.audioFile.isPlay && e.stop();
|
|
var t = {
|
|
type: "audio"
|
|
};
|
|
t.value = this.data.audioFile, this.data.audioFile.curDurationStr = "00:00", this.data.audioFile.curDuration = 0,
|
|
this.data.audioFile.isPlay = !1, "add" == this.data.sourceType ? this.data.valueList.push(t) : this.data.valueList.splice(this.data.currentIndex, "edit" == this.data.sourceType ? 1 : 0, t),
|
|
this.setData({
|
|
valueList: this.data.valueList,
|
|
audioFile: null,
|
|
isShowAudio: !1
|
|
});
|
|
},
|
|
checkRecordPermission: function () {
|
|
var t = this;
|
|
wx.getSetting({
|
|
success: function (a) {
|
|
a.authSetting["scope.record"] ? t.setData({
|
|
isShowAudio: !0
|
|
}) : wx.authorize({
|
|
scope: "scope.record",
|
|
success: function () {
|
|
t.setData({
|
|
isShowAudio: !0
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
startRecord: function () {
|
|
var t = this;
|
|
t.data.setInter = setInterval(function () {
|
|
var a = parseInt(t.data.audioDuration + 1);
|
|
t.setData({
|
|
audioDuration: parseInt(a),
|
|
isRecording: !0
|
|
});
|
|
}, 1e3), t.start();
|
|
},
|
|
start: function () {
|
|
console.log("开始录音");
|
|
recorderManager.start({
|
|
duration: 6e4,
|
|
format: "mp3"
|
|
}), recorderManager.onStart(function () {
|
|
console.log("recorder start");
|
|
}), recorderManager.onError(function (t) {
|
|
console.log(t), _self.stop(!1);
|
|
});
|
|
},
|
|
doEndRecord: function () {
|
|
var t = this;
|
|
clearInterval(t.data.setInter);
|
|
recorderManager.stop();
|
|
recorderManager.onStop(function (a) {
|
|
t.data.audioDuration < 10 ? wx.showToast({
|
|
title: "录音时长需大于10秒",
|
|
icon: "none"
|
|
}) : (a.isPlay = !1, a.durationStr = t.data.audioDuration + "", a.duration = t.data.audioDuration,
|
|
a.totalDurationStr = "00:" + (t.data.audioDuration > 9 ? t.data.audioDuration : "0" + t.data.audioDuration),
|
|
a.curDurationStr = "00:00", a.curDuration = 0, a.isPlay = !1, t.setData({
|
|
audioFile: a
|
|
})), t.setData({
|
|
audioDuration: 0,
|
|
isRecording: !1
|
|
});
|
|
});
|
|
},
|
|
delAudio: function () {
|
|
var t = this;
|
|
wx.showModal({
|
|
title: "警告",
|
|
content: "确定要删除该条录音吗?",
|
|
success: function (a) {
|
|
a.confirm && t.setData({
|
|
audioFile: null
|
|
});
|
|
}
|
|
});
|
|
},
|
|
closePop: function (t) {
|
|
var a = t.currentTarget.dataset.type, i = this;
|
|
a && "audio" == a && (null != i.data.audioFile ? (i.data.audioFile.isPlay && e.stop(),
|
|
wx.showModal({
|
|
title: "警告",
|
|
content: "关闭录音弹窗将清除当前录制的音频文件,确定要关闭吗?",
|
|
success: function (t) {
|
|
t.confirm && i.setData({
|
|
audioFile: null,
|
|
isShowAudio: !1
|
|
});
|
|
}
|
|
})) : i.setData({
|
|
isShowAudio: !1
|
|
})), this.setData({
|
|
isShowPhoto: !1,
|
|
isShowEdit: !1,
|
|
isShowVideo: !1,
|
|
isShowSelect: !1,
|
|
sourceType: "add"
|
|
});
|
|
},
|
|
slider4change: function (t) {
|
|
var a = t.currentTarget.dataset.item;
|
|
i = t.currentTarget.dataset.type;
|
|
s = t.currentTarget.dataset.idx;
|
|
o = Number.parseInt(t.detail.value);
|
|
a.isPlay && (e.pause(), e.seek(o), setTimeout(function () {
|
|
e.play();
|
|
}, 500), "record" == i ? (this.data.audioFile.curDuration = o, this.data.audioFile.curDurationStr = "00:" + (o > 9 ? o : "0" + o),
|
|
console.log(this.data.audioFile), this.setData({
|
|
audioFile: this.data.audioFile
|
|
})) : (this.data.valueList[s].value.curDuration = o, this.data.valueList[s].value.curDurationStr = "00:" + (o > 9 ? o : "0" + o),
|
|
this.setData({
|
|
valueList: this.data.valueList
|
|
})));
|
|
},
|
|
play: function (t) {
|
|
var a = t.currentTarget.dataset.item, i = this, s = t.currentTarget.dataset.type, o = t.currentTarget.dataset.idx;
|
|
a.isPlay ? e.stop() : ((e = wx.createInnerAudioContext()).src = a.tempFilePath,
|
|
e.autoplay = !0), e.onPlay(function () {
|
|
"record" == s ? (i.data.audioFile.isPlay = !0, i.setData({
|
|
audioFile: i.data.audioFile
|
|
})) : (i.data.valueList[o].value.isPlay = !0, i.setData({
|
|
valueList: i.data.valueList
|
|
}));
|
|
}), e.onStop(function (t) {
|
|
"record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
|
}), e.onEnded(function (t) {
|
|
"record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
|
}), e.onError(function (t) {
|
|
wx.showToast({
|
|
title: "播放失败",
|
|
icon: "error"
|
|
}), "record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
|
}), e.onTimeUpdate(function () {
|
|
var t = e.currentTime;
|
|
if ("record" == s) {
|
|
i.data.audioFile.curDuration = t;
|
|
var a = Number.parseInt(i.data.audioFile.curDuration);
|
|
i.data.audioFile.curDurationStr = "00:" + (a > 9 ? a : "0" + a), i.setData({
|
|
audioFile: i.data.audioFile
|
|
});
|
|
} else {
|
|
i.data.valueList[o].value.curDuration = t;
|
|
var u = Number.parseInt(i.data.valueList[o].value.curDuration);
|
|
i.data.valueList[o].value.curDurationStr = "00:" + (u > 9 ? a : "0" + u), i.setData({
|
|
valueList: i.data.valueList
|
|
});
|
|
}
|
|
});
|
|
},
|
|
setAudioDefault: function () {
|
|
null != this.data.audioFile && (this.data.audioFile.curDurationStr = "00:00", this.data.audioFile.curDuration = 0,
|
|
this.data.audioFile.isPlay = !1, this.setData({
|
|
audioFile: this.data.audioFile
|
|
}));
|
|
},
|
|
setShowAudioDefault: function (t) {
|
|
this.data.valueList[t].value.curDurationStr = "00:00", this.data.valueList[t].value.curDuration = 0,
|
|
this.data.valueList[t].value.isPlay = !1, this.setData({
|
|
valueList: this.data.valueList
|
|
});
|
|
},
|
|
rewind: function (t) {
|
|
var a = t.currentTarget.dataset.item, i = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.type;
|
|
a.isPlay && ("record" == s ? (this.data.audioFile.curDuration = this.data.audioFile.curDuration - this.data.speedStep,
|
|
e.seek(this.data.audioFile.curDuration), this.setData({
|
|
audioFile: this.data.audioFile
|
|
})) : (this.data.valueList[i].value.curDuration = this.data.valueList[i].value.curDuration - this.data.speedStep,
|
|
e.seek(this.data.valueList[i].value.curDuration), this.setData({
|
|
valueList: this.data.valueList
|
|
})));
|
|
},
|
|
speed: function (t) {
|
|
var a = t.currentTarget.dataset.item, i = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.type;
|
|
a.isPlay && ("record" == s ? (this.data.audioFile.curDuration = this.data.audioFile.curDuration + this.data.speedStep,
|
|
e.seek(this.data.audioFile.curDuration), this.setData({
|
|
audioFile: this.data.audioFile
|
|
})) : (this.data.valueList[i].value.curDuration = this.data.valueList[i].value.curDuration + this.data.speedStep,
|
|
e.seek(this.data.valueList[i].value.curDuration), this.setData({
|
|
valueList: this.data.valueList
|
|
})));
|
|
},
|
|
onUnload: function () {
|
|
i.setLocation(null), this.setData({
|
|
map: null
|
|
});
|
|
}
|
|
}); |