zhangyun 3 rokov pred
rodič
commit
c270d77aef

+ 639 - 0
MingGaoApp/components/ksp-image-cutter/ksp-image-cutter.vue

@@ -0,0 +1,639 @@
+<template>
+<view v-show="url" class="ksp-image-cutter">
+	<canvas :style="{width: target.width + 'px', height: target.height + 'px'}" canvas-id="target"></canvas>
+	<view class="body">
+		<image v-if="url" class="image" @load="imageLoad" :style="{left: image.left + 'px', top: image.top + 'px', width: image.width + 'px', height: image.height + 'px'}" :src="url"></image>
+		<view v-if="mask.show" class="mask"></view>
+		<view @touchstart="touchStart($event, 'plank')" @touchmove="touchMove" @touchend="touchEnd" @touchcancel="touchCancel"  class="plank">
+			<view class="frame" @touchstart="touchStart($event, 'frame')" @touchstart.stop.prevent="touchHandle" :style="{left: frame.left + 'px', top: frame.top + 'px', width: frame.width + 'px', height: frame.height + 'px'}">
+				<canvas v-if="mask.show" class="canvas" :style="{width: frame.width + 'px', height: frame.height + 'px'}" canvas-id="canvas"></canvas>
+				<view class="rect"></view>
+				<view class="line-one"></view>
+				<view class="line-two"></view>
+				<view class="line-three"></view>
+				<view class="line-four"></view>
+				<view @touchstart="touchStart($event, 'left')" @touchstart.stop.prevent="touchHandle" class="frame-left"></view>
+				<view @touchstart="touchStart($event, 'right')" @touchstart.stop.prevent="touchHandle" class="frame-right"></view>
+				<view @touchstart="touchStart($event, 'top')" @touchstart.stop.prevent="touchHandle" class="frame-top"></view>
+				<view @touchstart="touchStart($event, 'bottom')" @touchstart.stop.prevent="touchHandle" class="frame-bottom"></view>
+				<view @touchstart="touchStart($event, 'left-top')" @touchstart.stop.prevent="touchHandle" class="frame-left-top"></view>
+				<view @touchstart="touchStart($event, 'left-bottom')" @touchstart.stop.prevent="touchHandle" class="frame-left-bottom"></view>
+				<view @touchstart="touchStart($event, 'right-top')" @touchstart.stop.prevent="touchHandle" class="frame-right-top"></view>
+				<view @touchstart="touchStart($event, 'right-bottom')" @touchstart.stop.prevent="touchHandle" class="frame-right-bottom"></view>
+			</view>
+		</view>
+	</view>
+	<view class="toolbar">
+		<button @tap="oncancle" class="btn-cancel">返回</button>
+		<button @tap="onok" class="btn-ok">确定</button>
+	</view>
+</view>
+</template>
+
+<script>
+export default {
+	props: {
+		url: {
+			type: String,
+			default: ""
+		},
+		fixed: {
+			type: Boolean,
+			default: false
+		},
+		width: {
+			type: Number,
+			default: 200
+		},
+		height: {
+			type: Number,
+			default: 200
+		},
+		maxWidth: {
+			type: Number,
+			default: 1024
+		},
+		maxHeight: {
+			type: Number,
+			default: 1024
+		},
+		blob: {
+			type: Boolean,
+			default: true
+		}
+	},
+	data() {
+		return {
+			mask: {
+				show: false
+			},
+			frame: {
+				left: 50,
+				top: 50,
+				width: this.width,
+				height: this.height
+			},
+			image: {
+				left: 20,
+				top: 20,
+				width: 300,
+				height: 400
+			},
+			real: {
+				width: 100,
+				height: 100
+			},
+			target: {
+				width: this.width,
+				height: this.height
+			},
+			touches: [],
+			type: "",
+			start: {
+				frame: {
+					left: 0,
+					top: 0,
+					width: 0,
+					height: 0
+				},
+				image: {
+					left: 0,
+					top: 0,
+					width: 0,
+					height: 0
+				},
+			},
+			timeoutId: -1,
+			context: null
+		};
+	},
+	mounted() {
+		//#ifdef H5
+		this.$el.addEventListener("touchmove", (ev) => {
+			ev.preventDefault();
+		});
+		// #endif
+		this.context = uni.createCanvasContext("canvas", this);
+		this.targetContext = uni.createCanvasContext("target", this);
+	},
+	methods: {
+		imageLoad(ev) {
+			this.mask.show = true;
+			this.real.width = ev.detail.width;
+			this.real.height = ev.detail.height;
+			this.image.width = ev.detail.width;
+			this.image.height = ev.detail.height;
+			this.frame.width = this.width;
+			this.frame.height = this.height;
+			if (!this.fixed) {
+				this.frame.width = this.image.width;
+				this.frame.height = this.image.height;
+			}
+			var query = uni.createSelectorQuery().in(this);
+			query.select(".body").boundingClientRect((data) => {
+				var bw = data.width;
+				var bh = data.height;
+				var fw = this.frame.width;
+				var fh = this.frame.height;
+				var tw = bw * 0.8;
+				var th = bh * 0.8;
+				var sx = tw / fw;
+				var sy = th / fh;
+				var scale = sx;
+				if (sx < sy) {
+					scale = sy;
+				}
+				tw = fw * scale;
+				th = fh * scale;
+				var tx = (bw - tw) / 2;
+				var ty = (bh - th) / 2;
+				this.frame.width = tw;
+				this.frame.height = th;
+				this.frame.left = tx;
+				this.frame.top = ty;
+				
+				var iw = this.image.width;
+				var ih = this.image.height;
+				sx = tw / iw;
+				sy = th / ih;
+				scale = sx;
+				if (sx < sy) {
+					scale = sy;
+				}
+				this.image.width = iw * scale;
+				this.image.height = ih * scale;
+				this.image.left = (bw - this.image.width) / 2;
+				this.image.top = (bh - this.image.height) / 2;
+				setTimeout(() => {
+					this.trimImage();
+				}, 100);
+			}).exec();
+		},
+		touchHandle() {},
+		touchStart(ev, type) {
+			this.stopTime();
+			this.mask.show = false;
+			if (this.touches.length == 0) {
+				this.type = type;
+				this.start.frame.left = this.frame.left;
+				this.start.frame.top = this.frame.top;
+				this.start.frame.width = this.frame.width;
+				this.start.frame.height = this.frame.height;
+				this.start.image.left = this.image.left;
+				this.start.image.top = this.image.top;
+				this.start.image.width = this.image.width;
+				this.start.image.height = this.image.height;
+			}
+			var touches = ev.changedTouches;
+			for(var i = 0; i < touches.length; i++) {
+				var touch = touches[i];
+				// this.touches[touch.identifier] = touch;
+				this.touches.push(touch);
+			}
+		},
+		touchMove(ev) {
+			this.stopTime();
+			ev.preventDefault();
+			var touches = ev.touches;
+			if (this.touches.length == 1) {
+				if (this.type == "plank" || this.type == "frame" || this.fixed) {
+					this.moveImage(this.touches[0], touches[0]);
+				} else {
+					this.scaleFrame(this.touches[0], touches[0], this.type);
+				}
+			} else if (this.touches.length == 2 && touches.length == 2) {
+				var ta = this.touches[0];
+				var tb = this.touches[1];
+				var tc = touches[0];
+				var td = touches[1];
+				if (ta.identifier != tc.identifier) {
+					var temp = tc;
+					tc = td;
+					td = temp;
+				}
+				this.scaleImage(ta, tb, tc, td);
+			}
+		},
+		touchEnd(ev) {
+			this.type = "";
+			this.touches = [];
+			this.startTime();
+		},
+		touchCancel(ev) {
+			this.type = "";
+			this.touches = [];
+			this.startTime();
+		},
+		startTime() {
+			this.stopTime();
+			this.timeoutId = setTimeout(() => {
+				this.trimImage();
+			}, 800);
+		},
+		stopTime() {
+			if (this.timeoutId >= 0) {
+				clearTimeout(this.timeoutId);
+				this.timeoutId = -1;
+			}
+		},
+		trimImage() {
+			this.mask.show = true;
+			var query = uni.createSelectorQuery().in(this);
+			query.select(".body").boundingClientRect((data) => {
+				var bw = data.width;
+				var bh = data.height;
+				var fw = this.frame.width;
+				var fh = this.frame.height;
+				var tw = bw * 0.8;
+				var th = bh * 0.8;
+				var sx = tw / fw;
+				var sy = th / fh;
+				var scale = sx;
+				if (sx > sy) {
+					scale = sy;
+				}
+				tw = fw * scale;
+				th = fh * scale;
+				var tx = (bw - tw) / 2;
+				var ty = (bh - th) / 2;
+				var ax = tx - this.frame.left + (this.frame.left - this.image.left) * (1 - scale);
+				var ay = ty - this.frame.top + (this.frame.top - this.image.top) * (1 - scale);
+				this.frame.width = tw;
+				this.frame.height = th;
+				this.frame.left = tx;
+				this.frame.top = ty;
+				this.image.width *= scale;
+				this.image.height *= scale;
+				this.image.left += ax;
+				this.image.top += ay;
+			}).exec();
+			setTimeout(() => {
+				var scale = this.image.width / this.real.width;
+				var x = (this.frame.left - this.image.left) / scale;
+				var y = (this.frame.top - this.image.top) / scale;
+				var width = this.frame.width / scale;
+				var height = this.frame.height / scale;
+				this.context.drawImage(this.url, x, y, width, height, 0, 0, this.frame.width, this.frame.height);
+				this.context.draw(false);
+			}, 100);
+		},
+		moveImage(ta, tb) {
+			var ax = tb.clientX - ta.clientX;
+			var ay = tb.clientY - ta.clientY;
+			this.image.left = this.start.image.left + ax;
+			this.image.top = this.start.image.top + ay;
+			if (this.image.left > this.frame.left) {
+				this.image.left = this.frame.left;
+			}
+			if (this.image.top > this.frame.top) {
+				this.image.top = this.frame.top;
+			}
+			if (this.image.left + this.image.width < this.frame.left + this.frame.width) {
+				this.image.left = this.frame.left + this.frame.width - this.image.width; 
+			}
+			if (this.image.top + this.image.height < this.frame.top + this.frame.height) {
+				this.image.top = this.frame.top + this.frame.height - this.image.height; 
+			}
+		},
+		scaleImage(ta, tb, tc, td) {
+			var x1 = ta.clientX;
+			var y1 = ta.clientY;
+			var x2 = tb.clientX;
+			var y2 = tb.clientY;
+			var x3 = tc.clientX;
+			var y3 = tc.clientY;
+			var x4 = td.clientX;
+			var y4 = td.clientY;
+			var ol = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
+			var el = Math.sqrt((x3 - x4) * (x3 - x4) + (y3 - y4) * (y3 - y4));
+			var ocx = (x1 + x2) / 2;
+			var ocy = (y1 + y2) / 2;
+			var ecx = (x3 + x4) / 2;
+			var ecy = (y3 + y4) / 2;
+			var ax = ecx - ocx;
+			var ay = ecy - ocy;
+			var scale = el / ol;
+			if (this.start.image.width * scale < this.frame.width) {
+				scale = this.frame.width / this.start.image.width;
+			}
+			if (this.start.image.height * scale < this.frame.height) {
+				scale = this.frame.height / this.start.image.height;
+			}
+			if (this.start.image.width * scale < this.frame.width) {
+				scale = this.frame.width / this.start.image.width;
+			}
+			this.image.left = this.start.image.left + ax - (ocx - this.start.image.left) * (scale - 1);
+			this.image.top = this.start.image.top + ay - (ocy - this.start.image.top) * (scale - 1);
+			this.image.width = this.start.image.width * scale;
+			this.image.height = this.start.image.height * scale;
+			if (this.image.left > this.frame.left) {
+				this.image.left = this.frame.left;
+			}
+			if (this.image.top > this.frame.top) {
+				this.image.top = this.frame.top;
+			}
+			if (this.image.left + this.image.width < this.frame.left + this.frame.width) {
+				this.image.left = this.frame.left + this.frame.width - this.image.width; 
+			}
+			if (this.image.top + this.image.height < this.frame.top + this.frame.height) {
+				this.image.top = this.frame.top + this.frame.height - this.image.height; 
+			}
+			
+		},
+		scaleFrame(ta, tb, type) {
+			var ax = tb.clientX - ta.clientX;
+			var ay = tb.clientY - ta.clientY;
+			var x1 = this.start.frame.left;
+			var y1 = this.start.frame.top;
+			var x2 = this.start.frame.left + this.start.frame.width;
+			var y2 = this.start.frame.top + this.start.frame.height;
+			if (type == "left") {
+				x1 += ax;
+			} else if (type == "right") {
+				x2 += ax;
+			} else if (type == "top") {
+				y1 += ay;
+			} else if (type == "bottom") {
+				y2 += ay;
+			} else if (type == "left-top") {
+				x1 += ax;
+				y1 += ay;
+			} else if (type == "left-bottom") {
+				x1 += ax;
+				y2 += ay;
+			} else if (type == "right-top") {
+				x2 += ax;
+				y1 += ay;
+			} else if (type == "right-bottom") {
+				x2 += ax;
+				y2 += ay;
+			}
+			if (x1 < this.image.left) {
+				x1 = this.image.left;
+			}
+			if (y1 < this.image.top) {
+				y1 = this.image.top;
+			}
+			if (x2 > this.image.left + this.image.width) {
+				x2 = this.image.left + this.image.width;
+			}
+			if (y2 > this.image.top + this.image.height) {
+				y2 = this.image.top + this.image.height;
+			}
+			this.frame.left = x1;
+			this.frame.top = y1;
+			this.frame.width = x2 - x1;
+			this.frame.height = y2 - y1;
+		},
+		parseBlob(base64) {
+			var arr = base64.split(',');
+			var mime = arr[0].match(/:(.*?);/)[1];
+			var bstr = atob(arr[1]);
+			var n = bstr.length;
+			var u8arr = new Uint8Array(n);
+			for(var i = 0; i < n; i++) {
+				u8arr[i] = bstr.charCodeAt(i);
+			}
+			var url = URL || webkitURL;
+			return url.createObjectURL(new Blob([u8arr], {type: mime}));
+		},
+		onok() {
+			var scale = this.image.width / this.real.width;
+			var x = (this.frame.left - this.image.left) / scale;
+			var y = (this.frame.top - this.image.top) / scale;
+			var width = this.frame.width / scale;
+			var height = this.frame.height / scale;
+			var tw = width;
+			var th = height;
+			if (this.fixed) {
+				tw = this.width / 2;
+				th = this.height / 2;
+			} else {
+				if (tw > this.maxWidth / 2) {
+					var sc = this.maxWidth / 2 / tw;
+					tw = tw * sc;
+					th = th * sc;
+				}
+				if (th > this.maxHeight / 2) {
+					var sc = this.maxHeight / 2 / th;
+					th = th * sc;
+					tw = tw * sc;
+				}
+			}
+			this.target.width = tw;
+			this.target.height = th;
+			uni.showLoading({
+				title: "正在裁剪"
+			});
+			setTimeout(() => {
+				this.targetContext.drawImage(this.url, x, y, width, height, 0, 0, tw, th);
+				this.targetContext.draw(false, () => {
+					uni.canvasToTempFilePath({
+						canvasId: "target",
+						success: (res) => {
+							var path = res.tempFilePath;
+							// #ifdef H5
+							if (this.blob) {
+								path = this.parseBlob(path);
+							}
+							// #endif
+							this.$emit("ok", {
+								path: path
+							});
+						},
+						fail: (ev) => {
+							console.log(ev);
+						},
+						complete: () => {
+							uni.hideLoading();
+						}
+					}, this);
+				});
+			}, 100);
+		},
+		oncancle() {
+			this.$emit("cancel");
+		}
+	}
+}
+</script>
+
+<style scoped>
+.ksp-image-cutter {
+	position: absolute;
+	width: 100%;
+	height: 100%;
+	top: 0;
+	bottom: 0;
+	z-index: 1000;
+}
+.toolbar {
+	position: absolute;
+	width: 100%;
+	height: 100upx;
+	left: 0upx;
+	bottom: 0upx;
+	box-sizing: border-box;
+	border-bottom: 1px solid #C0C0C0;
+	background: #F8F8F8;
+}
+.btn-cancel {
+	position: absolute;
+	left: 100upx;
+	top: 12upx;
+	font-size: 30upx;
+	line-height: 30upx;
+	padding: 20upx;
+	color: #333333;
+}
+.btn-ok {
+	position: absolute;
+	right: 100upx;
+	top: 12upx;
+	font-size: 30upx;
+	line-height: 30upx;
+	padding: 20upx;
+	color: #333333;
+}
+.body {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 100upx;
+	background: black;
+	overflow: hidden;
+}
+.mask {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 0upx;
+	background: black;
+	opacity: 0.4;
+}
+.plank {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 0upx;
+}
+.image {
+	position: absolute;
+}
+.frame {
+	position: absolute;
+}
+.canvas {
+	position: absolute;
+	display: block;
+	left: 0px;
+	top: 0px;
+}
+.rect {
+	position: absolute;
+	left: -2px;
+	top: -2px;
+	width: 100%;
+	height: 100%;
+	border: 2px solid white;
+}
+.line-one {
+	position: absolute;
+	width: 100%;
+	height: 1px;
+	background: white;
+	left: 0;
+	top: 33.3%;
+}
+.line-two {
+	position: absolute;
+	width: 100%;
+	height: 1px;
+	background: white;
+	left: 0;
+	top: 66.7%;
+}
+.line-three {
+	position: absolute;
+	width: 1px;
+	height: 100%;
+	background: white;
+	top: 0;
+	left: 33.3%;
+}
+.line-four {
+	position: absolute;
+	width: 1px;
+	height: 100%;
+	background: white;
+	top: 0;
+	left: 66.7%;
+}
+.frame-left {
+	position: absolute;
+	height: 100%;
+	width: 8px;
+	left: -4px;
+	top: 0;
+}
+.frame-right {
+	position: absolute;
+	height: 100%;
+	width: 8px;
+	right: -4px;
+	top: 0;
+}
+.frame-top {
+	position: absolute;
+	width: 100%;
+	height: 8px;
+	top: -4px;
+	left: 0;
+}
+.frame-bottom {
+	position: absolute;
+	width: 100%;
+	height: 8px;
+	bottom: -4px;
+	left: 0;
+}
+.frame-left-top {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	left: -6px;
+	top: -6px;
+	border-left: 4px solid red;
+	border-top: 4px solid red;
+}
+.frame-left-bottom {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	left: -6px;
+	bottom: -6px;
+	border-left: 4px solid red;
+	border-bottom: 4px solid red;
+}
+.frame-right-top {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	right: -6px;
+	top: -6px;
+	border-right: 4px solid red;
+	border-top: 4px solid red;
+}
+.frame-right-bottom {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	right: -6px;
+	bottom: -6px;
+	border-right: 4px solid red;
+	border-bottom: 4px solid red;
+}
+</style>

+ 3 - 0
MingGaoApp/main.js

@@ -13,6 +13,9 @@ Vue.use(uView);
 
 import {myRequest} from './util/api.js'
 Vue.prototype.$myRequest=myRequest
+
+import config from "./util/url.js"
+Vue.prototype.baseUrl = config.baseUrl
 app.$mount()
 // #endif
 

+ 38 - 1
MingGaoApp/pages.json

@@ -38,7 +38,44 @@
 			}
 
 		}
-	],
+	    ,{
+            "path" : "pages/my/myinfo",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "个人中心",
+                "enablePullDownRefresh": false,
+				"navigationBarBackgroundColor":"#FFFFFF"
+            }
+            
+        }
+        ,{
+            "path" : "pages/my/password",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "修改密码",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/my/monitorlog",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "监测日志",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/my/addcont",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "新增内容",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "",

+ 9 - 11
MingGaoApp/pages/login/login.vue

@@ -98,17 +98,6 @@
 		},
 		onLoad() {
 			uni.getStorage({
-				key: 'session_key',
-				success: (res) => {
-					// console.log(res)
-					if (res.data != "") {
-						uni.switchTab({
-							url: "../index/index"
-						})
-					}
-				},
-			})
-			uni.getStorage({
 				key: 'logincheckbox',
 				success: (res) => {
 					console.log(res)
@@ -131,6 +120,15 @@
 					}
 				},
 			})
+			uni.getStorage({
+				key: 'session_key',
+				success: (res) => {
+					// console.log(res)
+					if (res.data != "") {
+						this.login()
+					}
+				},
+			})
 		}
 	}
 </script>

+ 167 - 0
MingGaoApp/pages/my/addcont.vue

@@ -0,0 +1,167 @@
+<template>
+	<view>
+		<view class="context_box">
+			<view class="weatherbox">
+				<u--form labelPosition="left" :model="weatherdatas" :rules="rules" ref="form1">
+					<u-form-item label="监测事项" prop="temp" ref="item1" labelWidth="80">
+						<u--input v-model="weatherdatas.temp" border="none"></u--input>
+					</u-form-item>
+				</u--form>
+			</view>
+			<view class="imgbox">
+				<view class="title">
+					图像信息
+				</view>
+				<view class="imgbox_box">
+					<view class="addimg" @click="gainimg">
+						<u-icon size="20" name="plus" color="#409eff"></u-icon>
+					</view>
+					<view class="imgitem" v-for="item,index in urllist" :key="index">
+						<image :src="item" mode="" class="img"></image>
+					</view>
+
+				</view>
+			</view>
+			<view class="describe_box">
+				<view class="title">
+					图像信息
+				</view>
+				<view class="textarea">
+					<u--textarea v-model="value1" placeholder="请输入内容" :autoHeight="true"></u--textarea>
+				</view>
+			</view>
+		</view>
+	<kps-image-cutter @ok="onok" @cancel="oncancle" :url="kpsurlL" :fixed="false" :blob="false" :maxWidth="500"
+		:maxHeight="500"></kps-image-cutter>
+	</view>
+</template>
+
+<script>
+	import kpsImageCutter from "@/components/ksp-image-cutter/ksp-image-cutter.vue";
+	export default {
+		data() {
+			return {
+				weatherdatas: {
+					temp: ""
+				},
+				rules: {
+					'temp': {
+						type: 'string',
+						required: true,
+						message: '请填写温度',
+						trigger: ['blur', 'change']
+					},
+				},
+				urllist: [],
+				value1: "",
+				kpsurlL:""
+			}
+		},
+		components:{
+			kpsImageCutter
+		},
+		methods: {
+			gainimg() { //添加图片
+				uni.chooseImage({
+					count: 1, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['album', 'camera'], //从相册选择
+					success: (res) => {
+						console.log(res)
+						// this.urllist.push(res.tempFilePaths[0])
+						this.kpsurlL = res.tempFilePaths[0]
+					}
+				});
+			},
+			oncancle(){
+				
+			},
+			onok(ev){
+				uni.uploadFile({
+				    url: 'http://192.168.1.17:12345/api/api_gateway?method=monitor_manage.cbd_manage.add_img', //仅为示例,非真实的接口地址
+					filePath: ev.path,
+				    name: 'img_file',
+				    success: (uploadFileRes) => {
+						// console.log(ev.path)
+						console.log(JSON.parse(uploadFileRes.data).data.src)
+						// this.path = JSON.parse(uploadFileRes.data).data.src
+						// this.uploadingTF=true
+						// this.toloadTF = false
+				    }
+				});
+			}
+		},
+		onLoad(){
+			console.log(this.baseUrl)
+		}
+		
+	}
+</script>
+
+<style lang="less" scoped>
+	.context_box {
+		width: 90%;
+		margin: 0 auto;
+
+		/deep/.u-form-item__body {
+			border-bottom: 1px solid #F6F6F6;
+			margin-bottom: 20rpx;
+		}
+
+		.imgbox {
+			width: 100%;
+			display: flex;
+			margin-top: 30rpx;
+
+			.title {
+				font-size: 30rpx;
+				width: 160rpx;
+			}
+
+			.imgbox_box {
+				display: flex;
+				flex-wrap: wrap;
+				width: 80%;
+
+				// justify-content: space-around;
+				.addimg {
+					width: 140rpx;
+					height: 140rpx;
+					border: 1px dashed #409eff;
+					// text-align: center;
+					display: flex;
+					justify-content: space-around;
+					margin-right: 30rpx;
+					margin-bottom: 30rpx;
+				}
+
+				.imgitem {
+					width: 140rpx;
+					height: 140rpx;
+					margin-right: 30rpx;
+					margin-bottom: 30rpx;
+
+					.img {
+						width: 100%;
+						height: 100%;
+					}
+				}
+			}
+		}
+
+		.describe_box {
+			width: 100%;
+			display: flex;
+			margin-top: 30rpx;
+
+			.title {
+				font-size: 30rpx;
+				width: 160rpx;
+			}
+
+			.textarea {
+				width: 80%;
+			}
+		}
+	}
+</style>

+ 31 - 13
MingGaoApp/pages/my/index.vue

@@ -2,12 +2,12 @@
 	<view class="my_box">
 		<view class="my_info">
 			<view class="my_info_logo">
-				<image :src="'http://192.168.1.17:12345'+userinfo.theme_info.logo_url" mode=""></image>
+				<image :src="userinfo.theme_info.logo_url.indexOf('http') == -1 ?'http://192.168.1.17:12345'+userinfo.theme_info.logo_url:userinfo.theme_info.logo_url" mode=""></image>
 			</view>
 			<view class="my_info_name">{{userinfo.username}}</view>
 		</view>
 		<view class="my_tab">
-			<view class="my_tab_item" v-for="item,index in tablist" :key="index">
+			<view class="my_tab_item" v-for="item,index in tablist" :key="index" @click="myskip(index)">
 				<view class="item_name">
 					{{item}}
 				</view>
@@ -21,12 +21,12 @@
 	export default {
 		data() {
 			return {
-				userinfo:{
-					theme_info:{
-						logo_url:""
+				userinfo: {
+					theme_info: {
+						logo_url: ""
 					}
 				},
-				tablist:["个人中心","检测日志","监督记录"]
+				tablist: ["个人中心", "检测日志", "监督记录","版本信息"]
 			}
 		},
 		methods: {
@@ -36,6 +36,17 @@
 				})
 				console.log(res)
 				this.userinfo = res
+			},
+			myskip(index) {
+				if (index == 0) {
+					uni.navigateTo({
+						url: './myinfo',
+					});
+				}else if(index == 1){
+					uni.navigateTo({
+						url: './monitorlog',
+					});
+				}
 			}
 		},
 		onLoad() {
@@ -51,36 +62,43 @@
 		background-image: url(../../static/image/geren.jpg);
 		background-size: 100%;
 		background-repeat: no-repeat;
-		.my_info{
+
+		.my_info {
 			width: 90%;
 			padding-top: 150rpx;
 			text-align: center;
 			margin: 0 auto;
-			.my_info_logo{
+
+			.my_info_logo {
 				width: 200rpx;
 				height: 200rpx;
 				margin: 0 auto 30rpx;
-				image{
+
+				image {
 					width: 100%;
 					height: 100%;
 					border-radius: 50%;
 				}
 			}
-			.my_info_name{
+
+			.my_info_name {
 				color: #fff;
 				font-size: 34rpx;
 			}
 		}
-		.my_tab{
+
+		.my_tab {
 			width: 90%;
 			padding-top: 150rpx;
 			margin: 0 auto;
-			.my_tab_item{
+
+			.my_tab_item {
 				display: flex;
 				padding: 30rpx 0;
 				border-bottom: 1px solid #F6F6F6;
 				justify-content: space-between;
-				.item_name{
+
+				.item_name {
 					color: #606060;
 				}
 			}

+ 109 - 0
MingGaoApp/pages/my/monitorlog.vue

@@ -0,0 +1,109 @@
+<template>
+	<view>
+		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
+		<view class="weatherbox">
+			<u--form labelPosition="left" :model="weatherdatas" :rules="rules" ref="form1">
+				<u-form-item label="温度" prop="temp" ref="item1">
+					<u--input v-model="weatherdatas.temp" border="none"></u--input>
+				</u-form-item>
+				<u-form-item label="天气" prop="weather" ref="item1">
+					<u--input v-model="weatherdatas.weather" border="none"></u--input>
+				</u-form-item>
+				<u-form-item label="日期" prop="date" ref="item1">
+					<u--input v-model="weatherdatas.date" border="none"></u--input>
+				</u-form-item>
+				<u-form-item label="地址" prop="city" ref="item1">
+					<u--input v-model="weatherdatas.city" border="none"></u--input>
+				</u-form-item>
+			</u--form>
+			<view class="title_box">
+				<view class="">
+					监测内容
+				</view>
+				<u-icon  size="20" name="plus-circle" color="#409eff" @click="add"></u-icon>
+			</view>
+			<view class="">
+				
+			</view>
+		</view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				list: ['填写监测日志', '历史记录'],
+				current: 0,
+				weatherdatas: {
+					temp: "",
+					weather: "",
+					date: "",
+					city: ""
+				},
+				rules: {
+					'temp': {
+						type: 'string',
+						required: true,
+						message: '请填写温度',
+						trigger: ['blur', 'change']
+					},
+					'weather': {
+						type: 'string',
+						required: true,
+						message: '请填写天气',
+						trigger: ['blur', 'change']
+					},
+					'date': {
+						type: 'string',
+						required: true,
+						message: '请填写日期',
+						trigger: ['blur', 'change']
+					},
+					'city': {
+						type: 'string',
+						required: true,
+						message: '请填写地址',
+						trigger: ['blur', 'change']
+					},
+				},
+				kpsurlL:""
+			}
+		},
+		methods: {
+			sectionChange(e) {
+				this.current = e
+			},
+			add(){
+				uni.navigateTo({
+					url:"./addcont"
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	/deep/.u-subsection {
+		background-color: #fff !important;
+
+		.u-subsection__bar {
+			background-color: #eeeeef;
+		}
+	}
+	.weatherbox{
+		width: 90%;
+		margin: 0 auto;
+		/deep/.u-form-item__body {
+			border-bottom: 1px solid #F6F6F6;
+			margin-bottom: 20rpx;
+		}
+		.title_box{
+			width: 100%;
+			display: flex;
+			justify-content: space-between;
+			margin-top: 30rpx;
+		}
+	}
+</style>

+ 147 - 0
MingGaoApp/pages/my/myinfo.vue

@@ -0,0 +1,147 @@
+<template>
+	<view>
+		<view class="my_infobox">
+			<view class="my_info_item">
+				<view class="">
+					账号名称
+				</view>
+				<view class="">
+					{{userinfo.username}}
+				</view>
+			</view>
+			<view class="">
+				<u-collapse>
+					<u-collapse-item title="隶属海关" name="Docs guide">
+						<p class="u-collapse-content" v-for="(item,index) in userinfo.org_list" :key="index">
+							{{index+1+"、"}}{{item.org_name}}</p>
+					</u-collapse-item>
+				</u-collapse>
+			</view>
+			<view class="my_info_item">
+				<view class="">
+					角色
+				</view>
+				<view class="">
+					{{userinfo.real_name}}
+				</view>
+			</view>
+			<view class="my_info_item">
+				<view class="">
+					手机号码
+				</view>
+				<view class="">
+					{{userinfo.mobile}}
+				</view>
+			</view>
+			<view class="my_info_item">
+				<view class="">
+					邮箱
+				</view>
+				<view class="">
+					{{userinfo.email}}
+				</view>
+			</view>
+			<view class="my_info_item" @click="toalter">
+				<view class="">
+					密码
+				</view>
+				<view class="item_name">
+					修改
+				</view>
+			</view>
+			<view class="my_info_item">
+				<u-button type="primary" text="退出账号" @click="show = true"></u-button>
+				<u-modal :show="show" :title="title" :content='content' :showCancelButton="true" @confirm="confirm" @cancel="show = false"></u-modal>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				userinfo: {},
+				orglist: "",
+				title: "",
+				show: false,
+				content: "确定要退出当前账号吗?"
+			}
+		},
+		methods: {
+			async getinfo() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=sysmenage.usermanager.user_info',
+				})
+				console.log(res)
+				this.userinfo = res
+			},
+			toalter() {
+				uni.navigateTo({
+					url: './password',
+				});
+			},
+			async confirm() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=sysmenage.usermanager.user_logout',
+				})
+				console.log(res)
+				if(res){
+					uni.removeStorage({
+						key: 'username',
+					})
+					uni.removeStorage({
+						key: 'password',
+					})
+					uni.removeStorage({
+						key: 'session_key',
+					})
+					uni.reLaunch({
+						url: '../login/login',
+					});
+				}
+			}
+		},
+		onLoad() {
+			this.getinfo()
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	.my_infobox {
+		width: 90%;
+		margin: 0 auto;
+
+		.my_info_item {
+			display: flex;
+			padding: 30rpx 0;
+			border-bottom: 1px solid #F6F6F6;
+			justify-content: space-between;
+
+			.item_name {
+				color: #409eff;
+			}
+		}
+
+		.my_info_item:first-child {
+			border-bottom: 0;
+		}
+
+		/deep/.u-line {
+			border-bottom: 1px solid #F6F6F6 !important;
+			transform: scaleY(1) !important;
+		}
+
+		/deep/.u-cell__body {
+			padding-left: 0;
+			padding-right: 0;
+			font-size: 32rpx;
+
+			.u-cell__title-text {
+				font-size: 32rpx;
+				font-family: "微软雅黑";
+			}
+		}
+	}
+</style>

+ 97 - 0
MingGaoApp/pages/my/password.vue

@@ -0,0 +1,97 @@
+<template>
+	<view>
+		<view class="alterbox">
+			<u--form labelPosition="left" :model="setpass" :rules="rules" ref="uForm">
+				<u-form-item label="旧密码" prop="password" ref="item1" :labelWidth="80">
+					<u--input v-model="setpass.password" border="none" type="password"></u--input>
+				</u-form-item>
+				<u-form-item label="新密码" prop="newpassword" ref="item1" :labelWidth="80">
+					<u--input v-model="setpass.newpassword" border="none" type="password"></u--input>
+				</u-form-item>
+				<u-form-item label="确认密码" prop="newpasswordtwo" ref="item1" :labelWidth="80">
+					<u--input v-model="setpass.newpasswordtwo" border="none" type="password"></u--input>
+				</u-form-item>
+			</u--form>
+			<u-button type="primary" text="确定修改" @click="submit"></u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				setpass: {
+					password: "",
+					newpassword: "",
+					newpasswordtwo: "",
+				},
+				rules: {
+					'password': {
+						type: 'string',
+						required: true,
+						message: '请填写旧密码',
+						trigger: ['blur', 'change']
+					},
+					'newpassword': {
+						type: 'string',
+						required: true,
+						message: '请填写新密码',
+						trigger: ['blur', 'change']
+					},
+					'newpasswordtwo': [{
+							type: 'string',
+							required: true,
+							message: '请填写新密码',
+							trigger: ['blur', 'change']
+						},
+						{
+							validator: (rule, value, callback) => {
+								return value == this.setpass.newpassword;
+							},
+							message: "密码不一致,请重新输入!",
+							trigger: ['blur', 'change']
+						}
+					]
+				},
+			}
+		},
+		methods: {
+			submit() {
+				this.$refs.uForm.validate().then(res => {
+					this.alterpass()
+				}).catch(errors => {
+					uni.$u.toast('校验失败')
+				})
+			},
+			async alterpass() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=app.my.app_change_pwd',
+					data: {
+						old_password: this.setpass.password,//必传 旧密码
+						new_password: this.setpass.newpassword,//必传 新密码
+						confirm_password: this.setpass.newpasswordtwo,
+					}
+				})
+				console.log(res)
+				this.userinfo = res
+			},
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+	.alterbox {
+		width: 90%;
+		margin: 0 auto;
+	}
+
+	.u-form {
+		margin-bottom: 50rpx;
+	}
+
+	/deep/.u-form-item__body {
+		border-bottom: 1px solid #F6F6F6;
+		margin-bottom: 30rpx;
+	}
+</style>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2 - 2
MingGaoApp/unpackage/dist/dev/app-plus/app-config-service.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 12523 - 6570
MingGaoApp/unpackage/dist/dev/app-plus/app-service.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 4923 - 450
MingGaoApp/unpackage/dist/dev/app-plus/app-view.js


+ 4 - 8
MingGaoApp/util/api.js

@@ -1,11 +1,7 @@
-// const BASE_URL='http://8.136.98.49:8002'
-let BASE_URL = 'http://192.168.1.112:8002'
+import config from "./url.js"
+
 export const myRequest=(options)=>{
-	BASE_URL=uni.getStorageSync('http')
-	if(BASE_URL==''){
-		BASE_URL = 'http://192.168.1.17:12345'
-	}
-	// BASE_URL = 'http://192.168.1.77:8002'
+	let BASE_URL = config.baseUrl
 	console.log(BASE_URL) 
 	var session_key=""
 	session_key=uni.getStorageSync('session_key')
@@ -26,7 +22,7 @@ export const myRequest=(options)=>{
 			success:(res)=>{
 				if(res.data.message!=""){
 					return	uni.showToast({
-						title:res.data.message,
+						title:res.data.message || '请求接口失败',
 						icon:"none"
 					})
 				}

+ 3 - 0
MingGaoApp/util/url.js

@@ -0,0 +1,3 @@
+export default{
+ baseUrl:"http://www.test.com"
+}