Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
transport-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
transport-show-h5
Commits
109db5f1
提交
109db5f1
authored
7月 02, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updata
上级
98d8617a
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
83 行增加
和
2 行删除
+83
-2
base_api.js
src/api/base_api.js
+9
-0
pay.js
src/api/pay.js
+24
-0
main.js
src/main.js
+1
-0
bind.vue
src/pages/login/bind.vue
+1
-0
login.vue
src/pages/login/login.vue
+12
-2
index.vue
src/pages/pay/index.vue
+30
-0
routes.js
src/router/routes.js
+6
-0
没有找到文件。
src/api/base_api.js
浏览文件 @
109db5f1
...
...
@@ -86,10 +86,19 @@ export default class API {
* @param {[object]} res 如果未到达 response 阶段,则无res.response
*/
_reqFail
(
res
)
{
// console.log(res.response, '========')
let
err
=
null
if
(
res
.
code
===
'ECONNABORTED'
)
{
err
=
new
Error
(
'网络超时,请稍后重试'
)
}
else
if
(
res
.
response
)
{
const
{
status
,
data
}
=
res
.
response
if
(
data
)
{
if
(
status
===
402
)
{
window
.
G
.
$instance_vue
.
$router
.
push
({
path
:
'/pay'
})
}
}
err
=
new
Error
(
JSON
.
stringify
(
res
.
response
))
}
else
{
err
=
new
Error
(
'msg:'
+
res
.
message
+
'stack:'
+
res
.
stack
)
...
...
src/api/pay.js
0 → 100644
浏览文件 @
109db5f1
import
BaseAPI
from
'@/api/base_api'
const
httpRequest
=
new
BaseAPI
(
webConf
)
/**
* 获取商品详情
*/
export
function
getGoodsDetails
(
id
)
{
return
httpRequest
.
get
(
`/zy/v2/mall/product/
${
id
}
`
)
}
/* 模拟考试设置角色 */
export
function
setRole
(
data
)
{
return
httpRequest
.
post
(
'/zy/v2/examination/role'
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
/* 获取考试状态 */
export
function
getExamStatus
(
data
)
{
return
httpRequest
.
get
(
'/zy/v2/examination/examination-papers-status'
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
src/main.js
浏览文件 @
109db5f1
...
...
@@ -43,6 +43,7 @@ window.G = Vue.prototype.$GLOBAL = {
Vue
.
prototype
.
VueEvent
=
new
Vue
()
Vue
.
prototype
.
wx
=
window
.
wx
.
miniProgram
/* 创建实例之前,通过导航守卫,处理部分逻辑,如:是否直接进入系统 */
// const before = createBefore()
/* 导航守卫 */
...
...
src/pages/login/bind.vue
浏览文件 @
109db5f1
...
...
@@ -107,6 +107,7 @@ export default {
// 回调地址
const
redirectURI
=
`
${
process
.
env
.
VUE_APP_WECHAT_REDIRECT_URL
}
?needCheck=false&identity=friend&redirectUrl=
${
window
.
location
.
origin
}
`
// 微信的地址
console
.
log
(
redirectURI
)
const
wechatUrl
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appId
}
&redirect_uri=
${
encodeURIComponent
(
redirectURI
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
...
...
src/pages/login/login.vue
浏览文件 @
109db5f1
...
...
@@ -48,7 +48,8 @@ export default {
},
passwordVisible
:
false
,
isWechat
:
/micromessenger/
.
test
(
UA
),
unionid
:
Cookies
.
get
(
'wechat_login_no_phone_error'
)
unionid
:
Cookies
.
get
(
'wechat_login_no_phone_error'
),
redirectUrl
:
''
}
},
computed
:
{
...
...
@@ -118,7 +119,7 @@ export default {
wechatLogin
()
{
const
appId
=
'wx451c01d40d090d7a'
// 回调地址
const
redirectURI
=
`
${
process
.
env
.
VUE_APP_WECHAT_REDIRECT_URL
}
?needCheck=false&identity=friend&redirectUrl=
${
window
.
location
.
origin
}
`
const
redirectURI
=
`
https://passport.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=
${
window
.
location
.
origin
}
/login
`
// 微信的地址
const
wechatUrl
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appId
}
&redirect_uri=
${
encodeURIComponent
(
redirectURI
...
...
@@ -132,6 +133,15 @@ export default {
Cookies
.
get
(
'wechat_login_no_phone_error'
)
)
}
},
async
created
()
{
const
isLogin
=
await
this
.
$store
.
dispatch
(
'checkLogin'
)
console
.
log
(
!
this
.
checkWechatLogin
(),
'=============='
)
if
(
!
isLogin
)
{
if
(
this
.
isWechat
&&
!
this
.
checkWechatLogin
())
{
this
.
wechatLogin
()
}
}
}
}
</
script
>
...
...
src/pages/pay/index.vue
0 → 100644
浏览文件 @
109db5f1
<
template
>
<div>
<van-button
type=
"primary"
>
默认按钮
</van-button>
</div>
</
template
>
<
script
>
import
Cookies
from
'js-cookie'
import
*
as
api
from
'@/api/pay.js'
export
default
{
components
:
{
},
data
()
{
return
{
}
},
mounted
()
{
console
.
log
(
Cookies
.
get
(
'TGC'
))
this
.
getGoodsDetail
()
},
methods
:
{
getGoodsDetail
()
{
api
.
getGoodsDetails
(
'6682927830365372416'
).
then
(
res
=>
{
console
.
log
(
res
)
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
src/router/routes.js
浏览文件 @
109db5f1
...
...
@@ -75,5 +75,11 @@ export default [
path
:
'/my'
,
name
:
'my'
,
component
:
()
=>
import
(
'../pages/my/index.vue'
)
},
// 支付
{
path
:
'/pay'
,
name
:
'pay'
,
component
:
()
=>
import
(
'../pages/pay/index.vue'
)
}
]
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论