基础接口对接

This commit is contained in:
仲么了
2023-05-25 10:10:22 +08:00
parent cca66bab21
commit e9b1e9a417
11 changed files with 579 additions and 171 deletions

231
pages/gc/detail.vue Normal file
View File

@@ -0,0 +1,231 @@
<template>
<Cn-page :loading="loading" noPadding>
<view slot="body">
<view class="detail">
<view class="header">
<view class="header-title"
>{{ gc.name }}
<!-- <view class="header-title-extra">用能</view> -->
</view>
<view class="header-des-mini mb10">{{ gc.provinceName + gc.cityName }} {{ gc.createTime }}</view>
<view class="header-des">{{ gc.description }} </view>
</view>
<view class="nav">
<view
class="nav-menu"
:class="{ 'nav-menu-active': navMenuActive == index }"
v-for="(item, index) in navMenuList"
:key="index"
@click="navMenuClick(index)"
>{{ item.text }}
</view>
</view>
<view class="content device" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }">
<view v-show="navMenuActive == 0">
<uni-card
:title="item.name"
:extra="item.projectType"
@click="jumpProject(item)"
v-for="(item, index) in store.data"
:key="index"
>
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备个数</view>
<view>3</view>
</view>
<view class="term-list-bottom-item">
<view>用户个数</view>
<view>1</view>
</view>
</view>
</uni-card>
<Cn-empty v-if="store.empty"></Cn-empty>
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
</view>
<view style="padding: 0 20rpx" v-show="navMenuActive == 2">
<image class="gplot gplot-box" mode="aspectFill" src="/static/test2.pic.png" v-for="(item, key) in 3" :key="key" />
</view>
</view>
<uni-fab
ref="fab"
direction="vertical"
horizontal="right"
vertical="bottom"
:content="content"
@trigger="trigger"
v-if="content.length"
/>
<uni-popup ref="share" type="share" background-color="#fff">
<uni-popup-share title="分享到"></uni-popup-share>
</uni-popup>
</view>
</view>
</Cn-page>
</template>
<script>
import list from '../../common/js/list'
export default {
mixins: [list],
data() {
return {
loading: false,
gc: '',
navMenuList: [
{
text: '项目',
},
{
text: '拓扑图',
},
],
content: [],
navHeight: 0,
navMenuActive: 0,
}
},
methods: {
trigger(e) {
console.log(this.$refs)
if (e.item.text == '移交') {
uni.navigateTo({
url: '/pages/gc/transfer',
})
} else if (e.item.text == '分享') {
this.$refs.share.open()
}
},
navMenuClick(index) {
this.navMenuActive = index
},
goUserDetail() {
uni.navigateTo({
url: '/pages/mine/userDetail',
})
},
del() {
console.log('del')
uni.showModal({
title: '提示',
content: '确定要移除该成员吗?',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
},
})
},
goDevice() {
uni.navigateTo({
url: '/pages/device/APF/detail',
})
},
jumpProject(item) {
uni.navigateTo({
url: '/pages/project/detail?project=' + JSON.stringify(item),
})
},
init() {
this.store = this.DataSource('/project/queryProject')
this.store.params.engineeringId = this.gc.id
this.store.reload()
},
},
onLoad(option) {
this.gc = JSON.parse(option.gc)
let userInfo = uni.getStorageSync('userInfo')
if (userInfo.role == '3') {
this.content.push({
iconPath: '/static/transfer.png',
text: '移交',
})
} else if (userInfo.role == '4') {
this.content.push({
iconPath: '/static/share.png',
text: '分享',
})
}
setTimeout(() => {
// 获取nav高度
uni.createSelectorQuery()
.select('.nav')
.boundingClientRect((rect) => {
this.navHeight = rect.height
})
.exec()
}, 1000)
this.init()
// uni.setNavigationBarTitle({ title: this.gc })
},
}
</script>
<style lang="scss">
.detail {
.content {
box-sizing: border-box;
padding-bottom: 20rpx;
}
.header {
padding: 20rpx 20rpx 0;
.header-title {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 40rpx;
margin-bottom: 10rpx;
.header-title-extra {
font-size: 24rpx;
color: #666;
padding-right: 10rpx;
}
}
.header-des {
font-size: 28rpx;
color: #666;
}
.header-des-mini {
font-size: 24rpx;
color: #999;
}
}
.footer-btn {
padding: 0 20rpx;
height: 50rpx;
background-color: #007aff;
font-size: 24rpx;
color: #fff;
text-align: center;
line-height: 50rpx;
border-radius: 10rpx;
}
}
.gplot {
position: relative;
width: 100%;
border: 8rpx solid #ccc;
}
.term-list-bottom {
.term-list-bottom-item {
font-size: 28rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
// view:first-of-type{
// color: #111;
// }
}
.term-list-bottom-item:last-of-type {
margin-bottom: 0;
}
}
</style>

View File

@@ -1,23 +1,32 @@
<template>
<view :loading="loading">
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> -->
<uni-nav-bar dark :fixed="true" status-bar left-icon="left" :rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
background-color="#fff" color="#111" title="工程管理" @clickLeft="back" @clickRight="add" />
<uni-nav-bar
dark
:fixed="true"
status-bar
left-icon="left"
:rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
background-color="#fff"
color="#111"
title="工程管理"
@clickLeft="back"
@clickRight="add"
/>
<view class="message">
<uni-card :title="item.name" :extra="item.projectType" @click="jump('XXX项目1')"
v-for="(item, index) in store.data" :key="index">
<uni-card :title="item.name" :extra="item.projectType" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>区域</view>
<view>{{ item.province +item.city}}</view>
<view>{{ item.provinceName + item.cityName }}</view>
</view>
<view class="term-list-bottom-item">
<view>创建时间</view>
<view>{{ item.createTime}}</view>
<view>{{ item.createTime }}</view>
</view>
</view>
</uni-card>
<Cn-empty v-if="store.empty" style="padding-top:200rpx"></Cn-empty>
<Cn-empty v-if="store.empty" style="padding-top: 200rpx"></Cn-empty>
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
</view>
</view>
@@ -27,40 +36,41 @@
import list from '../../common/js/list'
export default {
mixins: [list],
data () {
data() {
return {
loading: false,
userInfo: {}
userInfo: {},
}
},
methods: {
init () {
init() {
this.store = this.DataSource('/engineering/queryEngineeringPage')
this.store.params.userId = uni.getStorageSync('userInfo').id
this.store.params.userId = uni.getStorageSync('userInfo').id
this.store.reload()
},
back () {
back() {
uni.navigateBack()
},
add () {
add() {
uni.navigateTo({
url: `/pages/gc/new`
url: `/pages/gc/new`,
})
},
upgrade (code) {
console.log(code);
upgrade(code) {
console.log(code)
uni.showToast({
title: '升级成功',
icon: 'none'
icon: 'none',
})
},
jump (type) {
jump(gc) {
uni.navigateTo({
url: `/pages/project/detail?project=${type}`
url: `/pages/gc/detail?gc=${JSON.stringify(gc)}`,
})
}
},
},
onLoad () {
onLoad() {
this.init()
},
}
@@ -140,4 +150,4 @@ export default {
margin-bottom: 0;
}
}
</style>
</style>

View File

@@ -1,7 +1,7 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='new'>
<Cn-page :loading="loading">
<view slot="body">
<view class="new">
<view class="content">
<uni-forms :label-width="80">
<uni-forms-item label="工程名称">
@@ -17,8 +17,7 @@
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
</uni-forms-item>
<uni-forms-item label="描述">
<uni-easyinput type="textarea" autoHeight v-model="formData.description"
placeholder="请输入工程描述" />
<uni-easyinput type="textarea" autoHeight v-model="formData.description" placeholder="请输入工程描述" />
</uni-forms-item>
</uni-forms>
</view>
@@ -38,10 +37,10 @@ export default {
localdata: area,
loading: false,
formData: {
city: "",
description: "",
name: "",
province: "",
city: '',
description: '',
name: '',
province: '',
},
}
},
@@ -49,40 +48,41 @@ export default {
uni.getLocation({
type: 'wgs84',
success: function (res) {
console.log(res);
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
}
});
console.log(res)
console.log('当前位置的经度:' + res.longitude)
console.log('当前位置的纬度:' + res.latitude)
},
})
// console.log(area);
console.log( this.$util.prePage());
},
methods: {
areaChange(e) {
console.log(e);
console.log(e)
this.formData.province = e.detail.value[0].value
this.formData.city = e.detail.value[1].value
},
select(e) {
console.log(e);
console.log(e)
},
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);
}
});
console.log('位置名称:' + res.name)
console.log('详细地址:' + res.address)
console.log('纬度:' + res.latitude)
console.log('经度:' + res.longitude)
},
})
},
async submit() {
console.log(this.formData)
if (!this.formData.name) {
this.$util.toast('请输入工程名称')
return
}
if (!this.formData.province) {
this.$util.toast('请选择区域信息')
return
@@ -91,18 +91,19 @@ export default {
this.$util.toast('请输入工程描述')
return
}
addEngineering(this.formData).then(res => {
addEngineering(this.formData).then((res) => {
console.log(res)
this.$util.toast('工程创建成功')
this.$util.prePage().store?.reload()
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500);
}, 1500)
})
}
}
},
},
}
</script>
<style lang='scss'>
<style lang="scss">
.new {
padding: 34rpx;
@@ -141,4 +142,4 @@ export default {
/deep/ .uni-drawer__content {
width: 100vw !important;
}
</style>
</style>