+
@@ -70,7 +70,6 @@ export default {
},
data() {
return {
- dates: ['2020/03', '2020/04', '2020/05', '2020/06', '2020/07', '2020/08'],
projects: [
{
pName: '地基与基础工程',
@@ -180,6 +179,22 @@ export default {
this.openedIndex = index
}
}
+ },
+ computed: {
+ dateList() {
+ let dates = []
+ const mapDates = data => {
+ data.map(p => {
+ dates.push(p.startTime)
+ dates.push(p.endTime)
+ p.children && mapDates(p.children)
+ })
+ }
+ mapDates(this.projects)
+ dates = dates.map(date => date.slice(0, 7)).sort()
+ dates = [...new Set(dates)]
+ return dates
+ }
}
}
From 923aad5fefb97ebe62b15db2d034793eae0e0ab0 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Wed, 10 Aug 2022 17:18:03 +0800
Subject: [PATCH 05/10] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E6=8A=BD?=
=?UTF-8?q?=E7=A6=BB=E8=8E=B7=E5=8F=96=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=8F=82?=
=?UTF-8?q?=E6=95=B0=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../jlw/planProgress/centerTop.vue | 64 ++++++++++---------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
index bc289a61..acdf0164 100644
--- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue
+++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
@@ -75,6 +75,7 @@ export default {
pName: '地基与基础工程',
startTime: '2020/04/06',
endTime: '2020/05/09',
+ delay: 5,
status: 0,
gantts: [],
// gantts: [{ left: '420px', width: '100px', status: '' }],
@@ -91,45 +92,48 @@ export default {
}
},
methods: {
+ getGanttStyle(project) {
+ let { startTime, endTime, pName } = project
+ const startArr = startTime.split('/')
+ const endArr = endTime.split('/')
+ let startRef = null
+ let endRef = null
+
+ if (!(startArr[2] % 2)) {
+ const day = startArr[2] - 1
+ startArr[2] = day < 10 ? '0' + day : day
+ startTime = startArr.join('/')
+ console.log(startTime, 'xxx')
+ }
+ if (!(endArr[2] % 2)) {
+ const day = endArr[2] - 1
+ endArr[2] = day < 10 ? '0' + day : day
+ endTime = endArr.join('/')
+ console.log(endTime, 'xxx')
+ }
+
+ startRef = this.$refs[`${pName}-${startTime}`][0]
+ const startLeft = startRef.offsetLeft
+
+ endRef = this.$refs[`${pName}-${endTime}`][0]
+ const endWidth = endRef.offsetWidth
+ const endLeft = endRef.offsetLeft
+ const ganttWidth = endLeft - startLeft + endWidth
+
+ return { left: startLeft + 'px', width: ganttWidth + 'px' }
+ },
setGantts() {
const configGantts = projects => {
projects.map(project => {
- let { startTime, endTime, pName, gantts } = project
- const startArr = startTime.split('/')
- const endArr = endTime.split('/')
- let startRef = null
- let endRef = null
-
- if (!(startArr[2] % 2)) {
- const day = startArr[2] - 1
- startArr[2] = day < 10 ? '0' + day : day
- startTime = startArr.join('/')
- console.log(startTime, 'xxx')
- }
- if (!(endArr[2] % 2)) {
- const day = endArr[2] - 1
- endArr[2] = day < 10 ? '0' + day : day
- endTime = endArr.join('/')
- console.log(endTime, 'xxx')
- }
-
- startRef = this.$refs[`${pName}-${startTime}`][0]
- const startLeft = startRef.offsetLeft
-
- endRef = this.$refs[`${pName}-${endTime}`][0]
- const endWidth = endRef.offsetWidth
- const endLeft = endRef.offsetLeft
- const ganttWidth = endLeft - startLeft + endWidth
-
- const gantt = { left: startLeft + 'px', width: ganttWidth + 'px', background: this.colors[project.status] }
+ let { gantts } = project
+ const gantt = this.getGanttStyle(project)
+ gantt.background = this.colors[project.status]
if (gantts) {
gantts.push(gantt)
} else {
project.gantts = [gantt]
}
- console.log(startLeft, ganttWidth, '丢雷', `${pName}-${endTime}`)
-
// debugger
project.children && configGantts(project.children)
})
From 812821f1060d5806804ac66ccac51935a47ddb69 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Wed, 10 Aug 2022 18:31:48 +0800
Subject: [PATCH 06/10] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E7=94=98=E7=89=B9=E5=9B=BE=E5=BB=B6=E6=97=B6=E8=BF=9B?=
=?UTF-8?q?=E5=BA=A6=E6=9D=A1=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../jlw/planProgress/centerTop.vue | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
index acdf0164..3beee7ff 100644
--- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue
+++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
@@ -75,7 +75,7 @@ export default {
pName: '地基与基础工程',
startTime: '2020/04/06',
endTime: '2020/05/09',
- delay: 5,
+ delay: 10,
status: 0,
gantts: [],
// gantts: [{ left: '420px', width: '100px', status: '' }],
@@ -125,21 +125,38 @@ export default {
setGantts() {
const configGantts = projects => {
projects.map(project => {
- let { gantts } = project
+ let { endTime, pName, gantts } = project
const gantt = this.getGanttStyle(project)
gantt.background = this.colors[project.status]
+
if (gantts) {
gantts.push(gantt)
} else {
project.gantts = [gantt]
}
+ if (project.delay) {
+ const delayStartTime = this.increaseDate(endTime, 1)
+ const delayEndTime = this.increaseDate(endTime, project.delay)
+ const gantt = this.getGanttStyle({ startTime: delayStartTime, endTime: delayEndTime, pName })
+ gantt.background = this.colors[3]
+ gantts.push(gantt)
+ console.log(gantt, '是的发生的范范')
+ }
+
// debugger
project.children && configGantts(project.children)
})
}
configGantts(this.projects)
},
+ increaseDate(date, delay) {
+ const timestamp = new Date(date).getTime() + (delay + 1) * 1000 * 60 * 60 * 24
+ return new Date(timestamp)
+ .toISOString()
+ .replace(/-/g, '/')
+ .slice(0, 10)
+ },
getDays(date) {
const year = date.split('/')[0]
const month = +date.split('/')[1]
From 8f15a0a94cc86b59b8d48f186c5cc25112b1e601 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Thu, 11 Aug 2022 16:41:26 +0800
Subject: [PATCH 07/10] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=E6=BB=9A=E5=8A=A8=E7=94=98=E7=89=B9=E5=9B=BE=E9=98=B2?=
=?UTF-8?q?=E6=8A=96=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../jlw/planProgress/centerTop.vue | 73 ++++++++++++++++++-
1 file changed, 70 insertions(+), 3 deletions(-)
diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
index 3beee7ff..9e17bcb3 100644
--- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue
+++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
@@ -1,7 +1,7 @@
-
+
分部分项工程名称
@@ -30,7 +30,14 @@
-
+
+
@@ -88,7 +99,14 @@ export default {
{ pName: '建筑装饰装修', startTime: '2020/04/21', endTime: '2020/07/30', status: 1 }
],
openedIndex: 9999,
- colors: ['#4C87FF', '#54CF8E', '#F2D026', '#FF6C7F']
+ colors: ['#4C87FF', '#54CF8E', '#F2D026', '#FF6C7F'],
+ tooltipsStyle: {
+ display: 'none',
+ left: 0,
+ top: 0
+ },
+ scrollLeft: 0,
+ scrollTimer: 0
}
},
methods: {
@@ -199,6 +217,32 @@ export default {
} else {
this.openedIndex = index
}
+ },
+ handleScroll(e) {
+ if (this.scrollTimer) {
+ clearTimeout(this.scrollTimer)
+ }
+ this.scrollTimer = setTimeout(() => {
+ this.scrollLeft = e.target.scrollLeft
+ this.scrollTimer = null
+ }, 100)
+ },
+ handleHover(e) {
+ const { clientX, clientY } = e
+ const decreaseLeft = clientX - 680
+ const decreaseTop = clientY - 200
+ this.tooltipsStyle = {
+ left: decreaseLeft + 'px',
+ top: decreaseTop + 'px',
+ display: 'block'
+ }
+ console.log('enter')
+ },
+ handleLeave() {
+ this.tooltipsStyle = {
+ display: 'none'
+ }
+ console.log('leave')
}
},
computed: {
@@ -224,6 +268,7 @@ export default {
.gantt-chart {
height: 100%;
.table {
+ position: relative;
height: 100%;
overflow-x: auto;
&::-webkit-scrollbar {
@@ -356,6 +401,28 @@ export default {
}
}
}
+ .tooltips {
+ position: absolute;
+ box-sizing: border-box;
+ padding: 10px;
+ width: 130px;
+ height: 65px;
+ font-size: 14px;
+ color: #fff;
+ border-radius: 8px;
+ background-color: #50a6b3;
+ .status {
+ display: inline-block;
+ margin-bottom: 6px;
+ padding: 0 10px;
+ height: 20px;
+ min-width: 60px;
+ line-height: 20px;
+ font-size: 12px;
+ border-radius: 10px;
+ background-color: #ff6c7f;
+ }
+ }
}
}
From d98c8a421afe24f65bbf6d7069b5be60fbc9f268 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Thu, 11 Aug 2022 16:57:48 +0800
Subject: [PATCH 08/10] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E6=96=B0?=
=?UTF-8?q?=E5=A2=9Etooltips?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/projectAdmin/jlw/planProgress/centerTop.vue | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
index 9e17bcb3..27f7a7b1 100644
--- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue
+++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
@@ -236,13 +236,11 @@ export default {
top: decreaseTop + 'px',
display: 'block'
}
- console.log('enter')
},
handleLeave() {
this.tooltipsStyle = {
display: 'none'
}
- console.log('leave')
}
},
computed: {
From 8679ff66d4b1e28fb256693c2da4bb78e0965358 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Thu, 11 Aug 2022 17:12:09 +0800
Subject: [PATCH 09/10] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=20tooltips=20=E5=81=8F=E7=A7=BB=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/projectAdmin/jlw/planProgress/centerTop.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
index 27f7a7b1..b4a13c62 100644
--- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue
+++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue
@@ -232,7 +232,7 @@ export default {
const decreaseLeft = clientX - 680
const decreaseTop = clientY - 200
this.tooltipsStyle = {
- left: decreaseLeft + 'px',
+ left: decreaseLeft + this.scrollLeft + 'px',
top: decreaseTop + 'px',
display: 'block'
}
From a086af9d13ce177aa72b7be1c57aa1d436417b17 Mon Sep 17 00:00:00 2001
From: Jack <1638169491@qq.com>
Date: Thu, 11 Aug 2022 18:27:05 +0800
Subject: [PATCH 10/10] =?UTF-8?q?http.js=EF=BC=9A=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E8=A7=86=E9=A2=91=E6=8F=92=E4=BB=B6=E7=99=BB=E5=BD=95=E8=AF=B7?=
=?UTF-8?q?=E6=B1=82=20401=20=E6=8B=A6=E6=88=AA=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/assets/js/http.js | 464 +++++++++++++++++++++---------------------
1 file changed, 237 insertions(+), 227 deletions(-)
diff --git a/src/assets/js/http.js b/src/assets/js/http.js
index 8f0233b3..9f5a5c2e 100644
--- a/src/assets/js/http.js
+++ b/src/assets/js/http.js
@@ -3,231 +3,239 @@ import axios from 'axios'
// import QS from 'qs'
import store from '@/store'
// import router from '../../router'
-import {
- Loading,
- Message
-} from 'element-ui'
+import { Loading, Message } from 'element-ui'
Vue.prototype.$http = axios
// Vue.prototype.qs = QS;
// Vue.use(ElementUI)
-var loading;
-let needLoadingRequestCount = 0;
-let showLoadingConfig = '';
+var loading
+let needLoadingRequestCount = 0
+let showLoadingConfig = ''
function getLang() {
- let currentLanguage = store.state.currentLanguage
- let langParam = ''
- switch (currentLanguage) {
- case 'zh':
- langParam = 'zh_CN'
- break;
- case 'en':
- langParam = 'en_US'
- break;
- }
- return langParam
+ let currentLanguage = store.state.currentLanguage
+ let langParam = ''
+ switch (currentLanguage) {
+ case 'zh':
+ langParam = 'zh_CN'
+ break
+ case 'en':
+ langParam = 'en_US'
+ break
+ }
+ return langParam
}
// 环境的切换
if (process.env.NODE_ENV == 'development') {
- // axios.defaults.baseURL = 'http://8.142.139.165:7080' // 湖里区
- // axios.defaults.baseURL = 'http://124.71.87.250/'
- // axios.defaults.baseURL = 'http://139.9.66.234:30/'
- // axios.defaults.baseURL = 'http://14.29.220.211:6023/'
- // axios.defaults.baseURL = 'https://zhgd.loganwy.com/' //龙光
- // axios.defaults.baseURL = 'https://zhgd-uat.logan.com.cn/'
+ // axios.defaults.baseURL = 'http://8.142.139.165:7080' // 湖里区
+ // axios.defaults.baseURL = 'http://124.71.87.250/'
+ // axios.defaults.baseURL = 'http://139.9.66.234:30/'
+ // axios.defaults.baseURL = 'http://14.29.220.211:6023/'
+ // axios.defaults.baseURL = 'https://zhgd.loganwy.com/' //龙光
+ // axios.defaults.baseURL = 'https://zhgd-uat.logan.com.cn/'
- // axios.defaults.baseURL = 'http://36.137.53.203:9090/'; // 南昌地铁 17512009894 123456789 gdjt 123456789
+ // axios.defaults.baseURL = 'http://36.137.53.203:9090/' // 南昌地铁 17512009894 123456789 gdjt 87654321
- // axios.defaults.baseURL = 'http://192.168.34.125:6023/'
- // axios.defaults.baseURL = 'http://124.71.178.44:100/' // 河南
- // tag: 本地
- // axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地
- axios.defaults.baseURL = 'http://192.168.34.125:6023/'; //杨意本地 http/1.1
- // axios.defaults.baseURL = 'http://192.168.34.231:6023/'; //杨思瑞本地
- // axios.defaults.baseURL = 'http://47.97.202.104:6023/';
- // axios.defaults.baseURL = 'http://124.71.178.44:9500/'; // 星璇
- // axios.defaults.baseURL = 'http://120.196.217.6:7000/';
- // axios.defaults.baseURL = 'http://139.9.66.234:8/';
- // axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲
- // axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西
- // axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲
-
+ // axios.defaults.baseURL = 'http://192.168.34.125:6023/'
+ // axios.defaults.baseURL = 'http://124.71.178.44:100/' // 河南
+ // tag: 本地
+ // axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地
+ axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1
+ // axios.defaults.baseURL = 'http://192.168.34.231:6023/'; //杨思瑞本地
+ // axios.defaults.baseURL = 'http://47.97.202.104:6023/';
+ // axios.defaults.baseURL = 'http://124.71.178.44:9500/'; // 星璇
+ // axios.defaults.baseURL = 'http://120.196.217.6:7000/';
+ // axios.defaults.baseURL = 'http://139.9.66.234:8/';
+ // axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲
+ // axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西
+ // axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲
- // axios.defaults.baseURL = 'http://117.156.17.59:9090/'; //
- // axios.defaults.baseURL = 'http://120.236.247.200:9000/'; //横琴线上
- // axios.defaults.baseURL = 'http://223.82.100.80:9000/'; //南昌地铁
- // axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期
- // axios.defaults.baseURL = 'http://124.71.178.44:30/';
- // axios.defaults.baseURL = 'http://192.168.34.125:9090/';
- // axios.defaults.baseURL = 'http://192.168.88.220:6023/';
- // axios.defaults.baseURL = 'https://192.168.34.125:6688/'; //本地 http/2
- // axios.defaults.baseURL = 'http://124.71.178.44:8/'; //本地 http/3
- // axios.defaults.baseURL = 'http://124.71.178.44:9000/'; //中建 cscec101 123456
- // axios.defaults.baseURL = 'https://jk.cscec1b1.com:5138/';//沃尔
- // axios.defaults.baseURL = 'http://61.190.32.219:9050/'
- // axios.defaults.baseURL = 'http://183.95.84.54:5800/'//合展-宿迁 zxsd 123456
- // axios.defaults.baseURL = 'http://183.95.84.54:9500/'//贵州-敏尚 17512075572 123456
- // axios.defaults.baseURL = 'http://183.95.84.34:7185/' //测试服
- // axios.defaults.baseURL = 'http://183.60.227.61:30246/'
- // axios.defaults.baseURL = 'http://183.60.227.61:30249/' //测试服2
- // axios.defaults.baseURL = 'http://183.60.227.61:20561/' //龙光地产 龙光地产 123456
- // axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456
- // axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789
- // axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789
-}
-else if (process.env.NODE_ENV == 'debug') {
- axios.defaults.baseURL = 'https://www.ceshi.com';
+ // axios.defaults.baseURL = 'http://117.156.17.59:9090/'; //
+ // axios.defaults.baseURL = 'http://120.236.247.200:9000/'; //横琴线上
+ // axios.defaults.baseURL = 'http://223.82.100.80:9000/'; //南昌地铁
+ // axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期
+ // axios.defaults.baseURL = 'http://124.71.178.44:30/';
+ // axios.defaults.baseURL = 'http://192.168.34.125:9090/';
+ // axios.defaults.baseURL = 'http://192.168.88.220:6023/';
+ // axios.defaults.baseURL = 'https://192.168.34.125:6688/'; //本地 http/2
+ // axios.defaults.baseURL = 'http://124.71.178.44:8/'; //本地 http/3
+ // axios.defaults.baseURL = 'http://124.71.178.44:9000/'; //中建 cscec101 123456
+ // axios.defaults.baseURL = 'https://jk.cscec1b1.com:5138/';//沃尔
+ // axios.defaults.baseURL = 'http://61.190.32.219:9050/'
+ // axios.defaults.baseURL = 'http://183.95.84.54:5800/'//合展-宿迁 zxsd 123456
+ // axios.defaults.baseURL = 'http://183.95.84.54:9500/'//贵州-敏尚 17512075572 123456
+ // axios.defaults.baseURL = 'http://183.95.84.34:7185/' //测试服
+ // axios.defaults.baseURL = 'http://183.60.227.61:30246/'
+ // axios.defaults.baseURL = 'http://183.60.227.61:30249/' //测试服2
+ // axios.defaults.baseURL = 'http://183.60.227.61:20561/' //龙光地产 龙光地产 123456
+ // axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456
+ // axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789
+ // axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789
+} else if (process.env.NODE_ENV == 'debug') {
+ axios.defaults.baseURL = 'https://www.ceshi.com'
} else if (process.env.NODE_ENV == 'production') {
- let host = window.location.host;
- axios.defaults.baseURL = window.location.protocol + "//" + host + "/"
- // axios.defaults.baseURL ='http://192.168.34.125:6023/'
- // axios.defaults.baseURL = window.location.protocol + "//" + host.split(":")[0] + ":6023" + "/"
- // axios.defaults.baseURL = 'http://zhgd.loganwy.com/'
+ let host = window.location.host
+ axios.defaults.baseURL = window.location.protocol + '//' + host + '/'
+ // axios.defaults.baseURL ='http://192.168.34.125:6023/'
+ // axios.defaults.baseURL = window.location.protocol + "//" + host.split(":")[0] + ":6023" + "/"
+ // axios.defaults.baseURL = 'http://zhgd.loganwy.com/'
}
// tag: 河南
if (COMPANY == 'henan') {
- axios.defaults.baseURL = 'http://124.71.178.44:100/'
+ axios.defaults.baseURL = 'http://124.71.178.44:100/'
}
// axios.defaults.baseURL = store.getters.BASEURL //'http://124.71.178.44:100/'axios.defaults.timeout = 600000;
// console.log('store.state.userInfo',store)
if (store.state.userInfo) {
- axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + store.state.userInfo.token;
- axios.defaults.headers.common['operateId'] = store.state.userInfo.userId;
+ axios.defaults.headers.common['Authorization'] = 'Bearer' + ' ' + store.state.userInfo.token
+ axios.defaults.headers.common['operateId'] = store.state.userInfo.userId
}
// http请求拦截器
-axios.interceptors.request.use(config => {
+axios.interceptors.request.use(
+ config => {
// 分屏插件兼容配置
const screensBaseURL = sessionStorage.getItem('screens-baseURL')
if (config.url.indexOf(screensBaseURL) !== -1) {
- delete config.headers.common['operateId']
- if(config.url === screensBaseURL + '/login') {
- const Authorization = sessionStorage.getItem('screens-Authorization')
- config.headers.common['Authorization'] = Authorization
- } else {
- delete config.headers.common['Authorization']
- const token = sessionStorage.getItem('screens-token')
- config.headers.common['token'] = token
- }
- return config
+ delete config.headers.common['operateId']
+ if (config.url === screensBaseURL + '/login') {
+ const Authorization = sessionStorage.getItem('screens-Authorization')
+ config.headers.common['Authorization'] = Authorization
+ } else {
+ delete config.headers.common['Authorization']
+ const token = sessionStorage.getItem('screens-token')
+ config.headers.common['token'] = token
+ }
+ return config
}
if (showLoadingConfig == '' || showLoadingConfig == undefined) {
- showFullScreenLoading()
+ showFullScreenLoading()
}
return config
-}, error => {
+ },
+ error => {
tryHideFullScreenLoading()
// Message.error('加载超时');
return Promise.reject(error)
-})
+ }
+)
// 响应拦截器
axios.interceptors.response.use(
- response => {
- tryHideFullScreenLoading()
- if (response.status === 200) {
- return Promise.resolve(response);
- } else {
- return Promise.reject(response);
- }
- },
- // 服务器状态码不是2开头的的情况
- // 这里可以跟你们的后台开发人员协商好统一的错误状态码
- // 然后根据返回的状态码进行一些操作,例如登录过期提示,错误提示等等
- // 下面列举几个常见的操作,其他需求可自行扩展
- error => {
- tryHideFullScreenLoading()
- if (error.response.status) {
- console.log('----------',error.response)
- let errorUrl = error.response.config.baseURL
- console.log('-----------------',errorUrl)
- let screensUrl = sessionStorage.getItem('screens-baseURL')
- if(errorUrl == screensUrl){
- return
- }else {
- switch (error.response.status) {
- // 401: 未登录
- // 未登录则跳转登录页面,并携带当前页面的路径
- // 在登录成功后返回当前页面,这一步需要在登录页操作。
- case 401:
- Message.error('会话已失效,请重新登录');
- logout()
- break;
-
- // 403 token过期
- // 登录过期对用户进行提示
- // 清除本地token和清空vuex中token对象
- // 跳转登录页面
- case 403:
- Message.error('登录过期,请重新登录');
- logout()
- break;
- // 404请求不存在
- case 404:
- Message.error('网络请求不存在');
- break;
- case 500:
- Message.error('服务器错误');
- break;
- }
- return Promise.reject(error.response);
- }
- }
+ response => {
+ tryHideFullScreenLoading()
+ if (response.status === 200) {
+ return Promise.resolve(response)
+ } else {
+ return Promise.reject(response)
}
-);
+ },
+ // 服务器状态码不是2开头的的情况
+ // 这里可以跟你们的后台开发人员协商好统一的错误状态码
+ // 然后根据返回的状态码进行一些操作,例如登录过期提示,错误提示等等
+ // 下面列举几个常见的操作,其他需求可自行扩展
+ error => {
+ tryHideFullScreenLoading()
+ if (error.response.status) {
+ console.log('----------', error.response)
+ let errorUrl = error.response.config.baseURL
+ console.log('-----------------', errorUrl)
+ let screensUrl = sessionStorage.getItem('screens-baseURL')
+
+ const url = error.response.url
+
+ if (errorUrl == screensUrl || url === '26938512:7zS9LX2X8u4tW4Ps0ZjN/login') {
+ return
+ } else {
+ switch (error.response.status) {
+ // 401: 未登录
+ // 未登录则跳转登录页面,并携带当前页面的路径
+ // 在登录成功后返回当前页面,这一步需要在登录页操作。
+ case 401:
+ Message.error('会话已失效,请重新登录')
+ logout()
+ break
+
+ // 403 token过期
+ // 登录过期对用户进行提示
+ // 清除本地token和清空vuex中token对象
+ // 跳转登录页面
+ case 403:
+ Message.error('登录过期,请重新登录')
+ logout()
+ break
+ // 404请求不存在
+ case 404:
+ Message.error('网络请求不存在')
+ break
+ case 500:
+ Message.error('服务器错误')
+ break
+ }
+ return Promise.reject(error.response)
+ }
+ }
+ }
+)
/**
* get方法,对应get请求
* @param {String} url [请求的url地址]
* @param {Object} params [请求时携带的参数]
*/
function logout() {
- store.commit('setUserInfo', null)
- store.commit('setMapBackArr', [])
- store.commit('setMoudle', null)
- store.commit('setProDetail', null)
- sessionStorage.clear()
- let json = {
- name: '工作站',
- id: 1,
- url: '/projectV2/taskList',
- menuList: [{
- id: 100000,
- menuName: "任务清单",
- path: "/projectV2/taskList"
- }, {
- id: 100001,
- menuName: "通知公告",
- path: "/projectV2/noticeList"
- }, {
- id: 100002,
- menuName: "工作日程",
- path: "/projectV2/workerSchedule"
- }]
+ store.commit('setUserInfo', null)
+ store.commit('setMapBackArr', [])
+ store.commit('setMoudle', null)
+ store.commit('setProDetail', null)
+ sessionStorage.clear()
+ let json = {
+ name: '工作站',
+ id: 1,
+ url: '/projectV2/taskList',
+ menuList: [
+ {
+ id: 100000,
+ menuName: '任务清单',
+ path: '/projectV2/taskList'
+ },
+ {
+ id: 100001,
+ menuName: '通知公告',
+ path: '/projectV2/noticeList'
+ },
+ {
+ id: 100002,
+ menuName: '工作日程',
+ path: '/projectV2/workerSchedule'
+ }
+ ]
}
- this.$store.commit("setCurModule", json);
- setTimeout(() => {
- window.location.href = "/index.html#/login"
- }, 1000)
+ this.$store.commit('setCurModule', json)
+ setTimeout(() => {
+ window.location.href = '/index.html#/login'
+ }, 1000)
}
export function get(url, params, config) {
- showLoadingConfig = config
- url = url + '?lang=' + getLang()
- return new Promise((resolve, reject) => {
- axios.get(url, {
- params: params
- }).then(res => {
- if (res.data.code == 200) {
- resolve(res.data);
- } else {
- Message.error(res.data.message);
- }
- }).catch(err => {
- reject(err.data)
- })
- });
+ showLoadingConfig = config
+ url = url + '?lang=' + getLang()
+ return new Promise((resolve, reject) => {
+ axios
+ .get(url, {
+ params: params
+ })
+ .then(res => {
+ if (res.data.code == 200) {
+ resolve(res.data)
+ } else {
+ Message.error(res.data.message)
+ }
+ })
+ .catch(err => {
+ reject(err.data)
+ })
+ })
}
/**
@@ -236,25 +244,26 @@ export function get(url, params, config) {
* @param {Object} params [请求时携带的参数]
*/
export function post(url, params, config) {
- showLoadingConfig = config
- url = url + '?lang=' + getLang()
- return new Promise((resolve, reject) => {
- axios.post(url, params)
- .then(res => {
- if (res.data.code == 200) {
- resolve(res.data);
- } else {
- if (res.data.status !== 'SUCCESS') {
- Message.error(res.data.message);
- }else{
- resolve(res.data);
- }
- }
- })
- .catch(err => {
- reject(err.data)
- })
- });
+ showLoadingConfig = config
+ url = url + '?lang=' + getLang()
+ return new Promise((resolve, reject) => {
+ axios
+ .post(url, params)
+ .then(res => {
+ if (res.data.code == 200) {
+ resolve(res.data)
+ } else {
+ if (res.data.status !== 'SUCCESS') {
+ Message.error(res.data.message)
+ } else {
+ resolve(res.data)
+ }
+ }
+ })
+ .catch(err => {
+ reject(err.data)
+ })
+ })
}
/**
* put方法,对应put请求
@@ -262,46 +271,47 @@ export function post(url, params, config) {
* @param {Object} params [请求时携带的参数]
*/
export function put(url, params, config) {
- showLoadingConfig = config
- url = url + '?lang=' + getLang()
- return new Promise((resolve, reject) => {
- axios.put(url, params)
- .then(res => {
- if (res.data.code == 200) {
- resolve(res.data);
- } else {
- Message.error(res.data.message);
- }
- })
- .catch(err => {
- reject(err.data)
- })
- });
+ showLoadingConfig = config
+ url = url + '?lang=' + getLang()
+ return new Promise((resolve, reject) => {
+ axios
+ .put(url, params)
+ .then(res => {
+ if (res.data.code == 200) {
+ resolve(res.data)
+ } else {
+ Message.error(res.data.message)
+ }
+ })
+ .catch(err => {
+ reject(err.data)
+ })
+ })
}
export function showFullScreenLoading() {
- if (needLoadingRequestCount === 0) {
- startLoading()
- }
- needLoadingRequestCount++
+ if (needLoadingRequestCount === 0) {
+ startLoading()
+ }
+ needLoadingRequestCount++
}
export function tryHideFullScreenLoading() {
- if (needLoadingRequestCount <= 0) return
- needLoadingRequestCount--
- if (needLoadingRequestCount === 0) {
- endLoading()
- }
+ if (needLoadingRequestCount <= 0) return
+ needLoadingRequestCount--
+ if (needLoadingRequestCount === 0) {
+ endLoading()
+ }
}
function startLoading() {
- loading = Loading.service({
- lock: true,
- text: '加载中...',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.5)'
- })
+ loading = Loading.service({
+ lock: true,
+ text: '加载中...',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.5)'
+ })
}
function endLoading() {
- loading.close()
+ loading.close()
}