123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- // lionfish_comshop/pages/user/articleProtocol.js
- var util = require('../../utils/util.js');
- var app = getApp();
- var WxParse = require('../../wxParse/wxParse.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: ''
- },
- token: '',
- id: 0,
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let id = options.id || 0;
- this.id = id;
- let about = options.about || 0;
- var token = wx.getStorageSync('token');
- this.token = token;
- wx.showLoading({ title: '加载中' });
- if (about){
- this.get_about_us();
- }else{
- this.get_article();
- }
- },
- /**
- * 获取列表
- */
- get_article: function () {
- let that = this;
- app.util.request({
- 'url': 'entry/wxapp/index',
- 'data': {
- controller: 'article.get_article',
- 'token': that.token,
- 'id': that.id
- },
- dataType: 'json',
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == 0) {
- var list = res.data.data;
- WxParse.wxParse('article', 'html', list.content, that, 15);
- wx.setNavigationBarTitle({
- title: list.title
- })
- }
- }
- })
- },
- /**
- * 获取列表
- */
- get_about_us: function () {
- let that = this;
- app.util.request({
- 'url': 'entry/wxapp/index',
- 'data': {
- controller: 'user.get_about_us'
- },
- dataType: 'json',
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == 0) {
- var list = res.data.data;
- WxParse.wxParse('article', 'html', list, that, 15);
- wx.setNavigationBarTitle({
- title: '关于我们'
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|