17755135699 2 månader sedan
förälder
incheckning
974ba1dda8

+ 1 - 0
App.vue

@@ -15,4 +15,5 @@
 <style lang="scss">
 	/*每个页面公共css */
 	@import "@/node_modules/uview-ui/index.scss";
+	.page{padding-bottom: 130rpx;background-color: #E1EDFF;}
 </style>

+ 100 - 0
components/Tabbar/tabbar.vue

@@ -0,0 +1,100 @@
+<template>
+	<view>
+		<view class="bottom_tabbar">
+			<view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)">
+				<image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
+				<text :class="tabbarIndex===index?'on':''">{{item.text}}</text>
+
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			tabbarIndex: 0
+		},
+		data() {
+			return {
+				tabbarValue: 0,
+				list: [{
+						inactiveImg: './../../static/imgs/tabbar/icon1.png',
+						activeImg: './../../static/imgs/tabbar/icon1_on.png',
+						text: '首页',
+						path: '/pages/index/index'
+					},
+					{
+						inactiveImg: './../../static/imgs/tabbar/icon2.png',
+						activeImg: './../../static/imgs/tabbar/icon2_on.png',
+						text: '方案',
+						path: '/pages/plan/index'
+					},
+					{
+						inactiveImg: './../../static/imgs/tabbar/icon3.png',
+						activeImg: './../../static/imgs/tabbar/icon3_on.png',
+						text: '在线咨询',
+						path: '/pages/consult/index'
+					},
+				],
+			}
+		},
+		mounted() {
+			this.tabbarValue = this.tabbarIndex;
+		},
+		methods: {
+			changeTabbar(e) {
+				if (!this.list[e].path) return this.$showToast('正在开发中...')
+				this.tabbarValue = e;
+				uni.reLaunch({
+					url: this.list[e].path
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="less">
+	.bottom_tabbar {
+		width: 100%;
+		height: 120rpx;
+		background: #FFFFFF;
+		// box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.08);
+		// border-radius: 60rpx;
+		display: flex;
+		align-items: center;
+		justify-content: space-around;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		background-color: #fff;
+		z-index: 9;
+		// 底部安全区域
+		box-sizing: content-box;
+		padding-bottom: 0 !important;
+		padding-bottom: constant(safe-area-inset-bottom) !important;
+		padding-bottom: env(safe-area-inset-bottom) !important;
+		&>view {
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+
+			image {
+				width: 48rpx;
+				height: 48rpx;
+			}
+
+			text {
+				margin-top: 4rpx;
+				font-size: 24rpx;
+				font-family: PingFangSC, PingFang SC;
+				font-weight: 500;
+				color: #666666;
+				&.on{
+					color: #385FDF;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
index.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
   <head>
-    <meta charset="UTF-8" />
+    <meta charset="UTF-8" name="viewport" viewport-fit=cover" />
     <script>
       var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
         CSS.supports('top: constant(a)'))

+ 3 - 0
main.js

@@ -35,6 +35,9 @@ import uHeader from '@/components/common/uHeader'
 Vue.component('uHeader',uHeader);
 import cusEcharts from '@/components/cusEcharts/index'
 Vue.component('cusEcharts',cusEcharts);
+//tabbar
+import tabbar from '@/components/Tabbar/tabbar'
+Vue.component('tabbar',tabbar);
 
 // #endif
 

+ 12 - 0
pages.json

@@ -8,6 +8,18 @@
 			"style": {
 				"navigationBarTitleText": "智慧工厂演示案例"
 			}
+		},
+		{
+			"path": "pages/plan/index",
+			"style": {
+				"navigationBarTitleText": "方案"
+			}
+		},
+		{
+			"path": "pages/consult/index",
+			"style": {
+				"navigationBarTitleText": "在线咨询"
+			}
 		}
 	],
 	"globalStyle": {

+ 509 - 0
pages/consult/index.vue

@@ -0,0 +1,509 @@
+<template>
+	<view class="page">
+		<view class="chart" v-if="testData.length">
+			<cusEcharts :option="testOption"></cusEcharts>
+		</view>
+		<view class="chart" v-if="kxData.length">
+			<cusEcharts :option="kxOption"></cusEcharts>
+		</view>
+		<view class="chart" v-if="kxData2.length">
+			<cusEcharts :option="kxOption2"></cusEcharts>
+		</view>
+		<tabbar :tabbarIndex="2"></tabbar>
+	</view>
+</template>
+
+<script>
+    import * as echarts from "echarts";
+	import aqiData from '@/static/js/aqi-beijing.js'
+	export default {
+		data(){
+			return {
+				testData:[],
+				testOption:null,
+				kxData:[],
+				kxOption:null,
+				kxData2:[],
+				kxOption2:null
+			}
+		},
+		mounted() {
+			this.init();
+		},
+		methods:{
+			init(){
+				this.initTestChart();
+				this.initKxChart();
+				this.initKxChart2();
+			},
+			initTestChart(){
+				this.testData = [150, 230, 224, 218, 135, 147, 260];
+				this.testOption = {
+				  xAxis: {
+					type: 'category',
+					data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+				  },
+				  yAxis: {
+					type: 'value'
+				  },
+				  series: [
+					{
+					  data: this.testData,
+					  type: 'line'
+					}
+				  ]
+				};
+			},
+			initKxChart(){
+				this.kxData = [270,220,350,210,280,400];
+				const offsetX = 4;
+				const offsetY = 2;
+				// 绘制左侧面
+				const CubeLeft = echarts.graphic.extendShape({
+					shape: {
+						x: 0,
+						y: 0,
+					},
+					buildPath: function (ctx, shape) {
+						// 会canvas的应该都能看得懂,shape是从custom传入的
+						const xAxisPoint = shape.xAxisPoint;
+						const c0 = [shape.x, shape.y];
+						const c1 = [shape.x - offsetX, shape.y - offsetY];
+						const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
+						const c3 = [xAxisPoint[0], xAxisPoint[1]];
+						ctx
+							.moveTo(c0[0], c0[1])
+							.lineTo(c1[0], c1[1])
+							.lineTo(c2[0], c2[1])
+							.lineTo(c3[0], c3[1])
+							.closePath();
+					},
+				});
+				// 绘制右侧面
+				const CubeRight = echarts.graphic.extendShape({
+					shape: {
+						x: 0,
+						y: 0,
+					},
+					buildPath: function (ctx, shape) {
+						const xAxisPoint = shape.xAxisPoint;
+						const c1 = [shape.x, shape.y];
+						const c2 = [xAxisPoint[0], xAxisPoint[1]];
+						const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY];
+						const c4 = [shape.x + offsetX, shape.y - offsetY];
+						ctx
+							.moveTo(c1[0], c1[1])
+							.lineTo(c2[0], c2[1])
+							.lineTo(c3[0], c3[1])
+							.lineTo(c4[0], c4[1])
+							.closePath();
+					},
+				});
+				// 绘制顶面
+				const CubeTop = echarts.graphic.extendShape({
+					shape: {
+						x: 0,
+						y: 0,
+					},
+					buildPath: function (ctx, shape) {
+						const c1 = [shape.x, shape.y];
+						const c2 = [shape.x + offsetX, shape.y - offsetY]; //右点
+						const c3 = [shape.x, shape.y - offsetX];
+						const c4 = [shape.x - offsetX, shape.y - offsetY];
+						ctx
+							.moveTo(c1[0], c1[1])
+							.lineTo(c2[0], c2[1])
+							.lineTo(c3[0], c3[1])
+							.lineTo(c4[0], c4[1])
+							.closePath();
+					},
+				});
+
+				// 注册三个面图形
+				echarts.graphic.registerShape("CubeLeft", CubeLeft);
+				echarts.graphic.registerShape("CubeRight", CubeRight);
+				echarts.graphic.registerShape("CubeTop", CubeTop);
+
+				this.kxOption = {
+					tooltip: {
+						trigger: 'axis',
+						backgroundColor: 'rgba(13,5,30,.6)',
+						borderWidth: 1,
+						borderColor: '#4ddd8f',
+						padding: 5,
+						textStyle: {
+							color: '#fff'
+						}
+					},
+					legend: {
+						right: 170,
+						top: 15,
+						textStyle: {
+							fontSize: 12,
+							color: '#A7BFDE'
+						},
+						itemWidth: 6,
+						itemHeight: 8
+					},
+					grid: {
+						left: '4%',
+						right: '3%',
+						top: '25%',
+						bottom: '8%',
+						containLabel: true,
+					},
+					xAxis: {
+						type: 'category',
+						data: ['3月', '4月', '5月', '6月', '7月', '8月'],
+						axisPointer: {
+							type: 'shadow'
+						},
+						axisTick: {
+							show: true,
+							length: 4,
+							lineStyle: {
+								color: 'rgba(199,211,229,0.5)'
+							}
+						},
+						axisLine: {
+							show: true,
+							lineStyle: {
+								color: 'rgba(199,211,229,0.5)'
+							}
+						},
+						axisLabel: {
+							color: '#c7d3e5'
+						}
+					},
+					yAxis: {
+						name:'(单位)',
+						type: 'value',
+						nameTextStyle: {
+							fontSize: 12,
+							color: '#C6D7F1',
+							fontWeight: 400,
+						},
+						nameGap: 25,
+						axisLine: {
+							show: false,
+							lineStyle: {
+								width: 1,
+								color: '#545454'
+							}
+						},
+						splitLine: {
+							show: true,
+							lineStyle: {
+								color: 'rgba(199,211,229,0.3)',
+								width: 1,
+								type: 'dashed'
+							}
+						},
+						axisTick: {
+							show: false
+						},
+						axisLabel: {
+							fontSize: 12,
+							color: '#c7d3e5'
+						}
+					},
+					series: [
+						{
+							name: "国内",
+							type: "custom",
+							renderItem: (params, api) => {
+								const location = api.coord([api.value(0), api.value(1)]);
+								const xAxisPoint = api.coord([api.value(0), 0]);
+								const distance = 7;
+								return {
+									type: "group",
+									children: [{
+											type: "CubeLeft",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] + distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] + distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#0B5FA9',
+													},
+													{
+														offset: 1,
+														color: 'rgba(11,95,169,0)'
+													}
+												]),
+											},
+										},
+										{
+											type: "CubeRight",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] + distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] + distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#088BFF',
+													},
+													{
+														offset: 1,
+														color: 'rgba(8,139,255,0)'
+													}
+												]),
+											},
+										},
+										{
+											type: "CubeTop",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] + distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] + distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#61B5FF',
+													},
+													{
+														offset: 1,
+														color: '#61B5FF'
+													}
+												]),
+											},
+										},
+									],
+								};
+							},
+							itemStyle: {
+								color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+										offset: 0,
+										color: "#00BFF4",
+									},
+									{
+										offset: 1,
+										color: "#A5E2FF",
+									},
+								]),
+							},
+							data: [410,330,210,210,480,190],
+						},
+						{
+							name: "出口",
+							type: "custom",
+							renderItem: (params, api) => {
+								const location = api.coord([api.value(0), api.value(1)]);
+								const xAxisPoint = api.coord([api.value(0), 0]);
+								const distance = 7;
+								return {
+									type: "group",
+									children: [{
+											type: "CubeLeft",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] - distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#28A9A2',
+													},
+													{
+														offset: 1,
+														color: 'rgba(40,169,162,0)'
+													}
+												]),
+											},
+										},
+										{
+											type: "CubeRight",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] - distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#35FFF4',
+													},
+													{
+														offset: 1,
+														color: 'rgba(53,255,244,0)'
+													}
+												]),
+											},
+										},
+										{
+											type: "CubeTop",
+											shape: {
+												api,
+												xValue: api.value(0),
+												yValue: api.value(1),
+												x: location[0] - distance,
+												y: location[1],
+												xAxisPoint: [xAxisPoint[0] - distance, xAxisPoint[1]],
+											},
+											style: {
+												fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+														offset: 0,
+														color: '#7EFFF8',
+													},
+													{
+														offset: 1,
+														color: '#7EFFF8'
+													}
+												]),
+											},
+										},
+									],
+								};
+							},
+							itemStyle: {
+								color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+										offset: 0,
+										color: "#6AAAFF",
+									},
+									{
+										offset: 1,
+										color: "#046EFE",
+									},
+								]),
+							},
+							data: this.kxData,
+						}
+					],
+				};
+			},
+			initKxChart2(){
+				this.kxData2 = [0];
+				let data = aqiData;
+				this.kxOption2 = {
+					title: {
+						text: 'Beijing AQI',
+						left: '1%'
+					  },
+					  tooltip: {
+						trigger: 'axis'
+					  },
+					  grid: {
+						left: '10%',
+						right: '150px',
+						bottom: '20%'
+					  },
+					  xAxis: {
+						data: data.map(function (item) {
+						  return item[0];
+						})
+					  },
+					  yAxis: {},
+					  dataZoom: [
+						{
+						  startValue: '2014-06-01'
+						},
+						{
+						  type: 'inside'
+						}
+					  ],
+					  visualMap: {
+						top: 50,
+						right: 10,
+						pieces: [
+						  {
+							gt: 0,
+							lte: 50,
+							color: '#93CE07'
+						  },
+						  {
+							gt: 50,
+							lte: 100,
+							color: '#FBDB0F'
+						  },
+						  {
+							gt: 100,
+							lte: 150,
+							color: '#FC7D02'
+						  },
+						  {
+							gt: 150,
+							lte: 200,
+							color: '#FD0100'
+						  },
+						  {
+							gt: 200,
+							lte: 300,
+							color: '#AA069F'
+						  },
+						  {
+							gt: 300,
+							color: '#AC3B2A'
+						  }
+						],
+						outOfRange: {
+						  color: '#999'
+						}
+					  },
+					  series: {
+						name: 'Beijing AQI',
+						type: 'line',
+						data: data.map(function (item) {
+						  return item[1];
+						}),
+						markLine: {
+						  silent: true,
+						  lineStyle: {
+							color: '#333'
+						  },
+						  data: [
+							{
+							  yAxis: 50
+							},
+							{
+							  yAxis: 100
+							},
+							{
+							  yAxis: 150
+							},
+							{
+							  yAxis: 200
+							},
+							{
+							  yAxis: 300
+							}
+						  ]
+						}
+					  }
+				}
+			},
+		}
+	}
+</script>
+
+<style scoped lang="less">
+	.chart{
+		width: 100%;
+		height: 300px;
+		margin-top: 50px;
+		&:first-child{
+			margin-top: 0;
+		}
+	}
+</style>

+ 0 - 85
pages/index/index - 副本.vue

@@ -1,85 +0,0 @@
-<template>
-  <view class="charts-box">
-    <qiun-data-charts 
-      type="column"
-      :opts="opts"
-      :chartData="chartData"
-    />
-  </view>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      chartData: {},
-      //您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
-      opts: {
-        color: ["#FAC858","#EE6666","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
-        padding: [15,15,0,5],
-        enableScroll: false,
-        legend: {},
-        xAxis: {
-          disableGrid: true
-        },
-        yAxis: {
-          data: [
-            {
-              min: 0
-            }
-          ]
-        },
-        extra: {
-          column: {
-            type: "group",
-            width: 30,
-            activeBgColor: "#000000",
-            activeBgOpacity: 0.08,
-            linearType: "custom",
-            seriesGap: 5,
-            linearOpacity: 0.5,
-            barBorderCircle: true,
-            customColor: [
-              "#FA7D8D",
-              "#EB88E2"
-            ]
-          }
-        }
-      }
-    };
-  },
-  onReady() {
-    this.getServerData();
-  },
-  methods: {
-    getServerData() {
-      //模拟从服务器获取数据时的延时
-      setTimeout(() => {
-        //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
-        let res = {
-            categories: ["2018","2019","2020","2021","2022","2023"],
-            series: [
-              {
-                name: "目标值",
-                data: [35,36,31,33,13,34]
-              },
-              {
-                name: "完成量",
-                data: [18,27,21,24,6,28]
-              }
-            ]
-          };
-        this.chartData = JSON.parse(JSON.stringify(res));
-      }, 500);
-    },
-  }
-};
-</script>
-
-<style scoped>
-  /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
-  .charts-box {
-    width: 100%;
-    height: 300px;
-  }
-</style>

+ 1 - 0
pages/index/index.vue

@@ -9,6 +9,7 @@
 		<view class="chart" v-if="kxData2.length">
 			<cusEcharts :option="kxOption2"></cusEcharts>
 		</view>
+		<tabbar :tabbarIndex="0"></tabbar>
 	</view>
 </template>
 

BIN
static/imgs/icon_fangan_active.png


BIN
static/imgs/icon_fangan_inactive.png


BIN
static/imgs/icon_home_active.png


BIN
static/imgs/icon_home_inactive.png


BIN
static/imgs/icon_zxzx_active.png


BIN
static/imgs/icon_zxzx_inactive.png


BIN
static/imgs/tabbar/icon1.png


BIN
static/imgs/tabbar/icon1_on.png


BIN
static/imgs/tabbar/icon2.png


BIN
static/imgs/tabbar/icon2_on.png


BIN
static/imgs/tabbar/icon3.png


BIN
static/imgs/tabbar/icon3_on.png