Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
f8a9e4e4
Commit
f8a9e4e4
authored
Apr 30, 2019
by
Junling Bu
Browse files
chore[litemall-vue]: 删除vuex支持,目前暂时使用storage
parent
e77ce462
Changes
6
Hide whitespace changes
Inline
Side-by-side
litemall-vue/package.json
View file @
f8a9e4e4
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
"vee-validate"
:
"^2.1.4"
,
"vee-validate"
:
"^2.1.4"
,
"vue"
:
"^2.5.17"
,
"vue"
:
"^2.5.17"
,
"js-cookie"
:
"2.2.0"
,
"js-cookie"
:
"2.2.0"
,
"vuex"
:
"3.0.1"
,
"vue-router"
:
"^3.0.1"
,
"vue-router"
:
"^3.0.1"
,
"vuelidation"
:
"^1.1.0"
"vuelidation"
:
"^1.1.0"
},
},
...
...
litemall-vue/src/main.js
View file @
f8a9e4e4
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
App
from
'
./App.vue
'
;
import
App
from
'
./App.vue
'
;
import
router
from
'
./router
'
;
import
router
from
'
./router
'
;
import
store
from
'
./store
'
import
'
vant/lib/icon/local.css
'
;
import
'
vant/lib/icon/local.css
'
;
import
'
@/assets/scss/global.scss
'
;
import
'
@/assets/scss/global.scss
'
;
import
'
@/assets/scss/iconfont/iconfont.css
'
;
import
'
@/assets/scss/iconfont/iconfont.css
'
;
...
@@ -41,6 +40,5 @@ Vue.config.productionTip = false;
...
@@ -41,6 +40,5 @@ Vue.config.productionTip = false;
new
Vue
({
new
Vue
({
router
,
router
,
store
,
render
:
h
=>
h
(
App
)
render
:
h
=>
h
(
App
)
}).
$mount
(
'
#app
'
);
}).
$mount
(
'
#app
'
);
litemall-vue/src/store/getters.js
deleted
100644 → 0
View file @
e77ce462
const
getters
=
{
sidebar
:
state
=>
state
.
app
.
sidebar
,
language
:
state
=>
state
.
app
.
language
,
size
:
state
=>
state
.
app
.
size
,
device
:
state
=>
state
.
app
.
device
,
token
:
state
=>
state
.
user
.
token
,
avatar
:
state
=>
state
.
user
.
avatar
,
name
:
state
=>
state
.
user
.
name
,
introduction
:
state
=>
state
.
user
.
introduction
,
status
:
state
=>
state
.
user
.
status
,
roles
:
state
=>
state
.
user
.
roles
,
perms
:
state
=>
state
.
user
.
perms
,
setting
:
state
=>
state
.
user
.
setting
}
export
default
getters
litemall-vue/src/store/index.js
deleted
100644 → 0
View file @
e77ce462
import
Vue
from
'
vue
'
import
Vuex
from
'
vuex
'
import
app
from
'
./modules/app
'
import
user
from
'
./modules/user
'
import
getters
from
'
./getters
'
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
modules
:
{
app
,
user
},
getters
})
export
default
store
litemall-vue/src/store/modules/app.js
deleted
100644 → 0
View file @
e77ce462
import
Cookies
from
'
js-cookie
'
const
app
=
{
state
:
{
sidebar
:
{
opened
:
!+
Cookies
.
get
(
'
sidebarStatus
'
),
withoutAnimation
:
false
},
device
:
'
desktop
'
,
language
:
Cookies
.
get
(
'
language
'
)
||
'
en
'
,
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
},
mutations
:
{
TOGGLE_SIDEBAR
:
state
=>
{
if
(
state
.
sidebar
.
opened
)
{
Cookies
.
set
(
'
sidebarStatus
'
,
1
)
}
else
{
Cookies
.
set
(
'
sidebarStatus
'
,
0
)
}
state
.
sidebar
.
opened
=
!
state
.
sidebar
.
opened
state
.
sidebar
.
withoutAnimation
=
false
},
CLOSE_SIDEBAR
:
(
state
,
withoutAnimation
)
=>
{
Cookies
.
set
(
'
sidebarStatus
'
,
1
)
state
.
sidebar
.
opened
=
false
state
.
sidebar
.
withoutAnimation
=
withoutAnimation
},
TOGGLE_DEVICE
:
(
state
,
device
)
=>
{
state
.
device
=
device
},
SET_LANGUAGE
:
(
state
,
language
)
=>
{
state
.
language
=
language
Cookies
.
set
(
'
language
'
,
language
)
},
SET_SIZE
:
(
state
,
size
)
=>
{
state
.
size
=
size
Cookies
.
set
(
'
size
'
,
size
)
}
},
actions
:
{
toggleSideBar
({
commit
})
{
commit
(
'
TOGGLE_SIDEBAR
'
)
},
closeSideBar
({
commit
},
{
withoutAnimation
})
{
commit
(
'
CLOSE_SIDEBAR
'
,
withoutAnimation
)
},
toggleDevice
({
commit
},
device
)
{
commit
(
'
TOGGLE_DEVICE
'
,
device
)
},
setLanguage
({
commit
},
language
)
{
commit
(
'
SET_LANGUAGE
'
,
language
)
},
setSize
({
commit
},
size
)
{
commit
(
'
SET_SIZE
'
,
size
)
}
}
}
export
default
app
litemall-vue/src/store/modules/user.js
deleted
100644 → 0
View file @
e77ce462
import
{
authLoginByAccount
,
authLogout
,
authInfo
}
from
'
@/api/api
'
import
{
getToken
,
setToken
,
removeToken
}
from
'
@/utils/auth
'
const
user
=
{
state
:
{
user
:
''
,
status
:
''
,
code
:
''
,
token
:
getToken
(),
name
:
''
,
avatar
:
''
,
introduction
:
''
,
roles
:
[],
perms
:
[],
setting
:
{
articlePlatform
:
[]
}
},
mutations
:
{
SET_CODE
:
(
state
,
code
)
=>
{
state
.
code
=
code
},
SET_TOKEN
:
(
state
,
token
)
=>
{
state
.
token
=
token
},
SET_INTRODUCTION
:
(
state
,
introduction
)
=>
{
state
.
introduction
=
introduction
},
SET_SETTING
:
(
state
,
setting
)
=>
{
state
.
setting
=
setting
},
SET_STATUS
:
(
state
,
status
)
=>
{
state
.
status
=
status
},
SET_NAME
:
(
state
,
name
)
=>
{
state
.
name
=
name
},
SET_AVATAR
:
(
state
,
avatar
)
=>
{
state
.
avatar
=
avatar
},
SET_ROLES
:
(
state
,
roles
)
=>
{
state
.
roles
=
roles
},
SET_PERMS
:
(
state
,
perms
)
=>
{
state
.
perms
=
perms
}
},
actions
:
{
// 用户名登录
LoginByUsername
({
commit
},
userInfo
)
{
const
username
=
userInfo
.
username
.
trim
()
return
new
Promise
((
resolve
,
reject
)
=>
{
authLoginByAccount
(
username
,
userInfo
.
password
).
then
(
response
=>
{
const
token
=
response
.
data
.
data
commit
(
'
SET_TOKEN
'
,
token
)
setToken
(
token
)
resolve
()
}).
catch
(
error
=>
{
reject
(
error
)
})
})
},
// 获取用户信息
GetUserInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getUserInfo
(
state
.
token
).
then
(
response
=>
{
const
data
=
response
.
data
.
data
commit
(
'
SET_ROLES
'
,
data
.
roles
)
commit
(
'
SET_NAME
'
,
data
.
name
)
commit
(
'
SET_AVATAR
'
,
data
.
avatar
)
commit
(
'
SET_INTRODUCTION
'
,
data
.
introduction
)
resolve
(
response
)
}).
catch
(
error
=>
{
reject
(
error
)
})
})
},
// 登出
LogOut
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
authLogout
(
state
.
token
).
then
(()
=>
{
commit
(
'
Authorization
'
,
''
)
commit
(
'
avatar
'
,
''
)
commit
(
'
background_image
'
,
[])
commit
(
'
nickName
'
,
[])
removeToken
()
resolve
()
}).
catch
(
error
=>
{
reject
(
error
)
})
})
}
}
}
export
default
user
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment