123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- // pages/home/map/list.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- workelist:[],
- status:"",
- inputValue:""
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.workDesc();
- this.setData({
- status:app.globalData.status
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- //网点列表
- workDesc:function(e){
- var that=this;
- var keyword=that.data.inputValue;
- console.log(keyword);
- var latitude=wx.getStorageSync('latitude');
- var longitude=wx.getStorageSync('longitude');
-
- app.api.useApi(app.globalData.baseAppUrl + "api", {
- lat: latitude,
- lng: longitude,
- keyword: keyword,
- }, "get").then(function (res) {
- if (res.code != 200) {
- wx.showLoading({
- title: '网点加载失败'+res.status,
- })
- } else {
- that.setData({
- workelist:res.message.data.data
- })
- }
- wx.hideLoading();
- }).catch(function (err) {
- console.log(222);
- })
- },
- bindKeyInput: function (e) {
- this.setData({
- inputValue: e.detail.value
- })
- },
- setworke(e){
- console.log(e);
- const network_id=e.currentTarget.dataset.id
- var that=this;
- app.api.useApi(app.globalData.baseAppUrl+"api/user/"+network_id+"/setNetwork",{
- },"post").then(function(res){
- if (res.code == 200) {
- wx.showLoading({
- title: '网点设置成功',
- })
- wx.setStorageSync('nid', network_id);
- setTimeout(function () {
- wx.switchTab({
- url: '/pages/tabber/home/index',
- })
-
- }, 1000)
-
-
-
- }
- }).catch(function(err){
- console.log(222);
- })
- },
- location(e){
- wx.openLocation({
- latitude: Number(e.currentTarget.dataset.lat),
- longitude:Number(e.currentTarget.dataset.lng)
- });
- }
- })
|