页面切图

This commit is contained in:
仲么了
2023-02-20 14:19:28 +08:00
parent 7d28b3476a
commit 5e69ab1da6
50 changed files with 1136 additions and 213 deletions

View File

@@ -30,4 +30,5 @@ export default {
} }
</style> </style>

View File

@@ -84,7 +84,7 @@ page {
margin-bottom: 20rpx; margin-bottom: 20rpx;
.grid-card-title { .grid-card-title {
padding: 20rpx 0; padding: 0 0 20rpx;
font-size: 28rpx; font-size: 28rpx;
color: #111; color: #111;
font-weight: 700; font-weight: 700;
@@ -133,7 +133,7 @@ page {
.index { .index {
.header { .header {
margin: 0 30rpx; margin: 0 20rpx;
background: $uni-theme-blue; background: $uni-theme-blue;
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx 10rpx 40rpx; padding: 30rpx 10rpx 40rpx;
@@ -162,21 +162,21 @@ page {
position: sticky; position: sticky;
top: 0; top: 0;
left: 0; left: 0;
padding: 30rpx; padding: 20rpx 20rpx 0;
padding-left: 0;
display: flex; display: flex;
flex-wrap: wrap;
background: rgb(243, 244, 245); background: rgb(243, 244, 245);
z-index: 2; z-index: 2;
.nav-menu { .nav-menu {
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
margin-left: 20rpx; margin-left: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx; font-size: 28rpx;
border-radius: 8rpx; border-radius: 8rpx;
background: #ebeaec; background: #ebeaec;
color: #666; color: #666;
&:first-of-type {
margin-left: 0;
}
&-active { &-active {
background: #dfe5f7; background: #dfe5f7;
color: $uni-theme-blue; color: $uni-theme-blue;

View File

@@ -1,12 +1,12 @@
<template> <template>
<view class="grid-nav"> <view class="grid-nav">
<view class="grid-nav-title" v-if="title">{{title}}</view> <view class="grid-nav-title" v-if="title">{{ title }}</view>
<view class="grid-nav-content"> <view class="grid-nav-content">
<slot /> <slot />
<Rc-grid-item background="#fff" v-for="item in seat" :key="item"></Rc-grid-item> <Cn-grid-item background="#fff" v-for="item in seat" :key="item"></Cn-grid-item>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
@@ -19,9 +19,9 @@ export default {
mounted () { mounted () {
console.warn(this.$slots.default.length); console.warn(this.$slots.default.length);
let num = this.$slots.default.length; let num = this.$slots.default.length;
let yushu = num % 3; let yushu = num % 4;
if (yushu > 0) { if (yushu > 0) {
for (let i = 0; i < 3 - yushu; i++) { for (let i = 0; i < 4 - yushu; i++) {
this.seat.push(i); this.seat.push(i);
} }
} }
@@ -34,6 +34,7 @@ export default {
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
background: $uni-theme-white; background: $uni-theme-white;
.grid-nav-title { .grid-nav-title {
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
@@ -42,6 +43,7 @@ export default {
color: #999; color: #999;
font-size: 28rpx; font-size: 28rpx;
} }
.grid-nav-content { .grid-nav-content {
background: #f6f7f8; background: #f6f7f8;
display: grid; display: grid;

View File

@@ -134,11 +134,11 @@
} }
}, },
{ {
"path": "pages/device/DVR/record", "path": "pages/device/DVR/record",
"style": { "style": {
"navigationBarTitleText": "操作记录" "navigationBarTitleText": "操作记录"
} }
}, },
{ {
"path": "pages/device/APF/report", "path": "pages/device/APF/report",
"style": { "style": {
@@ -146,11 +146,11 @@
} }
}, },
{ {
"path": "pages/device/DVR/report", "path": "pages/device/DVR/report",
"style": { "style": {
"navigationBarTitleText": "告警情况" "navigationBarTitleText": "告警情况"
} }
}, },
{ {
"path": "pages/device/APF/about", "path": "pages/device/APF/about",
"style": { "style": {
@@ -158,11 +158,11 @@
} }
}, },
{ {
"path": "pages/device/DVR/about", "path": "pages/device/DVR/about",
"style": { "style": {
"navigationBarTitleText": "关于" "navigationBarTitleText": "关于"
} }
}, },
{ {
"path": "pages/gateway/list", "path": "pages/gateway/list",
"style": { "style": {
@@ -260,9 +260,27 @@
} }
}, },
{ {
"path": "pages/mine/project", "path": "pages/project/list",
"style": { "style": {
"navigationBarTitleText": "项目管理" "navigationStyle": "custom"
}
},
{
"path": "pages/project/new",
"style": {
"navigationBarTitleText": "新增项目"
}
},
{
"path": "pages/user/erweima",
"style": {
"navigationBarTitleText": "我的二维码"
}
},
{
"path": "pages/project/detail",
"style": {
"navigationBarTitleText": "项目详情"
} }
} }
], ],
@@ -297,8 +315,8 @@
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "灿能电力", "navigationBarTitleText": "灿能电力",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#ffffff",
"backgroundColor": "#fff" "backgroundColor": "#f3f4f5"
// #ifdef H5 // #ifdef H5
, ,
"navigationStyle": "custom" "navigationStyle": "custom"

View File

@@ -27,7 +27,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.about { .about {
padding: 34rpx; padding: 34rpx;
.about-title { .about-title {
font-size: 34rpx; font-size: 34rpx;
font-weight: bold; font-weight: bold;

View File

@@ -180,32 +180,32 @@ export default {
color: #999; color: #999;
} }
.nav { // .nav {
position: sticky; // position: sticky;
top: 0; // top: 0;
left: 0; // left: 0;
padding: 20rpx; // padding: 20rpx;
display: flex; // display: flex;
background: rgb(243, 244, 245); // background: rgb(243, 244, 245);
.nav-menu { // .nav-menu {
padding: 10rpx 20rpx; // padding: 10rpx 20rpx;
margin-left: 20rpx; // margin-left: 20rpx;
font-size: 28rpx; // font-size: 28rpx;
border-radius: 8rpx; // border-radius: 8rpx;
background: $uni-theme-white; // background: $uni-theme-white;
&:first-of-type { // &:first-of-type {
margin-left: 0; // margin-left: 0;
} // }
&-active { // &-active {
background: $uni-theme-blue; // background: $uni-theme-blue;
color: #fff; // color: #fff;
} // }
} // }
} // }
.content { .content {
box-sizing: border-box; box-sizing: border-box;

View File

@@ -27,7 +27,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.about { .about {
padding: 34rpx; padding: 34rpx;
.about-title { .about-title {
font-size: 34rpx; font-size: 34rpx;
font-weight: bold; font-weight: bold;

View File

@@ -174,31 +174,31 @@ export default {
color: #999; color: #999;
} }
.nav { // .nav {
position: sticky; // position: sticky;
top: 0; // top: 0;
left: 0; // left: 0;
padding-top: 20rpx; // padding-top: 20rpx;
display: flex; // display: flex;
flex-wrap: wrap; // flex-wrap: wrap;
background: rgb(243, 244, 245); // background: rgb(243, 244, 245);
.nav-menu { // .nav-menu {
padding: 10rpx 20rpx; // padding: 10rpx 20rpx;
margin-left: 20rpx; // margin-left: 20rpx;
margin-bottom: 20rpx; // margin-bottom: 20rpx;
font-size: 28rpx; // font-size: 28rpx;
border-radius: 8rpx; // border-radius: 8rpx;
background: $uni-theme-white; // background: $uni-theme-white;
&-active { // &-active {
background: $uni-theme-blue; // background: $uni-theme-blue;
color: #fff; // color: #fff;
} // }
} // }
} // }
.content { .content {
box-sizing: border-box; box-sizing: border-box;

View File

@@ -56,11 +56,11 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.content { .content {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -84,7 +84,4 @@ export default {
} }
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
</style> </style>

View File

@@ -3,16 +3,18 @@
<template v-if="type == 1"> <template v-if="type == 1">
<view class="content"> <view class="content">
<uni-forms> <uni-forms>
<uni-forms-item label="设备DID"> <uni-forms-item label="设备识别码">
<view style="display:flex"> <view style="display:flex">
<uni-easyinput type="number" v-model="code" placeholder="请输入设备DID" /> <uni-easyinput type="number" v-model="code" placeholder="请输入设备识别码" />
<uni-icons type="camera" color="#007aff" size="26" class="ml20" <uni-icons type="camera" color="#007aff" size="26" class="ml20"
@click="scanCode"></uni-icons> @click="scanCode"></uni-icons>
</view> </view>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
<view class="new-btn" @click="register"> 发起注册 </view> <view class="btn-wrap">
<view class="btn-wrap-item" @click="register"> 发起注册 </view>
</view>
</template> </template>
<template v-else> <template v-else>
@@ -206,7 +208,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.new { .new {
padding: 34rpx; padding: 34rpx;
.new-btn { .new-btn {
display: flex; display: flex;
@@ -228,7 +230,7 @@ export default {
} }
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -300,9 +302,7 @@ export default {
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
/deep/ .uni-drawer__content { /deep/ .uni-drawer__content {
width: 100vw !important; width: 100vw !important;

View File

@@ -32,7 +32,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.footer-btn { .footer-btn {
padding: 0 20rpx; padding: 0 20rpx;

View File

@@ -3,9 +3,9 @@
<template v-if="type == 1"> <template v-if="type == 1">
<view class="content"> <view class="content">
<uni-forms> <uni-forms>
<uni-forms-item label="设备DID"> <uni-forms-item label="设备识别码">
<view style="display:flex"> <view style="display:flex">
<uni-easyinput type="number" v-model="code" placeholder="请输入设备NDID" /> <uni-easyinput type="number" v-model="code" placeholder="请输入设备识别码" />
<uni-icons type="camera" color="#007aff" size="26" class="ml20" <uni-icons type="camera" color="#007aff" size="26" class="ml20"
@click="scanCode"></uni-icons> @click="scanCode"></uni-icons>
</view> </view>
@@ -110,7 +110,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.new { .new {
padding: 34rpx; padding: 34rpx;
.new-btn { .new-btn {
display: flex; display: flex;
@@ -132,7 +132,7 @@ export default {
} }
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -204,10 +204,6 @@ export default {
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
/deep/ .uni-drawer__content { /deep/ .uni-drawer__content {
width: 100vw !important; width: 100vw !important;
} }

View File

@@ -5,7 +5,8 @@
<view class="content" v-for="(item, index) in deviceList" :key="index"> <view class="content" v-for="(item, index) in deviceList" :key="index">
<uni-forms :label-width="80"> <uni-forms :label-width="80">
<uni-forms-item label="类型"> <uni-forms-item label="类型">
<uni-data-select v-model="item.type" :localdata="range"></uni-data-select> <uni-data-select v-model="item.type" :localdata="range"
@change="typeChange(item)"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="MAC地址"> <uni-forms-item label="MAC地址">
<uni-easyinput type="text" v-model="item.address" placeholder="请输入设备MAC地址" /> <uni-easyinput type="text" v-model="item.address" placeholder="请输入设备MAC地址" />
@@ -19,16 +20,12 @@
@click="chooseGplot(item)"></uni-icons> @click="chooseGplot(item)"></uni-icons>
</view> </view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="监测点"> <uni-forms-item label="监测点" v-if="item.pointList.length">
<view class="point-item" v-for="(item2, index2) in item.pointList" :key="index2"> <view class="point-item" v-for="(item2, index2) in item.pointList" :key="index2"
<view style="flex:1">{{ item2.pointName }}</view> @click="editPoint(item, index2)">
<uni-icons type="trash" color="#007aff" size="26" class="ml20" <view style="flex:1" v-if="item2.pointName">{{ item2.pointName }}</view>
@click="deletePoint(item, index2)"></uni-icons> <view style="flex:1;color:#999" v-else>请选择监测点</view>
<uni-icons type="compose" color="#007aff" size="26" class="ml20" <uni-icons type="compose" color="#007aff" size="26" class="ml20"></uni-icons>
@click="editPoint(item, index2)"></uni-icons>
</view>
<view class="add-point" @click="addNewPoint(item)">
<uni-icons type="plusempty" color="#999" size="20" class="ml20"></uni-icons>
</view> </view>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
@@ -40,9 +37,9 @@
<uni-drawer ref="gplot" mode="right" :mask-click="false"> <uni-drawer ref="gplot" mode="right" :mask-click="false">
<scroll-view style="height: 100%;" scroll-y="true"> <scroll-view style="height: 100%;" scroll-y="true">
<view class="content"> <view class="content">
<image class="gplot gplot-box" mode="aspectFill" <image class="gplot gplot-box" mode="aspectFill" :class="{ 'gplot-active': key == activeGplot }"
:class="{ 'gplot-active': key == activeGplot }" src="/static/test2.pic.jpg" src="/static/test2.pic.jpg" @click="activeGplot = key" v-for="(item, key) in 3"
@click="activeGplot = key" v-for="(item, key) in 3" :key="key" /> :key="key" />
<view class="btn-wrap"> <view class="btn-wrap">
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view> <view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view> <view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view>
@@ -95,8 +92,27 @@ export default {
} }
], ],
range: [ range: [
{ value: 0, text: "DVR" }, { value: 1, text: "POS-882AX", point: 1 },
{ value: 1, text: "APF" }, { value: 2, text: "NPOS-681", point: 2 },
{ value: 3, text: "NPOS-681", point: 1 },
{ value: 4, text: "POV-500", point: 2 },
{ value: 5, text: "PQV-300", point: 1 },
{ value: 6, text: "NPOS-571W", point: 3 },
{ value: 7, text: "NPQS-572W", point: 3 },
{ value: 8, text: "POS-882B6", point: 2 },
{ value: 9, text: "PQS-882B5", point: 1 },
{ value: 10, text: "POS-882B4", point: 2 },
{ value: 11, text: "PQS-882B2", point: 1 },
{ value: 12, text: "POS-882A", point: 2 },
{ value: 13, text: "POS-883A", point: 1 },
{ value: 14, text: "NPOS-581", point: 2 },
{ value: 15, text: "PQS-681", point: 1 },
{ value: 16, text: "POS-8825", point: 3 },
{ value: 17, text: "PQS-782", point: 1 },
{ value: 18, text: "POS-880X", point: 3 },
{ value: 19, text: "NPQS-580", point: 1 },
{ value: 20, text: "NPOS-572", point: 2 },
], ],
point: { point: {
x: 170, x: 170,
@@ -109,6 +125,21 @@ export default {
} }
}, },
methods: { methods: {
typeChange (item) {
console.log(item.type);
setTimeout(() => {
if (!item.type) return
let rangeIndex = this.range.findIndex((v) => v.value == item.type)
item.pointList = []
for (let index = 0; index < this.range[rangeIndex].point; index++) {
item.pointList.push({
name: '',
x: 170,
y: 100,
})
}
}, 100);
},
addDevice () { addDevice () {
console.log(this.formData); console.log(this.formData);
this.deviceList.push({ this.deviceList.push({
@@ -214,11 +245,11 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.content { .content {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -242,12 +273,10 @@ export default {
} }
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
.index { .index {
padding: 34rpx; padding: 20rpx;
.new-btn { .new-btn {
display: flex; display: flex;
@@ -269,7 +298,7 @@ export default {
} }
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -341,9 +370,7 @@ export default {
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
/deep/ .uni-drawer__content { /deep/ .uni-drawer__content {
width: 100vw !important; width: 100vw !important;

View File

@@ -14,10 +14,10 @@
<div class="header-item-label">离线设备</div> <div class="header-item-label">离线设备</div>
</div> </div>
</div> </div>
<view style="padding:30rpx 30rpx 0"> <view style="padding:20rpx 20rpx 0">
<Cn-grid title="注册"> <Cn-grid title="注册">
<Cn-grid-item src="/static/device2.png" text="设备"></Cn-grid-item> <Cn-grid-item src="/static/device2.png" text="设备" @click="registerDevice"></Cn-grid-item>
<Cn-grid-item src="/static/gateway2.png" text="网关"></Cn-grid-item> <Cn-grid-item src="/static/gateway2.png" text="网关" @click="registerGateway"></Cn-grid-item>
<Cn-grid-item background="#fff"></Cn-grid-item> <Cn-grid-item background="#fff"></Cn-grid-item>
<Cn-grid-item background="#fff"></Cn-grid-item> <Cn-grid-item background="#fff"></Cn-grid-item>
</Cn-grid> </Cn-grid>
@@ -27,12 +27,14 @@
v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text }} v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text }}
</view> </view>
</view> </view>
<uni-card :title="item.name" :sub-title="item.project" :extra="item.type" v-for="item in deviceListFilter" <view class="content" :style="{ minHeight: minHeight }">
:key="item" style="margin-top:4rpx" @click="jump(item)" thumbnail="/static/device.png"> <uni-card :title="item.name" :sub-title="item.project" :extra="item.type"
<text>{{ item.project }} {{ item.type }}</text> v-for="(item, index) in deviceListFilter" :key="index" style="margin-top:4rpx" @click="jump(item)"
</uni-card> thumbnail="/static/device.png">
<text>{{ item.project }} {{ item.type }}</text>
<uni-load-more status="nomore"></uni-load-more> </uni-card>
<uni-load-more status="nomore"></uni-load-more>
</view>
</view> </view>
</template> </template>
<script> <script>
@@ -48,6 +50,8 @@ export default {
text: '治理' text: '治理'
}], }],
navMenuActive: 0, navMenuActive: 0,
navHeight: 0,
minHeight: '',
deviceList: [ deviceList: [
{ {
name: '设备1', name: '设备1',
@@ -60,6 +64,30 @@ export default {
des: '设备描述2', des: '设备描述2',
type: 'DVR', type: 'DVR',
project: '治理' project: '治理'
},
{
name: '设备3',
des: '设备描述3',
type: 'DVR',
project: '治理'
},
{
name: '设备4',
des: '设备描述4',
type: 'DVR',
project: '治理'
},
{
name: '设备5',
des: '设备描述5',
type: 'APF',
project: '治理'
},
{
name: '设备6',
des: '设备描述6',
type: 'APF',
project: '治理'
} }
] ]
} }
@@ -74,11 +102,36 @@ export default {
} }
}, },
methods: { methods: {
registerDevice () {
uni.showModal({
title: '提示',
content: '请选择设备类型',
confirmText: '直连装置',
cancelText: '网关接入',
cancelColor: '#007aff',
success: ({ confirm, cancel }) => {
if (confirm) {
uni.navigateTo({
url: '/pages/device/new'
})
} else if (cancel) {
uni.navigateTo({
url: '/pages/gateway/list'
})
}
}
})
},
registerGateway () {
uni.navigateTo({
url: '/pages/gateway/new'
})
},
navMenuClick (index) { navMenuClick (index) {
this.navMenuActive = index this.navMenuActive = index
}, },
jump (item) { jump (item) {
if (item % 2) { if (item.type == 'APF') {
uni.navigateTo({ uni.navigateTo({
url: '/pages/device/APF/detail' url: '/pages/device/APF/detail'
}) })
@@ -88,6 +141,21 @@ export default {
}) })
} }
}, },
},
mounted () {
setTimeout(() => {
// 获取nav高度
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
this.navHeight = rect.height
// #ifdef H5
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
// #endif
// #ifdef APP-PLUS
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
// #endif
}).exec()
}, 1000);
} }
} }
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<Cn-page :loading="loading"> <Cn-page :loading="loading" noPadding>
<view slot="body"> <view slot="body">
<view class="index"> <view class="index">
<!-- 运维 --> <!-- 运维 -->
@@ -12,12 +12,11 @@
<ZhuYongHu v-if="userInfo.role == 4" /> <ZhuYongHu v-if="userInfo.role == 4" />
<!-- 子用户 --> <!-- 子用户 -->
<ZiYongHu v-if="userInfo.role == 5" /> <ZiYongHu v-if="userInfo.role == 5" />
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content" <uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content"
@trigger="trigger" /> @trigger="trigger" />
</view> </view>
</view> </view>
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import YunWei from "./comp/indexYunWei.vue"; import YunWei from "./comp/indexYunWei.vue";
@@ -37,7 +36,7 @@ export default {
return { return {
loading: false, loading: false,
userInfo: { userInfo: {
role: 1 role: 4
} }
} }
}, },
@@ -61,15 +60,15 @@ export default {
text: '子用户', text: '子用户',
} }
] ]
if (arr.indexOf(this.userInfo.role) > -1) { // if (arr.indexOf(this.userInfo.role) > -1) {
content.push({ // content.push({
iconPath: '/static/device.png', // iconPath: '/static/device.png',
text: '添加设备', // text: '添加设备',
}, { // }, {
iconPath: '/static/gateway.png', // iconPath: '/static/gateway.png',
text: '添加网关', // text: '添加网关',
}) // })
} // }
return content return content
} }
}, },
@@ -128,13 +127,13 @@ export default {
this.loading = false this.loading = false
}, },
onShow () { onShow () {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) || { role: 1 } this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) || { role: 4 }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx 0; padding: 34rpx 0 0;
} }
/deep/ .uni-card { /deep/ .uni-card {

View File

@@ -108,7 +108,7 @@ export default {
} }
.message-nav { .message-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;

View File

@@ -7,6 +7,11 @@
<view>灿能电力</view> <view>灿能电力</view>
<view class="tag">{{ roleName }}</view> <view class="tag">{{ roleName }}</view>
</view> </view>
<image
src="/static/erweima.png"
style="height: 50rpx;width: 50rpx;border-radius:12rpx"
mode="scaleToFill"
/>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<!-- <view class="mine-nav" @click="jump('upgrade')"> <!-- <view class="mine-nav" @click="jump('upgrade')">
@@ -15,13 +20,13 @@
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> --> </view> -->
<view class="mine-nav" @click="jump('user')" v-if="userInfo.role == 4"> <!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.role == 4">
<image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" />
<view class="mine-nav-label">子用户列表</view> <view class="mine-nav-label">子用户列表</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view> -->
<view class="mine-nav" @click="jump('project')" v-if="userInfo.role == 4"> <view class="mine-nav" @click="jump('project')" v-if="userInfo.role == 4">
<image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" /> <image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
<view class="mine-nav-label">项目管理</view> <view class="mine-nav-label">项目管理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
@@ -109,6 +114,11 @@ export default {
url: `/pages/user/basic` url: `/pages/user/basic`
}) })
break; break;
case 'project':
uni.navigateTo({
url: `/pages/project/list`
})
break;
break; break;
default: default:
uni.navigateTo({ uni.navigateTo({
@@ -158,7 +168,7 @@ export default {
} }
.mine-nav { .mine-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;

View File

@@ -24,7 +24,7 @@ export default {
.about { .about {
box-sizing: border-box; box-sizing: border-box;
height: 100vh; height: 100vh;
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

View File

@@ -20,6 +20,6 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
} }
</style> </style>

View File

@@ -20,6 +20,6 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
} }
</style> </style>

View File

@@ -7,8 +7,8 @@
<uni-forms-item label="类型"> <uni-forms-item label="类型">
<uni-data-select v-model="item.type" :localdata="range"></uni-data-select> <uni-data-select v-model="item.type" :localdata="range"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="标题"> <uni-forms-item label="区域">
<uni-easyinput type="text" v-model="item.title" placeholder="请输入问题简要" /> <uni-easyinput type="textarea" v-model="item.title" placeholder="请输入问题简要" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="描述"> <uni-forms-item label="描述">
<uni-easyinput type="textarea" v-model="item.des" placeholder="请输入详细描述" /> <uni-easyinput type="textarea" v-model="item.des" placeholder="请输入详细描述" />
@@ -55,11 +55,11 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.content { .content {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }
@@ -82,8 +82,4 @@ export default {
} }
} }
} }
/deep/ .uni-forms-item:last-of-type {
margin-bottom: 0;
}
</style> </style>

View File

@@ -20,6 +20,6 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
} }
</style> </style>

View File

@@ -83,6 +83,7 @@ export default {
<style lang="scss"> <style lang="scss">
.mine { .mine {
padding-top: 20rpx;
.mine-header { .mine-header {
padding: 200rpx 34rpx 34rpx; padding: 200rpx 34rpx 34rpx;
display: flex; display: flex;
@@ -109,7 +110,7 @@ export default {
} }
.mine-nav { .mine-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;

View File

@@ -78,7 +78,7 @@ export default {
} }
.mine-nav { .mine-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;

View File

@@ -19,6 +19,6 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
} }
</style> </style>

View File

@@ -20,6 +20,6 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
} }
</style> </style>

View File

@@ -32,7 +32,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx; padding: 20rpx;
.submit-btn { .submit-btn {
background: $uni-theme-blue; background: $uni-theme-blue;

View File

@@ -53,7 +53,7 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.footer-btn { .footer-btn {
padding: 0 20rpx; padding: 0 20rpx;

126
pages/project/detail.vue Normal file
View File

@@ -0,0 +1,126 @@
<template>
<Cn-page :loading='loading' noPadding>
<view slot='body'>
<view class='detail'>
<view class="header">
<view class="header-title">{{ project }}</view>
<view class="header-des">项目详情</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" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }">
<view v-show="navMenuActive == 0">
<uni-card title="基础设备" sub-title="副标题" extra="APF" v-for="item in 10" :key="item" @click="jump"
thumbnail="/static/real_time_data.png">
<text>设备基础信息 </text>
</uni-card>
</view>
<view style="padding: 0 20rpx" v-show="navMenuActive == 1">
<uni-list>
<uni-list-item title="张三" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
<template v-slot:footer>
<view class="footer-btn mt20" style="background:#e47470" @click="del">移除</view>
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
</template>
</uni-list-item>
<uni-list-item title="李四" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
<template v-slot:footer>
<view class="footer-btn mt20" style="background:#e47470" @click="del">移除</view>
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
</template>
</uni-list-item>
</uni-list>
</view>
<uni-load-more status="nomore"></uni-load-more>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
data () {
return {
loading: false,
project: '',
navMenuList: [{
text: '设备列表'
}, {
text: '子用户列表'
}],
navMenuActive: 0
}
},
methods: {
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('用户点击取消')
}
}
})
}
},
onLoad (option) {
this.project = option.project
setTimeout(() => {
// 获取nav高度
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
this.navHeight = rect.height
}).exec()
}, 1000);
// uni.setNavigationBarTitle({ title: this.project })
}
}
</script>
<style lang='scss'>
.detail {
.content {
box-sizing: border-box;
padding-bottom: 20rpx;
}
.header {
padding: 20rpx 20rpx 0;
.header-title {
font-size: 40rpx;
margin-bottom: 10rpx;
}
.header-des {
font-size: 28rpx;
color: #666;
}
}
.footer-btn {
padding: 0 20rpx;
height: 50rpx;
background-color: #007aff;
font-size: 24rpx;
color: #fff;
text-align: center;
line-height: 50rpx;
border-radius: 10rpx;
}
}
</style>

View File

@@ -1,17 +1,20 @@
<template> <template>
<view :loading="loading"> <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="plusempty" background-color="#fff"
color="#111" title="项目管理" @clickLeft="back" @clickRight="add" />
<view class="message"> <view class="message">
<view class="message-nav" @click="jump('system')"> <view class="message-nav" @click="jump('监测')">
<view class="message-nav-label">监测</view> <view class="message-nav-label">监测</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="message-nav" @click="jump('feedback')"> <view class="message-nav" @click="jump('治理')">
<view class="message-nav-label">治理</view> <view class="message-nav-label">治理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="message-nav" @click="jump('report')"> <view class="message-nav" @click="jump('用能')">
<view class="message-nav-label">用能</view> <view class="message-nav-label">用能</view>
<uni-badge text="3"></uni-badge> <!-- <uni-badge text="3"></uni-badge> -->
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
@@ -29,6 +32,14 @@ export default {
methods: { methods: {
init () { init () {
}, },
back () {
uni.navigateBack()
},
add () {
uni.navigateTo({
url: `/pages/project/new`
})
},
upgrade (code) { upgrade (code) {
console.log(code); console.log(code);
uni.showToast({ uni.showToast({
@@ -38,7 +49,7 @@ export default {
}, },
jump (type) { jump (type) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/device/list` url: `/pages/project/detail?project=${type}`
}) })
} }
}, },
@@ -51,6 +62,7 @@ export default {
<style lang="scss"> <style lang="scss">
.message { .message {
padding-top: 20rpx; padding-top: 20rpx;
.message-header { .message-header {
padding: 200rpx 34rpx 34rpx; padding: 200rpx 34rpx 34rpx;
display: flex; display: flex;

102
pages/project/new.vue Normal file
View File

@@ -0,0 +1,102 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='new'>
<view class="content">
<uni-forms :label-width="80">
<uni-forms-item label="项目名称">
<uni-easyinput type="number" v-model="formData.name" placeholder="请输入项目名称" />
</uni-forms-item>
<uni-forms-item label="区域">
<view style="display:flex;">
<uni-easyinput :clearable="false" type="textarea" autoHeight v-model="formData.address"
placeholder="请输入区域信息" />
<uni-icons type="location" color="#007aff" size="26" class="ml20"
@click="chooseLocation"></uni-icons>
</view>
</uni-forms-item>
<uni-forms-item label="描述">
<uni-easyinput type="textarea" v-model="formData.name" placeholder="请输入项目描述" />
</uni-forms-item>
<uni-file-picker title="请上传拓扑图" :sourceType="['album']"></uni-file-picker>
</uni-forms>
</view>
<view class="btn-wrap">
<view class="btn-wrap-item" @click="submit"> 提交 </view>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
data () {
return {
loading: false,
formData: {
name: '',
gplot: ''
},
}
},
methods: {
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);
}
});
},
submit () {
this.$util.toast('项目创建成功')
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500);
}
}
}
</script>
<style lang='scss'>
.new {
padding: 34rpx;
.content {
.content-des {
font-size: 28rpx;
color: #666;
margin-bottom: 20rpx;
}
margin-bottom: 20rpx;
padding: 34rpx;
background: $uni-theme-white;
border-radius: 12rpx;
}
.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;
background: $uni-theme-blue;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
}
}
/deep/ .uni-drawer__content {
width: 100vw !important;
}
</style>

View File

@@ -8,11 +8,20 @@
mode="scaleToFill" /> mode="scaleToFill" />
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('changeName')" style="border-bottom: none; "> <view class="mine-nav" @click="jump('changeName')" >
<view class="mine-nav-label">名字</view> <view class="mine-nav-label">名字</view>
<view class="mine-nav-des">灿能电力</view> <view class="mine-nav-des">灿能电力</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons> <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view> </view>
<view class="mine-nav" @click="jump('erweima')" style="border-bottom: none; ">
<view class="mine-nav-label">我的二维码</view>
<image
src="/static/erweima.png"
style="height: 50rpx;width: 50rpx;border-radius:12rpx"
mode="scaleToFill"
/>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view>
</view> </view>
</view> </view>
</Cn-page> </Cn-page>
@@ -39,10 +48,10 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.index { .index {
padding: 34rpx; padding: 20rpx;
.mine-nav { .mine-nav {
padding: 34rpx; padding: 34rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: $uni-theme-white; background: $uni-theme-white;

View File

@@ -31,11 +31,11 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.change-name { .change-name {
padding: 34rpx; padding: 34rpx;
.content { .content {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 34rpx; padding: 34rpx;
background: $uni-theme-white; background: $uni-theme-white;
border-radius: 12rpx; border-radius: 12rpx;
} }

View File

@@ -116,7 +116,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx; padding: 20rpx;
.submit-btn { .submit-btn {
background: $uni-theme-blue; background: $uni-theme-blue;

View File

@@ -106,7 +106,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx; padding: 20rpx;
.submit-btn { .submit-btn {
background: $uni-theme-blue; background: $uni-theme-blue;

25
pages/user/erweima.vue Normal file
View File

@@ -0,0 +1,25 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='erweima'>
二维码
</view>
</view>
</Cn-page>
</template>
<script>
export default {
data () {
return {
loading: false
}
},
methods: {
}
}
</script>
<style lang='scss'>
.index {
padding: 20rpx;
}
</style>

View File

@@ -110,7 +110,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx; padding: 20rpx;
.submit-btn { .submit-btn {
background: $uni-theme-blue; background: $uni-theme-blue;

View File

@@ -118,7 +118,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.index { .index {
padding: 34rpx; padding: 20rpx;
.submit-btn { .submit-btn {
background: $uni-theme-blue; background: $uni-theme-blue;

BIN
static/erweima.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
static/project.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 330 KiB

BIN
static/test3.pic.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -72,7 +72,7 @@
}, },
margin: { margin: {
type: String, type: String,
default: '15px' default: '10px'
}, },
spacing: { spacing: {
type: String, type: String,

View File

@@ -2,7 +2,7 @@
<view class="uni-file-picker"> <view class="uni-file-picker">
<view v-if="title" class="uni-file-picker__header"> <view v-if="title" class="uni-file-picker__header">
<text class="file-title">{{ title }}</text> <text class="file-title">{{ title }}</text>
<text class="file-count">{{ filesList.length }}/{{ limitLength }}</text> <!-- <text class="file-count">{{ filesList.length }}/{{ limitLength }}</text> -->
</view> </view>
<upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly" <upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly"
:image-styles="imageStyles" :files-list="filesList" :limit="limitLength" :disablePreview="disablePreview" :image-styles="imageStyles" :files-list="filesList" :limit="limitLength" :disablePreview="disablePreview"

View File

@@ -580,7 +580,9 @@
font-weight: bold; font-weight: bold;
} }
} }
.uni-forms-item:last-of-type{
margin-bottom: 0;
}
.uni-forms-item--border { .uni-forms-item--border {
margin-bottom: 0; margin-bottom: 0;

View File

@@ -0,0 +1,47 @@
## 1.3.92022-10-13
- 修复 条件编译错误的bug
## 1.3.82022-10-12
- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug
## 1.3.72022-08-11
- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug
## 1.3.62022-06-30
- 修复 组件示例中插槽用法无法显示内容的bug
## 1.3.52022-05-24
- 新增 stat 属性 可开启统计title 上报 仅使用了title 属性且项目开启了uni统计生效
## 1.3.42022-01-24
- 更新 组件示例
## 1.3.32022-01-24
- 新增 left-width/right-width属性 ,可修改左右两侧的宽度
## 1.3.22022-01-18
- 修复 在vue下标题不垂直居中的bug
## 1.3.12022-01-18
- 修复 height 属性类型错误
## 1.3.02022-01-18
- 新增 height 属性,可修改组件高度
- 新增 dark 属性可可开启暗黑模式
- 优化 标题字数过多显示省略号
- 优化 插槽,插入内容可完全覆盖
## 1.2.12022-01-10
- 修复 color 属性不生效的bug
## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-nav-bar](https://uniapp.dcloud.io/component/uniui/uni-nav-bar)
## 1.1.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.112021-05-12
- 新增 组件示例地址
## 1.0.102021-04-30
- 修复 在nvue下fixed为true宽度不能撑满的Bug
## 1.0.92021-04-21
- 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.82021-04-14
- uni-ui 修复 uni-nav-bar 当 fixed 属性为 true 时铺不满屏幕的 bug
## 1.0.72021-02-25
- 修复 easycom 下,找不到 uni-status-bar 的bug
## 1.0.62021-02-05
- 优化 组件引用关系通过uni_modules引用组件
## 1.0.52021-02-05
- 调整为uni_modules目录规范

View File

@@ -0,0 +1,357 @@
<template>
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
:style="{ 'background-color': themeBgColor }" >
<status-bar v-if="statusBar" />
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
class="uni-navbar__header">
<view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left"
:style="{width:leftIconWidth}">
<slot name="left">
<view class="uni-navbar__content_view" v-if="leftIcon.length > 0">
<uni-icons :color="themeColor" :type="leftIcon" size="20" />
</view>
<view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text"
v-if="leftText.length">
<text :style="{ color: themeColor, fontSize: '12px' }">{{ leftText }}</text>
</view>
</slot>
</view>
<view class="uni-navbar__header-container " @tap="onClickTitle">
<slot>
<view class="uni-navbar__header-container-inner" v-if="title.length>0">
<text class="uni-nav-bar-text uni-ellipsis-1"
:style="{color: themeColor }">{{ title }}</text>
</view>
</slot>
</view>
<view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right"
:style="{width:rightIconWidth}">
<slot name="right">
<view v-if="rightIcon.length">
<uni-icons :color="themeColor" :type="rightIcon" size="22" />
</view>
<view class="uni-navbar-btn-text" v-if="rightText.length && !rightIcon.length">
<text class="uni-nav-bar-right-text" :style="{ color: themeColor}">{{ rightText }}</text>
</view>
</slot>
</view>
</view>
</view>
<!-- #ifndef APP-NVUE -->
<view class="uni-navbar__placeholder" v-if="fixed">
<status-bar v-if="statusBar" />
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
</view>
<!-- #endif -->
</view>
</template>
<script>
import statusBar from "./uni-status-bar.vue";
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
/**
*
*
* NavBar 自定义导航栏
* @description 导航栏组件,主要用于头部导航
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
* @property {Boolean} dark 开启黑暗模式
* @property {String} title 标题文字
* @property {String} leftText 左侧按钮文本
* @property {String} rightText 右侧按钮文本
* @property {String} leftIcon 左侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
* @property {String} rightIcon 右侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
* @property {String} color 图标和文字颜色
* @property {String} backgroundColor 导航栏背景颜色
* @property {Boolean} fixed = [true|false] 是否固定顶部
* @property {Boolean} statusBar = [true|false] 是否包含状态栏
* @property {Boolean} shadow = [true|false] 导航栏下是否有阴影
* @property {Boolean} stat 是否开启统计标题上报
* @event {Function} clickLeft 左侧按钮点击时触发
* @event {Function} clickRight 右侧按钮点击时触发
* @event {Function} clickTitle 中间标题点击时触发
*/
export default {
name: "UniNavBar",
components: {
statusBar
},
emits: ['clickLeft', 'clickRight', 'clickTitle'],
props: {
dark: {
type: Boolean,
default: false
},
title: {
type: String,
default: ""
},
leftText: {
type: String,
default: ""
},
rightText: {
type: String,
default: ""
},
leftIcon: {
type: String,
default: ""
},
rightIcon: {
type: String,
default: ""
},
fixed: {
type: [Boolean, String],
default: false
},
color: {
type: String,
default: ""
},
backgroundColor: {
type: String,
default: ""
},
statusBar: {
type: [Boolean, String],
default: false
},
shadow: {
type: [Boolean, String],
default: false
},
border: {
type: [Boolean, String],
default: true
},
height: {
type: [Number, String],
default: 44
},
leftWidth: {
type: [Number, String],
default: 60
},
rightWidth: {
type: [Number, String],
default: 60
},
stat: {
type: [Boolean, String],
default: ''
}
},
computed: {
themeBgColor() {
if (this.dark) {
// 默认值
if (this.backgroundColor) {
return this.backgroundColor
} else {
return this.dark ? '#333' : '#FFF'
}
}
return this.backgroundColor || '#FFF'
},
themeColor() {
if (this.dark) {
// 默认值
if (this.color) {
return this.color
} else {
return this.dark ? '#fff' : '#333'
}
}
return this.color || '#333'
},
navbarHeight() {
return getVal(this.height)
},
leftIconWidth() {
return getVal(this.leftWidth)
},
rightIconWidth() {
return getVal(this.rightWidth)
}
},
mounted() {
if (uni.report && this.stat && this.title !== '') {
uni.report('title', this.title)
}
},
methods: {
onClickLeft() {
this.$emit("clickLeft");
},
onClickRight() {
this.$emit("clickRight");
},
onClickTitle() {
this.$emit("clickTitle");
}
}
};
</script>
<style lang="scss" scoped>
$nav-height: 44px;
.uni-nvue-fixed {
/* #ifdef APP-NVUE */
position: sticky;
/* #endif */
}
.uni-navbar {
// box-sizing: border-box;
}
.uni-nav-bar-text {
/* #ifdef APP-PLUS */
font-size: 34rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 14px;
/* #endif */
}
.uni-nav-bar-right-text {
font-size: 12px;
}
.uni-navbar__content {
position: relative;
// background-color: #fff;
// box-sizing: border-box;
background-color: transparent;
}
.uni-navbar__content_view {
// box-sizing: border-box;
}
.uni-navbar-btn-text {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: flex-start;
align-items: center;
line-height: 12px;
}
.uni-navbar__header {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
padding: 0 10px;
flex-direction: row;
height: $nav-height;
font-size: 12px;
}
.uni-navbar__header-btns {
/* #ifndef APP-NVUE */
overflow: hidden;
display: flex;
/* #endif */
flex-wrap: nowrap;
flex-direction: row;
width: 120rpx;
// padding: 0 6px;
justify-content: center;
align-items: center;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-navbar__header-btns-left {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
width: 120rpx;
justify-content: flex-start;
align-items: center;
}
.uni-navbar__header-btns-right {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
// width: 150rpx;
// padding-right: 30rpx;
justify-content: flex-end;
align-items: center;
}
.uni-navbar__header-container {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
padding: 0 10px;
overflow: hidden;
}
.uni-navbar__header-container-inner {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
flex-direction: row;
align-items: center;
justify-content: center;
font-size: 12px;
overflow: hidden;
// box-sizing: border-box;
}
.uni-navbar__placeholder-view {
height: $nav-height;
}
.uni-navbar--fixed {
position: fixed;
z-index: 998;
/* #ifdef H5 */
left: var(--window-left);
right: var(--window-right);
/* #endif */
/* #ifndef H5 */
left: 0;
right: 0;
/* #endif */
}
.uni-navbar--shadow {
box-shadow: 0 1px 6px #ccc;
}
.uni-navbar--border {
border-bottom-width: 1rpx;
border-bottom-style: solid;
border-bottom-color: #eee;
}
.uni-ellipsis-1 {
overflow: hidden;
/* #ifndef APP-NVUE */
white-space: nowrap;
text-overflow: ellipsis;
/* #endif */
/* #ifdef APP-NVUE */
lines: 1;
text-overflow: ellipsis;
/* #endif */
}
// 暗主题配置
.uni-dark {}
</style>

View File

@@ -0,0 +1,27 @@
<template>
<view :style="{ height: statusBarHeight }" class="uni-status-bar">
<slot />
</view>
</template>
<script>
export default {
name: 'UniStatusBar',
data() {
return {
statusBarHeight: 20
}
},
mounted() {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
}
}
</script>
<style lang="scss" >
.uni-status-bar {
// width: 750rpx;
height: 20px;
// height: var(--status-bar-height);
}
</style>

View File

@@ -0,0 +1,86 @@
{
"id": "uni-nav-bar",
"displayName": "uni-nav-bar 自定义导航栏",
"version": "1.3.9",
"description": "自定义导航栏组件,主要用于头部导航。",
"keywords": [
"uni-ui",
"导航",
"导航栏",
"自定义导航栏"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [
"uni-scss",
"uni-icons"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
## NavBar 导航栏
> **组件名uni-nav-bar**
> 代码块: `uNavBar`
导航栏组件,主要用于头部导航。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-nav-bar)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839