Files
app-govern/pages/gateway/new.vue

219 lines
6.5 KiB
Vue
Raw Normal View History

2023-02-07 17:59:54 +08:00
<template>
<view class='new'>
2023-02-14 13:34:00 +08:00
<template v-if="type == 1">
<view class="content">
<uni-forms>
2023-02-27 14:56:08 +08:00
<uni-forms-item label="网关识别码">
2023-02-14 13:34:00 +08:00
<view style="display:flex">
2023-02-27 14:56:08 +08:00
<uni-easyinput type="number" v-model="code" placeholder="请输入网关识别码" />
2024-09-10 08:48:01 +08:00
<!-- <uni-icons type="camera" color="#007aff" size="26" class="ml20"
@click="scanCode"></uni-icons> -->
2023-02-14 13:34:00 +08:00
</view>
</uni-forms-item>
</uni-forms>
</view>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="register"> 发起注册 </view>
</view>
</template>
<template v-else>
<view class="content">
<uni-forms>
2023-02-27 14:56:08 +08:00
<uni-forms-item label="项目">
<uni-data-select v-model="formData.project" :localdata="projectRange"></uni-data-select>
</uni-forms-item>
2023-02-14 13:34:00 +08:00
<uni-forms-item label="位置">
<view style="display:flex;">
<uni-easyinput :clearable="false" type="textarea" autoHeight v-model="formData.address"
placeholder="请输入位置信息" />
2025-08-13 10:42:31 +08:00
<!-- <uni-icons type="location" color="#007aff" size="26" class="ml20"
@click="chooseLocation"></uni-icons> -->
2023-02-14 13:34:00 +08:00
</view>
</uni-forms-item>
<uni-forms-item label="拓扑图">
<view style="display:flex;">
<view style="flex:1">
2023-02-23 08:44:46 +08:00
<image class="gplot" src="/static/test2.pic.png" mode="aspectFill" />
2023-02-14 13:34:00 +08:00
</view>
<uni-icons type="image" color="#007aff" size="26" class="ml20"
@click="chooseGplot"></uni-icons>
</view>
</uni-forms-item>
</uni-forms>
</view>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="submit"> 提交 </view>
</view>
</template>
<uni-drawer ref="gplot" mode="right" :mask-click="false">
<scroll-view style="height: 100%;" scroll-y="true">
<view class="content">
<image class="gplot gplot-box" mode="aspectFill" :class="{ 'gplot-active': key == activeGplot }"
2023-02-23 08:44:46 +08:00
src="/static/test2.pic.png" @click="activeGplot = key" v-for="(item, key) in 3" :key="key" />
2023-02-14 13:34:00 +08:00
<view class="btn-wrap">
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
<view class="btn-wrap-item ml20" @click="closeDrawer"> 确定 </view>
</view>
</view>
</scroll-view>
</uni-drawer>
2023-02-07 17:59:54 +08:00
</view>
</template>
<script>
export default {
data () {
return {
loading: false,
code: '',
type: 1,
formData: {
address: '',
2023-02-27 14:56:08 +08:00
project:""
2023-02-07 17:59:54 +08:00
},
2023-02-27 14:56:08 +08:00
projectRange: [
{ value: 1, text: "监测", point: 1 },
{ value: 2, text: "治理", point: 2 },
{ value: 3, text: "用能", point: 1 },
],
2023-02-14 13:34:00 +08:00
activeGplot: 1,
2023-02-07 17:59:54 +08:00
}
},
methods: {
2023-02-14 13:34:00 +08:00
chooseGplot () {
this.$refs.gplot.open()
},
closeDrawer () {
this.$refs.gplot.close()
},
2023-02-07 17:59:54 +08:00
scanCode () {
uni.scanCode({
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
},
register () {
this.type = 2
},
2025-08-13 10:42:31 +08:00
// chooseLocation () {
// uni.chooseLocation({
// success: function (res) {
// this.address = res.name
// console.log('位置名称:' + res.name);
// console.log('详细地址:' + res.address);
// console.log('纬度:' + res.latitude);
// console.log('经度:' + res.longitude);
// }
// });
// },
2023-02-07 17:59:54 +08:00
submit () {
this.$util.toast('提交成功')
2023-02-14 13:34:00 +08:00
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500);
2023-02-07 17:59:54 +08:00
},
}
}
</script>
<style lang='scss'>
.new {
2023-02-20 14:19:28 +08:00
padding: 34rpx;
2023-02-07 17:59:54 +08:00
.new-btn {
display: flex;
align-items: center;
justify-content: center;
margin: 80rpx auto 0;
width: 320rpx;
2023-08-03 14:51:36 +08:00
background: $uni-theme-color;
2023-02-07 17:59:54 +08:00
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
2023-02-14 13:34:00 +08:00
.content {
.content-des {
font-size: 28rpx;
color: #666;
margin-bottom: 20rpx;
}
margin-bottom: 20rpx;
2023-02-20 14:19:28 +08:00
padding: 34rpx;
2023-02-14 13:34:00 +08:00
background: $uni-theme-white;
border-radius: 12rpx;
}
.gplot {
position: relative;
width: 100%;
height: 188rpx;
}
.gplot-box {
height: 280rpx;
margin: 0 auto;
}
.gplot-active::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
2023-08-03 14:51:36 +08:00
border: 8rpx solid $uni-theme-color;
2023-02-14 13:34:00 +08:00
// background: rgba(3, 3, 3, .5);
}
.btn-wrap {
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
.btn-wrap-item {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
2023-08-03 14:51:36 +08:00
background: $uni-theme-color;
2023-02-14 13:34:00 +08:00
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
}
}
.map-pin-box {
position: relative;
width: 375px;
margin: 0 auto;
.map-pin-box-area {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.point {
height: 100rpx;
width: 100rpx;
image {
width: 100%;
height: 100%;
}
}
}
/deep/ .uni-drawer__content {
width: 100vw !important;
2023-02-07 17:59:54 +08:00
}
</style>