浏览代码

Merge branch 'develop' of http://code.nyzhwlw.com:10202/yf_zhb/bigdata_WX into develop

allen 2 天之前
父节点
当前提交
f980261d51
共有 2 个文件被更改,包括 110 次插入1 次删除
  1. 103 0
      pages/index/components/ImagePopup.vue
  2. 7 1
      pages/index/index.vue

+ 103 - 0
pages/index/components/ImagePopup.vue

@@ -0,0 +1,103 @@
+<template>
+	<view class="popup-mask" v-if="visible" @click="handleClose">
+		<view class="popup-content" @click.stop>
+			<view class="close-btn" @click="handleClose">×</view>
+			<image
+				class="popup-image"
+				:src="imageUrl"
+				mode="widthFix"
+			></image>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	name: 'ImagePopup',
+	props: {
+		imageUrl: {
+			type: String,
+			default: ''
+		},
+		storageKey: {
+			type: String,
+			default: 'version_shown'
+		}
+	},
+	data() {
+		return {
+			visible: false
+		}
+	},
+	mounted() {
+		this.checkAndShowPopup()
+	},
+	methods: {
+		checkAndShowPopup() {
+			const hasShown = uni.getStorageSync(this.storageKey)
+			if (!hasShown) {
+				this.visible = true
+			}
+		},
+		handleClose() {
+			this.visible = false
+			uni.setStorage({
+				key: this.storageKey,
+				data: true
+			})
+			this.$emit('close')
+		}
+	}
+}
+</script>
+
+<style lang="less" scoped>
+.popup-mask {
+	position: fixed;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	background-color: rgba(0, 0, 0, 0.7);
+	z-index: 9999;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+
+	.popup-content {
+		position: relative;
+		width: 85%;
+		max-width: 600rpx;
+		background-color: transparent;
+		border-radius: 16rpx;
+		box-sizing: border-box;
+
+		.close-btn {
+			position: absolute;
+			bottom: -60rpx;
+			left: 50%;
+			transform: translateX(-50%);
+			width: 56rpx;
+			height: 56rpx;
+			line-height: 48rpx;
+			text-align: center;
+			font-size: 40rpx;
+			color: #999;
+			background-color: rgba(255, 255, 255, 0.9);
+			border-radius: 50%;
+			border: 2rpx solid #ddd;
+			z-index: 10;
+			cursor: pointer;
+
+			&:active {
+				background-color: #f5f5f5;
+			}
+		}
+
+		.popup-image {
+			width: 100%;
+			border-radius: 8rpx;
+		}
+	}
+}
+</style>

+ 7 - 1
pages/index/index.vue

@@ -128,6 +128,7 @@
 				</view>
 			</view>
 		</view>
+		<ImagePopup :imageUrl="popupImageUrl" @close="handlePopupClose" />
 	</view>
 </template>
 
@@ -135,7 +136,11 @@
 	import {
 		Debounce,
 	} from '../../util/anitthro.js';
+	import ImagePopup from './components/ImagePopup.vue';
 	export default {
+		components: {
+			ImagePopup,
+		},
 		// // 分享给朋友
 		// onShareAppMessage() {
 		//   return {
@@ -192,7 +197,8 @@
 				hello: '',
 				show: false,
 				url: '',
-				loadTF: false
+				loadTF: false,
+				popupImageUrl: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/version/app-version.png'
 			};
 		},
 		watch: {