// pages/user/service/list/index.js import util from "../../../../utils/util" import commonApi from "../../../../utils/https/common" Page({ /** * 页面的初始数据 */ data: { typeid:null, tagid:null, list:[], total:1, page_no:1, keyword:"", showModal: false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(options.tagid){ this.setData({ tagid:options.tagid }) } else if(options.typeid){ this.setData({ typeid:options.typeid }) } else { util.back(); return; } this.getList(); }, changeKeyword:function(e){ this.setData({ keyword:e.detail.value }) }, search:function(){ this.setData({ list:[], total:1, page_no:1 }) this.getList(); }, showService:function(){ util.pagePoint({ event:'customer_service_human_click' },1) wx.showModal({ title: '提示', content: '呼叫人工客服\n0512-66555111', confirmColor:"#0B898E", success (res) { if (res.confirm) { wx.makePhoneCall({ phoneNumber: '0512-66555111', }) } else if (res.cancel) { } } }) }, getList:function(){ let service = "ics/getQuestionByTypeId",data={ type_id:this.data.typeid, tag_id:this.data.tagid, page_no:this.data.page_no, page_num:10, keywords:this.data.keyword },list = this.data.list; if(list.length>=this.data.total) return; if(this.data.tagid){ service="ics/getQuestionByTagId" } commonApi._post(service,data).then(res=>{ this.setData({ list:list.concat(res.data.rows), total:res.data.total, page_no:this.data.page_no+1 }) }) }, showDialogBtn: function () { this.setData({ showModal: true }) }, hideModal: function () { this.setData({ showModal: false }); }, onCancel: function () { this.hideModal(); }, onConfirm: function (e) { console.log(e.currentTarget.dataset.name); this.hideModal(); }, phoneCall:function(){ console.log(1111); wx.makePhoneCall({ phoneNumber: '0512-66555111', }) }, phoneCall2:function(){ console.log(1111); wx.makePhoneCall({ phoneNumber: '18915532527', }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.getList() } })