html52.com
我爱小程序-开发者交流社区

scroll-view 问题?

多次(10次左右)切换左边和右边的一样了

多次(10次左右)切换左边和右边的一样了

网友回复

葱头:

我打印是接口返回数据变了,但是postman多次测试没有错误

var httpClient = require('../utils/HttpClient.js');

var tools = require('../utils/util.js');

import url from "../utils/apiUrl.js"

var pageData = {

   //被点击的左侧菜单

   currentIndex:0,

   //右侧内容的滚动条距离顶部的距离

   scrollTop:0,

    //左侧菜单的数据

    leftMenuList:[],

   //右侧列表

   rightList:[],

   type:'',

   id:'',

   skip:'',

   jobIndustryParent:'1001',

   height:''

};


var methods = {

  //获取行业左侧内容

  getLeftMenuList(){

    let that=this

    httpClient.get(url.getJobIndustryList).then(function(r){

      console.log('11111',url.getJobIndustryList);

      console.log('左边',r)

      //构造左侧的大菜单数据

  let leftMenuList=r

  //console.log("左侧菜单",leftMenuList);

  that.setData({

    leftMenuList,

    

  })

    })

},

  //获取行业信息右侧内容

  getJobIndustryList(value){

    wx.showLoading({

        title: '正在加载...',

      });

      let that=this

      httpClient.get(url.getJobIndustryList+"?parent_no="+value).then(function(r){

        wx.hideLoading();

        console.log('右边',r)

        //构造左侧的大菜单数据

    let rightList=r

    //console.log("右侧菜单",rightList);

    that.setData({

      rightList,

      

    })

      })

  },

  //右侧行业信息传参跳转

  rightClick(e){

     const {industry}=e.currentTarget.dataset

     const {name}=e.currentTarget.dataset

     const {type}=e.currentTarget.dataset;

    // console.log('industryNo',industry);

     //console.log('name',name);

    // console.log('type',type);

     //console.log('id',this.data.id);

    let jobIndustryParent=this.data.jobIndustryParent

     //企业行业

     if(this.data.skip==1){

      var parentPage= tools.getPage(getCurrentPages(),'pages/enterpris-data-entry/enterpris-data-entry');

    //console.log('parentPage',parentPage);

    parentPage.changeIndustry(industry,name,jobIndustryParent)

    wx.navigateBack({

      delta: 1

    });

     }

     else if(this.data.skip==3){

      var parentPage= tools.getPage(getCurrentPages(),'pages/new-posts-added/new-posts-added');

    //console.log('parentPage',parentPage);

    parentPage.changeIndustry(industry,name)

    wx.navigateBack({

      delta: 1

    });

     }

     else{

      var parentPage= tools.getPage(getCurrentPages(),'pages/job-intention/job-intention');

    //console.log('parentPage',parentPage);

    parentPage.changeIndustry(industry,name)

    wx.navigateBack({

      delta: 1

    });

     }

  },

  //获取职位左侧内容

  getJobPositionList(value){

    let that=this

    httpClient.get(url.getJobPositionList).then(function(r){

      console.log('22222',url.getJobPositionList);

      console.log('左边',r)

      //构造左侧的大菜单数据

  let leftMenuList=r

  //console.log("左侧菜单",leftMenuList);

  that.setData({

    leftMenuList,

    

  })


    })

},

  //获取职位右侧内容

  getJobIndustryList2(value){

    //console.log('value',value);

  wx.showLoading({

      title: '正在加载...',

    });

    let that=this

    httpClient.get(url.getJobPositionList+"?parent_no="+value).then(function(r){

      wx.hideLoading();

      console.log('右边',r)

      //构造左侧的大菜单数据

  let rightList=r

  //console.log("右侧菜单",rightList);

  that.setData({

    rightList,

    

  })

    })

},

//右侧职位菜单传参跳转

positionClick(e){

  const {industry}=e.currentTarget.dataset

  const {name}=e.currentTarget.dataset

  const {type}=e.currentTarget.dataset;

  const {positionno}=e.currentTarget.dataset;

  if(this.data.skip==2){

    var parentPage= tools.getPage(getCurrentPages(),'pages/new-posts-added/new-posts-added');

    parentPage.changePositionName(name,positionno)

    wx.navigateBack({

      delta: 1

    });

  }else{

    var parentPage= tools.getPage(getCurrentPages(),'pages/job-intention/job-intention');

    parentPage.changePositionName(name,positionno)

    wx.navigateBack({

      delta: 1

    });

  }

},

  //左侧菜单点击事件

  handleItemTap(e){

  const {index}=e.currentTarget.dataset;

  const {industry}=e.currentTarget.dataset;

  const {type}=e.currentTarget.dataset;

  if(type==1){

    this.getJobIndustryList(industry)

  }else{

    this.getJobIndustryList2(industry)

  }

  //console.log(e.currentTarget.dataset);

  let jobIndustryParent=this.data.leftMenuList[index].industryNo

  this.setData({

    currentIndex:index,

    /* 重新设置 右侧内容的 scroll-view标签的距离顶部的距离*/

    scrollTop:0,

    jobIndustryParent

  })

},

//返回带参

back(e){

  const {id}=e.currentTarget.dataset

  //console.log('id back',id);

  wx.navigateBack({

    delta: 1

  });

},

}

module.exports = {

  pageData: pageData,

  methods: methods


}

}

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付