You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.2 KiB

5 years ago
// pages/user/service/index.js
import commonApi from "../../../utils/https/common"
4 years ago
import util from '../../../utils/util'
5 years ago
Page({
/**
* 页面的初始数据
*/
data: {
tags:[],
types:[],
typeId:null,
list:[],
total:1,
page_no:1,
typename:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 获取问题标签
commonApi._post("ics/getTags").then(res=>{
console.log(res)
this.setData({
tags:res.data
})
})
// 获取问题分类
commonApi._post("ics/getType").then(res=>{
this.setData({
types:res.data,
typeId:res.data[0].id,
typename:res.data[0].type_name
})
this.getList();
})
},
changeType:function(e){
this.setData({
typeId:e.currentTarget.dataset.type,
typename:e.currentTarget.dataset.typename,
list:[],
total:1,
page_no:1
})
this.getList();
},
getList:function(){
let list = this.data.list;
if(list.length>=this.data.total) return;
commonApi._post("ics/getQuestionByTypeId",{
type_id:this.data.typeId,
page_no:1,
3 years ago
page_num:5
5 years ago
}).then(res=>{
this.setData({
list:res.data.rows,
total:res.data.total,
page_no:this.data.page_no+1
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
4 years ago
5 years ago
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// this.getList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onShareTimeline: function() {
return {
title: '君到苏州-在线客服',
query: '',
imageUrl: 'https://static.ticket.sz-trip.com/xcxImages/zwt/logo.png'
}
5 years ago
}
})