import { $wuxToast } from '../../dist/index' var app = getApp() Page({ /** * 页面的初始数据 */ data: { lynr:'' }, onChange(e) { let that = this; let id = e.currentTarget.id; let values = e.detail.value; if (id == 'lynr') { that.setData({ lynr: values }); } }, getList: function () { let uid = app.globalData.openid; var that = this; wx.request({ url: app.data.resturl + '/lylist.action', data: { uid: uid }, success: function (res) { console.log(res); that.setData({ dlist: res.data.dlist }) } }) }, showError: function (info) { $wuxToast().show({ type: 'text', duration: 1500, color: '#fff', text: info }) }, saveInfo: function () { let lynr = this.data.lynr; if (lynr == null || lynr == '') { this.showError('请输入内容'); return; } let that = this; let uid = app.globalData.openid; wx.request({ url: app.data.resturl + '/addLiuyan.action', method: 'post', header: { 'content-type': 'application/x-www-form-urlencoded' }, data: { lynr: lynr, uid: uid }, success: function (res) { let code = res.data.code; if (code == 200) { that.getList(); } } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { var that = this that.getList(); } })