guhongwei 2 éve
szülő
commit
ef562d9681

+ 67 - 1
App.vue

@@ -1,5 +1,71 @@
 <script>
-	export default {}
+	export default {
+		data() {
+			return {}
+		},
+		onLoad() {},
+		onShow() {},
+		onLaunch() {
+			const that = this;
+			that.checkVersion()
+		},
+		methods: {
+			// 检查版本
+			checkVersion() {
+				const that = this;
+				plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
+					uni.request({
+						url: `${that.$config.serverUrl}/files/project/appVersion.json`,
+						method: 'GET',
+						success: (res) => {
+							if (wgtinfo.version === res.data.version) return;
+							uni.showModal({
+								title: '更新',
+								content: "有新版本,是否下载?",
+								success: (oneres) => {
+									if (oneres.confirm) {
+										// 下载app
+										this.toUpdateAPK(res.data.url);
+									}
+								}
+							})
+						}
+					})
+				})
+			},
+			toUpdateAPK(url) {
+				if (!url) return;
+				uni.showLoading({
+					title: '更新中……',
+					mask: true,
+				})
+				uni.downloadFile({
+					url: url,
+					success: (res) => {
+						uni.hideLoading();
+						if (res.statusCode == 200) {
+							uni.showModal({
+								content: '更新成功,确定现在重启吗?',
+								confirmText: '重启',
+								confirmColor: '#EE8F57',
+								success: modalRes => {
+									if (modalRes.confirm) {
+										plus.runtime.install(
+											res.tempFilePath, {
+												force: true
+											},
+											function(res) {
+												plus.runtime.restart();
+											})
+									}
+								}
+							})
+						}
+					}
+				})
+			}
+		},
+	}
 </script>
 
 <style>

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "益智游戏",
     "appid" : "__UNI__2080341",
     "description" : "",
-    "versionName" : "1.0.0",
-    "versionCode" : "100",
+    "versionName" : "1.0.4",
+    "versionCode" : 104,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 22 - 2
pages/index/index.vue

@@ -2,6 +2,7 @@
 	<view class="content">
 		<view class="one">
 			<image :src="logoUrl" mode="aspectFit"></image>
+			<view class="version">{{versionInfo.version}}</view>
 		</view>
 		<view class="two">
 			<view class="two_1">
@@ -25,13 +26,22 @@
 		data() {
 			return {
 				logoUrl: 'https://broadcast.waityou24.cn/files/test/20230116145912.jpg',
-				timer: null
+				timer: null,
+				versionInfo: {}, 
 			}
 		},
 		onLoad() {
 			const that = this;
 			that.search('/pagesHome/home/index');
 		},
+		onShow() {
+			const that = this;
+			// 获取版本信息
+			plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
+				that.$set(that, `versionInfo`, wgtinfo)
+				that.setTitle(wgtinfo)
+			})
+		},
 		methods: {
 			async search(e) {
 				const that = this;
@@ -45,6 +55,12 @@
 				// 	clearTimeout(that.timer);
 				// 	that.timer = null;
 				// }, 2000)
+			},
+			// 赋值标题栏
+			setTitle(e) {
+				uni.setNavigationBarTitle({
+					title: e.name
+				});
 			}
 		}
 	}
@@ -59,10 +75,14 @@
 			image {
 				width: 50vw;
 				height: 50vw;
-				border-radius: 90px;
+				border-radius: 90%;
 				box-shadow: 0 0 5px #f1f1f1;
 				margin: 30vw 0 0 0;
 			}
+
+			.version {
+				margin: 2vw 0 0 0;
+			}
 		}
 
 		.two {

+ 2 - 2
pagesHome/home/video.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		<view class="one">
-			<video :src="info.path"></video>
+			<video :src="info.path" :page-gesture="true" :show-mute-btn="true" :play-strategy="2"></video>
 		</view>
 	</view>
 </template>
@@ -35,7 +35,7 @@
 	}
 </script>
 
-<style lang="scss"> 
+<style lang="scss">
 	.content {
 		.one {
 			text-align: center;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
unpackage/dist/build/app-plus/app-service.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/build/app-plus/app-view.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/build/app-plus/manifest.json


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/components/upload/index.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/home/index.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/home/video.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 14 - 9
unpackage/dist/dev/app-plus/app-service.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 20 - 7
unpackage/dist/dev/app-plus/app-view.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/app-plus/manifest.json


+ 5 - 0
unpackage/dist/dev/mp-weixin/pagesHome/home/video.js

@@ -164,6 +164,11 @@ var _default = {
     that.$set(that, "info", info);
     that.search();
   },
+  onPullDownRefresh: function onPullDownRefresh() {
+    var that = this;
+    that.search();
+    uni.stopPullDownRefresh();
+  },
   methods: {
     search: function search() {
       var that = this;