ソースを参照

v102版本号显示

liuq 2 週間 前
コミット
12ea0d82f4
2 ファイル変更33 行追加2 行削除
  1. 2 2
      manifest.json
  2. 31 0
      pages/profile/index.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "韫珠IM",
     "appid" : "__UNI__6801EE3",
     "description" : "",
-    "versionName" : "1.0.1",
-    "versionCode" : 101,
+    "versionName" : "1.0.2",
+    "versionCode" : 102,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 31 - 0
pages/profile/index.vue

@@ -49,6 +49,7 @@
 			<view class="action-btn change-pwd-btn" @click="onChangePassword">修改密码</view>
 			<view class="logout-btn" @click="onLogout">退出登录</view>
 		</view>
+		<text v-if="appVersionLabel" class="version-footer">当前版本 {{ appVersionLabel }}</text>
 	</view>
 </template>
 
@@ -68,6 +69,7 @@
 			return {
 				isAndroid: false,
 				loading: false,
+				appVersionLabel: '',
 				user: {
 					name: '',
 					id: '',
@@ -85,13 +87,33 @@
 		onLoad() {
 			this.applyFromStorage()
 			this.refreshAndroidFlag()
+			this.refreshAppVersion()
 		},
 		onShow() {
 			this.applyFromStorage()
 			this.refreshAndroidFlag()
+			this.refreshAppVersion()
 			this.refreshFromServer()
 		},
 		methods: {
+			refreshAppVersion() {
+				let v = ''
+				// #ifdef APP-PLUS
+				try {
+					if (typeof plus !== 'undefined' && plus.runtime) {
+						const name = plus.runtime.version
+						if (name) v = String(name)
+					}
+				} catch (e) {}
+				// #endif
+				if (!v) {
+					try {
+						const si = uni.getSystemInfoSync()
+						v = String(si.appVersion || si.appWgtVersion || '').trim()
+					} catch (e) {}
+				}
+				this.appVersionLabel = v
+			},
 			refreshAndroidFlag() {
 				// #ifdef APP-PLUS
 				try {
@@ -280,4 +302,13 @@
 		font-size: 32rpx;
 		color: #e54d42;
 	}
+	.version-footer {
+		display: block;
+		text-align: center;
+		margin-top: 40rpx;
+		font-size: 24rpx;
+		color: #999;
+		line-height: 1.5;
+		padding: 0 16rpx;
+	}
 </style>