提交 109db5f1 authored 作者: lihuihui's avatar lihuihui

updata

上级 98d8617a
......@@ -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)
......
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' }
})
}
......@@ -43,6 +43,7 @@ window.G = Vue.prototype.$GLOBAL = {
Vue.prototype.VueEvent = new Vue()
Vue.prototype.wx = window.wx.miniProgram
/* 创建实例之前,通过导航守卫,处理部分逻辑,如:是否直接进入系统 */
// const before = createBefore()
/* 导航守卫 */
......
......@@ -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`
......
......@@ -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>
......
<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>
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论