Commit 2f1305e4 authored by dlkong's avatar dlkong

房间创建提交校验

parent 37e23fbf
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<header class="header"> <header class="header">
<span @click="close" class="iconLeft"> 关闭</span> <span @click="close" class="iconLeft"> 关闭</span>
<span>{{text}}</span> <span>{{text}}</span>
<span @click="confim" class="iconRight" v-show="!isView">确定</span> <span @click="confim" class="iconRight" v-show="!isViews">确定</span>
<span class="iconRight" v-show="isView"></span> <span class="iconRight" v-show="isViews"></span>
</header> </header>
</van-sticky> </van-sticky>
<grid-layout :layout.sync="layout" <grid-layout :layout.sync="layout"
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
</grid-item> </grid-item>
</grid-layout> </grid-layout>
<div class="setBtns"> <div class="setBtns">
<van-button @click="addItem" type="info" size="mini" v-if="!isView">添加房间</van-button> <van-button @click="addItem" type="info" size="mini" v-if="!isViews">添加房间</van-button>
<van-grid direction="horizontal" :column-num="2" class="footer" v-if="isView"> <van-grid direction="horizontal" :column-num="2" class="footer" v-if="isViews">
风险等级图例: 风险等级图例:
<span class="riskTab type1"></span>重大风险 <span class="riskTab type1"></span>重大风险
<span class="riskTab type2"></span>较大风险 <span class="riskTab type2"></span>较大风险
...@@ -101,12 +101,12 @@ export default { ...@@ -101,12 +101,12 @@ export default {
roomName:'', roomName:'',
columns: ['办公', '餐饮', '住宅', '超市'], columns: ['办公', '餐饮', '住宅', '超市'],
colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'], colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
isView:false,// true:查看页面; false: 添加页面 isViews:false,// true:查看页面; false: 添加页面
showHeader:true showHeader:true
} }
}, },
props:{ props:{
isViews: { isView: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
...@@ -117,13 +117,13 @@ export default { ...@@ -117,13 +117,13 @@ export default {
// this.rotateBox(); // this.rotateBox();
this.initRotate(); this.initRotate();
}); });
if (this._props.isViews) { if (this._props.isView) {
console.log('作为组件传值==>>',) console.log('作为组件传值==>>',)
this.isView = true this.isViews = true
this.showHeader = false this.showHeader = false
} }
if (this.$route.params.isView) { if (this.$route.params.isView) {
this.isView = true this.isViews = true
} }
this.getRoomInfo() this.getRoomInfo()
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", this.orientationChange, false); window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", this.orientationChange, false);
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
item.position.i = item.id item.position.i = item.id
item.position.isDraggable = false item.position.isDraggable = false
item.position.isResizable = false item.position.isResizable = false
if (!this.isView) { //添加页面不显示颜色 if (!this.isViews) { //添加页面不显示颜色
item.position.c = '#eee' item.position.c = '#eee'
}else{ }else{
item.position.c = this.colorList[Math.floor(Math.random()*4)] item.position.c = this.colorList[Math.floor(Math.random()*4)]
...@@ -269,6 +269,14 @@ export default { ...@@ -269,6 +269,14 @@ export default {
}, },
// 确定 保存房间信息 // 确定 保存房间信息
confim(){ confim(){
if (this.roomName == '') {
Toast.fail({
title: '提示',
forbidClick: true,
message: '请先添加房间!',
})
return
}
let data = { let data = {
floorId: this.$route.params.floorId ? this.$route.params.floorId : '18', floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
name:this.roomName, name:this.roomName,
...@@ -279,6 +287,8 @@ export default { ...@@ -279,6 +287,8 @@ export default {
if (res.code == 200) { if (res.code == 200) {
Toast.success('提交成功'); Toast.success('提交成功');
this.getRoomInfo() this.getRoomInfo()
this.roomType = ''
this.roomName = ''
} }
}).catch((err) => { }).catch((err) => {
console.log('err==>>',err) console.log('err==>>',err)
......
...@@ -8,9 +8,10 @@ module.exports = { ...@@ -8,9 +8,10 @@ module.exports = {
//以上的ip和端口是我们本机的;下面为需要跨域的 //以上的ip和端口是我们本机的;下面为需要跨域的
proxy: { //配置跨域 proxy: { //配置跨域
'/app-api': { '/app-api': {
target: 'http://192.168.4.232:8080/', //这里是后台的地址 // target: 'http://192.168.4.232:8080/', //这里是后台的地址
// target: 'http://192.168.15.124:8080/', //这里是杨帆的地址 // target: 'http://192.168.15.124:8080/', //这里是杨帆的地址
// target: 'http://192.168.10.137:8080/', //这里是昊哥的地址 // target: 'http://192.168.10.137:8080/', //这里是昊哥的地址
target: 'http://192.168.10.36:8080/', //这里是昊哥的地址
// target: 'http://localhost:8080/', //这里是后台的地址 // target: 'http://localhost:8080/', //这里是后台的地址
ws: true, ws: true,
changOrigin: true, //允许跨域 changOrigin: true, //允许跨域
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment