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.
181 lines
3.8 KiB
181 lines
3.8 KiB
5 years ago
|
// miniprogram/pages/dub/dub.js
|
||
|
const order = ['demo1', 'demo2', 'demo3']
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data:{
|
||
|
Lovedata:[],
|
||
|
Hisdata:[],
|
||
|
Docudata:[],
|
||
|
Comedydata:[],
|
||
|
Tragdydata:[],
|
||
|
Animadata:[],
|
||
|
Story:[],
|
||
|
Drama:[],
|
||
|
Pome:[],
|
||
|
Prse:[],
|
||
|
Novel:[],
|
||
|
Falbe:[],
|
||
|
toView:order[0],
|
||
|
style:''
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
var i=0;
|
||
|
this.setData({
|
||
|
toView: order[i]
|
||
|
})
|
||
|
this.onQuery('video', '爱情剧',0);
|
||
|
this.onQuery('video', '古装剧', 1);
|
||
|
this.onQuery('video', '悲剧', 4);
|
||
|
this.onQuery('video', '纪录片', 5);
|
||
|
this.onQuery('video', '动漫剧', 2);
|
||
|
this.onQuery('video', '喜剧', 3);
|
||
|
},
|
||
|
upper(e) {
|
||
|
|
||
|
},
|
||
|
scroll(e) {
|
||
|
|
||
|
},
|
||
|
lower(e) {
|
||
|
|
||
|
},
|
||
|
LookMore(e){
|
||
|
var type = e.currentTarget.dataset.name;
|
||
|
//console.log("你的剧种是" + type);
|
||
|
wx.navigateTo({
|
||
|
url: '../LookMore/LookMore?Type='+type,
|
||
|
//success: function (res) { console.log("成功")},
|
||
|
//fail: function (res) { console.log("失败")},
|
||
|
//complete: function (res) { console.log("完成") },
|
||
|
})
|
||
|
},
|
||
|
bindViewDub(e) {
|
||
|
//console.log("你的路径是" + e.currentTarget.dataset.src);
|
||
|
var path = e.currentTarget.dataset.src;
|
||
|
wx.navigateTo({
|
||
|
url:'../Dubbing/Dubbing?path='+path,
|
||
|
})
|
||
|
}, bindViewDub(e) {
|
||
|
//console.log("你的路径是" + e.currentTarget.dataset.src);
|
||
|
var path = e.currentTarget.dataset.src;
|
||
|
wx.navigateTo({
|
||
|
url: '../Dubbing/Dubbing?path=' + path,
|
||
|
})
|
||
|
},
|
||
|
//查询数据库
|
||
|
onQuery: function (d, style,flag) {
|
||
|
const db = wx.cloud.database();
|
||
|
var me = this;
|
||
|
var picture = new Array();
|
||
|
// 查询当前用户所有的 counters
|
||
|
db.collection(d).where({
|
||
|
style: style
|
||
|
}).get({
|
||
|
success: res => {
|
||
|
me.setData({
|
||
|
queryResult: JSON.stringify(res.data, null, 2),
|
||
|
})
|
||
|
if(flag==0){
|
||
|
this.setData({
|
||
|
'Lovedata[0]': res.data[0].picture,
|
||
|
'Lovedata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
if (flag == 1) {
|
||
|
this.setData({
|
||
|
'Hisdata[0]': res.data[0].picture,
|
||
|
'Hisdata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
if (flag == 2) {
|
||
|
this.setData({
|
||
|
'Animadata[0]': res.data[0].picture,
|
||
|
'Animadata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
if (flag ==3 ) {
|
||
|
this.setData({
|
||
|
'Comedydata[0]': res.data[0].picture,
|
||
|
'Comedydata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
if (flag == 4) {
|
||
|
this.setData({
|
||
|
'Tragdydata[0]': res.data[0].picture,
|
||
|
'Tragdydata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
if (flag == 5) {
|
||
|
this.setData({
|
||
|
'Docudata[0]': res.data[0].picture,
|
||
|
'Docudata[1]': res.data[1].picture
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
fail: err => {
|
||
|
wx.showToast({
|
||
|
icon: 'none',
|
||
|
title: '查询记录失败'
|
||
|
})
|
||
|
console.error('[数据库] [查询记录] 失败:', err)
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
default:{
|
||
|
|
||
|
},
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
}
|
||
|
})
|