From 6bada63c77bf06be0fc37de8e652423b95cd2b04 Mon Sep 17 00:00:00 2001 From: dou18 <1550117198@qq.com> Date: Sun, 5 Jan 2020 23:27:37 +0800 Subject: [PATCH] second commit --- lookmyTxt/lookmyTxt.js | 129 +++++++++++++++++++++++++++++ lookmyTxt/lookmyTxt.json | 3 + lookmyTxt/lookmyTxt.wxml | 7 ++ lookmyTxt/lookmyTxt.wxss | 1 + lookmyVideo/lookmyVideo.js | 131 +++++++++++++++++++++++++++++ lookmyVideo/lookmyVideo.json | 3 + lookmyVideo/lookmyVideo.wxml | 6 ++ lookmyVideo/lookmyVideo.wxss | 1 + mine/mine.js | 156 +++++++++++++++++++++++++++++++++++ mine/mine.json | 3 + mine/mine.wxml | 22 +++++ mine/mine.wxss | 1 + 12 files changed, 463 insertions(+) create mode 100644 lookmyTxt/lookmyTxt.js create mode 100644 lookmyTxt/lookmyTxt.json create mode 100644 lookmyTxt/lookmyTxt.wxml create mode 100644 lookmyTxt/lookmyTxt.wxss create mode 100644 lookmyVideo/lookmyVideo.js create mode 100644 lookmyVideo/lookmyVideo.json create mode 100644 lookmyVideo/lookmyVideo.wxml create mode 100644 lookmyVideo/lookmyVideo.wxss create mode 100644 mine/mine.js create mode 100644 mine/mine.json create mode 100644 mine/mine.wxml create mode 100644 mine/mine.wxss diff --git a/lookmyTxt/lookmyTxt.js b/lookmyTxt/lookmyTxt.js new file mode 100644 index 0000000..b2be37f --- /dev/null +++ b/lookmyTxt/lookmyTxt.js @@ -0,0 +1,129 @@ +// miniprogram/pages/lookmyTxt/lookmyTxt.js +var CloudPath='' +var Path='' +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: '', + picturePath:'' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log("picture=" + options.picturepath); + Path = options.path; + this.setData({ + // list: options.list, + picturePath:options.picturepath, + path:Path + }) + this.onQuery() + //console.log('cloudpath'+CloudPath) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + RequestTxt:function(CloudPath){ + wx.request({//获取文本内容 + url: CloudPath, + header: { 'cntent-type': 'application/json;charset=utf-8' }, + success: (res) => { + console.log(res.data); + this.setData({ + list: res.data, + }) + try { + wx.setStorageSync('list', res.data) + } catch (e) { + }; + } + }) + }, + play:function(){ + wx.playVoice({ + filePath: Voice, + success: function () { + wx.showToast({ + title: '播放结束', + }) + }, + }) + }, + onQuery: function () { + const db = wx.cloud.database() + var i; + // 查询当前用户所有的 counters + console.log('path'+Path) + db.collection('text').where({ + picture:Path, + }).get({ + success: res => { + this.setData({ + queryResult: JSON.stringify, + }) + console.log('[数据库] [查询记录] 成功: ', res) + CloudPath=res.data[0].cloudPath; + this.RequestTxt(CloudPath) + console.log('cloudpathfhdkhkhk'+CloudPath) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '查询记录失败' + }) + console.error('[数据库] [查询记录] 失败:', err) + } + }) + } +}) diff --git a/lookmyTxt/lookmyTxt.json b/lookmyTxt/lookmyTxt.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/lookmyTxt/lookmyTxt.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/lookmyTxt/lookmyTxt.wxml b/lookmyTxt/lookmyTxt.wxml new file mode 100644 index 0000000..d87af4f --- /dev/null +++ b/lookmyTxt/lookmyTxt.wxml @@ -0,0 +1,7 @@ + + + + {{list}} + + + diff --git a/lookmyTxt/lookmyTxt.wxss b/lookmyTxt/lookmyTxt.wxss new file mode 100644 index 0000000..589a210 --- /dev/null +++ b/lookmyTxt/lookmyTxt.wxss @@ -0,0 +1 @@ +/* miniprogram/pages/lookmyTxt/lookmyTxt.wxss */ \ No newline at end of file diff --git a/lookmyVideo/lookmyVideo.js b/lookmyVideo/lookmyVideo.js new file mode 100644 index 0000000..75d149e --- /dev/null +++ b/lookmyVideo/lookmyVideo.js @@ -0,0 +1,131 @@ +// miniprogram/pages/lookmyVideo/lookmyVideo.js +var Path='' +var Voice='' +Page({ + + /** + * 页面的初始数据 + */ + data: { + muted:true, + src:'', + path:'', + cloudPath: '', + Works:[],//音频voice‘ + voice:'' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + var Path = options.path; + var a = Path.length; + Path = Path.substring(0, a - 5) + '.mp4' + this.setData({ + path: Path//根据图片路径得到相应的视频路径 + }); + //this.onQuery() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + this.audioCtx=wx.createAudioContext('myAudio') + this.audioCtx.setSrc(Voice); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + /**播放视频 */ + play(e) { + //执行全屏方法 + var videoContext = wx.createVideoContext('myvideo',this); + videoContext.requestFullScreen(); + this.setData({ + fullScreen:true + }) + this.audioCtx.play() + }, + /**关闭视屏 */ + closeVideo() { + //执行退出全屏方法 + var videoContext = wx.createVideoContext('myvideo', this); + videoContext.exitFullScreen(); + }, + /**视屏进入、退出全屏 */ + fullScreen(e){ + var isFull = e.detail.fullScreen; + //视屏全屏时显示加载video,非全屏时,不显示加载video + this.setData({ + fullScreen:isFull + }) + }, + onQuery: function () { + const db = wx.cloud.database() + var i; + var a = options.path.length + // 查询当前用户所有的 counters + db.collection('text').where({ + Picture:Path, + _openid:getApp().globalData.openid + }).get({ + success: res => { + this.setData({ + queryResult: JSON.stringify, + }) + console.log('[数据库] [查询记录] 成功: ', res) + CloudPath=res.data[0].cloudPath; + + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '查询记录失败' + }) + console.error('[数据库] [查询记录] 失败:', err) + } + }) +} +}) \ No newline at end of file diff --git a/lookmyVideo/lookmyVideo.json b/lookmyVideo/lookmyVideo.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/lookmyVideo/lookmyVideo.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/lookmyVideo/lookmyVideo.wxml b/lookmyVideo/lookmyVideo.wxml new file mode 100644 index 0000000..b888334 --- /dev/null +++ b/lookmyVideo/lookmyVideo.wxml @@ -0,0 +1,6 @@ + + + + + + diff --git a/lookmyVideo/lookmyVideo.wxss b/lookmyVideo/lookmyVideo.wxss new file mode 100644 index 0000000..c594f22 --- /dev/null +++ b/lookmyVideo/lookmyVideo.wxss @@ -0,0 +1 @@ +/* miniprogram/pages/lookmyVideo/lookmyVideo.wxss */ \ No newline at end of file diff --git a/mine/mine.js b/mine/mine.js new file mode 100644 index 0000000..bb85ab2 --- /dev/null +++ b/mine/mine.js @@ -0,0 +1,156 @@ +// miniprogram/pages/mine/mine.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + video:[],//视频数组 + txt:[], + Works:[]//音频 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.onQuery(), + this.onQueryT() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + //查看视频配音 + bindlookmyvedio:function(e){ + //console.log("你的路径是" + e.currentTarget.dataset.src); + var path = e.currentTarget.dataset.src; + wx.navigateTo({ + url: '../lookmyVideo/lookmyVideo?path='+path, + success: function (res) { console.log("成功") }, + fail: function (res) { console.log("失败"+res.data) }, + }) + }, + bindlookmytxt:function(e){ + //console.log("你的路径是" + e.currentTarget.dataset.src); + var path = e.currentTarget.dataset.src; + wx.navigateTo({ + url: '../lookmyTxt/lookmyTxt?path='+path, + success: function (res) { console.log("成功") }, + fail: function (res) { console.log("失败"+res.data) }, + }) + }, + onQuery: function () { + const db = wx.cloud.database() + var i; + // 查询当前用户所有的 counters + db.collection('user-video').where({ + _openid:getApp().globalData.openid + }).get({ + success: res => { + this.setData({ + queryResult: JSON.stringify, + }) + console.log('[数据库] [查询记录] 成功: ', res) + var j = res.data.length; + for (i = 0; i < j; i++) { + var videoI = "video[" + i + "]" + var length = res.data[i].VideoPath.length + var picture = res.data[i].VideoPath.substring(0, length-4) + 't.jpg'; + this.setData({ + [videoI]:picture, + }) + console.log('video'+picture) + } + + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '查询记录失败' + }) + console.error('[数据库] [查询记录] 失败:', err) + } + }) + }, + + onQueryT: function () { + const db = wx.cloud.database() + var i; + // 查询当前用户所有的 counters + db.collection('user-text').where({ + _openid:getApp().globalData.openid + }).get({ + success: res => { + this.setData({ + queryResult: JSON.stringify, + }) + console.log('[数据库] [查询记录] 成功: ', res) + var j = res.data.length; + for (i = 0; i < j; i++) { + var txtI = "txt[" + i + "]" + var text = "txt["+i+"]" + var picture = res.data[i].Picture; + this.setData({ + [txtI]:picture, + }) + console.log('text'+picture) + } + + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '查询记录失败' + }) + console.error('[数据库] [查询记录] 失败:', err) + } + }) + } + +}) \ No newline at end of file diff --git a/mine/mine.json b/mine/mine.json new file mode 100644 index 0000000..6f5247b --- /dev/null +++ b/mine/mine.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/mine/mine.wxml b/mine/mine.wxml new file mode 100644 index 0000000..d304968 --- /dev/null +++ b/mine/mine.wxml @@ -0,0 +1,22 @@ + + + + + +我的配音作品: + +视频配音 + + + + + + + +文本配音 + + + + + + diff --git a/mine/mine.wxss b/mine/mine.wxss new file mode 100644 index 0000000..41bd9ce --- /dev/null +++ b/mine/mine.wxss @@ -0,0 +1 @@ +/* miniprogram/pages/mine/mine.wxss */ \ No newline at end of file