142 行
3.1 KiB
Vue
142 行
3.1 KiB
Vue
<template>
|
||
<view class="drawer-mask" v-if="visible" @tap="close">
|
||
<view class="drawer-sheet" @tap.stop>
|
||
<!-- 商品图片支持:从相册中选择(含拍照与相册) / 从商品图库中选择(历史上传图库) / 从系统图库中选择(系统默认图片) -->
|
||
<view class="sheet-menu">
|
||
<view class="menu-item clickable-hover" @tap="chooseAction('album')">
|
||
<text class="menu-txt">从相册中选择</text>
|
||
</view>
|
||
<template v-if="mediaType === 'image'">
|
||
<view class="menu-item clickable-hover" @tap="chooseAction('goods_default')">
|
||
<text class="menu-txt">从商品图库中选择</text>
|
||
</view>
|
||
<view class="menu-item clickable-hover" @tap="chooseAction('system_default')">
|
||
<text class="menu-txt">从系统图库中选择</text>
|
||
<view class="sys-badge">
|
||
<text class="sb-txt">系统默认图片</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
</view>
|
||
<view class="sheet-divider"></view>
|
||
<view class="menu-cancel clickable-hover" @tap="close">
|
||
<text class="cancel-txt">取消</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
defineProps({
|
||
visible: { type: Boolean, default: false },
|
||
mediaType: { type: String, default: 'image' }
|
||
});
|
||
|
||
const emit = defineEmits(['update:visible', 'select']);
|
||
|
||
function chooseAction(type) {
|
||
emit('select', type);
|
||
close();
|
||
}
|
||
|
||
function close() {
|
||
emit('update:visible', false);
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.drawer-mask {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background: rgba(0, 0, 0, 0.55);
|
||
z-index: 999;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-end;
|
||
animation: fadeIn 0.2s ease-out;
|
||
}
|
||
|
||
@keyframes fadeIn {
|
||
from { opacity: 0; }
|
||
to { opacity: 1; }
|
||
}
|
||
|
||
.drawer-sheet {
|
||
background-color: $yjyf-bg-card;
|
||
border-top-left-radius: 24rpx;
|
||
border-top-right-radius: 24rpx;
|
||
padding-bottom: env(safe-area-inset-bottom);
|
||
overflow: hidden;
|
||
animation: slideUp 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
|
||
}
|
||
|
||
@keyframes slideUp {
|
||
from { transform: translateY(100%); }
|
||
to { transform: translateY(0); }
|
||
}
|
||
|
||
.sheet-menu {
|
||
background-color: $yjyf-bg-card;
|
||
}
|
||
|
||
.menu-item {
|
||
height: 112rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
position: relative;
|
||
}
|
||
|
||
.menu-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.menu-txt {
|
||
font-size: $yjyf-font-title;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.sys-badge {
|
||
margin-left: 12rpx;
|
||
height: 44rpx;
|
||
padding: 0 18rpx;
|
||
border-radius: 22rpx;
|
||
background-color: $yjyf-danger;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.sb-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-inverse;
|
||
line-height: 1;
|
||
}
|
||
|
||
.sheet-divider {
|
||
height: 16rpx;
|
||
background-color: $yjyf-bg-page;
|
||
}
|
||
|
||
.menu-cancel {
|
||
background-color: $yjyf-bg-card;
|
||
height: 110rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.cancel-txt {
|
||
font-size: $yjyf-font-title;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.clickable-hover:active {
|
||
background-color: $yjyf-bg-page;
|
||
}
|
||
</style>
|