ccjgmwz 3 vuotta sitten
vanhempi
commit
eb95e0e9c6
3 muutettua tiedostoa jossa 90 lisäystä ja 83 poistoa
  1. 69 82
      common/appUpdate.js
  2. 9 1
      pages.json
  3. 12 0
      pages/user/user.vue

+ 69 - 82
common/appUpdate.js

@@ -3,91 +3,78 @@
 
 import * as config from '../config'
 export default function appUpdate() {
-	var data ={
-			appid: plus.runtime.appid,
-			version: plus.runtime.version,
-			imei: "1"
-		}
 		
-	let baseUrl = config.def().baseUrl
-	let _gp = 'user'
-	let _mt = 'updateAppVersion'
+	let baseUrlNew = config.def().baseUrlNew
 	uni.request({
-		url: baseUrl + '/m.api',
-		data: {
-			...data,
-			_gp,
-			_mt
-		},
-		method: 'POST',
-		header: {
-			'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
-			'ACCESSTOKEN': 'accessToken'
-		},
-		success: (res) => {
-			
-			console.log("uni.request update success",res)
-			plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
-				let client_version = wgtinfo.version
-				var flag_update = client_version.split(".").splice(0, 2).join(".") != res.data.data.version.split(".").splice(0, 2)
-					.join(".")
-				var flag_hot = (Number(client_version.split(".")[2]) < Number(res.data.data.version.split(".")[2])) & !flag_update
-				console.log("client_version",client_version) 
-				console.log("flag_update",flag_update)
-				console.log("flag_hot",flag_hot)
-
-				if (flag_update) {
-					console.log("更新弹窗")
-					// 提醒用户更新
-					uni.showModal({
-						title: '更新提示',
-						content: res.data.data.note,
-						success: (showResult) => {
-							if (showResult.confirm) {
-								plus.nativeUI.toast("正在准备环境,请稍后!");
-								console.log(res.data.data.url, )
-								var dtask = plus.downloader.createDownload(res.data.data.url, {
-									method: 'GET',
-									filename: '_doc/update/'
-								}, function(d, status) {
-									if (status == 200) {
-										var path = d.filename; //下载apk
-										plus.runtime.install(path); // 自动安装apk文件
-									} else {
-										plus.nativeUI.alert('版本更新失败:' + status);
-									}
-								});
-								dtask.start();
+	    url: baseUrlNew + '/appVersion/selectInfo',
+	    data: {
+	    	appid: plus.runtime.appid,
+	    	version: plus.runtime.version,
+	    	imei: "1"
+	    },
+	    method: 'GET',
+	    success: (res) => {			
+	    	if (res.statusCode === 200) {
+				console.log("uni.request update success",res)
+				plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
+					let client_version = wgtinfo.version
+					var flag_update = client_version.split(".").splice(0, 2).join(".") != res.data.data.version.split(".").splice(0, 2)
+						.join(".")
+					var flag_hot = (Number(client_version.split(".")[2]) < Number(res.data.data.version.split(".")[2])) & !flag_update
+					console.log("client_version",client_version) 
+					console.log("flag_update",flag_update)
+					console.log("flag_hot",flag_hot)
+				
+					if (flag_update) {
+						console.log("更新弹窗")
+						// 提醒用户更新
+						uni.showModal({
+							title: '更新提示',
+							content: res.data.data.note,
+							success: (showResult) => {
+								if (showResult.confirm) {
+									plus.nativeUI.toast("正在准备环境,请稍后!");
+									console.log(res.data.data.url, )
+									var dtask = plus.downloader.createDownload(res.data.data.url, {
+										method: 'GET',
+										filename: '_doc/update/'
+									}, function(d, status) {
+										if (status == 200) {
+											var path = d.filename; //下载apk
+											plus.runtime.install(path); // 自动安装apk文件
+										} else {
+											plus.nativeUI.alert('版本更新失败:' + status);
+										}
+									});
+									dtask.start();
+								}
 							}
-						}
-					})
-				} else if (flag_hot) {
-					console.log("热更新") 
-					uni.downloadFile({
-						url: res.data.data.wgtUrl,
-						success: (downloadResult) => {
-							console.log(downloadResult.tempFilePath)
-							if (downloadResult.statusCode === 200) {
-								plus.nativeUI.toast(`正在热更新!${res.data.data.versionCode}`);
-								plus.runtime.install(downloadResult.tempFilePath, {
-									force: false
-								}, function() {
-									plus.nativeUI.toast("热更新成功");
-									plus.runtime.restart();
-								}, function(e) {
-									console.log(e)
-									plus.nativeUI.toast(`热更新失败:${e.message}`);
-								});
+						})
+					} else if (flag_hot) {
+						console.log("热更新") 
+						uni.downloadFile({
+							url: res.data.data.wgtUrl,
+							success: (downloadResult) => {
+								console.log(downloadResult.tempFilePath)
+								if (downloadResult.statusCode === 200) {
+									plus.nativeUI.toast(`正在热更新!${res.data.data.versionCode}`);
+									plus.runtime.install(downloadResult.tempFilePath, {
+										force: false
+									}, function() {
+										plus.nativeUI.toast("热更新成功");
+										plus.runtime.restart();
+									}, function(e) {
+										console.log(e)
+										plus.nativeUI.toast(`热更新失败:${e.message}`);
+									});
+								}
 							}
-						}
-					});
-				}
-
-			});
-
-
-
-
-		}
+						});
+					}
+				
+				});
+	    	}
+	    }
 	})
+
 }

+ 9 - 1
pages.json

@@ -469,7 +469,15 @@
 				"enablePullDownRefresh": false
 			}
 
-		}
+		},{
+            "path" : "pages/user/fankui",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
 
 	],
 	"subpackages": [{

+ 12 - 0
pages/user/user.vue

@@ -41,6 +41,13 @@
 					</view>
 					<!-- <image src="../../static/img/sign/authentication@3x.png" mode=""></image> -->
 				</view>
+				<view class='cu-item' @click='fankui'>
+					<view>
+						<image src="../../static/img/sign/authentication@2x.png" class="sign"></image>
+						<text class="text-grey">意见反馈</text>
+					</view>
+					<view class = 'tip_text cuIcon-right' ></view>
+				</view>
 				<!-- <view class='cu-item' @click='scanCode'>
 							<view>
 								<text class="cuIcon-scan icon text-grey"></text>
@@ -272,6 +279,11 @@
 			}
 		},
 		methods: {
+			fankui(){
+				uni.navigateTo({
+					url: `/pages/user/fankui`
+				})
+			},
 			zhibo() {
 				uni.navigateTo({
 					url: `/pageB/video/broadcast`