Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-shop
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-shop
Commits
3928aea4
提交
3928aea4
authored
6月 15, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
d9a4754b
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
14 行增加
和
14 行删除
+14
-14
main.vue
src/components/layout/main.vue
+1
-12
main.js
src/main.js
+0
-1
index.js
src/store/index.js
+7
-1
axios.js
src/utils/axios.js
+6
-0
没有找到文件。
src/components/layout/main.vue
浏览文件 @
3928aea4
...
...
@@ -16,18 +16,7 @@ import AppBreadcrumb from './breadcrumb'
export
default
{
name
:
'AppMain'
,
props
:
{
hasBreadcrumb
:
{
type
:
Boolean
,
default
:
true
}
},
components
:
{
AppBreadcrumb
},
watch
:
{
$route
:
{
immediate
:
true
,
handler
()
{
// 没有shopId
if
(
!
this
.
$store
.
state
.
shopId
)
{
this
.
$router
.
push
({
path
:
'/shop'
})
}
}
}
}
components
:
{
AppBreadcrumb
}
}
</
script
>
...
...
src/main.js
浏览文件 @
3928aea4
...
...
@@ -13,7 +13,6 @@ Vue.use(ElementUI)
/* 导航守卫 */
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
before
.
update
(
to
,
from
,
next
)
next
()
})
Vue
.
prototype
.
msgCenter
=
new
Vue
()
...
...
src/store/index.js
浏览文件 @
3928aea4
...
...
@@ -37,10 +37,16 @@ const store = new Vuex.Store({
},
// 获取店铺信息
getShop
({
commit
,
state
})
{
getShopList
({
shop_id
:
state
.
shopId
}).
then
(
response
=>
{
getShopList
({
shop_id
:
state
.
shopId
})
.
then
(
response
=>
{
const
[
first
=
{}]
=
response
.
data
||
[]
commit
(
'setShop'
,
first
)
})
.
catch
(()
=>
{
commit
(
'setShop'
,
{})
commit
(
'setShopId'
,
''
)
window
.
localStorage
.
removeItem
(
'shopId'
)
})
},
// 获取商品分组列表
getGroups
({
commit
,
state
})
{
...
...
src/utils/axios.js
浏览文件 @
3928aea4
import
axios
from
'axios'
import
qs
from
'qs'
import
{
Message
}
from
'element-ui'
import
router
from
'@/router'
const
httpRequest
=
axios
.
create
({
// baseURL: webConf.others.baseUrl,
timeout
:
60000
,
...
...
@@ -35,6 +36,11 @@ httpRequest.interceptors.response.use(
function
(
response
)
{
const
{
data
}
=
response
if
(
data
.
code
)
{
if
(
data
.
code
===
1002
)
{
window
.
localStorage
.
removeItem
(
'shopId'
)
router
.
replace
(
'/shop'
)
return
Promise
.
reject
(
data
)
}
if
(
!
[
1010
,
1001
].
includes
(
data
.
code
))
{
Message
.
error
(
data
.
msg
||
data
.
message
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论