- 在 fittingRoom.js 中添加 disableTabs 数组,用于控制不允许上传的分类- 修改 canUpload getter,使用 disableTabs 判断是否允许上传 - 更新 s-grid-clothes.vue 和 s-select-mote.vue 组件,增加上传功能 - 调整上传按钮样式和布局
110 lines
2.6 KiB
Vue
110 lines
2.6 KiB
Vue
<!--
|
|
* @Author: liguigong liguigong@shopline.com
|
|
* @Date: 2025-09-19 16:26:36
|
|
* @LastEditors:
|
|
* @LastEditTime: 2025-09-19 22:34:40
|
|
* @FilePath: pages/fittingRoom/components/s-grid-clothes.vue
|
|
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
|
-->
|
|
<template>
|
|
<view class="tabContainer">
|
|
<uni-grid :column="4" :highlight="true" :square="false" borderColor="#000" @change="change">
|
|
<uni-grid-item v-for="(item, index) in 7" :key="index" :index="index + 100">
|
|
<view class="grid-item-box" style="background-color: #fff">
|
|
<view v-if="index == 3" class="inUse">
|
|
<view class="edit" @click="goEdit">编辑</view>
|
|
</view>
|
|
|
|
<template v-if="fittingRoom.canUpload && index === 0">
|
|
<image
|
|
class="clothes"
|
|
mode="aspectFill"
|
|
src="/static/uploads/1.png"
|
|
@click="uploadFile"
|
|
></image>
|
|
<uni-file-picker
|
|
:auto-upload="false"
|
|
:del-icon="false"
|
|
:disable-preview="true"
|
|
:image-styles="imageStyle"
|
|
:sizeType="sizeType"
|
|
class="upload"
|
|
limit="1"
|
|
mode="grid"
|
|
@select="selectPic"
|
|
>选择
|
|
</uni-file-picker>
|
|
</template>
|
|
<image v-else class="clothes" mode="aspectFill" src="/static/yifu1.png"></image>
|
|
</view>
|
|
</uni-grid-item>
|
|
</uni-grid>
|
|
</view>
|
|
</template>
|
|
<script setup>
|
|
import sheep from '@/sheep';
|
|
|
|
const fittingRoom = sheep.$store('fittingRoom');
|
|
|
|
function selectPic(...data) {
|
|
console.log(fittingRoom.tab);
|
|
console.log('🚀 ~ selectPic 🐶47 ~ data: ', data);
|
|
}
|
|
|
|
function uploadFile() {}
|
|
|
|
const sizeType = ['original'];
|
|
const imageStyle = {
|
|
width: 200,
|
|
height: 200,
|
|
};
|
|
|
|
function goEdit() {
|
|
sheep.$router.go('/pages/report/index', {});
|
|
}
|
|
|
|
function change(e) {
|
|
fittingRoom.changeClothes();
|
|
console.log('🚀 ~ change 🐶25 ~ index: ', e.detail.index);
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.grid-item-box {
|
|
height: 272rpx;
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.clothes {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.upload {
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
position: absolute;
|
|
opacity: 0;
|
|
}
|
|
|
|
.inUse {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, 0.1);
|
|
z-index: 3;
|
|
|
|
.edit {
|
|
color: #000;
|
|
right: 14rpx;
|
|
top: 12rpx;
|
|
font-size: 24rpx;
|
|
position: absolute;
|
|
}
|
|
}
|
|
</style>
|