重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
Page({
|
||||
data: {
|
||||
selected: '#7BA7C7',
|
||||
customColor: '#7BA7C7',
|
||||
wheelColors: [
|
||||
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
||||
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
||||
],
|
||||
recommendedColors: ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8'],
|
||||
paletteColors: [
|
||||
'#6F8F83', '#7BA7C7', '#8AAECA', '#9BA9C8', '#A894C7', '#C19AB7',
|
||||
'#D98DA5', '#D9958D', '#D7A86E', '#C8B47E', '#B9A16B', '#9FAD7B',
|
||||
'#8FB89A', '#79A6A3', '#6E9E92', '#A6B7A4', '#B8B0A6', '#C7B7A3',
|
||||
'#8E8A7D', '#A4A097', '#B6A6A0', '#C9A2A2', '#B58A8A', '#8C7C92',
|
||||
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
||||
]
|
||||
},
|
||||
select(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
selectWheelColor(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
onCustomInput(event) {
|
||||
this.setData({ customColor: event.detail.value })
|
||||
},
|
||||
applyCustomColor() {
|
||||
let color = (this.data.customColor || '').trim()
|
||||
if (color && color[0] !== '#') color = `#${color}`
|
||||
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
||||
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ selected: color.toUpperCase(), customColor: color.toUpperCase() })
|
||||
},
|
||||
save() { wx.showToast({ title: '已保存到本地' }) },
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "颜色设置"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card color-preview" style="background: {{selected}};">{{selected}}</view>
|
||||
<view class="section-title">推荐色</view>
|
||||
<view class="palette recommended-palette">
|
||||
<view wx:for="{{recommendedColors}}" wx:key="*this" class="color-swatch recommended {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||
</view>
|
||||
<view class="section-title">色盘选择</view>
|
||||
<view class="card color-wheel-card">
|
||||
<view class="color-wheel-wrap">
|
||||
<view class="color-wheel">
|
||||
<view wx:for="{{wheelColors}}" wx:key="*this" class="wheel-hit hit-{{index}}" data-color="{{item}}" bindtap="selectWheelColor"></view>
|
||||
<view class="wheel-center" style="background: {{selected}};">
|
||||
<text>{{selected}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="palette-grid compact">
|
||||
<view wx:for="{{paletteColors}}" wx:key="*this" class="palette-dot {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card custom-color-card">
|
||||
<view class="custom-color-preview" style="background: {{customColor}};"></view>
|
||||
<input class="custom-color-input" value="{{customColor}}" maxlength="7" placeholder="#7BA7C7" bindinput="onCustomInput" />
|
||||
<button class="small-action" bindtap="applyCustomColor">应用</button>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存颜色</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1,148 @@
|
||||
.color-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 168rpx;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.palette {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 14rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.color-swatch {
|
||||
height: 92rpx;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.color-swatch.active {
|
||||
outline: 6rpx solid rgba(47, 111, 98, 0.22);
|
||||
}
|
||||
|
||||
.color-wheel-card {
|
||||
padding: 22rpx 18rpx 18rpx;
|
||||
}
|
||||
|
||||
.color-wheel-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.color-wheel {
|
||||
position: relative;
|
||||
width: 308rpx;
|
||||
height: 308rpx;
|
||||
border-radius: 50%;
|
||||
background: conic-gradient(#e0627a, #e7785b, #e2a64b, #d8c85c, #9ebb63, #63b77b, #4cb7a6, #56a7d6, #5f82d7, #7c70d4, #a66bc8, #cf72a8, #e0627a);
|
||||
box-shadow: inset 0 0 0 2rpx rgba(255, 255, 255, 0.45), 0 12rpx 28rpx rgba(58, 48, 34, 0.12);
|
||||
}
|
||||
|
||||
.color-wheel::after {
|
||||
position: absolute;
|
||||
top: 42rpx;
|
||||
right: 42rpx;
|
||||
bottom: 42rpx;
|
||||
left: 42rpx;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.78), rgba(255,255,255,0.18) 38%, rgba(38,35,31,0.12) 100%);
|
||||
content: "";
|
||||
}
|
||||
|
||||
.wheel-center {
|
||||
position: absolute;
|
||||
top: 94rpx;
|
||||
left: 94rpx;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border: 8rpx solid #fffdf8;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
font-weight: 900;
|
||||
text-shadow: 0 2rpx 6rpx rgba(31, 25, 20, 0.22);
|
||||
box-shadow: 0 10rpx 24rpx rgba(58, 48, 34, 0.16);
|
||||
}
|
||||
|
||||
.wheel-hit {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
z-index: 3;
|
||||
width: 70rpx;
|
||||
height: 154rpx;
|
||||
margin-left: -35rpx;
|
||||
transform-origin: 50% 154rpx;
|
||||
}
|
||||
|
||||
.hit-0 { transform: rotate(0deg); }
|
||||
.hit-1 { transform: rotate(30deg); }
|
||||
.hit-2 { transform: rotate(60deg); }
|
||||
.hit-3 { transform: rotate(90deg); }
|
||||
.hit-4 { transform: rotate(120deg); }
|
||||
.hit-5 { transform: rotate(150deg); }
|
||||
.hit-6 { transform: rotate(180deg); }
|
||||
.hit-7 { transform: rotate(210deg); }
|
||||
.hit-8 { transform: rotate(240deg); }
|
||||
.hit-9 { transform: rotate(270deg); }
|
||||
.hit-10 { transform: rotate(300deg); }
|
||||
.hit-11 { transform: rotate(330deg); }
|
||||
|
||||
.palette-grid.compact {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.palette-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.palette-dot {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.42), 0 6rpx 14rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.palette-dot.active {
|
||||
outline: 6rpx solid rgba(47, 111, 98, 0.24);
|
||||
outline-offset: 3rpx;
|
||||
}
|
||||
|
||||
.custom-color-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
}
|
||||
|
||||
.custom-color-preview {
|
||||
width: 58rpx;
|
||||
height: 58rpx;
|
||||
flex-shrink: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
.custom-color-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 58rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #2f2a25;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
Reference in New Issue
Block a user