yuminge-app/yun-min-program-plugin-master/packageE/groupCode/groupCodeSearch/groupCodeSearch.js

95 lines
1.8 KiB
JavaScript

// packageE/groupCode/groupCodeSearch/groupCodeSearch.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
key: "",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData();
},
back() {
wx.navigateBack({
delta: 1,
});
},
keyvalue(e) {
let key = e.detail.value;
this.setData({
key: key,
});
this.getData();
},
toDetails(e) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: "/packageE/groupCode/groupCodeLabel/groupCodeLabel?id=" + id,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
getData() {
var that = this;
let urlStr = app.getNetAddresss(
"plugin.group-code.api.group-code.search-list"
);
urlStr += "&search[code_name]=" + that.data.key;
app._postNetWork({
url: urlStr,
success: (resdata) => {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
this.setData({
list: res.data.list.data,
});
} else {
// wx.showToast({
// title: res.msg,
// icon: 'none'
// })
console.log(res.msg);
}
},
});
},
});