qujingkind.js 2.3 KB
const app=getApp()
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		kindlist:[],
		show:true,
		showlist: 0,
		addressarr:[],
		sousuoword:true
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function (options) {
		this.getkindlist()
	},
  enterword(e) {
    console.log(e)
    this.setData({
      keyword: e.detail.value,
    })
	},
	sousuo(){
		wx.navigateTo({
			url: '/pages/qujingkindsecond/qujingkindsecond?keyword='+this.data.keyword,
		})
	},

	getkindlist(){
		console.log(9999)
    let that = this;
    let url = 'locat/search';
    app.post(url, 'post').then((res) => {
			console.log(res)
			that.setData({
				wordlist:res
			})
			that.data.wordlist.forEach(function(value,index,array){
				value.sel=false
			})
			that.setData({
				wordlist:that.data.wordlist
			})
			console.log(that.data.wordlist)

     
    }).catch((err) => {
    })
	},
	 // 搜素地名关键字
	 seladdress(e) {
    let that = this;
    let id = e.currentTarget.dataset.id;
		let index = e.currentTarget.dataset.index;
		let name=e.currentTarget.dataset.name
    // that.data.wordlist.forEach(function(value, indexk, array) {
    //   if (id == value.id) {
    //     value.sel = !value.sel;
    //     if (value.sel == true) {
    //       that.data.addressarr.push(value.id)
    //     } else {
    //       that.data.addressarr.forEach(function(value, indexl, array) {
    //         if (id == value) {
    //           that.data.addressarr.splice(indexl, 1)
    //         }
    //       })
    //     }
    //   }
    // })

    that.setData({
      address: that.data.address,
      addressarr: that.data.addressarr
    })
    wx.navigateTo({
      url: '/pages/qujingkindsecond/qujingkindsecond?sontype_id='+id+'&typename='+name
    })
  },

	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function () {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function () {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function () {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function () {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function () {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function () {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function () {

	}
})