From 236161bbb70c94de0ef1f6feeb73183adeb78d7d Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 19 六月 2024 13:45:49 +0800
Subject: [PATCH] 完成检验下单优化
---
src/main.js | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/src/main.js b/src/main.js
index a66b6be..1325d46 100644
--- a/src/main.js
+++ b/src/main.js
@@ -11,11 +11,30 @@
import api from './assets/api/controller.js'
import swal from 'sweetalert'
-Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; //鍓嶇鏈湴绔彛
-const javaApi = 'http://localhost:8001';
+// 椤圭洰鍒囨崲
+Vue.prototype.PROJECT = '妫�娴嬩腑蹇�'
+// Vue.prototype.PROJECT = '瑁呭鐢电紗'
+//鏈湴
+Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
+// const javaApi = 'http://127.0.0.1:8001';
+const javaApi = 'http://192.168.0.104:8001';
+
+//浜�
+// Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080";
+// const javaApi = 'http://114.132.189.42:1234';
+
+//妫�娴嬩腑蹇冩寮忓簱
+// Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080";
+// const javaApi = 'http://10.1.200.86:8001';
+
+//瑁呭鐢电紗娴嬭瘯搴�
+// Vue.prototype.LOCATIONVUE = "http://10.16.173.59";
+// const javaApi = 'http://10.16.173.59:8001';
+
Vue.prototype.HaveJson = (val) => {
return JSON.parse(JSON.stringify(val))
}
+Vue.prototype.javaApi = javaApi
Vue.use(VueAxios, axios)
Vue.config.productionTip = false
@@ -56,6 +75,13 @@
})
axios.interceptors.response.use(res => {
+ if(res.data.code === 201){
+ Message({
+ type: 'error',
+ dangerouslyUseHTMLString: true,
+ message: `${res.data.message}`
+ })
+ }
return res.data
}, async function(err) {
if (JSON.stringify(err).indexOf('timeout of') > -1) {
@@ -80,7 +106,9 @@
if (res.data.code == 201) {
Message.error('璁よ瘉澶辫触锛岄渶瑕侀噸鏂扮櫥褰�')
localStorage.removeItem('autoenter')
- window.location.href = '/enter'
+ next({
+ path: '/enter'
+ })
return Promise.reject(err)
}
sessionStorage.setItem('token', res.data.token)
@@ -94,6 +122,10 @@
})
router.beforeEach((to, from, next) => {
+ if(to.path.indexOf('/test') == 0){
+ next()
+ return
+ }
if (to.path.indexOf('/enter') != 0) {
if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem(
'token') == undefined) {
@@ -108,5 +140,9 @@
new Vue({
el: '#app',
router,
- render: h => h(App)
+ render: h => h(App),
+ beforeCreate() {
+ // 闇�瑕佸湪鍏ㄥ眬娣诲姞涓�涓睘鎬�
+ Vue.prototype.$bus = this
+ }
});
--
Gitblit v1.9.3