Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-shop-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-shop-show-h5
Commits
5d7878b1
提交
5d7878b1
authored
6月 02, 2021
作者:
pengxiaohui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调试购买下单页面接口
上级
c021d5ec
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
235 行增加
和
93 行删除
+235
-93
.config.dev.js
.config.dev.js
+10
-11
account.js
src/api/account.js
+10
-0
common.js
src/api/common.js
+7
-0
PhoneCodeLoginPopup.vue
src/components/PhoneCodeLoginPopup.vue
+37
-12
Before.js
src/components/beforeEnter/Before.js
+0
-27
main.js
src/main.js
+1
-1
BuyPopup.vue
src/pages/buy/components/BuyPopup.vue
+21
-17
index.vue
src/pages/buy/index.vue
+40
-10
index.vue
src/pages/home/index.vue
+2
-5
index.vue
src/pages/order/index.vue
+83
-7
routes.js
src/router/routes.js
+6
-0
axios.js
src/utils/axios.js
+3
-3
Before.js
src/utils/beforeEnter/Before.js
+15
-0
index.js
src/utils/beforeEnter/index.js
+0
-0
没有找到文件。
.config.dev.js
浏览文件 @
5d7878b1
module
.
exports
=
{
domain
:
'dev.ezijing.com'
,
url
:
'https://learn-api.ezijing.com/api'
,
// apiBaseURL: 'https://zy2.ezijing.com/',
url
:
'https://h5-shop2.ezijing.com/api'
,
webpack
:
{
externals
:
{
CKEDITOR
:
'window.CKEDITOR'
,
...
...
@@ -10,16 +9,16 @@ module.exports = {
regeneratorRuntime
:
'window.regeneratorRuntime'
,
wx
:
'window.wx'
,
WeixinJSBridge
:
'window.WeixinJSBridge'
},
devServer
:
{
proxy
:
{
'/api/shop'
:
{
target
:
'http://172.16.3.11:8089'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/api/shop'
:
''
}
}
}
}
// devServer: {
// proxy: {
// '/api/shop': {
// target: 'http://172.16.3.11:8089',
// changeOrigin: true,
// pathRewrite: { '^/api/shop': '' }
// }
// }
// }
},
ProvidePlugin
:
{},
others
:
{
...
...
src/api/account.js
浏览文件 @
5d7878b1
...
...
@@ -16,4 +16,13 @@ export function sendCode(data) {
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
data
})
}
// 通过手机号验证码注册并登陆
export
function
phoneCodeLogin
(
data
)
{
return
httpRequest
({
url
:
'/api/usercenter/user/register-and-login-by-mobile'
,
method
:
'post'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
},
data
})
}
\ No newline at end of file
src/api/common.js
浏览文件 @
5d7878b1
...
...
@@ -17,4 +17,10 @@ export function getGoodsList(data) {
*/
export
function
getGoodsSpecs
(
data
)
{
return
httpRequest
.
post
(
'/api/shop/commodity/spu/spec/value/search'
,
data
)
}
/**
* 创建订单
*/
export
function
createOrder
(
data
)
{
return
httpRequest
.
post
(
'/api/shop/order/add'
,
data
)
}
\ No newline at end of file
src/components/PhoneCodeLoginPopup.vue
浏览文件 @
5d7878b1
<
template
>
<van-popup
v-model=
"popupVisiable"
position=
"bottom"
class=
"buy-popup"
:style=
"
{ height: '60%' }" >
<h5>
手机号登录
</h5>
<van-form
:show-error=
"false"
@
failed=
"handFailed"
@
submit=
"handleSuccess"
>
<van-field
v-model=
"form.
phone"
name=
"phon
e"
label=
"手机号"
placeholder=
"请输入您的手机号"
:rules=
"[
{ required: true, message: '请输入您的手机号' }, { pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/, message: '手机号格式有误' }]" clearable/>
<van-form
:show-error=
"false"
@
submit=
"handleSuccess"
>
<van-field
v-model=
"form.
mobile"
name=
"mobil
e"
label=
"手机号"
placeholder=
"请输入您的手机号"
:rules=
"[
{ required: true, message: '请输入您的手机号' }, { pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/, message: '手机号格式有误' }]" clearable/>
<van-field
v-model=
"form.code"
name=
"code"
label=
"验证码"
placeholder=
"请输入手机验证码"
:rules=
"[
{ required: true, message: '请输入手机验证码' }]" clearable>
<template
#
button
>
<van-button
class=
"code-btn"
native-type=
"button"
size=
"small"
type=
"primary"
color=
"#F8F8F8"
:disabled=
"btnDisabled"
id=
"checkedCode"
@
click=
"sendCode"
>
获取验证码
</van-button>
</
template
>
</van-field>
<div
style=
"margin: 16px;"
>
<van-button
type=
"primary"
round
block
color=
"#C01540"
size=
"small"
>
登录
</van-button>
<van-button
type=
"primary"
round
block
color=
"#C01540"
size=
"small"
:disabled=
"payBtnDisabled"
>
登录
</van-button>
</div>
</van-form>
</van-popup>
</template>
<
script
>
import
{
Toast
}
from
'vant'
import
{
phoneCodeLogin
,
sendCode
}
from
'@/api/account'
import
store
from
'@/store'
const
MOBILE_REG
=
/^1
(
3
[
0-9
]
|4
[
01456879
]
|5
[
0-35-9
]
|6
[
2567
]
|7
[
0-8
]
|8
[
0-9
]
|9
[
0-35-9
])\d{8}
$/
export
default
{
props
:
{
...
...
@@ -29,9 +31,10 @@ export default {
popupVisiable
:
this
.
value
,
btnDisabled
:
false
,
form
:
{
phon
e
:
''
,
mobil
e
:
''
,
code
:
''
}
},
payBtnDisabled
:
false
}
},
watch
:
{
...
...
@@ -47,16 +50,13 @@ export default {
}
},
methods
:
{
handFailed
(
val
)
{
console
.
log
(
val
)
},
handleSuccess
(
val
)
{
console
.
log
(
val
)
this
.
fetchPhoneCodeLogin
(
)
},
sendCode
()
{
if
(
!
this
.
form
.
phon
e
)
{
if
(
!
this
.
form
.
mobil
e
)
{
Toast
(
'请填写手机号'
)
}
else
if
(
!
MOBILE_REG
.
test
(
this
.
form
.
phon
e
))
{
}
else
if
(
!
MOBILE_REG
.
test
(
this
.
form
.
mobil
e
))
{
Toast
(
'手机号格式错误'
)
}
else
{
this
.
fetchSendCode
()
...
...
@@ -80,7 +80,32 @@ export default {
}
},
1000
)
},
fetchSendCode
()
{}
fetchSendCode
()
{
const
params
=
{
account
:
this
.
form
.
mobile
,
service
:
'ezijing.com'
}
sendCode
(
params
).
then
(
res
=>
{
if
(
res
&&
res
.
code
===
0
)
{
Toast
.
success
(
'验证码发送成功'
)
}
else
{
Toast
.
error
(
res
.
msg
||
'发送验证码失败'
)
}
})
},
fetchPhoneCodeLogin
()
{
this
.
payBtnDisabled
=
true
phoneCodeLogin
(
this
.
form
).
then
(
async
res
=>
{
if
(
res
.
code
===
0
)
{
await
store
.
dispatch
(
'checkLogin'
)
Toast
.
success
(
'登录成功'
)
this
.
$emit
(
'input'
,
false
)
this
.
$emit
(
'loginSuccess'
)
}
else
{
Toast
.
error
(
res
.
msg
||
'登录失败'
)
}
})
}
}
}
</
script
>
...
...
src/components/beforeEnter/Before.js
deleted
100644 → 0
浏览文件 @
c021d5ec
import
store
from
'@/store'
export
default
class
Before
{
constructor
(
opt
)
{
this
.
opt
=
opt
||
{}
}
async
update
(
to
,
from
,
next
)
{
// 设置游客用户信息
const
{
user_id
:
userId
,
student_id
:
studentId
}
=
to
.
query
if
(
userId
&&
studentId
)
{
store
.
commit
(
'setGuestUser'
,
{
user_id
:
userId
,
student_id
:
studentId
})
}
// 创建游客用户
// await store.dispatch('createGuestUser')
const
isLogin
=
store
.
state
.
isLogin
||
(
await
store
.
dispatch
(
'checkLogin'
))
isLogin
&&
wx
.
miniProgram
.
postMessage
({
data
:
{
token
:
store
.
state
.
token
}
})
if
(
to
.
meta
.
requiredLogin
&&
!
isLogin
)
{
store
.
state
.
isWeapp
?
wx
.
miniProgram
.
redirectTo
({
url
:
'/pages/login/index'
})
:
next
(
`/login?redirect_uri=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
)
return
}
next
()
}
}
src/main.js
浏览文件 @
5d7878b1
...
...
@@ -8,7 +8,7 @@ import './style.scss' // 公共样式
import
'./assets/rem/rem.js'
import
MetaInfo
from
'vue-meta-info'
import
createBefore
from
'./
component
s/beforeEnter'
import
createBefore
from
'./
util
s/beforeEnter'
// vant
import
Vant
from
'vant'
...
...
src/pages/buy/components/BuyPopup.vue
浏览文件 @
5d7878b1
...
...
@@ -2,11 +2,11 @@
<van-popup
v-model=
"popupVisiable"
position=
"bottom"
class=
"buy-popup"
:style=
"
{ height: '60%' }" >
<div
class=
"goods-card van-hairline--bottom"
>
<div
class=
"thumb"
>
<img
:src=
"
goodsBuyInfo.
thumb"
>
<img
:src=
"thumb"
>
</div>
<div
class=
"content"
>
<div
class=
"price"
>
¥
<span>
{{
goodsBuyInfo
.
price
}}
</span></div>
<p
class=
"surplus"
>
剩余
{{
goodsBuyInfo
.
surplus
}}
</p>
<div
class=
"price"
>
¥
<span>
{{
price
}}
</span></div>
<p
class=
"surplus"
>
剩余
{{
surplus
}}
</p>
</div>
</div>
<van-field
label=
"规格"
class=
"tag-item"
>
...
...
@@ -53,9 +53,11 @@ export default {
goodsBuyInfo
:
{
thumb
:
'https://webapp-pub.oss-cn-beijing.aliyuncs.com/shop-h5/goods_01.png'
,
price
:
'350.00'
,
surplus
:
20
,
count
:
1
surplus
:
20
},
thumb
:
''
,
price
:
''
,
surplus
:
0
,
spec
:
''
,
specList
:
[],
form
:
{
...
...
@@ -94,6 +96,7 @@ export default {
options
:
{
handler
(
nv
)
{
// const specs = nv.specs
this
.
thumb
=
nv
.
thumb
const
fields
=
typeof
nv
.
fields
===
'string'
?
JSON
.
parse
(
nv
.
fields
)
:
undefined
if
(
Array
.
isArray
(
fields
))
{
this
.
assembleFields
(
fields
)
...
...
@@ -112,24 +115,26 @@ export default {
},
methods
:
{
handleTagSelected
(
val
)
{
console
.
log
(
val
)
this
.
goodsBuyInfo
.
price
=
val
.
price
this
.
goodsBuyInfo
.
surplus
=
val
.
stock
this
.
price
=
val
.
price
this
.
surplus
=
val
.
stock
},
handleSuccess
(
val
)
{
const
fields
=
[]
for
(
const
key
in
val
)
{
if
(
val
[
key
]
&&
key
.
includes
(
'field'
))
{
console
.
log
(
this
.
fieldsMap
[
key
])
const
obj
=
Object
.
assign
({},
this
.
fieldsMap
[
key
].
sourceData
,
{
value
:
val
[
key
]
})
fields
.
push
(
obj
)
}
}
console
.
log
(
fields
)
// const params = {
// shop_id: this.shop_id,
// spu_id: this.spu_id
// }
const
params
=
{
shop_id
:
this
.
shop_id
,
spu_id
:
this
.
spu_id
,
sku_id
:
this
.
spec
,
buy_count
:
this
.
form
.
count
,
payment_method
:
'8'
,
app_button_text
:
JSON
.
stringify
(
fields
)
}
this
.
$emit
(
'placeOrder'
,
params
)
},
assembleFields
(
list
)
{
const
fieldsMap
=
{}
...
...
@@ -158,7 +163,6 @@ export default {
fieldsMap
[
field
.
key
]
=
field
})
this
.
fieldsMap
=
fieldsMap
console
.
log
(
fieldsMap
)
},
fetchGoodsSpecs
()
{
const
params
=
{
...
...
@@ -169,8 +173,8 @@ export default {
this
.
specList
=
res
.
data
const
[
first
=
{}]
=
res
.
data
this
.
spec
=
first
.
spec_value_ids
this
.
goodsBuyInfo
.
price
=
first
.
price
this
.
goodsBuyInfo
.
surplus
=
first
.
stock
this
.
price
=
first
.
price
this
.
surplus
=
first
.
stock
})
}
}
...
...
src/pages/buy/index.vue
浏览文件 @
5d7878b1
<
template
>
<div
class=
"buy-container"
>
<van-swipe
class=
"my-swipe"
indicator-color=
"white"
>
<van-swipe-item
class=
"video"
v-if=
"details.main_chart_oss"
>
<video
:src=
"details.main_chart_oss"
controls=
"controls"
@
click=
"handleVideoClick"
ref=
"video"
></video>
<van-swipe-item
class=
"video"
v-if=
"details.main_chart_oss"
@
click=
"handleVideoClick"
>
<video
:src=
"details.main_chart_oss"
controls=
"controls"
ref=
"video"
></video>
<van-icon
:name=
"videoPlay ? 'pause-circle-o':'play-circle-o'"
/>
</van-swipe-item>
<van-swipe-item
v-for=
"item in imgList"
:key=
"item.url"
>
...
...
@@ -30,7 +30,7 @@
</div>
</div>
<div
class=
"item shop-item"
>
<van-cell
value=
"进点逛逛"
is-link
>
<van-cell
value=
"进点逛逛"
is-link
@
click=
"navShop(shopInfo.shop_id)"
>
<!-- 使用 title 插槽来自定义标题 -->
<template
#
title
>
<img
class=
"shop-logo"
:src=
"shopInfo.shop_logo"
>
...
...
@@ -41,14 +41,16 @@
<div
class=
"bottom-bar"
>
<van-button
type=
"primary"
round
block
color=
"#C01540"
size=
"small"
@
click=
"popupVisiable = true"
>
立即购买
</van-button>
</div>
<buy-popup
v-model=
"popupVisiable"
:options=
"popupOptions"
/>
<phone-code-login-popup
v-model=
"loginPopupVisiable"
/>
<buy-popup
v-model=
"popupVisiable"
:options=
"popupOptions"
@
placeOrder=
"handlePlaceOrder"
/>
<phone-code-login-popup
v-model=
"loginPopupVisiable"
@
loginSuccess=
"handleHasLogin"
/>
</div>
</template>
<
script
>
import
BuyPopup
from
'./components/BuyPopup.vue'
import
PhoneCodeLoginPopup
from
'@/components/PhoneCodeLoginPopup.vue'
import
{
getGoodsList
,
getShopList
}
from
'@/api/common.js'
import
{
getGoodsList
,
getShopList
,
createOrder
}
from
'@/api/common.js'
import
store
from
'@/store'
import
{
mapGetters
}
from
'vuex'
export
default
{
components
:
{
BuyPopup
,
PhoneCodeLoginPopup
},
data
()
{
...
...
@@ -59,18 +61,20 @@ export default {
details
:
{},
imgList
:
[],
shopInfo
:
{},
popupOptions
:
{}
popupOptions
:
{},
orderInfo
:
{}
}
},
computed
:
{
...
mapGetters
([
'user'
]),
query
()
{
return
this
.
$route
.
query
},
goods_id
()
{
return
this
.
query
.
id
||
'6805043172159258624'
return
this
.
query
.
goods_
id
||
'6805043172159258624'
},
shop_id
()
{
return
this
.
query
.
s_id
||
'6800681447305773056'
return
this
.
query
.
s
hop
_id
||
'6800681447305773056'
}
},
beforeMount
()
{
...
...
@@ -87,6 +91,26 @@ export default {
}
this
.
videoPlay
=
!
this
.
videoPlay
},
navShop
(
id
)
{
this
.
$router
.
push
({
path
:
'/shop'
,
query
:
{
shop_id
:
id
}
})
},
async
handlePlaceOrder
(
val
)
{
this
.
orderInfo
=
val
this
.
popupVisiable
=
false
const
isLogin
=
store
.
state
.
isLogin
||
(
await
store
.
dispatch
(
'checkLogin'
))
if
(
isLogin
)
{
this
.
handleHasLogin
()
}
else
{
this
.
loginPopupVisiable
=
true
}
},
handleHasLogin
()
{
const
params
=
Object
.
assign
({},
this
.
orderInfo
)
params
.
customer_id
=
this
.
user
.
id
params
.
customer_phone
=
this
.
user
.
phone
||
''
console
.
log
(
params
)
this
.
fetchPlaceOrder
(
params
)
},
fetchGoodsDetails
()
{
const
params
=
{
shop_id
:
this
.
shop_id
,
...
...
@@ -102,7 +126,8 @@ export default {
}
this
.
popupOptions
=
{
specs
:
first
.
spec
,
fields
:
first
.
app_button_text
fields
:
first
.
app_button_text
,
thumb
:
this
.
imgList
[
0
]
?
this
.
imgList
[
0
].
url
:
''
}
}
})
...
...
@@ -117,6 +142,11 @@ export default {
this
.
shopInfo
=
first
}
})
},
fetchPlaceOrder
(
params
)
{
createOrder
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
})
}
}
}
...
...
src/pages/home/index.vue
浏览文件 @
5d7878b1
...
...
@@ -38,10 +38,7 @@ export default {
components
:
{
AppSearchBar
},
data
()
{
return
{
goodsList
:
[
{
price
:
'350.00'
,
num
:
2
,
desc
:
'紫荆-Kelley MSF五期班开学典礼晚宴'
,
title
:
'紫荆-Kelley MSF五期班开学典礼晚宴'
,
thumb
:
'https://webapp-pub.oss-cn-beijing.aliyuncs.com/shop-h5/goods_01.png'
,
id
:
'111'
,
pay_count
:
222
},
{
price
:
'10.00'
,
num
:
2
,
desc
:
'描述信息'
,
title
:
'商品标题'
,
thumb
:
'https://img01.yzcdn.cn/vant/ipad.jpeg'
,
id
:
'222'
,
pay_count
:
222
}
]
goodsList
:
[]
}
},
computed
:
{
...
...
@@ -52,7 +49,7 @@ export default {
},
methods
:
{
handleClick
(
val
)
{
this
.
$router
.
push
({
path
:
'buy'
,
query
:
{
id
:
val
.
spu_id
,
s
_id
:
val
.
shop_id
}
})
this
.
$router
.
push
({
path
:
'buy'
,
query
:
{
spu_id
:
val
.
spu_id
,
shop
_id
:
val
.
shop_id
}
})
},
imgJsonParse
(
val
)
{
if
(
typeof
val
===
'string'
&&
typeof
JSON
.
parse
(
val
)
===
'object'
)
{
...
...
src/pages/order/index.vue
浏览文件 @
5d7878b1
...
...
@@ -3,7 +3,7 @@
<div
class=
"search-bar"
>
<van-icon
name=
"arrow-left"
/>
<van-search
v-model=
"
value
"
v-model=
"
search
"
shape=
"round"
size=
"small"
background=
"#f7f7f7"
...
...
@@ -11,20 +11,51 @@
/>
</div>
<van-tabs
v-model=
"active"
sticky
>
<van-tab
title=
"
标签 1
"
></van-tab>
<van-tab
title=
"
标签 2
"
></van-tab>
<van-tab
title=
"
标签 3
"
></van-tab>
<van-tab
title=
"
标签 4
"
></van-tab>
<van-tab
title=
"
全部
"
></van-tab>
<van-tab
title=
"
待付款
"
></van-tab>
<van-tab
title=
"
待发货
"
></van-tab>
<van-tab
title=
"
已完成
"
></van-tab>
</van-tabs>
<div
class=
"content"
></div>
<ul
class=
"order-list"
>
<li
class=
"order-item"
v-for=
"item in list"
:key=
"item.id"
>
<div
class=
"thumb"
>
<img
:src=
"item.thumb"
>
</div>
<div
class=
"content"
>
<div
class=
"status-row"
>
{{
item
.
status
|
statusFilter
}}
</div>
<div
class=
"title-row"
>
<div
class=
"title van-ellipsis"
>
{{
item
.
spu_name
}}
</div>
<div
class=
"price"
>
¥
{{
item
.
price
}}
</div>
</div>
<div
class=
"spec-row"
>
<p
class=
"spec"
>
{{
item
.
spec
}}
</p>
</div>
<div
class=
"sum_pay"
>
需付款¥
{{
item
.
sum_pay
}}
</div>
</div>
</li>
</ul>
</div>
</
template
>
<
script
>
const
statusMap
=
{
0
:
'等待买家付款'
,
1
:
'卖家已发货'
,
2
:
'交易完成'
}
export
default
{
data
()
{
return
{
search
:
''
,
active
:
''
,
list
:
[]
list
:
[
{
price
:
'350.00'
,
num
:
2
,
desc
:
'紫荆-Kelley MSF五期班开学典礼晚宴'
,
spu_name
:
'紫荆-Kelley MSF五期班开学典礼晚宴'
,
thumb
:
'https://webapp-pub.oss-cn-beijing.aliyuncs.com/shop-h5/goods_01.png'
,
id
:
'111'
,
pay_count
:
222
,
status
:
0
,
spec
:
'红,20'
,
sum_pay
:
'700.00'
},
{
price
:
'10.00'
,
num
:
1
,
desc
:
'描述信息'
,
spu_name
:
'商品标题'
,
thumb
:
'https://img01.yzcdn.cn/vant/ipad.jpeg'
,
id
:
'222'
,
pay_count
:
222
,
status
:
1
,
spec
:
'红,L'
,
sum_pay
:
'10.00'
}
]
}
},
filters
:
{
statusFilter
(
val
)
{
return
statusMap
[
val
]
}
}
}
...
...
@@ -52,4 +83,48 @@ export default {
}
}
}
.order-item
{
background
:
#fff
;
position
:relative
;
box-sizing
:border-box
;
padding
:
4vw
0
4vw
30vw
;
height
:
36vw
;
margin-top
:
15px
;
border-radius
:
3px
;
.thumb
{
width
:
26vw
;
height
:
26vw
;
position
:absolute
;
left
:
0
;
top
:
5vw
;
img
{
width
:
80%
;
display
:block
;
margin
:
10%
auto
;
}
}
.content
{
display
:flex
;
flex-direction
:column
;
height
:
100%
;
padding-right
:
10px
;
.status-row
{
line-height
:
0
.48rem
;
color
:
#C01540
;
text-align
:right
;
}
.title-row
{
line-height
:
30px
;
flex
:
1
;
display
:flex
;
.price
{
font-size
:
13px
;
}
.title
{
font-size
:
14px
;
flex
:
1
;
}
}
}
}
</
style
>
\ No newline at end of file
src/router/routes.js
浏览文件 @
5d7878b1
...
...
@@ -6,6 +6,12 @@ export default [
name
:
'Index'
,
component
:
()
=>
import
(
'../pages/home/index.vue'
)
},
/* 店铺 */
{
path
:
'/shop'
,
name
:
'Shop'
,
component
:
()
=>
import
(
'../pages/home/index.vue'
)
},
/* 商品购买页 */
{
path
:
'/buy'
,
...
...
src/utils/axios.js
浏览文件 @
5d7878b1
...
...
@@ -35,9 +35,9 @@ httpRequest.interceptors.response.use(
function
(
response
)
{
const
{
data
}
=
response
if
(
data
.
code
)
{
if
(
!
[
1010
,
1001
].
includes
(
data
.
code
))
{
Toast
.
fail
(
data
.
msg
||
data
.
message
)
}
//
if (![1010, 1001].includes(data.code)) {
//
Toast.fail(data.msg || data.message)
//
}
return
Promise
.
reject
(
data
)
}
return
data
...
...
src/utils/beforeEnter/Before.js
0 → 100644
浏览文件 @
5d7878b1
import
store
from
'@/store'
export
default
class
Before
{
constructor
(
opt
)
{
this
.
opt
=
opt
||
{}
}
async
update
(
to
,
from
,
next
)
{
const
isLogin
=
store
.
state
.
isLogin
||
(
await
store
.
dispatch
(
'checkLogin'
))
if
(
!
isLogin
)
{
// window.location.href = `${webConf.others.loginUrl}?rd=${encodeURIComponent(window.location.href)}`
next
()
}
next
()
}
}
src/
component
s/beforeEnter/index.js
→
src/
util
s/beforeEnter/index.js
浏览文件 @
5d7878b1
File moved
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论