<script>
export default {
    onLaunch: async function (option) {
        const self = this;

        self.$store.commit("user/update", {
            init: false,
        });
        // 调试开关
        uni.setEnableDebug({
            enableDebug: process.env.VUE_APP_ENV === "develop",
        });

        // 开发版设置
        if (process.env.VUE_APP_ENV === "develop") {
            // 打印接收参数
            console.log(option);
        }

        let user = this.$store.state.user.user;
        self.$store.commit("common/update", {
            tabList: [
                {
                    id: 1,
                    name: "订单",
                    imgOff: "../../static/tabBar/icon_green_1.png",
                    imgOn: "../../static/tabBar/icon_green_1_select.png",
                    url: "/pages/index/index",
                    hide: false,
                },
                {
                    id: 2,
                    name: "管理",
                    imgOff: "../../static/tabBar/icon_green_2.png",
                    imgOn: "../../static/tabBar/icon_green_2_select.png",
                    url: "/pages/manage/index",
                    hide: false,
                },
                {
                    id: 4,
                    name: "直邮",
                    imgOff: "../../static/tabBar/icon_green_3.png",
                    imgOn: "../../static/tabBar/icon_green_3_select.png",
                    url: "/pages/youxuan/brand",
                    hide: false,
                },
                {
                    id: 3,
                    name: "群助理",
                    imgOff: "../../static/tabBar/icon_green_4.png",
                    imgOn: "../../static/tabBar/icon_green_4_select.png",
                    url: "/pages/assistant/index",
                    hide: false,
                },
            ],
        });
    },

    onShow: async function (option) {
        const self = this;
        uni.getSystemInfo({
            success: (res) => {
                console.log(res);
            },
        });

        // 保存盒子id
        if (option.query.bid) {
            self.$store.commit("user/update", {
                boxId: option.query.bid,
            });
        }

        // 保存预览类型
        if (option.query.preview) {
            self.$store.commit("common/update", {
                preview: option.query.preview,
            });
        }

        // 登录处理
        // this.fn.roleHandle();
        // await self.fn.getToken(option)
        // self.fn.getStoreList();

        // 修改配置
        // self.fn.setConfig()
    },

    onHide: function () {
        const self = this;

        self.$store.commit("user/update", {
            init: false,
        });
    },
};
</script>

<style lang="scss">
@import "common/scss/main";
@import "common/iconfont/index.css";

page {
    background-color: #f8f8f8;
}
.page--iphoneX {
    padding-bottom: px(30);
}
.tabbar-page {
    padding-bottom: 3rem;
}
</style>
