/*
 * @Author: zhuangzhou zhuangzhou@btioe.com
 * @Date: 2020-01-01 23:30:14
 * @LastEditors: zhuangzhou zhuangzhou@btioe.com
 * @LastEditTime: 2022-05-04 17:42:52
 * @FilePath: /mlmt-mini/src/store/mutations.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as types from './mutation-types'
import cache from './../utils/cache'

const mutations = {
    // [方法名](参数1,参数2...){方法}
    [types.SET_THIRD](state, v) {
        if (!v) return
        state.openId = v.openid
        state.sessionKey = v.sessionKey
        state.unionId = v.unionid
    },
    [types.SET_OPEN_ID](state, v) {
        state.openId = v
    },
    [types.SET_SESSION_KEY](state, v) {
        state.sessionKey = v
    },
    [types.SET_UNION_ID](state, v) {
        state.unionId = v
    },
    [types.SET_TOKEN](state, v) {
        state.token = v
    },
    [types.SET_USER_INFO](state, v) {
        state.userInfo = v
    },
    [types.SET_PID](state, v) {
        state.pid = v
    },
    [types.SET_CHANNEL](state, v) {
        state.channel = v
    },
    [types.SET_ADID](state, v) {
        state.adid = v
    },
    [types.SET_CLICKID](state, v) {
        state.clickId = v
    },
    [types.SET_CALLBACK](state, v) {
        state.callback = v
    },
    [types.SET_PAYINFO](state, v) {
      console.log(v)
      state.payInfo = v
    },
    [types.LOGIN_OUT](state) {
        state.token = null
        state.userInfo = null
        cache.remove(cache.key.TEMP_TOKEN)
    },
    [types.SET_SYSTEM_INFO](state, v) {
        state.systemInfo = v
        state.isIphoneX = v.model.indexOf('iPhone X') != -1
    },
    [types.SET_LOADING](state, v) {
        state.loading = v
    },
    [types.SET_NOTIFY](state, v) {
        state.notify = v
    },
    [types.SET_PAGE_CONFIG](state, v) {
        state.pageConfig = v
    },
    [types.SET_CLOSE_VIBRATOR](state, v) {
        state.closeVibrator = v
    },
    [types.SET_CLOSE_ANIMAL](state, v) {
        state.closeAnimal = v
    },
    [types.SET_HIDE](state, v) {
        state.hide = v
    },
    [types.SET_SHARE_USERID](state, v) {
        state.shareUserId = v
    }
}

export default mutations
