修改调整页面样式

This commit is contained in:
2024-10-18 16:27:51 +08:00
parent 91c716103e
commit f44cf801e8
22 changed files with 543 additions and 278 deletions

View File

@@ -2,8 +2,8 @@
<view class="page min-page">
<view class="box">
<view>
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form"
:border="true" label-position="top" label-width="350">
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form" :border="true"
label-position="top" label-width="350">
<view class="block">
<view class="border-top-0">
<uni-forms-item label="图标">
@@ -13,14 +13,15 @@
</view>
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput padding-none="true" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.name" placeholder="输入分类名称" />
<uni-easyinput padding-none :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput padding-none="true" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
<uni-easyinput padding-none :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="category.sort" type="number"
placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
@@ -190,58 +191,59 @@
</view>
<view class="bottom" ref="bottom"></view>
<!-- 更多操作 -->
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet"
:list="actionSheet.list"></my-action-sheet>
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
<!-- 添加/编辑子分类 -->
<my-model ref="refAddChilCate" :title="refAddChilCateTitle">
<template #desc>
<view class="u-p-l-32 u-m-t-8 u-p-r-32 u-text-left">
<uni-forms :model="categoryChild" :rules="rules" err-show-type="toast" :border="true"
label-position="top" label-width="350">
<view class="border-top-0">
<uni-forms-item label="图标">
<my-upload-file ref="refFile" :limit="1"
@change="onfileChange($event,categoryChild,'pic')"
:images="categoryChild.pic"></my-upload-file>
</uni-forms-item>
</view>
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput padding-none :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput padding-none :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">开关</view>
<view class="u-flex">
<my-switch v-model="categoryChild.isShow"></my-switch>
</view>
</view>
</uni-forms-item>
</uni-forms>
</view>
</template>
<template #btn>
<view class="u-flex u-p-30">
<view class="u-flex-1 u-p-r-16">
<my-button shape="circle" type="default" @tap="refAddChilCateClose">取消</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button shape="circle" @tap="refAddChilCateConfirm">确认</my-button>
</view>
</view>
</template>
</my-model>
</view>
<!-- 添加/编辑子分类 -->
<my-model ref="refAddChilCate" :title="refAddChilCateTitle">
<template #desc>
<view class="u-p-40 u-text-left">
<uni-forms :model="categoryChild" :rules="rules" err-show-type="toast"
:border="true" label-position="top" label-width="350">
<view class="border-top-0">
<uni-forms-item label="图标">
<my-upload-file ref="refFile" :limit="1" @change="onfileChange($event,categoryChild,'pic')"
:images="categoryChild.pic"></my-upload-file>
</uni-forms-item>
</view>
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">开关</view>
<view class="u-flex">
<my-switch v-model="categoryChild.isShow"></my-switch>
</view>
</view>
</uni-forms-item>
</uni-forms>
</view>
</template>
<template #btn>
<view class="u-flex u-p-30">
<view class="u-flex-1 u-p-r-16">
<my-button shape="circle" type="default" @tap="refAddChilCateClose">取消</my-button>
</view>
<view class="u-flex-1 u-p-l-16">
<my-button shape="circle" @tap="refAddChilCateConfirm">确认</my-button>
</view>
</view>
</template>
</my-model>
</template>
<script setup>
@@ -270,11 +272,11 @@
const refAddChilCate = ref(null)
const refAddChilCateTitle = ref('添加子分类')
const refAddChilCateTitle = ref('添加子分类')
function refAddChilCateClose() {
refAddChilCate.value.close()
categoryChild.value ={
categoryChild.value = {
...categoryBasicData
}
}
@@ -293,19 +295,25 @@
if (result.length) {
return infoBox.showToast(result[0].errMeessage)
}
let res=''
if( refAddChilCateTitle.value ==='编辑子分类'){
res= await $productCategory.update({...categoryChild.value,pid:category.id})
categoryChild[selItem.index]=res
}else{
res= await $productCategory.add({...categoryChild.value,pid:category.id})
let res = ''
if (refAddChilCateTitle.value === '编辑子分类') {
res = await $productCategory.update({
...categoryChild.value,
pid: category.id
})
categoryChild[selItem.index] = res
} else {
res = await $productCategory.add({
...categoryChild.value,
pid: category.id
})
category.childrenList.push(res)
}
uni.setStorageSync('cateItem',category)
infoBox.showToast( refAddChilCateTitle.value==='编辑子分类'?'修改成功':'添加成功')
uni.setStorageSync('cateItem', category)
infoBox.showToast(refAddChilCateTitle.value === '编辑子分类' ? '修改成功' : '添加成功')
refAddChilCateClose()
}
let refMoreSheet = ref(null)
let selItem = {
@@ -313,7 +321,7 @@
index: ''
}
const actionSheet = reactive({
list: ['编辑', '删除']
list: ['编辑', '删除']
})
function moreShow(item, index) {
@@ -324,9 +332,9 @@
function actionSheetClick(index) {
console.log(index);
if(index===0){
refAddChilCateTitle.value='编辑子分类'
categoryChild.value=selItem.data
if (index === 0) {
refAddChilCateTitle.value = '编辑子分类'
categoryChild.value = selItem.data
refAddChilCate.value.open()
return
}
@@ -339,7 +347,7 @@
$productCategory.del([selItem.data.id]).then(res => {
category.childrenList.splice(selItem.index, 1)
infoBox.showToast('删除成功')
uni.setStorageSync('cateItem',category)
uni.setStorageSync('cateItem', category)
})
}
}
@@ -667,7 +675,14 @@
$icon-size: 34rpx;
$icon-line-width: 20rpx;
$icon-line-height: 4rpx;
@import '@/commons/style/reset-uni-form.scss';
::v-deep .uni-forms-item--border{
padding-top: 24rpx ;
padding-bottom: 24rpx ;
}
::v-deep .uni-forms-item.is-direction-top .uni-forms-item__label{
padding-bottom: 16rpx;
}
.category-icon {
width: 60rpx;
height: 60rpx;
@@ -682,7 +697,9 @@
.my-switch {
transform: scale(0.7);
}
::v-deep .uni-forms-item__content{
min-height: inherit;
}
::v-deep .uni-forms-item__error {
display: none !important;
}
@@ -747,16 +764,15 @@
.lh40 {
line-height: 40rpx;
}
::v-deep .uni-forms-item.is-direction-top .uni-forms-item__label{
padding-bottom: 24rpx;
}
.box {
font-size: 28rpx;
.block {
background: #FFFFFF;
border-radius: 6px 18rpx 0 18rpx;
padding: 12rpx 24rpx;
border-radius: 18rpx;
padding: 8rpx 24rpx;
margin-bottom: 32rpx;
}
}
@@ -766,7 +782,6 @@
left: 30rpx;
right: 30rpx;
bottom: 60rpx;
}
::v-deep.uni-forms-item {
@@ -789,6 +804,7 @@
color: #fff;
border-radius: 12rpx;
font-size: 28rpx;
border-radius: 100rpx;
}
.btn-hover-class {