const baseUrl = getApp(); const api = require('../../config/api.js'); const util = require('../../config/util.js'); Page({ onReady: function (e) { // 使用 wx.createAudioContext 获取 audio 上下文 context this.audioCtx = wx.createAudioContext('myAudio') }, /** * 页面的初始数据 */ data: { detailid: 0, voddetail: [], autodetail: [], baseurl: baseUrl.globalData.baseimgurl, replylist:[] }, audioPlay: function () { this.audioCtx.play() }, audioPause: function () { this.audioCtx.pause() }, audio14: function () { this.audioCtx.seek(14) }, audioStart: function () { this.audioCtx.seek(0) }, funplay: function () { console.log("audio play"); }, funpause: function () { console.log("audio pause"); }, funtimeupdate: function (u) { console.log(u.detail.currentTime); console.log(u.detail.duration); }, funended: function () { console.log("audio end"); }, funerror: function (u) { console.log(u.detail.errMsg); }, preview: function (params) { console.log(params); let that = this; let currentUrl = params.currentTarget.dataset.src; let arrindex = params.currentTarget.dataset.id; let picsid = params.currentTarget.dataset.pics; //单条信息ID console.log(picsid); let arr = []; arr[0] = that.data.baseurl + picsid console.log('-----'); console.log(arr); wx.previewImage({ current: currentUrl, // 当前显示图片的http链接 urls: arr // 需要预览的图片http链接列表 }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options); this.setData({ detailid: options.id }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { let id = this.data.detailid; this.msgdetail(id); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, msgdetail: function (e) { const that = this; let url = baseUrl.globalData.baseUrl + '/res/msgdetail'; var param = { id: e }; //此处为使用封装的post请求 util.post(url, param).then((res) => { console.log(res); that.setData({ voddetail: res.data }); }).catch((errMsg) => { console.log(errMsg); }); } })