You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
3.6 KiB
156 lines
3.6 KiB
// 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)
|
|
}
|
|
})
|
|
}
|
|
|
|
}) |