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.
109 lines
2.1 KiB
109 lines
2.1 KiB
5 years ago
|
// miniprogram/pages/LookMore/LookMore.js
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
Type:'',
|
||
|
data:[]
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (option) {
|
||
|
this.setData({
|
||
|
Type: option.Type//获取上一个页面传递过来的剧中类型
|
||
|
});
|
||
|
this.onQuery('video', this.data.Type);
|
||
|
},
|
||
|
//查询数据库
|
||
|
onQuery: function (d, style) {
|
||
|
const db = wx.cloud.database();
|
||
|
//var value= this.data.picture;
|
||
|
var me = this;
|
||
|
// 查询当前用户所有的 counters
|
||
|
db.collection(d).where({
|
||
|
style: style
|
||
|
}).get({
|
||
|
success: res => {
|
||
|
me.setData({
|
||
|
queryResult: JSON.stringify(res.data, null, 2),
|
||
|
|
||
|
})
|
||
|
var i;
|
||
|
console.log('[数据库] [查询记录] 成功: ', res);
|
||
|
var length = res.data.length;
|
||
|
for(i=0;i<length;i++){
|
||
|
var dataI="data["+i+"]";
|
||
|
var picture = res.data[i].picture;
|
||
|
this.setData({ [dataI]:picture })
|
||
|
console.log('[数据库] [查询记录] 成功: ',picture);
|
||
|
}
|
||
|
},
|
||
|
fail: err => {
|
||
|
wx.showToast({
|
||
|
icon: 'none',
|
||
|
title: '查询记录失败'
|
||
|
})
|
||
|
console.error('[数据库] [查询记录] 失败:', err)
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
bindViewDub(e) {
|
||
|
//console.log("你的路径是" + e.currentTarget.dataset.src);
|
||
|
var path = e.currentTarget.dataset.src;
|
||
|
wx.navigateTo({
|
||
|
url:'../Dubbing/Dubbing?path='+path,
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
}
|
||
|
})
|