|
|
@@ -9,9 +9,7 @@ Page({
|
|
|
// lists: [
|
|
|
// "杀虫灯", "虫情测报", "气象站", "孢子仪", "监控"
|
|
|
// ],
|
|
|
- lists: [
|
|
|
- "杀虫灯", "虫情测报", "气象站", "孢子仪"
|
|
|
- ],
|
|
|
+ lists: [],
|
|
|
indexId: 0,
|
|
|
list: [],
|
|
|
page: 1,
|
|
|
@@ -25,28 +23,30 @@ Page({
|
|
|
// 左侧点击事件
|
|
|
jumpIndex(e) {
|
|
|
let index = e.currentTarget.dataset.menuindex
|
|
|
+ let id = e.currentTarget.dataset.id
|
|
|
let that = this
|
|
|
+ let name = id[index]
|
|
|
that.setData({
|
|
|
indexId: index
|
|
|
});
|
|
|
//判断当前要请求什么数据
|
|
|
- if (index == '0') {
|
|
|
+ if (name == '杀虫灯') {
|
|
|
//杀虫灯
|
|
|
var type = '2'
|
|
|
var img = 'wechat_photo/index/scd_2.png'
|
|
|
- } else if (index == '1') {
|
|
|
+ } else if (name == '测报灯') {
|
|
|
//虫情测报
|
|
|
var type = '3'
|
|
|
var img = 'wechat_photo/index/cbd_2.png'
|
|
|
- } else if (index == '2') {
|
|
|
+ } else if (name == '气象站') {
|
|
|
//气象站
|
|
|
var type = '5'
|
|
|
var img = 'wechat_photo/index/qxz_2.png'
|
|
|
- } else if (index == '3') {
|
|
|
+ } else if (name == '孢子仪') {
|
|
|
//孢子仪
|
|
|
var type = '7'
|
|
|
var img = 'wechat_photo/index/bzy_2.png'
|
|
|
- } else if (index == '4') {
|
|
|
+ } else if (name == '监控') {
|
|
|
//监控
|
|
|
var type = '6'
|
|
|
var img = 'wechat_photo/index/jk_2.png'
|
|
|
@@ -55,7 +55,7 @@ Page({
|
|
|
img: img
|
|
|
})
|
|
|
|
|
|
- var thaa = this;
|
|
|
+
|
|
|
wx.getStorage({
|
|
|
key: 'login',
|
|
|
success(res) {
|
|
|
@@ -224,22 +224,29 @@ Page({
|
|
|
console.log(res.data.dat)
|
|
|
wx.hideLoading()
|
|
|
var data = res.data.dat
|
|
|
+ var lists = that.data.lists
|
|
|
+ var lists = []
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
if (data[i] == 2) {
|
|
|
var scd = 'scd'
|
|
|
//杀虫灯
|
|
|
+ lists.push('杀虫灯')
|
|
|
} else if (data[i] == 3) {
|
|
|
var cbd = 'cbd'
|
|
|
//测报灯
|
|
|
+ lists.push('测报灯')
|
|
|
} else if (data[i] == 5) {
|
|
|
var qxz = 'qxz'
|
|
|
//气象站
|
|
|
+ lists.push('气象站')
|
|
|
} else if (data[i] == 6) {
|
|
|
//监控
|
|
|
var jk = 'jk'
|
|
|
+ lists.push('监控')
|
|
|
} else if (data[i] == 7) {
|
|
|
var bzy = 'bzy'
|
|
|
//孢子仪
|
|
|
+ lists.push('孢子仪')
|
|
|
}
|
|
|
// } else if (data[i] == 8) {
|
|
|
// var xy = 'xy'
|
|
|
@@ -247,6 +254,10 @@ Page({
|
|
|
// console.log('性诱')
|
|
|
// }
|
|
|
}
|
|
|
+ that.setData({
|
|
|
+ lists: lists
|
|
|
+ })
|
|
|
+ that.requestVideos(1)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -259,7 +270,7 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- this.requestVideos(1)
|
|
|
+ // this.requestVideos(1)
|
|
|
//判断当前账号
|
|
|
this.ceshi()
|
|
|
wx.showLoading({
|
|
|
@@ -327,24 +338,26 @@ Page({
|
|
|
requestVideos: function () {
|
|
|
var that = this;
|
|
|
var indexId = that.data.indexId
|
|
|
+ var lists = that.data.lists
|
|
|
+ var name = lists[indexId]
|
|
|
//判断当前要请求什么数据
|
|
|
- if (indexId == '0') {
|
|
|
+ if (name == '杀虫灯') {
|
|
|
//杀虫灯
|
|
|
var type = '2'
|
|
|
var img = 'wechat_photo/index/scd_2.png'
|
|
|
- } else if (indexId == '1') {
|
|
|
+ } else if (name == '测报灯') {
|
|
|
//虫情测报
|
|
|
var type = '3'
|
|
|
var img = 'wechat_photo/index/cbd_2.png'
|
|
|
- } else if (indexId == '2') {
|
|
|
+ } else if (name == '气象站') {
|
|
|
//气象站
|
|
|
var type = '5'
|
|
|
var img = 'wechat_photo/index/qxz_2.png'
|
|
|
- } else if (indexId == '3') {
|
|
|
+ } else if (name == '孢子仪') {
|
|
|
//孢子仪
|
|
|
var type = '7'
|
|
|
var img = 'wechat_photo/index/bzy_2.png'
|
|
|
- } else if (indexId == '4') {
|
|
|
+ } else if (name == '监控') {
|
|
|
//监控
|
|
|
var type = '6'
|
|
|
var img = 'wechat_photo/index/jk_2.png'
|