| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | |
| | | |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | // console.log(options, 'options'); |
| | | |
| | | this.setData({ |
| | | navBarHeight: navBarHeight, |
| | | barHeight: systInfo.statusBarHeight, |
| | |
| | | this.getNoteList() |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | onUnload() { |
| | | myAudio.src = '' |
| | | myAudio.destroy() |
| | | |
| | | this.setData({ |
| | | myAudioPos: '', |
| | | isplay: false, //是否默认播放, |
| | | myAudioCurrent: '00:00', // 当前播放进度 |
| | | showData: '', |
| | | }); |
| | | myAudio.src = '' |
| | | |
| | | |
| | | console.log(this.data.myAudioPos, this.data.isplay, this.data.myAudioCurrent, this.data.showData, myAudio.src); |
| | | // console.log(myAudio.src); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | * |
| | |
| | | submitTitle: this.data.bookName, |
| | | dialogKey: true, |
| | | textvalue: '' |
| | | |
| | | |
| | | }); |
| | | }, |
| | | |
| | | closeDialog() { |
| | | |
| | | this.setData({ |
| | | dialogKey: false |
| | | }); |
| | |
| | | titleName: items.name |
| | | }) |
| | | this.pubulicPlayFun() |
| | | console.log(index, 'index'); |
| | | |
| | | let selectedIndex = index; // 存储选中项的索引 |
| | | this.setData({ |
| | | selectedId: selectedIndex // 设置选中项的索引 |
| | |
| | | }) |
| | | |
| | | const item = e.currentTarget.dataset.item |
| | | console.log(item, 'item0980'); |
| | | |
| | | if (this.data.showData != '') { |
| | | |
| | | |
| | |
| | | selectedId: e.currentTarget.dataset.index, |
| | | showData: '' |
| | | }) |
| | | console.log(e.currentTarget.dataset.index, 'e.currentTarget.dataset.index'); |
| | | |
| | | if (item.selectType == "audio") { |
| | | this.setData({ |
| | | showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file |
| | |
| | | res.datas.forEach((item) => { |
| | | |
| | | item.createDate = this.convertTimestamp(item.createDate) |
| | | console.log(item, 'item789'); |
| | | |
| | | }) |
| | | this.setData({ |
| | | "pageCount.total": res.totalSize, |
| | |
| | | }, |
| | | // 新建笔记接口 |
| | | async makeNote() { |
| | | const token = wx.getStorageSync('jsek-token') |
| | | if (!token) { |
| | | return wx.getUserProfile({ |
| | | desc: '用户登录', |
| | | success: (res) => { |
| | | // console.log(res); |
| | | } |
| | | }) |
| | | } |
| | | // const token = wx.getStorageSync('jsek-token') |
| | | // if (!token) { |
| | | // return wx.getUserProfile({ |
| | | // desc: '用户登录', |
| | | // success: (res) => { |
| | | // // console.log(res); |
| | | // } |
| | | // }) |
| | | // } |
| | | let topicId |
| | | await app.MG.ugc |
| | | .getProductUserSubmitTopic({ |
| | |
| | | // 播放公共代码 |
| | | pubulicPlayFun() { |
| | | myAudio.src = this.data.showData |
| | | console.log(myAudio.src); |
| | | // console.log(myAudio.src); |
| | | // 在onCanplay里获取并设置音频时长和播放进度 |
| | | myAudio.onCanplay(() => { |
| | | myAudio.duration; //必须写,不然获取不到。。。 |
| | | setTimeout(() => { |
| | | console.log(myAudio.duration, 'myAudio.duration'); |
| | | this.setData({ |
| | | myAudioDuration: this.format(myAudio.duration), |
| | | myAudioCurrent: this.format(myAudio.currentTime) |
| | |
| | | myAudioCurrent: this.format(myAudio.currentTime) |
| | | }); |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | //播放 |
| | | play() { |
| | | console.log(22222); |
| | | myAudio.startTime = this.data.myAudioCurrent; //考虑到进度条被拖动,不一定从00:00:00开始 |
| | | myAudio.play(); |
| | | this.setData({ |
| | | isplay: true |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | // 停止 |
| | | stop() { |
| | | |
| | | myAudio.pause(); |
| | | this.setData({ |
| | | isplay: false |