2024-02-21 17:43:11 +08:00

56 lines
1.0 KiB
JavaScript

let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
DOMAIN_NAME: app.DOMAIN_NAME,
currentTab: 0,
homelist: [],
name: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getList()
},
getList(searchValue) {
var that = this
app.AjaxRequest('post', {
'content-type': 'application/json'
}, '/user/search_customer', {
searchValue
}, function (res) {
if (res.code == 0) {
that.setData({
homelist: res.data
})
}
})
},
navDetail(e) {
const eventChannel = this.getOpenerEventChannel()
let homelist = this.data.homelist
let index = e.currentTarget.dataset.index
console.log(e)
wx.navigateBack({
url: '../logs/logs',
success() {
eventChannel.emit('acceptDataFromOpenedPage', {
data: homelist[index]
})
}
})
},
getName(e) {
this.setData({
name: e.detail.value
})
},
search() {
this.getList(this.data.name)
}
})