diff --git a/components/carPage/index.vue b/components/carPage/index.vue
index 9ba2cab..aeeed3a 100644
--- a/components/carPage/index.vue
+++ b/components/carPage/index.vue
@@ -9,7 +9,7 @@
{{item.name}}
{{item.val}}
- {{index==7||index==11?'mm':index==9?'°':''}}
+ {{index>=9?'mm':index==8?'°':''}}
@@ -21,7 +21,7 @@
{{item.name}}
{{item.val}}
- {{index==7||index==11?'mm':index==9?'°':''}}
+ {{index>=9?'mm':index==8?'°':''}}
@@ -33,7 +33,7 @@
{{item.name}}
{{item.val}}
- {{index==7||index==11?'mm':index==9?'°':''}}
+ {{index>=9?'mm':index==8?'°':''}}
@@ -44,103 +44,238 @@
diff --git a/components/controlPage/index.vue b/components/controlPage/index.vue
index 516709c..80b8f71 100644
--- a/components/controlPage/index.vue
+++ b/components/controlPage/index.vue
@@ -234,8 +234,8 @@
ctrlFlag: 0,//控制模式:0-手动、1-自动
lightFlag: 1,//设备状态:0-正常、1-异常
},
- errorIcon:'/static/image/error.png',
- normalIcon:'/static/image/normal.png'
+ errorIcon:'../../static/image/error.png',
+ normalIcon:'../../static/image/normal.png'
}
},
methods:{
@@ -245,18 +245,13 @@
url:`/zhxx/dt/horizonLoadIControl/${value}`,
data:{}
}).then((res)=>{
- if(res.code==200){
- uni.showToast({
- title: res.msg,
- icon: "success",
- duration: 1000
- })
- }else{
- uni.showToast({
- title: res.msg?res.msg:'请求失败',
- icon: "error",
- duration: 1000
- })
+ console.log(res)
+
+ if(res.data.code==200){
+ this.$eventBus.emit('showToast',{title:res.data.msg,duration:1000,icon:'success'})
+ }else {
+ console.log(22222)
+ this.$eventBus.emit('showToast',{title:res.data.msg?res.data.msg:'请求失败',duration:1000,icon:'error'})
}
}).catch((Error)=>{
// console.log(Error)
@@ -296,6 +291,7 @@
},
watch:{
Data:{
+ immediate:true,
handler(newVal,oldVal){
if(newVal){
this.deviceData=newVal
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 528a745..06200e7 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -12,7 +12,12 @@
退出
-->
-
+
+
+
+
+ {{showToastTitle}}
+
@@ -20,6 +25,8 @@
import controlPage from '/components/controlPage/index.vue';
import carPage from '/components/carPage/index.vue';
import {httpPost} from '../../utils/requset.js';
+ import error from '../../static/image/errorToast.png';
+ import successImage from '@/static/image/successToast.png';
export default {
components: {
controlPage,
@@ -28,66 +35,17 @@
data() {
return {
optionIndex:0,
- dataInter:[
- {
- name:'支架车在线状态:',
- width:0,
- val:''
- },{
- name:'左横移限位:',
- width:1,
- val:''
- },{
- name:'右横移限位:',
- width:1,
- val:''
- },{
- name:'上限位:',
- width:1,
- val:''
- },{
- name:'下限位:',
- width:1,
- val:''
- },{
- name:'左滚转限位:',
- width:1,
- val:''
- },{
- name:'右滚转限位:',
- width:1,
- val:''
- },{
- name:'行进位置:',
- width:1,
- val:''
- },{
- name:'横移位置:',
- width:1,
- val:''
- },{
- name:'滚转位置:',
- width:1,
- val:''
- },{
- name:'超重限位:',
- width:1,
- val:''
- },{
- name:'升降位置:',
- width:0,
- val:''
- }
- ],
- carData1:[],
- carData2:[],
- carData3:[],
deviceData:{},
+ showToastTitle:'',
+ showToastIcon:'',
+ showToastState:0,
+ errorIcon:error,
+ successIcon:successImage
}
},
methods: {
cutOption(value){
- this.optionIndex=value
+ this.optionIndex=value;
},
outLogin(){
uni.showModal({
@@ -117,59 +75,29 @@
url:'/zhxx/dt/horizonLoadInfo',
data:{}
}).then((res)=>{
- if(res.code==200){
- this.deviceData=res.data;
- this.carData1=this.carEntsorgen(res.data,1);
- this.carData2=this.carEntsorgen(res.data,2);
- this.carData3=this.carEntsorgen(res.data,3);
+ if(res.data.code==200){
+ this.deviceData=res.data.data[0];
+ }
+ }).catch((err)=>{
+ console.log(err)
+ if(err.errMsg.includes('Failed to connect')){
+ this.showToat({
+ title:'请确保成功连接网络',
+ icon:'error',
+ duration:1800
+ })
}
+
})
},
-
- carEntsorgen(value,type){
- let data=value;
- let arrData=this.dataInter;
- if(type==1){
- arrData[0].val=value.online==1?'在线':'离线';
- arrData[1].val=value.leftHorizontalLimit;
- arrData[2].val=value.rightHorizontalLimit;
- arrData[3].val=value.downLimit;
- arrData[4].val=value.upLimit;
- arrData[5].val=value.leftTurnLimit;
- arrData[6].val=value.rightTurnLimit;
- arrData[7].val=value.walkAxisPosition;
- arrData[8].val=value.horizontalAxisPosition;
- arrData[9].val=value.turnPosition;
- arrData[10].val=value.overWeightLimit;
- arrData[11].val=value.liftPosition;
- }else if(type==2){
- arrData[0].val=value.onlineTwo==1?'在线':'离线';
- arrData[1].val=value.leftHorizontalLimitTwo;
- arrData[2].val=value.rightHorizontalLimitTwo;
- arrData[3].val=value.downLimitTwo;
- arrData[4].val=value.upLimitTwo;
- arrData[5].val=value.leftTurnLimitTwo;
- arrData[6].val=value.rightTurnLimitTwo;
- arrData[7].val=value.walkAxisPositionTwo;
- arrData[8].val=value.horizontalAxisPositionTwo;
- arrData[9].val=value.turnPositionTwo;
- arrData[10].val=value.overWeightLimitTwo;
- arrData[11].val=value.liftPositionTwo;
- }else{
- arrData[0].val=value.onlineThree==1?'在线':'离线';
- arrData[1].val=value.leftHorizontalLimitThree;
- arrData[2].val=value.rightHorizontalLimitThree;
- arrData[3].val=value.downLimitThree;
- arrData[4].val=value.upLimitThree;
- arrData[5].val=value.leftTurnLimitThree;
- arrData[6].val=value.rightTurnLimitThree;
- arrData[7].val=value.walkAxisPositionThree;
- arrData[8].val=value.horizontalAxisPositionThree;
- arrData[9].val=value.turnPositionThree;
- arrData[10].val=value.overWeightLimitThree;
- arrData[11].val=value.liftPositionThree;
- }
- return arrData;
+ showToat(value){
+ this.showToastState=1;
+ this.showToastTitle=value.title;
+ this.showToastIcon=value.icon;
+
+ setTimeout(()=>{
+ this.showToastState=0;
+ },value.duration)
}
},
@@ -191,6 +119,13 @@
setInterval(()=>{
this.deviceAjax();
},1000)
+ // ,{title:res.data.msg?res.data.msg:'请求失败',duration:1000,icon:'error'}
+
+ this.$eventBus.on('showToast',(data)=>{
+ console.log(3333333);
+ this.showToat(data);
+
+ })
}
}
@@ -235,4 +170,30 @@
right: 2%;
}
+ .showToast{
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+ padding: 16px 12px;
+ background-color: rgb(0,0,0,0.7);
+ z-index: 2000;
+ top: 40%;
+ border-radius: 10px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .showToast>image{
+ width: 40px;
+ height: 40px;
+ margin-bottom: 20px;
+ }
+
+ .showToast>span{
+ color: #ffffff;
+ font-size: 18px;
+ }
+
\ No newline at end of file
diff --git a/static/image/errorToast.png b/static/image/errorToast.png
new file mode 100644
index 0000000..468129a
Binary files /dev/null and b/static/image/errorToast.png differ
diff --git a/static/image/successToast.png b/static/image/successToast.png
new file mode 100644
index 0000000..4671900
Binary files /dev/null and b/static/image/successToast.png differ
diff --git a/utils/requset.js b/utils/requset.js
index 63f27c6..1179ac7 100644
--- a/utils/requset.js
+++ b/utils/requset.js
@@ -27,12 +27,9 @@ export function httpPost(option) {
reject(err, 22222)
},
complete(res) {
- if (res.data.code == 401) {
- // uni.reLaunch({
- // url: "/pages/login/LoginPage"
- // })
- fetchUserName()
- }
+ // console.log(res)
+ reject(res)
+
}
})
})