ソースを参照

Merge branch 'master' of http://git.qiniu1314.com/cmy/CBB3

xiaol 3 週間 前
コミット
8c91b2bddb
7 ファイル変更124 行追加125 行削除
  1. 1 1
      .hbuilderx/launch.json
  2. 100 0
      library/upapp.js
  3. 5 3
      manifest.json
  4. 7 95
      pages/index/index.vue
  5. 1 13
      pages/login/register.vue
  6. 0 9
      pages/user/index.vue
  7. 10 4
      store/index.js

+ 1 - 1
.hbuilderx/launch.json

@@ -16,7 +16,7 @@
             "type" : "uniCloud"
         },
         {
-            "playground" : "standard",
+            "playground" : "custom",
             "type" : "uni-app:app-android"
         }
     ]

+ 100 - 0
library/upapp.js

@@ -0,0 +1,100 @@
+import Request from '@/library/Request.js'
+import sotre from "@/store/index.js"
+export default function initSys() {
+	const appType = uni.getSystemInfoSync().platform;
+	if (plus != null) {
+		plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
+			try {
+				let versionCode = wgtinfo.versionCode;
+				let arr1 = wgtinfo.version.split('.');
+				sotre.commit('chnangeSshowData', false);
+				Request.post("sysInit", {
+						code: versionCode
+					})
+					.then(res => {
+						if (res.code == 200) {
+							if (appType != "ios") {
+								if (wgtinfo.versionCode < res.data.app_code) {
+									sotre.commit('chnangeSshowData', false);
+									const upDater = uni.requireNativePlugin("CL-UpDater");
+									let options = {
+										title: "升级",
+										con: res.data.app_update,
+										downUrl: encodeURI(res.data.android_url), //必填
+										hidCancelbtn: true, //是否隐藏取消按钮;
+										btnBgColor: "#ff3300", //设置按钮背景色颜色
+										updateBtnText: "升级", //升级按钮文字,默认为立即升级
+										topImgBg: "", //非必填,用于自定义;自定义方法请参考demo,
+										hidBackBtn: true, //可选 默认为false(即会显示后台更新按钮), 设置android 整包更新弹框是否显示后台更新按钮,这个只有android整包更新才有这个参数,热更新是是无法设置的。
+										verCode: res.data
+											.app_version, //最新apk版本号 可选  用于Android整包升级,避免用户取消安装apk时,重复下载问题,如果不传的话,apk将会重新下载,
+										downMsgTip: "资源下载中,请稍后...", //可选(android)
+										goBackBtnText: "进入后台", //可选(android)
+									};
+									//必需提供下载地址;
+									upDater.startUpdate(options, () => {});
+								} else if (wgtinfo.versionCode > res.data.app_code) {
+									sotre.commit('chnangeSshowData', false);
+								} else {
+									sotre.commit('chnangeSshowData', true);
+								}
+							}
+						}
+					}).catch((err) => {
+						console.log(err)
+					});
+				if (appType == "ios") {
+					const getIosUpAppUrl = 'https://itunes.apple.com/cn/lookup?id=6474850968'
+					const iosAppStroeUrl =
+						'https://apps.apple.com/cn/app/%E6%98%93%E8%B6%A3cbb/id6474850968';
+					uni.request({
+						url: getIosUpAppUrl,
+						method: 'POST',
+						data: {},
+						success: res => {
+							let arr = res.data.results[0].version.split('.');
+							for (let i = 0; i < arr.length; i++) {
+								// 线上版本号
+								const x = +arr[i];
+								// 本地版本号
+								const y = +arr1[i];
+								// 判断线上版本是否小于本地版本
+								if (x < y) {
+									// 设置显示数据
+									sotre.commit('chnangeSshowData', false);
+									return
+								}
+								// 判断线上版本是否大于本地版本
+								else if (x > y) {
+									sotre.commit('chnangeSshowData', false);
+									uni.showModal({
+										title: '提示',
+										content: '请更新应用',
+										showCancel: false,
+										success(e) {
+											plus.runtime.openURL(
+												iosAppStroeUrl
+											);
+										}
+									});
+									return
+								}
+								// 判断是否本地版本等于线上版本
+								else if (x == y && i == arr.length - 1) {
+									sotre.commit('chnangeSshowData', true);
+									return
+								}
+							}
+						},
+						fail: res => {
+							console.log(res, 'shib');
+						}
+					});
+				}
+
+			} catch (e) {
+				console.log(e)
+			}
+		});
+	}
+}

+ 5 - 3
manifest.json

@@ -2,8 +2,8 @@
     "name" : "易趣CBB",
     "appid" : "__UNI__2978829",
     "description" : "一款电商App",
-    "versionName" : "3.1.6",
-    "versionCode" : 323,
+    "versionName" : "3.2.6",
+    "versionCode" : 326,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {
@@ -58,7 +58,9 @@
                     "request" : "none",
                     "prompt" : "为保证您正常、安全地使用,需要获取设备识别码(部分手机提示为获取手机号码)使用权限,请允许"
                 },
-                "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
+                "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
+                "targetSdkVersion" : 30,
+                "minSdkVersion" : 30
             },
             /* ios打包配置 */
             "ios" : {

+ 7 - 95
pages/index/index.vue

@@ -257,12 +257,15 @@
 	import uParse from '@/components/gaoyia-parse/parse.vue';
 	import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
 	import customerWiget from '@/components/ui-public/customer-wiget.vue';
+	// #ifdef APP
+	import upApp from "@/library/upapp.js"
+	// #endif
 	import {
 		mapState,
 		mapMutations
 	} from 'vuex';
 	export default {
-		computed: mapState(['user', 'lbs', 'sysData']),
+		computed: mapState(['user', 'lbs', 'sysData','showData']),
 		components: {
 			uParse,
 			maoScroll,
@@ -296,12 +299,6 @@
 				},
 				wenAr: {},
 				isLoad: false,
-				// #ifdef APP
-				showData: false,
-				// #endif
-				// #ifndef APP
-				showData: true,
-				// #endif
 			}
 		},
 		onLoad() {
@@ -309,6 +306,9 @@
 			// #ifdef APP
 			this.isShowInit(false);
 			// #endif
+			// #ifdef APP
+			upApp();
+			// #endif
 		},
 		onReachBottom() {
 			if (this.page.isFoot || this.page.isLoad) {
@@ -395,51 +395,15 @@
 			 */
 			initSys: function() {
 				const that = this;
-				const appType = uni.getSystemInfoSync().platform;
 				if (plus != null) {
 					plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
 						let versionCode = wgtinfo.versionCode;
-						let arr1 = wgtinfo.version.split('.');
-						uni.setStorageSync("showData", false);
-						that.showData = false;
-
 						this.request.post("sysInit", {
 								code: versionCode
 							})
 							.then(res => {
 								if (res.code == 200) {
 									this.setSys(res.data);
-									if (appType != "ios") {
-										if (wgtinfo.versionCode < res.data.app_code) {
-											uni.setStorageSync("showData", true);
-											that.showData = false;
-											const upDater = uni.requireNativePlugin("CL-UpDater");
-											let options = {
-												title: "升级",
-												con: res.data.app_update,
-												downUrl: this.$device.platform == 'ios' ? encodeURI(res
-													.data.ios_url) : encodeURI(res.data
-													.android_url), //必填
-												hidCancelbtn: true, //是否隐藏取消按钮;
-												btnBgColor: "#ff3300", //设置按钮背景色颜色
-												updateBtnText: "升级", //升级按钮文字,默认为立即升级
-												topImgBg: "", //非必填,用于自定义;自定义方法请参考demo,
-												hidBackBtn: true, //可选 默认为false(即会显示后台更新按钮), 设置android 整包更新弹框是否显示后台更新按钮,这个只有android整包更新才有这个参数,热更新是是无法设置的。
-												verCode: res.data
-													.app_version, //最新apk版本号 可选  用于Android整包升级,避免用户取消安装apk时,重复下载问题,如果不传的话,apk将会重新下载,
-												downMsgTip: "资源下载中,请稍后...", //可选(android)
-												goBackBtnText: "进入后台", //可选(android)
-											};
-											//必需提供下载地址;
-											upDater.startUpdate(options, () => {});
-										} else if (wgtinfo.versionCode > res.data.app_code) {
-											that.showData = false
-											uni.setStorageSync("showData", false)
-										} else {
-											that.showData = true
-											uni.setStorageSync("showData", true)
-										}
-									}
 									if (res.data.is_audit == 0) {
 										this.getGps({
 											page: this,
@@ -454,58 +418,6 @@
 									}
 								}
 							});
-
-						if (appType == "ios") {
-							const getIosUpAppUrl = 'https://itunes.apple.com/cn/lookup?id=6474850968'
-							const iosAppStroeUrl =
-								'https://apps.apple.com/cn/app/%E6%98%93%E8%B6%A3cbb/id6474850968';
-							uni.request({
-								url: getIosUpAppUrl,
-								method: 'POST',
-								data: {},
-								success: res => {
-									let arr = res.data.results[0].version.split('.');
-									for (let i = 0; i < arr.length; i++) {
-										// 线上版本号
-										const x = +arr[i];
-										// 本地版本号
-										const y = +arr1[i];
-										// 判断线上版本是否小于本地版本
-										if (x < y) {
-											// 设置显示数据
-											uni.setStorageSync("showData", true);
-											that.showData = true
-											return
-										}
-										// 判断线上版本是否大于本地版本
-										else if (x > y) {
-											uni.setStorageSync("showData", false);
-											that.showData = false
-											uni.showModal({
-												title: '提示',
-												content: '请更新应用',
-												showCancel: false,
-												success(e) {
-													plus.runtime.openURL(
-														iosAppStroeUrl
-													);
-												}
-											});
-											return
-										}
-										// 判断是否本地版本等于线上版本
-										else if (x == y && i == arr.length - 1) {
-											that.showData = true
-											uni.setStorageSync("showData", true)
-											return
-										}
-									}
-								},
-								fail: res => {
-									console.log(res, 'shib');
-								}
-							});
-						}
 					});
 				}
 			},

+ 1 - 13
pages/login/register.vue

@@ -206,6 +206,7 @@
 			maoScroll,
 			customerWiget
 		},
+		computed:mapState(['showData']),
 		data() {
 			return {
 				statusBarHeight: 20,
@@ -220,19 +221,9 @@
 				showPass : false,
 				captchaIns : null,
 				validate : "",
-				// #ifdef APP
-				showData:false,
-				// #endif
-				// #ifndef APP
-				showData:true,
-				// #endif
 			}
 		},
 		onLoad() {
-			// #ifdef APP
-			this.showData = uni.getStorageSync("showData");
-			console.log(this.showData)
-			// #endif
 			this.initView();
 			this.$nextTick(()=>{
 				this.initNeCaptcha();
@@ -241,15 +232,12 @@
 		methods: {
 			...mapMutations(['setSys','setUser']),
 			initView: function() {
-				
 				uni.getSystemInfo({
 					success: (res) => {
 						this.statusBarHeight = res.statusBarHeight;
 					}
 				});	
-			
 			},
-			
 			initNeCaptcha () {
 				// #ifdef H5
 					const options = {

+ 0 - 9
pages/user/index.vue

@@ -578,19 +578,10 @@
 				statusBarHeight: 20,
 				isGg: false,
 				isNewShow:false,
-				// #ifdef APP
-				showData:false,
-				// #endif
-				// #ifndef APP
-				showData:true,
-				// #endif
 			}
 		},
 		onLoad() {
 			this.initView();
-			// #ifdef APP
-			this.showData = uni.getStorageSync("showData");
-			// #endif
 		},
 		onShow(options) {
 			this.checkUserLogin({

+ 10 - 4
store/index.js

@@ -32,9 +32,18 @@ const store = new Vuex.Store({
 			"is_audit": 1,
 			app_update: "你有新版本要更新"
 		},
+		// #ifdef APP
+		showData: false,
+		// #endif
+		// #ifndef APP
+		showData: true,
+		// #endif
 	},
 	mutations: {
-
+		// 修改显示隐藏app
+		chnangeSshowData(store, data){
+			store.showData = data;
+		},
 		init(store, page) {
 			//	try{
 			var uuid = uni.getStorageSync("uuid");
@@ -471,8 +480,5 @@ const store = new Vuex.Store({
 			...permission
 		},
 	}
-
-
-
 });
 export default store