This commit is contained in:
Felix
2025-11-30 20:47:13 +08:00
parent 766c0400e6
commit 292b011052
3 changed files with 116 additions and 403 deletions

View File

@@ -44,7 +44,9 @@ Page({
avatarSvgData: '',
paperSvgData: '',
photoSvgData: '',
scrollTop: 0
scrollTop: 0,
takePhoto: false,
photoPath: ''
},
onLoad() {
@@ -633,6 +635,13 @@ Page({
handleSelected(e: any) {
const { index } = e.detail;
if (this.data.takePhoto) {
wx.showToast({
title: '请刷新页面',
icon: 'none'
})
return
}
console.log('用户选择:', index)
if (index === 0) {
this.handleTakePhoto();
@@ -659,21 +668,23 @@ Page({
this.setData({ isProcessing: true })
wx.showLoading({ title: '准备拍照...' })
const imagePath = await imageManager.takePhoto({
quality: 80,
maxWidth: 1920,
maxHeight: 1920
})
// const imagePath = await imageManager.takePhoto({
// quality: 80,
// maxWidth: 1920,
// maxHeight: 1920
// })
const imagePath = await imageManager.takePhoto({})
wx.hideLoading()
this.setData({ photoPath: imagePath, takePhoto: true })
console.log('拍照成功:', imagePath)
// 直接跳转到结果页面
this.navigateToResult(imagePath)
// this.navigateToResult(imagePath)
} catch (error: any) {
wx.hideLoading()
this.setData({ isProcessing: false })
this.setData({ isProcessing: false ,takePhoto: false})
console.error('拍照失败:', error)
if (error?.message !== '用户取消选择') {
@@ -699,14 +710,16 @@ Page({
const imagePath = await imageManager.chooseFromAlbum()
wx.hideLoading()
this.setData({ photoPath: imagePath, takePhoto: true })
console.log('选择图片成功:', imagePath)
// 直接跳转到结果页面
this.navigateToResult(imagePath)
// this.navigateToResult(imagePath)
} catch (error: any) {
wx.hideLoading()
this.setData({ isProcessing: false })
this.setData({ isProcessing: false ,takePhoto: false})
console.error('选择图片失败:', error)
if (error?.message !== '用户取消选择') {
@@ -747,9 +760,3 @@ Page({
})

View File

@@ -50,32 +50,28 @@
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" />
</view>
</view> -->
<view class="camera" bindtap="handleImageSelect">
<view class="strip"></view>
<view class="lens">
<view class="lens-shutter"></view>
<view class="camera-wrawpper {{todaySummary.length == 0 && groupedHistory.length == 0 && !takePhoto ? 'default' : ''}} {{takePhoto ? 'action' : ''}}">
<view class="camera" bindtap="handleImageSelect">
<view class="strip"></view>
<view class="lens">
<view class="lens-shutter"></view>
</view>
<view class="led"></view>
<view class="btn"></view>
<view class="bottom"></view>
</view>
<!-- <view class="shutter">
<view class="lens-outer"></view>
<view class="lens-inner"></view>
<view class="leaf a"></view>
<view class="leaf b"></view>
<view class="leaf c"></view>
</view> -->
<view class="led"></view>
<view class="btn"></view>
<view class="bottom"></view>
</view>
<view wx:if="{{todaySummary.length == 0 && groupedHistory.length == 0}}" class="photo-wrapper">
<view class="photo">
<view class="photo-inner">
<image class="photo-image" src="{{photoSvgData}}" mode="aspectFit"></image>
<view class="photo-wrapper">
<view class="photo">
<view class="photo-inner">
<image wx:if="{{takePhoto}}" class="photo-image" src="{{photoPath}}" mode="aspectFit"></image>
<image wx:else class="photo-image" src="{{photoSvgData}}" mode="aspectFit"></image>
</view>
</view>
</view>
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" />
</view>
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" />
</view>
<view class="history-wrap">
<view wx:if="{{!takePhoto && (todaySummary.length > 0 || groupedHistory.length > 0)}}" class="history-wrap">
<view class="today-card" wx:for="{{todaySummary}}" wx:key="index">
<p class="month-day">{{item.monthDay}}</p>
<scroll-view class="images-list" scroll-x enable-flex>
@@ -114,35 +110,5 @@
</view>
</view>
</view> -->
<!-- <view class="card-wrapper">
<view class="card-normal">
<image class="card-image" src="/static/sun-2.png" />
<view class="aurora-wrapper">
<view class="aurora"></view>
</view>
</view> -->
<!-- <view class="card-ascii">
<view class="ascii-content">
MAX_PARTICLES = 2500; const TRANSITION = 0.05; function clamp(n,
a, b) { return Math.max(a, Math.min(b, n)); } function lerp(a, b,
t) { return a + (b - a) * t; } const now = () => performance.now(
); function rng(min, max) { return Math.random() * (max - min) + m
in; } class Particle0 { constructor(x, y, vx, vy, r, a) { this.x =
x; this.y = y; this.vx = vx; this.vy = vy; this.r = r; this.a = a
; } step(dt) { this.x += this.vx * dt; this.y += this.vy * dt; } }
class Particle1 { constructor(x, y, vx, vy, r, a) { this.x = x; t
his.y = y; this.vx = vx; this.vy = vy; this.r = r; this.a = a; } s
tep(dt) { this.x += this.vx * dt; this.y += this.vy * dt; } } clas
s Particle2 { constructor(x, y, vx, vy, r, a) { this.x = x; this.y
= y; this.vx = vx; this.vy = vy; this.r = r; this.a = a; } step(d
t) { this.x += this.vx * dt; this.y += this.vy * dt; } } const sca
nner = { x: Math.floor(window.innerWidth / 2), width: SCAN_WIDTH,
glow: 3.5, }; function drawParticle(ctx, p) { ctx.globalAlpha = cl
amp(p.a, 0, 1); ctx.drawImage(gradient, p.x - p.r, p.y - p.r, p.r
* 2, p.r * 2); } function tick(t)
</view>
</view> -->
<!-- <view class="scanner"></view> -->
<!-- </view> -->
</view>
</view>
</view>

View File

@@ -724,20 +724,19 @@
50% { transform: translateY(-20px) rotate(180deg); }
}
.camera-wrawpper {
display: flex;
flex-direction: column;
align-items: center;
}
.camera {
position:relative;
/* left:50%; top:50%; */
position:relative;
width:300rpx; height:300rpx;
margin-top:40rpx;
background:#eaeaea;
border:1px solid rgba(0,0,0,.2); border-radius:50rpx;
border-radius:50rpx;
overflow:hidden;
transition: all .5s ease-in-out;
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-ms-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
z-index:2;
}
@@ -748,21 +747,6 @@ position:relative;
background-color: #2e3e4f;
border-radius: 15rpx;
box-shadow: 0px 3rpx 0px rgba(0,0,0,.4);
transition:all .2 ease-in-out;
-webkit-transition:all .2 ease-in-out;
-moz-transition:all .2 ease-in-out;
-ms-transition:all .2 ease-in-out;
-o-transition:all .2 ease-in-out;
animation: .5s btn;
-webkit-animation: .5s btn;
-moz-animation: .5s btn;
-ms-animation: .5s btn;
-o-animation: .5s btn;
animation-iteration-count:5;
-webkit-animation-iteration-count:5;
-moz-animation-iteration-count:5;
-ms-animation-iteration-count:5;
-o-animation-iteration-count:5;
}
.strip {
@@ -820,7 +804,7 @@ position:relative;
height: 340%;
width: 170%;
transition: .5s all linear;
animation: shutter 10.0s infinite ease-in-out;
/* animation: shutter 10.0s infinite ease-in-out; */
background:
linear-gradient(-150deg, transparent 52%, #000 calc(52% + 2rpx) calc(52% + 4rpx), grey calc(52% + 6rpx)) bottom/100% 40% no-repeat,
linear-gradient(150deg, transparent 52%, #000 calc(52% + 2rpx) calc(52% + 4rpx), grey calc(52% + 6rpx)),
@@ -837,7 +821,7 @@ position:relative;
height: 340%;
width: 170%;
transition: .5s all linear;
animation: shutter 10.0s infinite ease-in-out;
/* animation: shutter 10.0s infinite ease-in-out; */
background:
linear-gradient(-150deg, transparent 52%, #000 calc(52% + 2rpx) calc(52% + 4rpx), grey calc(52% + 6rpx)) bottom/100% 40% no-repeat,
linear-gradient(150deg, transparent 52%, #000 calc(52% + 2rpx) calc(52% + 4rpx), grey calc(52% + 6rpx)),
@@ -928,8 +912,8 @@ position:relative;
box-shadow: 0 4rpx 6rpx rgba(0, 0, 0, 0.2);
overflow: hidden;
z-index: 2;
transform: translateY(-105%);
animation: reveal 10s infinite ease-out;
/* transform: translateY(-105%); */
/* animation: reveal 10s infinite ease-out; */
}
@keyframes reveal {
@@ -959,8 +943,8 @@ position:relative;
width: 100%;
height: 100%;
background-color: #FEFDE2;
filter: blur(10rpx) brightness(0%) saturate(0%);
animation: showphoto 10s infinite ease-out;
/* filter: blur(10rpx) brightness(0%) saturate(0%); */
/* animation: showphoto 10s infinite ease-out; */
}
@keyframes showphoto {
0%, 25% {
@@ -973,315 +957,71 @@ position:relative;
filter: blur(10rpx) brightness(0%) saturate(0%);
}
}
@keyframes showphoto1 {
0%, 25% {
filter: blur(10rpx) brightness(0%) saturate(0%);
}
35%, 100% {
filter: blur(0rpx) brightness(100%) saturate(100%);
}
}
@keyframes shutter1 {
0% {
top: -120%;
height: 340%;
width: 170%;
opacity: 0;
} 10% {
top: 0;
height: 100%;
width: 50%;
opacity: 1;
} 20%, 100% {
top: -120%;
height: 340%;
width: 170%;
opacity: 0;
}
}
@keyframes reveal1 {
0%, 20% {
transform: translateY(-105%);
}
30% {
transform: translateY(0%);
opacity: 1;
}
100% {
transform: translateY(0%);
opacity: 1;
}
}
.default .camera .lens-shutter::after,
.default .camera .lens-shutter::before {
animation: shutter 10.0s infinite ease-in-out;
}
.default .photo-wrapper .photo {
animation: reveal 10s infinite ease-out;
}
.default .photo-wrapper .photo-inner {
animation: showphoto 10s infinite ease-out;
}
.action .camera .lens-shutter::after,
.action .camera .lens-shutter::before {
animation: shutter1 10s ease-in-out;
}
.action .photo-wrapper .photo {
animation: reveal1 10s ease-out;
}
.action .photo-wrapper .photo-inner {
animation: showphoto1 10s ease-out;
}
.photo-image {
width: 100%;
height: 100%;
}
/* .lens-outer{
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin: 50rpx 0 0 50rpx;
position: relative;
background: -moz-radial-gradient(83% 83%, circle closest-side, #c0b9c0, #968d9a 35%, #495057);
background: -webkit-radial-gradient(83% 83%, circle closest-side, #c0b9c0, #968d9a 35%, #495057);
background: -o-radial-gradient(83% 83%, circle closest-side, #c0b9c0, #968d9a 35%, #495057);
background: -ms-radial-gradient(83% 83%, circle closest-side, #c0b9c0, #968d9a 35%, #495057);
}
.lens-outer::before{
content: "";
display: block;
width: 68rpx;
height: 68rpx;
position: absolute;
top: 6rpx;
left: 6rpx;
border-radius: 50%;
background-color: #351c3c;
background-image: -webkit-linear-gradient(-45deg, #112b3c, #351c3c 70%);
background-image: -moz-linear-gradient(-45deg, #112b3c, #351c3c 70%);
background-image: -ms-linear-gradient(-45deg, #112b3c, #351c3c 70%);
background-image: -o-linear-gradient(-45deg, #112b3c, #351c3c 70%);
box-shadow: 0 0 0 2rpx #111d29;
}
.lens-outer::after{
content: "";
display: block;
width: 48rpx;
height: 48rpx;
position: absolute;
top: 16rpx;
left: 16rpx;
border-radius: 50%;
background-color: #150619;
background-image: -webkit-linear-gradient(-45deg, #0a2035, #17081b 70%);
background-image: -moz-linear-gradient(-45deg, #0a2035, #17081b 70%);
background-image: -ms-linear-gradient(-45deg, #0a2035, #17081b 70%);
background-image: -o-linear-gradient(-45deg, #0a2035, #17081b 70%);
box-shadow: 0 0 0 2rpx #393745;
}
.lens-inner{
width: 24rpx;
height: 24rpx;
border-radius: 50%;
background: #000;
position: absolute;
top: 76rpx;
left: 76rpx;
border: 2rpx solid #221f27;
}
.lens-inner::before{
content: "";
display: block;
width: 66rpx;
height: 66rpx;
border-radius: 50%;
position: absolute;
top: -20rpx;
left: -20rpx;
-webkit-transform: rotate(45deg);
-o-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
box-shadow: inset -6rpx 0 6rpx -4rpx #7c4c88;
}
.leaf {
width: 176rpx;
height: 176rpx;
position: absolute;
border-radius: 0 0 72rpx 104rpx/0 0 24rpx 40rpx;
}
.a{
bottom: 40rpx;
right: 10rpx;
box-shadow: 0 2rpx 0 #4c2f4d, -64rpx 24rpx 32rpx #442149, 0 80rpx 0 #7a21a3,inset 0 -2rpx 2rpx #200526;
}
.a::before {
content: "";
display: block;
width: 176rpx;
height: 176rpx;
position: absolute;
border-radius: 0 0 72rpx 104rpx/0 0 24rpx 40rpx;
bottom: -32rpx;
right: 32rpx;
box-shadow: 24rpx 16rpx 24rpx #5d206e, 0 80rpx 0 #9731c5,inset 0 -2rpx 2rpx #200526;
-webkit-transform: rotate(300deg);
-o-transform: rotate(300deg);
-moz-transform: rotate(300deg);
transform: rotate(300deg);
}
.a::after {
content: "";
display: block;
width: 176rpx;
height: 176rpx;
position: absolute;
border-radius: 0 0 72rpx 104rpx/0 0 24rpx 40rpx;
bottom: -72rpx;
right: 16rpx;
box-shadow: 64rpx 40rpx 40rpx #361d3b, 0 80rpx 0 #8829b7,inset 0 -2rpx 2rpx #200526;
-webkit-transform: rotate(240deg);
-o-transform: rotate(240deg);
-moz-transform: rotate(240deg);
transform: rotate(240deg);
}
.b{
bottom: -36rpx;
right: -6rpx;
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
-moz-transform: rotate(180deg);
transform: rotate(180deg);
box-shadow: 80rpx 56rpx 48rpx #1e618b, 0 80rpx 0 #522162,inset 0 -2rpx 2rpx #200526;
}
.b::before {
content: "";
display: block;
width: 176rpx;
height: 176rpx;
position: absolute;
border-radius: 0 0 72rpx 104rpx/0 0 24rpx 40rpx;
bottom: -32rpx;
right: 32rpx;
-webkit-transform: rotate(-60deg);
-o-transform: rotate(-60deg);
-moz-transform: rotate(-60deg);
transform: rotate(-60deg);
clip: rect(0em, 144rpx, 344.88rpx, 0em);
box-shadow: 44rpx 80rpx 32rpx #256186, 0 80rpx 0 #2f3241,inset 0 -2rpx 2rpx #200526;
}
.b::after{
content: "";
display: block;
width: 176rpx;
height: 176rpx;
position: absolute;
border-radius: 0 0 72rpx 104rpx/0 0 24rpx 40rpx;
bottom: -68rpx;
right: 18rpx;
-webkit-transform: rotate(-120deg);
-o-transform: rotate(-120deg);
-moz-transform: rotate(-120deg);
transform: rotate(-120deg);
clip: rect(0em, 144rpx, 344.88rpx, 0em);
box-shadow: -5rpx 0em 5.8rpx #4a7693,-88rpx 16rpx 40rpx #1e618b, 0 80rpx 0 #411e46,inset 0 -2rpx 2rpx #200526;
}
.c{
bottom: 40rpx;
right: 8rpx;
clip: rect(0em, 80rpx, 344.88rpx, 0em);
box-shadow: 0 2rpx 0 #4c2f4d, -24rpx 20rpx 32rpx #442149, 0 80rpx 0 #7a21a3,inset 0 -2rpx 2rpx #200526;
} */
.card-wrapper{
position: absolute;
top: 10%;
left: 10%;
width: 80%;
height: 80%;
flex-shrink: 0;
}
.card-normal {
background: transparent;
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 0;
color: white;
z-index: 2;
position: relative;
overflow: hidden;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* clip-path: inset(0 0 30% 0); */
}
.card-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: all 0.3s ease;
filter: brightness(1.1) contrast(1.1);
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}
.card-ascii {
background: transparent;
z-index: 1;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.ascii-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 36rpx;
overflow: hidden;
white-space: pre;
animation: glitch 0.1s infinite linear alternate-reverse;
margin: 0;
padding: 0;
text-align: left;
vertical-align: top;
box-sizing: border-box;
clip-path: inset(70% 0 0 0);
/* mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.8) 30%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.4) 80%, rgba(0, 0, 0, 0.2) 100%); */
mask-image: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.8) 30%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0.2) 100%);
background: linear-gradient(#eee, #ccc);
}
/* .scanner {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4rpx;
background: linear-gradient(90deg, transparent, #74b9ff, transparent);
box-shadow: 0 0 16rpx #74b9ff, 0 0 60px #74b9ff;
border-radius: 8rpx;
opacity: 0;
transition: transform 0s linear, opacity 0.3s ease;
animation: scan-animation 3s linear infinite;
background: linear-gradient(180deg, transparent 89%, rgba(0, 255, 255, 0.5) 1%, transparent);
border-radius: 20rpx;
animation: scan-animation 5s infinite;
background-size: 200% 200%;
box-shadow: inset 0 0px 15rpx 1rpx cyan;
z-index: 3;
}
@keyframes scan-animation {
0%, 100% {
top: 0%;
opacity: 0.9;
}
50% {
top: 100%;
opacity: 0.9;
}
} */
.aurora-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.9;
background: #272727;
}
.aurora{
position: absolute;
top: 300px;
width: 50vw;
height: 50px;
background: #D5D8FF;
filter: blur(40px);
border-radius: 50%;
animation-name: aurora-float;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
/* transform: translate(20%, 0); */
}
.aurora:nth-child(1) {
background: #D5A3E5;
}
.aurora:nth-child(2) {
background: #FDB5F0;
}
.aurora:nth-child(3) {
background: #F5838E;
}
.aurora:nth-child(4) {
background: #F0D9B6;
}
@keyframes aurora-float {
0% { transform: translateX(10vw) scale(1.2); }
50% { transform: translateX(32vw) scale(1.4); }
100% { transform: translateX(10vw) scale(1.2); }
}