Kaynağa Gözat

强制升级

wangxy 3 gün önce
ebeveyn
işleme
d67ecb0126

+ 97 - 0
components/dialog/tipMiddleDialog.vue

@@ -0,0 +1,97 @@
+<!-- 中弹窗 二行文字 -->
+<template>
+	<uni-popup ref="tipMiddlePopup" :animation="false" :is-mask-click="false"
+	 mask-background-color="rgba(255, 255, 255, 0.6);">
+	 <view class="phone-tip-dialog tip-middle-dialog">
+		<view class="tip-content-box">
+			<view class="tip-title">{{title}}</view>
+			<view class="tip-content">{{content}}</view>
+			<view class="tip-btn-box" style="position: relative">
+				<view v-if="closeFlag" class="not-confirm-btn" @click="handleClose"></view>
+				<view class="confirm-btn" @click="confirmBtn" style="text-align: center;">确认</view>
+        <view v-if="showTip" @click="handleShowImage" style="position: absolute;right: 0;top: -5px"><uni-icons type="info" size="30"></uni-icons></view>
+			</view>
+		</view>
+	 </view>
+	</uni-popup>
+
+  <!-- 自定义预览弹窗 -->
+  <uni-popup ref="previewPopup" type="center" :safe-area="false" :is-mask-click="false">
+    <view class="custom-preview" style="position: relative">
+      <image
+          src="/static/images/login/ggg.gif"
+          mode="widthFix"
+          class="preview-image"
+      />
+      <view class="close-btn" @click="handleCloseImg" style="position: absolute;top: -30px;right: 5px">
+        <text class="close-icon" style="color:#fff">关闭</text>
+      </view>
+    </view>
+  </uni-popup>
+</template>
+
+<script setup>
+	import { ref } from 'vue';
+	const props = defineProps({
+	  title: {
+	    type: String,
+	    default: '提示'
+	  },
+	   closeFlag: {
+	    type: Boolean,
+	    default: true
+	  },
+	  content: {
+	    type: String,
+		require: true,
+	    default: ''
+	  },
+    notClose: {
+      type: Boolean,
+      default: false
+    },
+    showTip: {
+      type: Boolean,
+      default: false
+    }
+	});
+	const tipMiddlePopup = ref(null); // 索引
+
+  const previewPopup = ref(null)
+
+	const $emit = defineEmits(['confirm-btn'])
+	// 打开弹窗
+	function handleShow() {
+		tipMiddlePopup.value.open();
+	}
+	// 取消
+	function handleClose() {
+		tipMiddlePopup.value.close();
+	}
+	// 确认
+	function confirmBtn(){
+		$emit('confirm-btn');
+    if (!props.notClose) {
+      tipMiddlePopup.value.close();
+    }
+	}
+
+  function handleCloseImg() {
+    previewPopup.value.close()
+  }
+
+  function handleShowImage() {
+    previewPopup.value.open()
+    // uni.previewImage({
+    //   urls: ['/static/images/login/ggg.gif'],
+    // });
+  }
+
+	defineExpose({
+			handleShow,
+			handleClose
+		})
+</script>
+
+<style>
+</style>

+ 36 - 3
pages/Login/components/adminloginBox.vue

@@ -24,6 +24,11 @@
 		</view>
 		<passwordLli ref="passLLiRef" :password="password" @lli-password="onLliPassword" />
 		<tip-dialog ref="tipDialogRef" :title="tipTitle" :content="tipContent"></tip-dialog>
+		
+		<!-- 安卓强制升级 -->
+		<tipMiddleDialog ref="tipDialogRef2" :closeFlag='false' :title="tipTitle" @confirm-btn="BanbenConfirmBtn" :showTip="true"
+			:notClose="true" :content="tipContentAndroid">
+		</tipMiddleDialog>
 	</view>
 </template>
 
@@ -37,7 +42,10 @@
 	import {useIsCanBack} from "@/store/isCanBack.js"
 	import config from '../../../config.js'
 	import tipDialog from '@/components/dialog/tipDialog.vue';
-	
+	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
+	import {
+		useVersionUpdate
+	} from "@/utils/versionUpdate.js";
 	
 	const userName = ref('') // 用户名
 	const password = ref('') // 密码
@@ -52,6 +60,23 @@
 	const tipDialogRef = ref(null);
 	const tipTitle = '升级提醒';
 	const tipContent = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!';
+	const tipContentAndroid = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!'
+	
+	const tipDialogRef2 = ref(null)
+	const updateUrl = ref(null)
+	
+	const {
+		initDownload
+	} = useVersionUpdate()
+	
+	function BanbenConfirmBtn() {
+		const systemInfo = uni.getSystemInfoSync();
+			if (systemInfo.platform == 'ios') {
+
+			} else {
+				initDownload(updateUrl.value)
+			}
+	}	
 	
 	// 加密
 	function handleUpdateLLiPassword() {
@@ -143,8 +168,16 @@
 		
 	function getLoginInit(){
 		httpApi.getVersion({}).then(res => {
-			if(version!=res.data.version){
-				tipDialogRef.value.handleShow();
+	
+			if (version != res.data.version) {
+				updateUrl.value = res.data.updateUrl
+				
+				const systemInfo = uni.getSystemInfoSync();
+				if (systemInfo.platform == 'ios') {
+				
+				} else {
+					tipDialogRef2.value.handleShow();
+				}
 			}
 		})
 	}

+ 38 - 2
pages/admin/ShouYe/shouye.vue

@@ -78,6 +78,12 @@
 	<!-- 页面底端 -->
 	<customTabbarAdminVue :current-tab="0"></customTabbarAdminVue>
 	<tip-dialog ref="tipDialogRef" :title="tipTitle" :content="tipContent"></tip-dialog>
+	
+	<!-- 安卓强制升级 -->
+	<tipMiddleDialog ref="tipDialogRef2" :closeFlag='false' :title="tipTitle" @confirm-btn="BanbenConfirmBtn" :showTip="true"
+		:notClose="true" :content="tipContentAndroid">
+	</tipMiddleDialog>
+	
   </view>
 </template>
 
@@ -90,6 +96,11 @@ import {getAppNoticeList,getAppNoticeWait,getGlIndexInfo,getIndexKechengList} fr
 import tipDialog from '@/components/dialog/tipDialog.vue';
 import config from '../../../config.js'
 import * as httpApi from "@/api/login.js"
+import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
+import {
+	useVersionUpdate
+} from "@/utils/versionUpdate.js";
+
 const version = config.appInfo.version;
 const tipDialogRef = ref(null);
 const tipTitle = '升级提醒';
@@ -100,6 +111,14 @@ const tzNum = ref(0);
 const tzContent = ref('');
 const searchType = ref('');
 const current = ref(0);
+const tipContentAndroid = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!'
+
+const tipDialogRef2 = ref(null)
+const updateUrl = ref(null)
+
+const {
+		initDownload
+	} = useVersionUpdate()
 let indexInfoData = reactive({
 		searchType:1,
 		bzCount: 0,
@@ -236,10 +255,27 @@ function tjBtnClick(data){
 				break;
 		}
 	}
+	
+	function BanbenConfirmBtn() {
+		const systemInfo = uni.getSystemInfoSync();
+			if (systemInfo.platform == 'ios') {
+	
+			} else {
+				initDownload(updateUrl.value)
+			}
+	}	
+	
 	function getLoginInit(){
 			httpApi.getVersion({}).then(res => {
-				if(version!=res.data.version){
-					tipDialogRef.value.handleShow();
+				if (version == res.data.version) {
+					updateUrl.value = res.data.updateUrl
+					tipDialogRef2.value.handleShow();
+					const systemInfo = uni.getSystemInfoSync();
+					if (systemInfo.platform == 'ios') {
+					
+					} else {
+						tipDialogRef2.value.handleShow();
+					}
 				}
 			})
 		}

BIN
static/images/login/ggg.gif