fm_shared.js 1.83 KB
// myPackage/pages/fm_shared.js
import {
    GET_DEVICEFREG_SHAREDDETAIL
} from '../http/fm'
import {getStorageSync} from '../../utils/util'
var app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        userInfo: {},
        receiverId: '',
        accorderId: '',
        list: [],
        avatar: '',
        operation: ''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        let user = getStorageSync('user')
        console.log(user)
        this.setData({
            receiverId: options.receiverId,
            accorderId: options.accorderId,
            avatar: options.avatar || user.avatar,
            operation: options.operation || user.nickName
        })
        this.getList()
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    // 获取列表
    getList() {
        let _this = this;
        let oParams = {}

        if (this.data.receiverId) {
            oParams.receiverId = this.data.receiverId
        }

        if (this.data.accorderId) {
            oParams.accorderId = this.data.accorderId
        }
        GET_DEVICEFREG_SHAREDDETAIL(oParams).then(res => {
            if (res.code != 200) {
                return false;
            }
            _this.setData({
                list: res.data || []
            })

        })
    }

})