import { get } from "../../utils/http" // pages/clientInfo/clientInfo.js Page({ /** * 页面的初始数据 */ data: { urls: [ "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto", "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto", "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto", "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto", "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto", "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto", "https://img0.baidu.com/it/u=3098615520,360170704&fm=26&fmt=auto", "https://img1.baidu.com/it/u=510862345,2249984174&fm=26&fmt=auto", "https://img2.baidu.com/it/u=2222750380,2392750381&fm=26&fmt=auto", ], sex: { 0: '保密', 1: '男', 2: '女' }, list: [], total: 0, page: 1, tags: ['美丽貌美','短短胳膊粗粗的腿','闭月羞花','人美声甜白富美'] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) if(options.userId) { this.setData({ userId: options.userId },() => { this.getUserInfo() this.getfeedbackList() }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if(this.data.page * 10 < this.data.total) { this.getfeedbackList(++this.data.page) } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, afterCalendarRender(e) { const calendar = this.selectComponent('#calendar').calendar console.log('afterCalendarRender -> calendar', calendar) const toSet = [ { year: 2021, month: 11, date: 15 }, { year: 2019, month: 3, date: 18 } ] calendar.setSelectedDates(toSet) }, /** * 图片预览 */ previewMedia(e) { let { idx,index } = e.currentTarget.dataset; let arr = this.data.list[idx].media_list let current = index wx.previewMedia({ sources: arr, current }) }, /** * 获取客户信息 * api/user/info */ getUserInfo(user_id) { let { userId } = this.data; get('api/user/info',{ user_id: userId },(res) => { this.setData({ userInfo: res.data }) console.log(res) }) }, /** * 获取订单反馈记录 * api/feedback/list/user */ getfeedbackList(_page) { let { page,list,userId } = this.data; get('api/feedback/list/user',{ user_id: userId, page: _page || page, limit: 10 },(res) => { console.log(res) res.data.list.forEach((item,index) => { item.media_list = JSON.parse(item.media_list) }) list.push(...res.data.list) this.setData({ list,total: res.data.total, }) }) } })