import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        clientType: "", // 当前环境类型 APP WeChat QQ
        isMiniProgram: false, // 程序判断当前环境是不是小程序
        miniProApp: true, // 分享是否落地小程序
        needDraw: true, //是否需要抽奖
        // ajax请求计数器
        axiosCounter: 0,

        token: "",
        activityId: "", //活动id
        templateId: '', //模板id
        isTemplate: false, //是否是模板
        shareUserId: '', //分享人id
        shareUserPin: '', //分享人pin
        userPin: '', //京东用户pin
        shopId: '', //店铺标识
        customerId: "", //C端用户标识
        nickName: '', //昵称
        userImg: '', //头像
        shareTitle: '', //分享标题
        shareImage: '', //分享图片
        shareContent: '', //分享内容
        jdActivityId: '', //京豆活动id
        appName: '', //prd
        nodeId: '',

        priviewId: '', //预览id

        teamId: '', //队伍id
        tabValue: '', //预览时期  1 签到期 2 领奖期 3 公告期 4 发起砍价 5 帮助砍价
        actName: '', //活动标题
        buttonClose: false, //遮罩层显示隐藏
        Resurrection: 0, //复活卡次数

        fenxiang: false,
    },
    mutations: {
        setFenXiang(state, value) {
            state.fenxiang = value;
        },
        setAppName(state, value) {
            state.appName = value;
        },
        setActName(state, value) {
            state.actName = value;
        },
        setToken(state, value) {
            state.token = value;
        },
        setActivityId(state, value) {
            state.activityId = value;
        },
        setTemplateId(state, value) {
            state.templateId = value;
        },
        setIsTemplate(state, value) {
            state.isTemplate = value;
        },
        setClientType(state, type) {
            state.clientType = type;
        },
        setShareUserId(state, type) {
            state.shareUserId = type;
        },
        setShareUserPin(state, type) {
            state.shareUserPin = type;
        },
        setUserPin(state, type) {
            state.userPin = type;
        },
        setShopId(state, type) {
            state.shopId = type;
        },
        setCustomerId(state, type) {
            state.customerId = type;
        },
        setNickName(state, type) {
            state.nickName = type;
        },
        setUserImg(state, type) {
            state.userImg = type;
        },

        setShareTitle(state, type) {
            state.shareTitle = type;
        },
        setShareImage(state, type) {
            state.shareImage = type;
        },
        setShareContent(state, type) {
            state.shareContent = type;
        },
        setJdActivityId(state, type) {
            state.jdActivityId = type;
        },

        setPriviewId(state, type) {
            state.priviewId = type;
        },
        setTabValue(state, type) {
            state.tabValue = type;
        },
        setNodeId(state, type) {
            state.nodeId = type;
        },
        setButtonClose(state, type) {
            state.buttonClose = type
        },
        setTeamId(state, type) {
            state.teamId = type;
        },
        setPriviewId(state, type) {
            state.priviewId = type;
        },

        setTabValue(state, type) {
            state.tabValue = type;
        },
        setNodeId(state, type) {
            state.nodeId = type;
        },
        setResurrection(state, type) {
            state.Resurrection = type
            console.log(type, state.Resurrection)
        },


        setMiniProgram(state, bool) {
            state.isMiniProgram = bool;
        },
        setMiniProApp(state, bool) {
            state.miniProApp = bool;
        },
        increase(state, num) {
            state.axiosCounter += num;
        },
        reduce(state, num) {
            state.axiosCounter -= num;
        },
    },



    actions: {},
    modules: {}
});