123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- // pages/tabber/news/index.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- selectInfo: {},
- logolist: [
- {
- title: '创星汇科技园45栋门前',
- isp: 1,
- id: 0
- }, {
- title: '创星汇科技园45栋门前',
- isp: 0,
- id: 1
- }, {
- title: '创星汇科技园45栋门前',
- isp: 1,
- id: 2
- }, {
- title: '创星汇科技园45栋门前',
- isp: 0,
- id: 3
- }, {
- title: '创星汇科技园45栋门前',
- isp: 0,
- id: 5
- }, {
- title: '创星汇科技园45栋门前',
- isp: 0,
- id: 6
- }, {
- title: '创星汇科技园45栋门前',
- isp: 0,
- id: 7
- }, {
- title: '创星汇科技园45栋门前',
- isp: 1,
- id: 8
- }, {
- title: '创星汇科技园45栋门前',
- id: 9,
- isp: 1,
- }, {
- title: '创星汇科技园45栋门前',
- id: 10,
- isp: 1
- },
- ],
- state: "",
- detashow: 0,
- worke: {"title":"暂无数据",'distance':0,'collect_num':0,'give_num':0,'visit_time':'无','device_no':'无'},
- nearby:''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.DevicesList()
- },
- DevicesList(city_id = "", title = "", sort = "") {
- var that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/DevicesList", {
- lng: wx.getStorageSync('latitude'),
- lat: wx.getStorageSync('longitude'),
- city_id: city_id,
- title: title,
- sort: sort
- }, "get").then(function (res) {
- console.log(res);
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.navigateBack({
- delta: 1
- })
- wx.hideLoading();
- }, 1000);
-
- } else {
- wx.hideLoading();
- var dataList = res.message.data.list
- var nearby = res.message.data.nearby
-
- that.setData({
- logolist: dataList,
- nearby:nearby,
- })
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- // const query = wx.createSelectorQuery()
- // query.select('#nav').boundingClientRect((res) => {
- // console.log(res);
- // this.setData({
- // selectInfo: res
- // })
- // })
- // query.exec()
- },
- //点击变色 显示按钮
- seled: function (e) {
- this.setData({
- detashow: 2,
- });
- var that = this;
- var id = e.currentTarget.dataset.id
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/SelectNetworker", {
- lng: wx.getStorageSync('latitude'),
- lat: wx.getStorageSync('longitude'),
- id: id
- }, "get").then(function (res) {
- console.log(res);
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
- } else {
- wx.hideLoading();
- var worke = res.message.data
- if(worke){
- that.setData({
- worke: worke
- })
-
- }
-
- }
- }).catch(function (err) {
- wx.showLoading({
- title: '数据获取失败',
- })
- })
- },
- deta: function () {
- this.setData({
- detashow: 0,
- });
- return false;
- if (this.data.detashow) {
- this.setData({
- detashow: false,
- });
- } else {
- this.setData({
- detashow: true,
- });
- }
- },
- location(e){
- wx.openLocation({
- latitude: Number(e.currentTarget.dataset.lat),
- longitude:Number(e.currentTarget.dataset.lng)
- });
- }
- })
|