upload project

This commit is contained in:
unknown 2025-12-27 17:16:03 +08:00
commit 06961cae04
422 changed files with 110626 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "",
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white",
"disableScroll": true,
"usingComponents": {}
}

View file

@ -0,0 +1,144 @@
<view class="camera-page">
<!-- 拍摄模式视图 -->
<view class="shoot-mode" wx:if="{{!hasTakenPhoto}}">
<view class="top-controls">
<view class="flash-btn" bindtap="toggleFlash">
<image src="{{flashState === 'off' ? '/images/cross.svg' : '/images/lightning.svg'}}" mode="aspectFit" style="width: 100%; height: 100%;"></image>
</view>
</view>
<view class="camera-container">
<camera
device-position="{{cameraPosition}}"
flash="{{flashState}}"
binderror="handleCameraError"
class="camera-preview"
></camera>
<!-- 双击检测覆盖层 -->
<view class="camera-tap-overlay" catchtap="onCameraDoubleTap"></view>
</view>
<view class="shoot-tip">轻触拍照</view>
<view class="shoot-controls">
<view class="close-btn" bindtap="navigateBack">取消</view>
<view class="shoot-button" bindtap="takePhoto"></view>
<view class="switch-camera-btn" bindtap="switchCamera">
<image src="/images/refresh.svg" mode="aspectFit" style="width: 100%; height: 100%;"></image>
</view>
</view>
</view>
<!-- 编辑模式视图 -->
<view class="edit-mode" wx:if="{{hasTakenPhoto}}">
<view class="edit-container">
<!-- 图片容器 -->
<view class="image-container" style="position: relative; transform: rotate({{rotateAngle}}deg)scale({{imageScale}});">
<image
src="{{currentPhotoPath}}"
mode="widthFix"
class="edit-image"
bindload="onImageLoaded"
></image>
<canvas
id="mosaicCanvas"
type="2d"
hidden="{{!(currentTool ==='mosaic' || currentTool === 'eraser')}}"
style="position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 999; pointer-events: auto;"
bindtouchstart="onCanvasTouchStart"
bindtouchmove="onCanvasTouchMove"
bindtouchend="onCanvasTouchEnd"
></canvas>
<canvas
id="mergeCanvas"
type="2d"
style="position: absolute; left: -9999rpx; top: -9999rpx; width: {{canvasWidth}}px; height: {{canvasHeight}}px;"
></canvas>
<!-- 裁剪框 -->
<view wx:if="{{isCropping}}" class="crop-overlay"
catchtouchstart="startCropMove"
catchtouchmove="onCropTouchMove"
catchtouchend="onCropTouchEnd">
<!-- 遮罩层 -->
<view class="crop-mask">
<!-- 上遮罩 -->
<view class="crop-mask-top" style="height: {{cropBox.top}}px;"></view>
<!-- 中间区域 -->
<view class="crop-mask-middle" style="height: {{cropBox.height}}px;">
<!-- 左遮罩 -->
<view class="crop-mask-left" style="width: {{cropBox.left}}px;"></view>
<!-- 裁剪区域(透明,不可触摸) -->
<view class="crop-area" style="width: {{cropBox.width}}px; height: 100%;"></view>
<!-- 右遮罩 -->
<view class="crop-mask-right"></view>
</view>
<!-- 下遮罩 -->
<view class="crop-mask-bottom"></view>
</view>
<!-- 裁剪框(可拖动和调整) -->
<view class="crop-box"
style="left: {{cropBox.left}}px; top: {{cropBox.top}}px; width: {{cropBox.width}}px; height: {{cropBox.height}}px;">
<!-- 裁剪框边框 -->
<view class="crop-border">
<!-- 四个角的控制点 -->
<view class="crop-handle crop-handle-tl" data-handle="top-left" catchtouchstart="startCropDrag" catchtouchmove="onCropTouchMove" catchtouchend="onCropTouchEnd"></view>
<view class="crop-handle crop-handle-tr" data-handle="top-right" catchtouchstart="startCropDrag" catchtouchmove="onCropTouchMove" catchtouchend="onCropTouchEnd"></view>
<view class="crop-handle crop-handle-bl" data-handle="bottom-left" catchtouchstart="startCropDrag" catchtouchmove="onCropTouchMove" catchtouchend="onCropTouchEnd"></view>
<view class="crop-handle crop-handle-br" data-handle="bottom-right" catchtouchstart="startCropDrag" catchtouchmove="onCropTouchMove" catchtouchend="onCropTouchEnd"></view>
</view>
</view>
</view>
</view>
</view>
<!-- 工具按钮栏 -->
<view class="edit-toolbar">
<view class="edit-tool-group">
<!-- 旋转按钮 -->
<view class="tool-btn {{isRotated ? 'active' : ''}}" bindtap="rotateImage" title="旋转">
<text>🔄</text>
</view>
<!-- 还原按钮 -->
<view class="tool-btn restore-btn {{hasEdits ? 'active' : ''}}" bindtap="restoreOriginal" title="还原">
<text>↩️</text>
</view>
<!-- 裁剪按钮 -->
<view class="tool-btn {{isCropping ? 'active' : ''}}" bindtap="selectTool" data-tool="crop" title="裁剪">
<text>✂️</text>
</view>
<!-- 马赛克按钮 -->
<view class="tool-btn {{currentTool === 'mosaic' ? 'active' : ''}}" bindtap="selectTool" data-tool="mosaic" title="马赛克">
<text>░</text>
</view>
<!-- 橡皮按钮 -->
<view class="tool-btn {{currentTool === 'eraser' ? 'active' : ''}}" bindtap="selectTool" data-tool="eraser" title="橡皮">
<text>🧽</text>
</view>
</view>
</view>
<!-- 底部控制栏-->
<view class="edit-controls">
<view class="close-btn" bindtap="goBackToShoot">重拍</view>
<!-- 裁剪模式下的确认/取消按钮 -->
<view wx:if="{{isCropping}}" class="crop-controls">
<button
type="text"
class="edit-control-btn cancel"
bindtap="cancelCrop"
>取消</button>
<button
type="text"
class="edit-control-btn confirm"
bindtap="applyCrop"
>确定</button>
</view>
<!-- 非裁剪模式下的使用照片按钮 -->
<button
wx:else
type="text"
class="edit-control-btn confirm"
bindtap="confirmPhoto"
>使用照片</button>
</view>
</view>
</view>

View file

@ -0,0 +1,379 @@
.camera-page {
width: 100%;
height: 100vh;
background-color: #000;
color: #fff;
overflow: hidden;
position: relative;
}
.shoot-mode {
width: 100%;
height: 100%;
position: relative;
}
.top-controls {
position: absolute;
top: 80rpx;
left: 20rpx;
z-index: 10;
}
.flash-btn {
width: 60rpx;
height: 60rpx;
font-size: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.camera-container {
position: absolute;
top: 150rpx;
left: 0;
width: 100%;
height: 70%;
background-color: #000;
z-index: 1;
/* 确保可以接收点击事件 */
pointer-events: auto;
}
.camera-preview {
width: 100%;
height: 100%;
object-fit: cover;
}
.camera-tap-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
/* 透明覆盖层,用于捕获双击事件 */
background-color: transparent;
pointer-events: auto;
}
.shoot-tip {
position: absolute;
bottom: 200rpx;
left: 50%;
transform: translateX(-50%);
font-size: 28rpx;
color: rgba(255, 255, 255, 0.8);
z-index: 5;
}
.shoot-controls {
position: absolute;
bottom: 40rpx;
left: 0;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
gap: 150rpx;
z-index: 10;
}
.switch-camera-btn {
width: 60rpx;
height: 60rpx;
font-size: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
/* 重置shoot-controls内部按钮的绝对定位 */
.shoot-controls .close-btn,
.shoot-controls .switch-camera-btn {
position: static;
top: auto;
left: auto;
transform: none;
}
/* 关闭按钮样式 */
.close-btn {
width: 120rpx;
height: 60rpx;
font-size: 36rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
color: #fff;
background-color: transparent;
}
.shoot-button {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 6rpx solid #fff;
display: flex;
align-items: center;
justify-content: center;
margin-right: 30px;
}
.empty-btn {
width: 0;
height: 0;
}
.edit-mode {
width: 100%;
height: 100%;
position: relative;
}
.edit-container {
position: absolute;
top: 150rpx;
left: 0;
width: 100%;
height: 70%;
background-color: #000;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
z-index: 1;
}
.image-container {
transition: transform 0.3s ease;
position: relative;
z-index: 5;
width: 100%;
height: 100%;
}
.edit-image {
width: 100%;
height: 100%;
object-fit: contain;
background-color: transparent;
}
.mosaic-controls {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
gap: 10rpx;
z-index: 20;
background-color: rgba(0, 0, 0, 0.5);
padding: 10rpx;
box-sizing: border-box;
}
.mosaic-controls text {
font-size: 26rpx;
}
.edit-toolbar {
position: absolute;
bottom: 100rpx;
left: 0;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 20rpx 0;
box-sizing: border-box;
z-index: 15;
background-color: rgba(0, 0, 0, 0.5);
}
.edit-controls {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 40rpx;
box-sizing: border-box;
z-index: 20;
background-color: #333;
}
.edit-tool-group {
display: flex;
gap: 15rpx;
align-items: center;
margin-left: 0;
}
.edit-tool-group .tool-btn {
background-color: rgba(0, 0, 0, 0.5);
padding: 15rpx;
border-radius: 50%;
font-size: 28rpx;
color: #fff;
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.edit-tool-group .tool-btn.active {
background-color: #007aff;
}
.edit-tool-group .restore-btn {
opacity: 0.5;
}
.edit-tool-group .restore-btn.active {
opacity: 1;
}
.edit-tool-group .clear-mosaic-btn {
opacity: 0.5;
}
.edit-tool-group .clear-mosaic-btn.active {
opacity: 1;
}
.edit-control-btn.confirm {
color: #fff;
font-size: 32rpx;
padding: 10rpx 40rpx;
border-radius: 0;
background-color: transparent;
margin-right: 5rpx;
}
.edit-control-btn.cancel {
color: #999;
font-size: 32rpx;
padding: 10rpx 40rpx;
border-radius: 0;
background-color: transparent;
margin-right: 20rpx;
}
.crop-controls {
display: flex;
align-items: center;
}
/* 裁剪相关样式 */
.crop-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
pointer-events: auto;
}
.crop-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.crop-mask-top {
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
flex: 0 0 auto;
}
.crop-mask-bottom {
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
flex: 1;
}
.crop-mask-middle {
display: flex;
width: 100%;
flex-direction: row;
flex: 0 0 auto;
}
.crop-mask-left {
background-color: rgba(0, 0, 0, 0.6);
flex: 0 0 auto;
}
.crop-mask-right {
background-color: rgba(0, 0, 0, 0.6);
flex: 1;
}
.crop-area {
background-color: transparent;
pointer-events: none;
}
.crop-box {
position: absolute;
border: 2rpx solid #fff;
box-sizing: border-box;
pointer-events: none;
z-index: 11;
}
.crop-border {
position: relative;
width: 100%;
height: 100%;
}
.crop-handle {
position: absolute;
width: 50rpx;
height: 50rpx;
background-color: #fff;
border: 3rpx solid #007aff;
border-radius: 50%;
box-sizing: border-box;
z-index: 12;
pointer-events: auto;
/* 使用transform居中定位在裁剪框的角上确保始终可见 */
transform: translate(-50%, -50%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.crop-handle-tl {
top: 0;
left: 0;
}
.crop-handle-tr {
top: 0;
right: 0;
}
.crop-handle-bl {
bottom: 0;
left: 0;
}
.crop-handle-br {
bottom: 0;
right: 0;
}