feat(fittingRoom): 优化上传功能并调整 UI
- 在 fittingRoom.js 中添加 disableTabs 数组,用于控制不允许上传的分类- 修改 canUpload getter,使用 disableTabs 判断是否允许上传 - 更新 s-grid-clothes.vue 和 s-select-mote.vue 组件,增加上传功能 - 调整上传按钮样式和布局
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<!--
|
<!--
|
||||||
* @Author: liguigong liguigong@shopline.com
|
* @Author: liguigong liguigong@shopline.com
|
||||||
* @Date: 2025-09-19 16:26:36
|
* @Date: 2025-09-19 16:26:36
|
||||||
* @LastEditors: liguigong liguigong@shopline.com
|
* @LastEditors:
|
||||||
* @LastEditTime: 2025-09-19 19:17:22
|
* @LastEditTime: 2025-09-19 22:34:40
|
||||||
* @FilePath: pages/fittingRoom/components/s-grid-clothes.vue
|
* @FilePath: pages/fittingRoom/components/s-grid-clothes.vue
|
||||||
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
||||||
-->
|
-->
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
limit="1"
|
limit="1"
|
||||||
mode="grid"
|
mode="grid"
|
||||||
@select="selectPic"
|
@select="selectPic"
|
||||||
>选择</uni-file-picker
|
>选择
|
||||||
></template
|
</uni-file-picker>
|
||||||
>
|
</template>
|
||||||
<image v-else class="clothes" mode="aspectFill" src="/static/yifu1.png"></image>
|
<image v-else class="clothes" mode="aspectFill" src="/static/yifu1.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</uni-grid-item>
|
</uni-grid-item>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
|
|
||||||
const fittingRoom = sheep.$store('fittingRoom');
|
const fittingRoom = sheep.$store('fittingRoom');
|
||||||
|
|
||||||
function selectPic(...data) {
|
function selectPic(...data) {
|
||||||
@@ -73,10 +74,12 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clothes {
|
.clothes {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload {
|
.upload {
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -85,6 +88,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inUse {
|
.inUse {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -93,6 +97,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: rgba(0, 0, 0, 0.1);
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
|
||||||
.edit {
|
.edit {
|
||||||
color: #000;
|
color: #000;
|
||||||
right: 14rpx;
|
right: 14rpx;
|
||||||
|
|||||||
@@ -7,8 +7,20 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<image class="shangchuan" mode="heightFix" src="/static/shangchuan.png"></image>
|
<image class="shangchuan" mode="heightFix" src="/static/shangchuan.png"></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>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" @click="switchModels">
|
||||||
<view class="item-text"></view>
|
<view class="item-text"></view>
|
||||||
<image class="item-image" mode="widthFix" src="/static/mote.png"></image>
|
<image class="item-image" mode="widthFix" src="/static/mote.png"></image>
|
||||||
</view>
|
</view>
|
||||||
@@ -16,9 +28,24 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '../../../sheep';
|
import sheep from '../../../sheep';
|
||||||
|
const sizeType = ['original'];
|
||||||
|
const imageStyle = {
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
};
|
||||||
|
|
||||||
const fittingRoom = sheep.$store('fittingRoom');
|
const fittingRoom = sheep.$store('fittingRoom');
|
||||||
|
|
||||||
|
function selectPic(...data) {
|
||||||
|
console.log(fittingRoom.tab);
|
||||||
|
console.log('🚀 ~ selectPic 🐶47 ~ data: ', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function switchModels() {
|
||||||
|
console.log("🚀 ~ ~ fittingRoom: ", 12);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('🚀 ~ 🐶9 ~ fittingRoom: ', fittingRoom);
|
console.log('🚀 ~ 🐶9 ~ fittingRoom: ', fittingRoom);
|
||||||
|
|
||||||
function expansion(e) {
|
function expansion(e) {
|
||||||
@@ -72,6 +99,14 @@
|
|||||||
height: 76rpx;
|
height: 76rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.upload {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.item-image {
|
.item-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -8,13 +8,15 @@ const fittingRoom = defineStore({
|
|||||||
type: true, // true: 我的衣橱, false: 衣服库
|
type: true, // true: 我的衣橱, false: 衣服库
|
||||||
tab: 0, // 对应下面tabs的序号
|
tab: 0, // 对应下面tabs的序号
|
||||||
tabs: ['全部', '上衣', '下装', '连衣裙', '外套', '发型'],
|
tabs: ['全部', '上衣', '下装', '连衣裙', '外套', '发型'],
|
||||||
|
disableTabs: [5], // 不允许上传图的tab索引
|
||||||
currentClothes: [], // 当前选的衣服
|
currentClothes: [], // 当前选的衣服
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
// 能上传图片的场景
|
// 能上传图片的场景
|
||||||
canUpload(state) {
|
canUpload(state) {
|
||||||
console.log(this.type, this.tab, state.type, '123');
|
console.log(this.type, this.tab, state.type, '123');
|
||||||
return this.type && this.tab > 0;
|
// 除了发型其他都能上传
|
||||||
|
return this.type && !this.disableTabs.includes(this.tab);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user