Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
2a7ba4dd
Commit
2a7ba4dd
authored
Sep 21, 2019
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vuex
parent
e6b85eb8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
8 deletions
+47
-8
src/main.js
+2
-0
src/pages/index/index.vue
+16
-7
src/pages/login/index.vue
+1
-1
src/store/index.js
+11
-0
src/store/mutations.js
+9
-0
src/store/state.js
+8
-0
No files found.
src/main.js
View file @
2a7ba4dd
import
Vue
from
'vue'
import
App
from
'./App'
import
Store
from
'./store/index'
Vue
.
config
.
productionTip
=
false
App
.
mpType
=
'app'
Vue
.
prototype
.
$store
=
Store
const
app
=
new
Vue
(
App
)
app
.
$mount
()
src/pages/index/index.vue
View file @
2a7ba4dd
...
...
@@ -6,7 +6,7 @@
<
script
>
import
spokesman
from
"@/api/spokesman.js"
;
import
{
serialize
,
getQueryVariable
}
from
"@/utils/index"
;
import
{
serialize
,
getQueryVariable
}
from
"@/utils/index"
;
export
default
{
data
()
{
return
{
...
...
@@ -42,11 +42,21 @@ export default {
if
(
options
.
share
)
{
//来自分享
this
.
link
=
decodeURIComponent
(
options
.
share
);
this
.
spokesmanGroupId
=
getQueryVariable
(
this
.
link
,
"spokesmanGroupId"
);
this
.
spokesmanShopId
=
getQueryVariable
(
this
.
link
,
"spokesmanShopId"
);
this
.
spokesmanRelId
=
getQueryVariable
(
this
.
link
,
"spokesmanRelId"
);
this
.
spokesmanBindId
=
getQueryVariable
(
this
.
link
,
"spokesmanBindId"
);
this
.
spokesmanGroupId
=
getQueryVariable
(
this
.
link
,
"spokesmanGroupId"
)
||
""
;
this
.
spokesmanShopId
=
getQueryVariable
(
this
.
link
,
"spokesmanShopId"
)
||
""
;
this
.
spokesmanRelId
=
getQueryVariable
(
this
.
link
,
"spokesmanRelId"
)
||
""
;
this
.
spokesmanBindId
=
getQueryVariable
(
this
.
link
,
"spokesmanBindId"
)
||
""
;
if
(
this
.
spokesmanGroupId
!=
""
)
{
this
.
$store
.
commit
(
"setSpokesman"
,
{
spokesmanGroupId
:
this
.
spokesmanGroupId
,
spokesmanShopId
:
this
.
spokesmanShopId
,
spokesmanRelId
:
this
.
spokesmanRelId
,
spokesmanBindId
:
this
.
spokesmanBindId
});
}
this
.
page
=
""
;
this
.
params
=
""
;
}
else
if
(
options
.
from
&&
options
.
from
==
"h5login"
)
{
...
...
@@ -80,7 +90,6 @@ export default {
}
console
.
log
(
"url"
,
this
.
link
+
this
.
page
+
this
.
params
);
this
.
getSpokesman
();
//获取店铺信息
},
components
:
{
// card
...
...
src/pages/login/index.vue
View file @
2a7ba4dd
...
...
@@ -71,7 +71,7 @@ export default {
this
.
backParams
=
serialize
(
options
.
params
);
}
console
.
log
(
options
,
"登录页面"
,
this
.
backPath
,
this
.
backParams
);
//
console.log(this.$store.state.spokesmanGroupId,'-----------0---------------')
console
.
log
(
this
.
$store
.
state
.
spokesmanGroupId
,
'-----------0---------------'
)
this
.
getshop
();
this
.
init
();
},
...
...
src/store/index.js
0 → 100644
View file @
2a7ba4dd
import
Vue
from
"vue"
;
import
Vuex
from
"vuex"
;
import
state
from
"./state"
;
import
mutations
from
"./mutations"
Vue
.
use
(
Vuex
);
export
default
new
Vuex
.
Store
({
state
,
mutations
})
\ No newline at end of file
src/store/mutations.js
0 → 100644
View file @
2a7ba4dd
const
mutations
=
{
setSpokesman
(
state
,
obj
)
{
for
(
let
[
key
,
val
]
of
Object
.
entries
(
obj
))
{
state
[
key
]
=
val
;
}
}
}
export
default
mutations
\ No newline at end of file
src/store/state.js
0 → 100644
View file @
2a7ba4dd
const
state
=
{
spokesmanGroupId
:
""
,
spokesmanShopId
:
""
,
spokesmanRelId
:
""
,
spokesmanBindId
:
""
}
export
default
state
\ No newline at end of file
Write
Preview
Markdown
is supported
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