<!-- 中弹窗 二行文字 -->
<template>
	<uni-popup ref="tipMiddlePopup" :animation="false" :is-mask-click="false"
	 mask-background-color="rgba(255, 255, 255, 0.6);">
	 <view class="phone-common-dialog">
		<view class="common-body-box">
			<view class="common-title">{{title}}</view>
			<view class="common-content">{{content}}</view>
			<view class="common-btn-box" style="position: relative">
				<view v-if="closeFlag" class="not-confirm-btn" @click="handleClose"></view>
				<view class="confirm-btn no-border-btn" @click="confirmBtn">确认</view>
				<view v-if="showTip" @click="handleShowImage" style="position: absolute;right: 0;top: 16rpx">
					<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>