12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import authorize from '@/common/authorize.js'
- import { formatDate } from '@/common/utilsTools.js'
- const state = {
- isIphoneX: false,
- isIphone: false,
- isActivity: false
- }
- const mutations = {
- login(state, provider) { //用户身份 1、协销 2、会员机构 3、供应商 4.普通机构
- state.hasLogin = true
- state.userInfo = provider
- uni.setStorage({ //缓存用户登陆状态
- key: 'userInfo',
- data: provider
- })
- },
- logout(state) {
- state.hasLogin = false
- state.userInfo = {}
- uni.removeStorage({
- key: 'userInfo'
- })
- uni.removeStorage({
- key: 'token'
- })
- },
- wxLogin(state, provider) {
- state.isWxAuthorize = true
- // console.log(state.isWxAuthorize)
- state.wechatUserInfo = provider
- uni.setStorageSync('_WX_State', true)
- uni.setStorage({ //缓存用户微信授权信息
- key: 'wechatUserInfo',
- data: provider
- })
- },
- updateStatus(state, provider) {
- let TIME = formatDate()
- console.log(`${TIME}`, provider)
- state.userInfo = provider
- uni.setStorage({ //缓存用户登陆状态
- key: 'userInfo',
- data: provider
- })
- },
- setActivity(state, variable) {
- state.isActivity = variable
- },
- setChangeVar(state, variable) {
- //获取设备信息是否为IphoneX
- state.isIphoneX = variable
- },
- setIsIphone(state, variable) {
- //获取设备信息是否为IphoneX
- state.isIphone = variable
- },
- setLoginType(state, variable) {
- //获取设备信息是否为IphoneX
- state.isLoginType = variable
- console.log(state.isLoginType)
- },
- setLoginProductId(state, variable) {
- //获取设备信息是否为IphoneX
- state.isLoginProductId = variable
- console.log(state.isLoginProductId)
- },
- setLoginOrderId(state, variable) {
- //获取设备信息是否为IphoneX
- state.isLoginOrderId = variable
- console.log(state.isLoginOrderId)
- },
- setWindowHeight(state, height) {
- state.windowHeight = height
- console.log(state.windowHeight)
- }
- }
- const actions = {
- setVariableFun: function(context, vData) {
- context.commit('setChangeVar', vData)
- },
- setIsIphoneFun: function(context, vData) {
- context.commit('setIsIphone', vData)
- },
- setActivityFn: function(context, vData) {
- context.commit('setActivity', vData)
- },
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|