// package_first/pages/upload/index.js
import {getOpenidData} from '../../../utils/getUserInfo.js'

Page({

    /**
     * 页面的初始数据
     */
    data: {
        // 列表数据筛选条件
        list: [],
        current: "",
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.setData({ current: "/index/westreamScenery/page" })
    },

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

    /* 更新数据 */
    updateList(e) {
        let list = this.data.list.concat(e.detail || [])
        this.setData({ list })
    },
    /* 重置数据 */
    resetList() {
        this.setData({ list: [] })
    },
    /* 跳转上报问题页面 */
    uploadBeauty(e) {
        const openid = wx.getStorageSync('openid')
        if(openid) {
            wx.navigateTo({
                url: '/package_first/pages/uploadBeauty/index',
            })
        } else {
            getOpenidData().then(res=> {
                wx.navigateTo({
                    url: '/package_first/pages/uploadBeauty/index',
                })
            })
        }
    },
    /* 跳转至详情页 */
    showDetail(e) {
        let data = JSON.stringify(e.currentTarget.dataset.item)
        wx.navigateTo({
        url: '/package_first/pages/beautyDetail/index?data='+ encodeURIComponent(data),
        })
    }
})