zhangyun 4 年之前
父節點
當前提交
14a0d7ad5f

+ 4 - 1
manifest.json

@@ -2,11 +2,14 @@
     "name" : "大数据平台APP",
     "appid" : "__UNI__DBA6730",
     "description" : "",
-    "versionName" : "1.0",
+    "versionName" : "1.0.0",
     "versionCode" : "100",
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {
+        "softinput" : {
+            "mode" : "adjustPan"
+        },
         "usingComponents" : true,
         "nvueCompiler" : "uni-app",
         "compilerVersion" : 3,

+ 10 - 1
pages.json

@@ -814,7 +814,16 @@
 			}
 
 		}
-	],
+	    ,{
+            "path" : "pages/my/record/record",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "版本更新记录详情",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"condition": { //模式配置,仅开发期间生效
 		"current": 3, //当前激活的模式(list 的索引项)
 		"list": [{

+ 149 - 53
pages/login/login.vue

@@ -12,7 +12,7 @@
 				<view class="username">
 					<u-icon name="account" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
 					<u-input class="uni-input" name="username" v-model="formdata.username" placeholder-class="icon iconfont icon-bianji1"
-					 placeholder="请输入用户名" @blur="blur"/>
+					 placeholder="请输入用户名" @blur="blur" />
 				</view>
 				<view class="passwold">
 					<u-icon name="lock" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
@@ -32,7 +32,7 @@
 		<view class="bg">
 			<image src="../../static/image/login/850c9307f4ef2d7dc6db1049711ab55.jpg" mode=""></image>
 		</view>
-		<view class="setbg" v-if="setbgtf" >
+		<view class="setbg" v-if="setbgtf">
 			<view class="mengban" @click.stop="setbgtf = !setbgtf"></view>
 			<view class="set_http">
 				<view class="set_http_top">
@@ -43,15 +43,20 @@
 				<view class="set_http_bot">
 					<p>服务器访问地址</p>
 					<view class="set_http_bot_input">
-						<input type="text" v-model="value" placeholder="请在此处输入服务器地址(http://...)"/>
+						<input type="text" v-model="value" placeholder="请在此处输入服务器地址(http://...)" />
 						<u-icon :name="arrowtf?'arrow-up':'arrow-down'" @click="arrow"></u-icon>
 					</view>
-					<scroll-view  scroll-y="true" class="scroll-Y" v-if="arrowtf">
-					    <view :id="'demo'+index" class="scroll-view-item uni-bg-red" v-for="item,index in httparr" :key="index" @click="value = item">{{item}}</view>
+					<scroll-view scroll-y="true" class="scroll-Y" v-if="arrowtf">
+						<view :id="'demo'+index" class="scroll-view-item uni-bg-red" v-for="item,index in httparr" :key="index" @click="value = item">{{item}}</view>
 					</scroll-view>
 				</view>
 			</view>
 		</view>
+		<u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
+			<view class="upgradeBox">
+				<u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum" :striped-active="true"></u-line-progress>
+			</view>
+		</u-modal>
 	</view>
 </template>
 
@@ -64,22 +69,27 @@
 					username: '',
 					passwold: ''
 				},
-				setbgtf:false,
-				setTF:false,
-				value:"http://8.136.98.49:8002",
-				httparr:["http://8.136.98.49:8002","http://182.92.193.64:8002"],
-				arrowtf:false
+				setbgtf: false,
+				setTF: false,
+				value: "http://8.136.98.49:8002",
+				httparr: ["http://8.136.98.49:8002", "http://182.92.193.64:8002"],
+				arrowtf: false,
+				showA: false, //
+				contentA: '',
+				isShow: false, //进度条
+				percentNum: 0, //在线下载进度
+
 			}
 		},
 		onLoad() {
 			uni.getStorage({
 				key: 'user_pass',
 				success: (res) => {
-					if(res.data){
+					if (res.data) {
 						this.formdata.passwold = res.data
-						this.checked =true
-					}else{
-						this.checked =false
+						this.checked = true
+					} else {
+						this.checked = false
 					}
 				}
 			})
@@ -96,20 +106,80 @@
 				}
 			})
 		},
-		onShow(){
-			uni.getStorage({
-				key: 'session_key',
-				success: (res) => {
-					console.log(res)
-					if(res.data!=""){
-						uni.switchTab({
-							url: "../index/index"
-						})
-					}
-				}
-			})
+		onShow() {
+			this.getEquipList()
 		},
 		methods: {
+			async getEquipList() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=home.homes.app_version_record',
+					data: {
+						ret: "first"
+					}
+				})
+				console.log(res)
+				this.appName = res[0].app_name
+				this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
+				var id = Number(plus.runtime.version.match(/\d+/g).join(""))
+				console.log(this.versions,id)
+				if (this.versions > id) {
+					uni.showModal({
+						title: '提示',
+						content: '检测到有新版本,是否更新?',
+						success: (res) => {
+							if (res.confirm) {
+								console.log('用户点击确定');
+								this.showA = true
+								this.isShow = true
+								this.upgrade()
+							} else if (res.cancel) {
+								plus.runtime.quit();
+								console.log('用户点击取消');
+							}
+						}
+					})
+				} else {
+					uni.getStorage({
+						key: 'session_key',
+						success: (res) => {
+							console.log(res)
+							if (res.data != "") {
+								uni.switchTab({
+									url: "../index/index"
+								})
+							}
+						},
+					})
+				}
+			},
+			upgrade() {
+				console.log(this.appName)
+				var url = this.value + "/app_file/" + this.appName
+				console.log(url)
+				const downloadTask = uni.downloadFile({
+					url: url, //仅为示例,并非真实的资源
+					success: (res) => {
+						console.log(res)
+						if (res.statusCode === 200) {
+							console.log('下载成功');
+							console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
+							plus.runtime.openFile(res.tempFilePath);
+						}
+					},
+					fail: (err) => {
+						console.log(err)
+					},
+					complete: (com) => {
+						console.log(com)
+					}
+				});
+				downloadTask.onProgressUpdate((res) => {
+					this.percentNum = res.progress
+					if (res.progress == 100) {
+						console.log('下载完成了')
+					}
+				});
+			},
 			async formSubmit() {
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=user.login.login_user',
@@ -118,6 +188,7 @@
 						password: this.formdata.passwold
 					}
 				})
+				console.log(res.session_key)
 				let session_key = res.session_key
 				uni.setStorage({
 					key: 'session_key',
@@ -133,7 +204,7 @@
 				this.formdata.passwold = this.formdata.passwold.replace(/[\u4E00-\u9FA5]/g, '')
 			},
 			rempass(val) {
-				if(val.value){
+				if (val.value) {
 					uni.setStorage({
 						key: 'user_pass',
 						data: this.formdata.passwold,
@@ -141,7 +212,7 @@
 							console.log('success');
 						}
 					})
-				}else{
+				} else {
 					uni.removeStorage({
 						key: 'user_pass',
 						success: function() {
@@ -150,7 +221,7 @@
 					})
 				}
 			},
-			blur(val){
+			blur(val) {
 				uni.setStorage({
 					key: 'user_name',
 					data: val,
@@ -159,23 +230,29 @@
 					}
 				})
 			},
-			logoTime(){
+			logoTime() {
 				this.setTF = true
 			},
-			set(){
+			set() {
 				this.setbgtf = true
 			},
-			sethttp(){
+			sethttp() {
 				uni.setStorage({
-				    key: 'http',
-				    data: this.value,
-				    success: function () {
-				        console.log('success');
-				    }
+					key: 'http',
+					data: this.value,
+					success: () => {
+						// console.log(this.value);
+						this.setbgtf = false
+						uni.showToast({
+							title: "修改成功",
+							icon: "none"
+						})
+						this.getEquipList()
+					}
 				});
-				this.setbgtf = false
+
 			},
-			arrow(){
+			arrow() {
 				this.arrowtf = !this.arrowtf
 			}
 		}
@@ -190,22 +267,26 @@
 		display: flex;
 		align-items: center;
 		padding-top: 240rpx;
+
 		image {
 			width: 280rpx;
 			margin: 0 auto;
 			height: 120rpx;
 		}
 	}
-	.set{
+
+	.set {
 		position: absolute;
 		right: 50rpx;
 		top: 100rpx;
 	}
+
 	.bg {
 		width: 100%;
 		position: fixed;
 		bottom: 0;
 		z-index: -1;
+
 		image {
 			width: 100%;
 		}
@@ -217,6 +298,7 @@
 
 	.uni-form-item {
 		width: 100%;
+
 		.username {
 			width: 80%;
 			margin: 0 auto;
@@ -270,25 +352,29 @@
 			}
 		}
 	}
-	.setbg{
+
+	.setbg {
 		width: 100%;
 		height: 100vh;
 		position: absolute;
 		top: 0;
 		z-index: 99999;
-		.mengban{
+
+		.mengban {
 			width: 100%;
 			height: 100vh;
 			position: absolute;
 			top: 0;
 			background-color: rgba($color: #000000, $alpha: 0.5);
 		}
-		.set_http{
+
+		.set_http {
 			position: absolute;
 			width: 90%;
 			left: 5%;
-			top:30%;
-			.set_http_top{
+			top: 30%;
+
+			.set_http_top {
 				display: flex;
 				justify-content: space-around;
 				background-color: #5DC18B;
@@ -299,36 +385,46 @@
 				border-top-left-radius: 20px;
 				font-size: 32rpx;
 			}
-			.set_http_bot{
+
+			.set_http_bot {
 				height: 150px;
 				background-color: #FFFFFF;
 				border-bottom-right-radius: 20px;
 				border-bottom-left-radius: 20px;
 				padding: 30px;
-				.set_http_bot_input{
+
+				.set_http_bot_input {
 					margin-top: 20rpx;
 					border: 2rpx solid #bdb6a6;
 					border-radius: 20rpx;
-					padding: 10rpx 40rpx 0  20rpx;
+					padding: 10rpx 40rpx 0 20rpx;
 					font-size: 32rpx;
 					height: 30px;
 					display: flex;
 					justify-content: space-between;
-					input{
+
+					input {
 						width: 90%;
 					}
 				}
 			}
-			.scroll-Y{
+
+			.scroll-Y {
 				border: 2rpx solid #d0d0d0;
 				border-radius: 20rpx;
-				.scroll-view-item{
+
+				.scroll-view-item {
 					padding-left: 20rpx;
-					height: 50rpx;
+					height: 70rpx;
 					font-size: 28rpx;
-					line-height: 50rpx;
+					line-height: 70rpx;
+					border-bottom: 2rpx solid #d0d0d0;
 				}
 			}
 		}
 	}
+
+	.upgradeBox {
+		padding: 15rpx;
+	}
 </style>

+ 108 - 6
pages/my/about/about.vue

@@ -8,7 +8,7 @@
 					云飞物联网
 				</view>
 				<view>
-					V3.0.0
+					V{{id}}
 				</view>
 			</view>
 		</view>
@@ -43,14 +43,26 @@
 		</view>
 		<view class="line"></view>
 		<view class="part">
-			<view class="info-item">
+			<view class="info-item" @click="renewal">
 				<text class="tit">版本更新</text>
-				<view class="iconfont icon-shipin"></view>
+				<u-icon name="arrow-right"></u-icon>
+			</view>
+		</view>
+		<view class="line"></view>
+		<view class="record">
+			<view class="info-item" @click="record">
+				<text class="tit">更新记录</text>
+				<u-icon name="arrow-right"></u-icon>
 			</view>
 		</view>
 		<view class="bottom">
 			©河南云飞科技发展有限公司
 		</view>
+		<u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
+			<view class="upgradeBox">
+				<u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum" :striped-active="true"></u-line-progress>
+			</view>
+		</u-modal>
 	</view>
 </template>
 
@@ -58,11 +70,89 @@
 	export default {
 		data() {
 			return {
-				
+				 id:'1.0.0',
+				 versions:'',
+				 showA: false, //
+				 contentA: '',
+				 isShow: false, //进度条
+				 percentNum: 0, //在线下载进度
 			}
 		},
 		methods: {
-			
+			async getEquipList() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=home.homes.app_version_record',
+					data: {
+						ret:"first"
+					}
+				})
+				console.log(res)
+				this.appName = res[0].app_name
+				this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
+				var ids = Number(this.id.match(/\d+/g).join(""))
+				if (this.versions > ids) {
+					uni.showModal({
+						title: '提示',
+						content: '检测到有新版本,是否更新?',
+						success: (res) => {
+							if (res.confirm) {
+								console.log('用户点击确定');
+								this.showA = true
+								this.isShow = true
+								this.upgrade()
+							} else if (res.cancel) {
+								plus.runtime.quit();
+								console.log('用户点击取消');
+							}
+						}
+					})
+				}else{
+					uni.showToast({
+						title:"当前版本已是最新版本",
+						icon:"none"
+					})
+				}
+			},
+			renewal(){
+				this.getEquipList()
+			},
+			upgrade() {
+				console.log(this.appName)
+				var url = "http://182.92.193.64:8002/app_file/" + this.appName
+				console.log(url)
+				const downloadTask = uni.downloadFile({
+					url: url, //仅为示例,并非真实的资源
+					success: (res) => {
+						console.log(res)
+						if (res.statusCode === 200) {
+							console.log('下载成功');
+							console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
+							plus.runtime.openFile(res.tempFilePath);
+						}
+					},
+					fail: (err) => {
+						console.log(err)
+					},
+					complete: (com) => {
+						console.log(com)
+					}
+				});
+				downloadTask.onProgressUpdate((res) => {
+					this.percentNum = res.progress
+					if (res.progress == 100) {
+						console.log('下载完成了')
+						plus.runtime.quit();
+					}
+				});
+			},
+			record(){
+				uni.navigateTo({
+					url:"../record/record"
+				})
+			}
+		},
+		onShow() {
+			// this.id = plus.runtime.version
 		},
 		onBackPress(option){
 			uni.redirectTo({
@@ -118,5 +208,17 @@ page {
 		}
 	}
 }
-
+.record{
+	background:#fff;
+	padding:0 40rpx;
+	.info-item{
+		display:flex;
+		justify-content: space-between;
+		line-height:100rpx;
+		.tit{font-size:14px}
+	}
+}
+.upgradeBox {
+		padding: 15rpx;
+	}
 </style>

+ 2 - 1
pages/my/index/index.vue

@@ -49,9 +49,10 @@
 			async getUserlogin() {
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=user.login.user_login_info',
+					
 				})
+				console.log(res)
 				this.usernames = res.username
-
 			},
 			async getUsermsg(user) {
 				const res = await this.$myRequest({

+ 105 - 0
pages/my/record/record.vue

@@ -0,0 +1,105 @@
+<template>
+	<view>
+		<view class="records">
+			<view class="records_itemtf" v-if="dataTF">
+				暂无更新记录
+			</view>
+			<view class="records_item" v-for="item,index in recordsdata" :key="index" @click="showtf(index)" v-else="dataTF">
+				<view class="records_item_top">
+					<view class="item_left">
+						<p>版本{{item.app_num}}主要更新</p>
+						<p>{{item.addtime|timeFormat()}}</p>
+					</view>
+					<view class="item_right">
+						<u-icon :name="indexnum == index?'arrow-down':'arrow-right'"></u-icon>
+					</view>
+				</view>
+				<view class="records_item_bot" v-if="indexnum == index">
+					<p v-for="item,index in item.app_desc" :key="index">{{index+1+'、'+item}}</p>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<style lang="scss">
+	page {
+		background-color: #f1f1f1;
+	}
+	.records{
+		margin-top: 20rpx;
+		.records_itemtf{
+			font-size: 30rpx;
+			width: 100%;
+			height: 100rpx;
+			line-height: 100rpx;
+			text-align: center;
+		}
+		.records_item{
+			margin-bottom: 10rpx;
+			.records_item_top{
+				width: 100%;
+				background-color: #FFFFFF;
+				height: 110rpx;
+				padding: 10rpx 28rpx;
+				display: flex;
+				justify-content: space-between;
+				box-sizing: border-box;
+				.item_left{
+					p{
+						color: #474747;
+					}
+					p:first-child{
+						font-size: 34rpx;
+						margin-bottom: 10rpx;
+					}
+					p:last-child{
+						font-size: 26rpx;
+					}
+				}
+				.item_right{
+					height: 110rpx;
+					line-height: 100rpx;
+				}
+			}
+			.records_item_bot{
+				padding: 10rpx 28rpx 0;
+				box-sizing: border-box;
+				p{
+					margin-bottom: 6rpx;
+				}
+			}
+		}
+	}
+</style>
+<script>
+	export default {
+		data() {
+			return {
+				recordsdata: [],
+				indexnum:0,
+				dataTF:false
+			}
+		},
+		methods: {
+			async getEquipList() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=home.homes.app_version_record'
+				})
+				console.log(res)
+				this.recordsdata = res
+				if(res.length == 0){
+					this.dataTF = true
+				}else{
+					this.dataTF = false
+				}
+			},
+			showtf(index){
+				this.indexnum = index
+				console.log(this.indexnum)
+			}
+		},
+		onLoad() {
+			this.getEquipList()
+		}
+	}
+</script>

文件差異過大導致無法顯示
+ 2 - 2
unpackage/cache/wgt/__UNI__DBA6730/app-config-service.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/app-service.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/app-view.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/cache/wgt/__UNI__DBA6730/manifest.json


文件差異過大導致無法顯示
+ 2 - 2
unpackage/dist/build/app-plus/app-config-service.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/build/app-plus/app-service.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/build/app-plus/app-view.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/build/app-plus/manifest.json


文件差異過大導致無法顯示
+ 2 - 2
unpackage/dist/dev/app-plus/app-config-service.js


文件差異過大導致無法顯示
+ 3859 - 3341
unpackage/dist/dev/app-plus/app-service.js


文件差異過大導致無法顯示
+ 3019 - 2396
unpackage/dist/dev/app-plus/app-view.js


文件差異過大導致無法顯示
+ 1 - 1
unpackage/dist/dev/app-plus/manifest.json


二進制
unpackage/release/apk/__UNI__DBA6730_20210413152639.apk


二進制
unpackage/release/apk/__UNI__DBA6730_20210415184559.apk


二進制
unpackage/release/apk/__UNI__DBA6730_20210412134823.apk


+ 5 - 17
util/api.js

@@ -1,25 +1,13 @@
 // const BASE_URL='http://8.136.98.49:8002'
 let BASE_URL = ''
 export const myRequest=(options)=>{
-	uni.getStorage({
-	    key: 'http',
-	    success: (res)=> {
-	        BASE_URL = res.data
-	    },
-		fail: (res) => {
-			BASE_URL = 'http://8.136.98.49:8002'
-		}
-	});
+	BASE_URL=uni.getStorageSync('http')
+	if(BASE_URL==''){
+		BASE_URL = 'http://8.136.98.49:8002'
+	}
+	console.log(BASE_URL) 
 	var session_key=""
-	// uni.getStorage({
-	// 	key:'session_key',
-	// 	success:function(res){
-	// 		session_key=res.data
-	// 		console.log(111)
-	// 	}
-	// })
 	session_key=uni.getStorageSync('session_key')
-	console.log(session_key)
 	let url=options.url
 	let data=options.data||{}
 	  if (url != 'user.login.login_user' && url != 'pest.pests.insect_discern' &&