提交 588aa263 authored 作者: 王鹏飞's avatar 王鹏飞

update

上级 c42d2e72
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
</template> </template>
<script> <script>
import Cookies from 'js-cookie'
import * as api from '@/api/pay' import * as api from '@/api/pay'
export default { export default {
data() { data() {
...@@ -45,10 +44,6 @@ export default { ...@@ -45,10 +44,6 @@ export default {
} }
}, },
beforeMount() { beforeMount() {
Cookies.set(
'TGC',
'VEdULTg1Ny1TTlY5QnF5Q2xocW9QenBLTFg2V0lQWUxORXpqOXc3aVBLS3ZBQVlZN1ZJTUhvLTVCSy1uOU9ieGxqWU5JbGhQTS1NLWV6aWppbmctcGFzc3BvcnQtNjRjNDQ2NWI1Zi1xdjZtYkBAQDE3Mi4xNy41LjczQEBATW96aWxsYS81LjAgKE1hY2ludG9zaDsgSW50ZWwgTWFjIE9TIFggMTBfMTNfNikgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg3LjAuNDI4MC44OCBTYWZhcmkvNTM3LjM2QEBANjc0NzcxMjkwOTg4ODk3ODk0NA=='
)
this.getProduct() this.getProduct()
} }
} }
......
...@@ -11,20 +11,20 @@ const httpRequest = axios.create({ ...@@ -11,20 +11,20 @@ const httpRequest = axios.create({
// 请求拦截 // 请求拦截
httpRequest.interceptors.request.use( httpRequest.interceptors.request.use(
function (config) { function(config) {
if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = qs.stringify(config.data) config.data = qs.stringify(config.data)
} }
return config return config
}, },
function (error) { function(error) {
return Promise.reject(error) return Promise.reject(error)
} }
) )
// 响应拦截 // 响应拦截
httpRequest.interceptors.response.use( httpRequest.interceptors.response.use(
function (response) { function(response) {
const { data } = response const { data } = response
if (data.code) { if (data.code) {
window.alert(data.msg) window.alert(data.msg)
...@@ -32,11 +32,15 @@ httpRequest.interceptors.response.use( ...@@ -32,11 +32,15 @@ httpRequest.interceptors.response.use(
} }
return data return data
}, },
function (error) { function(error) {
console.log(error.response) console.log(error.response)
if (error.response) { if (error.response) {
const { message } = error.response.data const { message, status } = error.response.data
if (status === 403) {
window.location.href = `${webConf.others.loginUrl}?rd=${encodeURIComponent(window.location.href)}`
} else {
window.alert(message || error.response.data) window.alert(message || error.response.data)
}
return Promise.reject(error.response) return Promise.reject(error.response)
} else { } else {
window.alert(error) window.alert(error)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论