123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- const app=getApp();
- const utils=require("../../../utils/http");
- let page=1;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- titlelist:[],
- videotop:'80',
- nowfirsTitle:'',
- loadFlag:false,
- datashow:false,
- imgUrl:app.globalData.imgUrl,
- nowArr:[],
- arri:0,
- nowtitle:'',
- type:0,
- firsTitext:'',
- nowTagText:'',
- secondtitlist:[],
- topdata:false,
- articlelist:[]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- wx.showLoading({
- title: '加载中...',
- })
- this.articletit();
- this.articleListfun();
- },
- articletit:function(){
- var that=this;
- utils.$post({
- url: app.globalData.webUrl + 'client/article/type',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{},
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- titlelist:res.data.data
- })
- }
- }
- })
- },
- firsttap:function(e){
- var that=this;
- if(e.currentTarget.dataset.fid!=''){
- that.setData({
- firsTitext:e.currentTarget.dataset.fid,
- nowTagText:'',
- videotop:'168',//顶部padding
- secondtitlist:that.data.titlelist[e.currentTarget.dataset.idx].sonLabel
- })
- }else{
- that.setData({
- firsTitext:e.currentTarget.dataset.fid,
- nowTagText:'',
- videotop:'80',//顶部padding
- secondtitlist:[]
- })
- }
- this.articleListfun()
- },
- childtypetap:function(e){
- this.setData({
- nowTagText:e.currentTarget.dataset.sid,
- })
- this.articleListfun();
- },
- articleListfun:function(){
- let that=this;
- page=1;
- utils.$post({
- url: app.globalData.webUrl + 'client/article/list',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- type: that.data.firsTitext,
- label: that.data.nowTagText,
- page: 1,
- limit: "10",
- keyword:''
- },
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- articlelist:res.data.data,
- datashow:true
- })
- }
- setTimeout(() => {
- wx.hideLoading()
- }, 1200);
-
- }
- })
- },
- onPageScroll:function(e){
- if(e.scrollTop>10){
- this.setData({
- topdata:true
- })
- }else{
- this.setData({
- topdata:false
- })
- }
- },
- casemsgTap:function(e){
- wx.navigateTo({
- url: '/customer/pages/decoratecasemsg/decoratecasemsg?aid='+e.currentTarget.dataset.tid
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- // stoptime=0;
- // setTimeout(function(){
- // stoptime=stoptime*1+1;
- // },1000)
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- let that=this;
- page=1;
- utils.$post({
- url: app.globalData.webUrl + 'client/article/list',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- type: that.data.firsTitext,
- label: that.data.nowTagText,
- page: 1,
- limit: "10",
- keyword:''
- },
- success: function (res) {
- wx.stopPullDownRefresh()
- if(res.data.code=='0'){
- that.setData({
- articlelist:res.data.data
- })
- }
- }
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- let that=this;
- page=page+1;
- utils.$post({
- url: app.globalData.webUrl + 'client/article/list',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- type: that.data.firsTitext,
- label: that.data.nowTagText,
- page: page,
- limit: "10",
- keyword:''
- },
- success: function (res) {
- let articlelist=that.data.articlelist;
- if(res.data.code=='0'){
- articlelist=articlelist.concat(res.data.data);
- that.setData({
- articlelist:articlelist
- })
- }
- }
- })
- },
- /**
- * 用户点击右上角分享
- */
- // onShareAppMessage: function () {
- // return {
- // title: '我是'+app.globalData.sharename+",这是我的个人微网。",
- // imageUrl:"../../../img/weiw.png",
- // path: '/pages/index/index?share_user_id='+this.data.share_user_id+"&sharename="+app.globalData.sharename
- // }
- // }
- })
|