// pages/agreement/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { topBarH: app.globalData.CustomBar, url: '', title: '', currentIndex: 0, tabs: [{ lab: '用户协议' }, { lab: '隐私协议' }], dealContent:'', }, /** * 选择菜单 */ tabSelect: function (params) { this.data.currentIndex = params.currentTarget.dataset.index; console.log(this.data.currentIndex,'this.data.currentIndex==>'); this.setData(this.data); this.getDetail(); }, /** * 获取消息详情 */ getDetail: function () { let dealKeyWord = ''; if (this.data.currentIndex == 1) { dealKeyWord = 'privacy_deal'; }else{ dealKeyWord = 'user_deal'; } app.axios("GET", "app", `/sysKey/dealSetting/${dealKeyWord}`, {}, false).then(res => { console.log(res,'res===>'); if (res.code == 1) { this.data.dealContent = res.data.dealContent; this.setData(this.data) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getDetail() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })