2026-01-15 10:27:14 +08:00
|
|
|
|
<template>
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<view class="avatar-page">
|
2026-01-31 22:42:57 +08:00
|
|
|
|
<NavBar title="头像制作" />
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 顶部步骤条 -->
|
|
|
|
|
|
<view class="top-steps">
|
|
|
|
|
|
<view class="step-bar">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="(tool, idx) in tools"
|
|
|
|
|
|
:key="idx"
|
|
|
|
|
|
class="step-item"
|
|
|
|
|
|
:class="{ active: activeTool === tool.type }"
|
|
|
|
|
|
@tap="openTool(tool.type)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="step-num-wrap">
|
|
|
|
|
|
<view class="step-line" v-if="idx > 0"></view>
|
|
|
|
|
|
<view class="step-num">
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<text v-if="activeTool === tool.type">{{ tool.icon }}</text>
|
2026-02-05 21:58:56 +08:00
|
|
|
|
<text v-else>{{ tool.step }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<text class="step-text">{{ tool.text }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
2026-01-15 10:27:14 +08:00
|
|
|
|
<view class="preview-card">
|
2026-02-05 22:26:13 +08:00
|
|
|
|
<view class="premium-tag">
|
|
|
|
|
|
<uni-icons type="info" size="12" color="#fff"></uni-icons>
|
|
|
|
|
|
<text>分享或保存即可去除水印</text>
|
|
|
|
|
|
</view>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
<view class="preview-square">
|
2026-02-05 22:26:13 +08:00
|
|
|
|
<view class="watermark">年禧集.马年春节祝福</view>
|
2026-01-28 10:35:31 +08:00
|
|
|
|
<image
|
|
|
|
|
|
class="avatar-img"
|
|
|
|
|
|
:src="currentAvatar?.imageUrl"
|
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
|
/>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
<image
|
|
|
|
|
|
v-if="selectedFrame"
|
|
|
|
|
|
class="frame-img"
|
2026-01-28 10:35:31 +08:00
|
|
|
|
:src="selectedFrame?.imageUrl"
|
2026-01-15 10:27:14 +08:00
|
|
|
|
mode="aspectFill"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<image
|
|
|
|
|
|
v-if="selectedDecor"
|
|
|
|
|
|
class="decor-img"
|
2026-01-28 10:35:31 +08:00
|
|
|
|
:src="selectedDecor?.imageUrl"
|
2026-01-15 10:27:14 +08:00
|
|
|
|
mode="aspectFit"
|
2026-01-23 09:44:42 +08:00
|
|
|
|
:style="decorStyle"
|
|
|
|
|
|
@touchstart.stop="onTouchStart"
|
|
|
|
|
|
@touchmove.stop="onTouchMove"
|
|
|
|
|
|
@touchend.stop="onTouchEnd"
|
2026-01-15 10:27:14 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
2026-01-23 14:18:00 +08:00
|
|
|
|
<view v-if="selectedDecor" class="interaction-tip">
|
|
|
|
|
|
<text>👆 单指拖动</text>
|
|
|
|
|
|
<text class="tip-divider">|</text>
|
|
|
|
|
|
<text>✌️ 双指缩放/旋转</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<text v-else class="preview-tip">实时预览效果</text>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2026-01-23 14:18:00 +08:00
|
|
|
|
<view class="action-buttons">
|
|
|
|
|
|
<button class="btn secondary" @tap="saveAndUse">保存</button>
|
|
|
|
|
|
<button class="btn primary" open-type="share">分享给朋友</button>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<!-- 资源选择区 -->
|
|
|
|
|
|
<view class="resource-selector">
|
|
|
|
|
|
<!-- 头像选择区 -->
|
|
|
|
|
|
<view v-if="activeTool === 'avatar'" class="section">
|
|
|
|
|
|
<view class="section-title">选择头像</view>
|
|
|
|
|
|
<view class="grid">
|
|
|
|
|
|
<view class="grid-item upload-card">
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="wechat-avatar-btn"
|
|
|
|
|
|
open-type="chooseAvatar"
|
|
|
|
|
|
@chooseavatar="onChooseAvatar"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="upload-icon">✨</view>
|
|
|
|
|
|
<text class="upload-text">微信头像</text>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="item in systemAvatars"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
class="grid-item"
|
|
|
|
|
|
:class="{ active: currentAvatar?.id === item.id }"
|
|
|
|
|
|
@tap="currentAvatar = item"
|
|
|
|
|
|
>
|
|
|
|
|
|
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
|
|
|
|
|
<view v-if="currentAvatar?.id === item.id" class="check">✓</view>
|
|
|
|
|
|
</view>
|
2026-01-25 23:00:05 +08:00
|
|
|
|
</view>
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<view v-if="avatarLoading" class="loading-more">加载中...</view>
|
|
|
|
|
|
<view v-if="!avatarHasNext" class="no-more">没有更多了</view>
|
|
|
|
|
|
</view>
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<!-- 头像框选择区 -->
|
|
|
|
|
|
<view v-if="activeTool === 'frame'" class="section">
|
|
|
|
|
|
<view class="section-title">选择头像框</view>
|
|
|
|
|
|
<view class="grid">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="item in frames"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
class="grid-item"
|
|
|
|
|
|
:class="{ active: selectedFrame?.id === item.id }"
|
|
|
|
|
|
@tap="toggleFrame(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
|
|
|
|
|
<view v-if="selectedFrame?.id === item.id" class="check">✓</view>
|
|
|
|
|
|
</view>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</view>
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<view v-if="frameLoading" class="loading-more">加载中...</view>
|
|
|
|
|
|
<view v-if="!frameHasNext" class="no-more">没有更多了</view>
|
|
|
|
|
|
</view>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<!-- 挂饰选择区 -->
|
|
|
|
|
|
<view v-if="activeTool === 'decor'" class="section">
|
|
|
|
|
|
<view class="section-title">选择挂饰</view>
|
|
|
|
|
|
<view class="grid">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="item in decors"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
class="grid-item"
|
|
|
|
|
|
:class="{ active: selectedDecor?.id === item.id }"
|
|
|
|
|
|
@tap="toggleDecor(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
|
|
|
|
|
<view v-if="selectedDecor?.id === item.id" class="check">✓</view>
|
|
|
|
|
|
</view>
|
2026-02-05 21:58:56 +08:00
|
|
|
|
</view>
|
2026-02-05 22:17:52 +08:00
|
|
|
|
<view v-if="decorLoading" class="loading-more">加载中...</view>
|
|
|
|
|
|
<view v-if="!decorHasNext" class="no-more">没有更多了</view>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<canvas
|
2026-01-28 08:55:59 +08:00
|
|
|
|
type="2d"
|
|
|
|
|
|
id="avatarCanvas"
|
2026-01-15 10:27:14 +08:00
|
|
|
|
canvas-id="avatarCanvas"
|
|
|
|
|
|
class="hidden-canvas"
|
|
|
|
|
|
style="width: 600px; height: 600px"
|
|
|
|
|
|
/>
|
2026-01-16 15:09:19 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- Login Popup -->
|
|
|
|
|
|
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
2026-01-25 23:00:05 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- More Avatar Popup -->
|
|
|
|
|
|
<uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
|
|
|
|
|
<view class="popup-content">
|
|
|
|
|
|
<view class="popup-header">
|
|
|
|
|
|
<text class="popup-title">选择头像</text>
|
|
|
|
|
|
<view class="close-btn" @tap="closeMorePopup">✕</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<scroll-view
|
|
|
|
|
|
scroll-y
|
|
|
|
|
|
class="popup-scroll"
|
|
|
|
|
|
@scrolltolower="loadMoreAvatars"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view class="popup-grid">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="(item, i) in moreAvatars"
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
class="popup-item"
|
|
|
|
|
|
@tap="selectMoreAvatar(item)"
|
|
|
|
|
|
>
|
2026-01-28 10:35:31 +08:00
|
|
|
|
<image :src="item.imageUrl" class="popup-img" mode="aspectFill" />
|
2026-01-25 23:00:05 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-if="loading" class="loading-text">加载中...</view>
|
|
|
|
|
|
<view v-if="!hasMore && moreAvatars.length > 0" class="no-more-text">
|
|
|
|
|
|
没有更多了
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-popup>
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-16 15:09:19 +08:00
|
|
|
|
import { ref, computed } from "vue";
|
2026-01-25 23:28:03 +08:00
|
|
|
|
import { onShareAppMessage, onLoad, onReachBottom } from "@dcloudio/uni-app";
|
2026-01-16 15:09:19 +08:00
|
|
|
|
import { useUserStore } from "@/stores/user";
|
2026-01-23 14:18:00 +08:00
|
|
|
|
import {
|
|
|
|
|
|
createShareToken,
|
|
|
|
|
|
getShareReward,
|
|
|
|
|
|
abilityCheck,
|
|
|
|
|
|
} from "@/api/system.js";
|
2026-01-25 23:28:03 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getAvatarSystemList,
|
|
|
|
|
|
getAvatarFrameList,
|
|
|
|
|
|
getAvatarDecorList,
|
2026-01-28 08:55:59 +08:00
|
|
|
|
avatarCreateComplete,
|
2026-01-25 23:28:03 +08:00
|
|
|
|
} from "@/api/avatar.js";
|
2026-01-28 08:55:59 +08:00
|
|
|
|
import {
|
|
|
|
|
|
saveRecordRequest,
|
|
|
|
|
|
getShareToken,
|
|
|
|
|
|
generateObjectId,
|
2026-01-28 09:31:58 +08:00
|
|
|
|
uploadImage,
|
2026-01-28 08:55:59 +08:00
|
|
|
|
} from "@/utils/common.js";
|
2026-01-31 22:42:57 +08:00
|
|
|
|
import NavBar from "@/components/NavBar/NavBar.vue";
|
2026-02-05 21:58:56 +08:00
|
|
|
|
import { getBavBarHeight } from "@/utils/system";
|
2026-01-16 15:09:19 +08:00
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
const loginPopupRef = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
2026-01-15 10:27:14 +08:00
|
|
|
|
|
2026-01-25 23:03:26 +08:00
|
|
|
|
const systemAvatars = ref([]);
|
2026-01-25 23:28:03 +08:00
|
|
|
|
const frames = ref([]);
|
|
|
|
|
|
const decors = ref([]);
|
|
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
// Panel and steps logic
|
|
|
|
|
|
const activeTool = ref("avatar");
|
|
|
|
|
|
const tools = [
|
|
|
|
|
|
{ step: "01", text: "头像", type: "avatar", icon: "👤" },
|
|
|
|
|
|
{ step: "02", text: "头像框", type: "frame", icon: "🖼️" },
|
|
|
|
|
|
{ step: "03", text: "挂饰配件", type: "decor", icon: "✨" },
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const openTool = (type) => {
|
|
|
|
|
|
activeTool.value = type;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-25 23:28:03 +08:00
|
|
|
|
// Pagination states
|
2026-02-05 22:17:52 +08:00
|
|
|
|
const avatarPage = ref(1);
|
|
|
|
|
|
const avatarHasNext = ref(true);
|
|
|
|
|
|
const avatarLoading = ref(false);
|
|
|
|
|
|
|
2026-01-25 23:28:03 +08:00
|
|
|
|
const framePage = ref(1);
|
|
|
|
|
|
const frameHasNext = ref(true);
|
|
|
|
|
|
const frameLoading = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const decorPage = ref(1);
|
|
|
|
|
|
const decorHasNext = ref(true);
|
|
|
|
|
|
const decorLoading = ref(false);
|
2026-01-15 10:27:14 +08:00
|
|
|
|
|
2026-01-28 10:35:31 +08:00
|
|
|
|
const currentAvatar = ref(null);
|
|
|
|
|
|
const selectedFrame = ref(null);
|
|
|
|
|
|
const selectedDecor = ref(null);
|
2026-01-15 10:27:14 +08:00
|
|
|
|
|
2026-01-25 23:00:05 +08:00
|
|
|
|
// More Popup logic
|
|
|
|
|
|
const morePopup = ref(null);
|
|
|
|
|
|
const moreAvatars = ref([]);
|
2026-02-05 22:17:52 +08:00
|
|
|
|
|
|
|
|
|
|
const loadAvatars = async () => {
|
|
|
|
|
|
if (avatarLoading.value || !avatarHasNext.value) return;
|
|
|
|
|
|
avatarLoading.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAvatarSystemList(avatarPage.value);
|
|
|
|
|
|
const list = res?.list || [];
|
|
|
|
|
|
if (list.length > 0) {
|
|
|
|
|
|
systemAvatars.value.push(
|
|
|
|
|
|
...list.map((item) => ({
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
imageUrl: item.imageUrl,
|
|
|
|
|
|
})),
|
|
|
|
|
|
);
|
|
|
|
|
|
avatarPage.value++;
|
|
|
|
|
|
// 默认选中第一个
|
|
|
|
|
|
if (systemAvatars.value.length > 0 && !currentAvatar.value) {
|
|
|
|
|
|
currentAvatar.value = systemAvatars.value[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof res.hasNext !== "undefined") {
|
|
|
|
|
|
avatarHasNext.value = res.hasNext;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (list.length < 10) avatarHasNext.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error("Failed to load avatars:", e);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
avatarLoading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2026-01-25 23:00:05 +08:00
|
|
|
|
|
2026-01-25 23:28:03 +08:00
|
|
|
|
const loadFrames = async () => {
|
|
|
|
|
|
if (frameLoading.value || !frameHasNext.value) return;
|
|
|
|
|
|
frameLoading.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAvatarFrameList(framePage.value);
|
|
|
|
|
|
const list = res?.list || [];
|
|
|
|
|
|
if (list.length > 0) {
|
2026-01-28 10:35:31 +08:00
|
|
|
|
frames.value.push(
|
|
|
|
|
|
...list.map((item) => ({
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
imageUrl: item.imageUrl,
|
|
|
|
|
|
})),
|
|
|
|
|
|
);
|
2026-01-25 23:28:03 +08:00
|
|
|
|
framePage.value++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof res.hasNext !== "undefined") {
|
|
|
|
|
|
frameHasNext.value = res.hasNext;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (list.length < 10) frameHasNext.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
frameLoading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const loadDecors = async () => {
|
|
|
|
|
|
if (decorLoading.value || !decorHasNext.value) return;
|
|
|
|
|
|
decorLoading.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getAvatarDecorList(decorPage.value);
|
|
|
|
|
|
const list = res?.list || [];
|
|
|
|
|
|
if (list.length > 0) {
|
2026-01-28 10:35:31 +08:00
|
|
|
|
decors.value.push(
|
|
|
|
|
|
...list.map((item) => ({
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
imageUrl: item.imageUrl,
|
|
|
|
|
|
})),
|
|
|
|
|
|
);
|
2026-01-25 23:28:03 +08:00
|
|
|
|
decorPage.value++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof res.hasNext !== "undefined") {
|
|
|
|
|
|
decorHasNext.value = res.hasNext;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (list.length < 10) decorHasNext.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
decorLoading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-28 15:55:26 +08:00
|
|
|
|
onLoad((options) => {
|
2026-02-05 22:17:52 +08:00
|
|
|
|
loadAvatars();
|
2026-01-25 23:28:03 +08:00
|
|
|
|
loadFrames();
|
|
|
|
|
|
loadDecors();
|
2026-01-28 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
|
// 处理推荐跳转参数
|
|
|
|
|
|
if (options && options.recommendId && options.type && options.imageUrl) {
|
|
|
|
|
|
const recommendItem = {
|
|
|
|
|
|
id: options.recommendId,
|
|
|
|
|
|
imageUrl: decodeURIComponent(options.imageUrl),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (options.type === "frame") {
|
2026-02-05 21:58:56 +08:00
|
|
|
|
activeTool.value = "frame";
|
2026-01-28 15:55:26 +08:00
|
|
|
|
selectedFrame.value = recommendItem;
|
|
|
|
|
|
} else if (options.type === "decor") {
|
2026-02-05 21:58:56 +08:00
|
|
|
|
activeTool.value = "decor";
|
2026-01-28 15:55:26 +08:00
|
|
|
|
selectedDecor.value = recommendItem;
|
|
|
|
|
|
} else if (options.type === "avatar") {
|
|
|
|
|
|
currentAvatar.value = recommendItem;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-25 23:28:03 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
onReachBottom(() => {
|
2026-02-05 22:17:52 +08:00
|
|
|
|
if (activeTool.value === "avatar") {
|
|
|
|
|
|
loadAvatars();
|
|
|
|
|
|
} else if (activeTool.value === "frame") {
|
|
|
|
|
|
loadFrames();
|
|
|
|
|
|
} else if (activeTool.value === "decor") {
|
|
|
|
|
|
loadDecors();
|
2026-01-25 23:28:03 +08:00
|
|
|
|
}
|
2026-01-25 23:03:26 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
const goBack = () => {
|
|
|
|
|
|
uni.navigateBack();
|
2026-01-25 23:00:05 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-23 14:18:00 +08:00
|
|
|
|
const toggleFrame = (frame) => {
|
|
|
|
|
|
if (selectedFrame.value === frame) {
|
2026-01-28 10:35:31 +08:00
|
|
|
|
selectedFrame.value = null;
|
2026-01-23 14:18:00 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
selectedFrame.value = frame;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-31 21:34:16 +08:00
|
|
|
|
const toggleDecor = (decor) => {
|
|
|
|
|
|
if (selectedDecor.value === decor) {
|
|
|
|
|
|
selectedDecor.value = null;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
selectedDecor.value = decor;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-23 09:44:42 +08:00
|
|
|
|
// 挂饰状态
|
|
|
|
|
|
const decorState = ref({
|
|
|
|
|
|
x: 300, // 初始中心 X (rpx)
|
|
|
|
|
|
y: 80, // 初始中心 Y (rpx)
|
|
|
|
|
|
scale: 1,
|
|
|
|
|
|
rotate: 0,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const decorStyle = computed(() => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
transform: `translate(${decorState.value.x - 120}rpx, ${
|
|
|
|
|
|
decorState.value.y - 120
|
|
|
|
|
|
}rpx) rotate(${decorState.value.rotate}deg) scale(${
|
|
|
|
|
|
decorState.value.scale
|
|
|
|
|
|
})`,
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 触摸状态
|
|
|
|
|
|
let startTouches = [];
|
|
|
|
|
|
let initialDecorState = {};
|
|
|
|
|
|
|
|
|
|
|
|
const getDistance = (p1, p2) => {
|
|
|
|
|
|
const x = p1.clientX - p2.clientX;
|
|
|
|
|
|
const y = p1.clientY - p2.clientY;
|
|
|
|
|
|
return Math.sqrt(x * x + y * y);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getAngle = (p1, p2) => {
|
|
|
|
|
|
const x = p1.clientX - p2.clientX;
|
|
|
|
|
|
const y = p1.clientY - p2.clientY;
|
|
|
|
|
|
return (Math.atan2(y, x) * 180) / Math.PI;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const onTouchStart = (e) => {
|
|
|
|
|
|
startTouches = e.touches;
|
|
|
|
|
|
initialDecorState = { ...decorState.value };
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const onTouchMove = (e) => {
|
|
|
|
|
|
if (e.touches.length === 1 && startTouches.length === 1) {
|
|
|
|
|
|
// 单指移动
|
|
|
|
|
|
const dx = e.touches[0].clientX - startTouches[0].clientX;
|
|
|
|
|
|
const dy = e.touches[0].clientY - startTouches[0].clientY;
|
|
|
|
|
|
|
|
|
|
|
|
// px 转 rpx
|
|
|
|
|
|
const systemInfo = uni.getSystemInfoSync();
|
|
|
|
|
|
const ratio = 750 / systemInfo.windowWidth;
|
|
|
|
|
|
|
|
|
|
|
|
decorState.value.x = initialDecorState.x + dx * ratio;
|
|
|
|
|
|
decorState.value.y = initialDecorState.y + dy * ratio;
|
|
|
|
|
|
} else if (e.touches.length === 2 && startTouches.length === 2) {
|
|
|
|
|
|
// 双指缩放/旋转
|
|
|
|
|
|
const p1 = e.touches[0];
|
|
|
|
|
|
const p2 = e.touches[1];
|
|
|
|
|
|
const startP1 = startTouches[0];
|
|
|
|
|
|
const startP2 = startTouches[1];
|
|
|
|
|
|
|
|
|
|
|
|
const currentDist = getDistance(p1, p2);
|
|
|
|
|
|
const startDist = getDistance(startP1, startP2);
|
|
|
|
|
|
|
|
|
|
|
|
const currentAngle = getAngle(p1, p2);
|
|
|
|
|
|
const startAngle = getAngle(startP1, startP2);
|
|
|
|
|
|
|
|
|
|
|
|
decorState.value.scale =
|
|
|
|
|
|
initialDecorState.scale * (currentDist / startDist);
|
|
|
|
|
|
decorState.value.rotate =
|
|
|
|
|
|
initialDecorState.rotate + (currentAngle - startAngle);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const onTouchEnd = () => {
|
|
|
|
|
|
// 可以在这里做边界检查等
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-16 15:09:19 +08:00
|
|
|
|
const handleLogind = async () => {
|
|
|
|
|
|
// Logic after successful login if needed
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-02-03 02:56:17 +08:00
|
|
|
|
const onChooseAvatar = async (e) => {
|
|
|
|
|
|
const avatarUrl = e.detail.avatarUrl;
|
|
|
|
|
|
if (!avatarUrl) return;
|
|
|
|
|
|
|
|
|
|
|
|
uni.showLoading({ title: "上传中...", mask: true });
|
|
|
|
|
|
try {
|
|
|
|
|
|
const imageUrl = await uploadImage(avatarUrl);
|
2026-02-03 05:04:10 +08:00
|
|
|
|
|
2026-02-03 02:56:17 +08:00
|
|
|
|
currentAvatar.value = {
|
|
|
|
|
|
id: "wechat_" + Date.now(),
|
|
|
|
|
|
imageUrl: imageUrl,
|
|
|
|
|
|
};
|
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
uni.hideLoading();
|
2026-02-03 05:04:10 +08:00
|
|
|
|
uni.showToast({ title: e || "上传失败", icon: "none" });
|
2026-02-03 02:56:17 +08:00
|
|
|
|
console.error("Upload avatar error", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
const createAvatarId = () => {
|
|
|
|
|
|
const id = generateObjectId();
|
|
|
|
|
|
return id;
|
2026-01-15 10:27:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-28 08:55:59 +08:00
|
|
|
|
const saveByCanvas = async (save = true) => {
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
const query = uni.createSelectorQuery();
|
|
|
|
|
|
query
|
|
|
|
|
|
.select("#avatarCanvas")
|
|
|
|
|
|
.fields({ node: true, size: true })
|
|
|
|
|
|
.exec(async (res) => {
|
|
|
|
|
|
if (!res[0] || !res[0].node) {
|
|
|
|
|
|
reject("Canvas not found");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const canvas = res[0].node;
|
|
|
|
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
|
|
|
|
|
|
|
|
const loadCanvasImage = (url) => {
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
const img = canvas.createImage();
|
|
|
|
|
|
img.onload = () => resolve(img);
|
|
|
|
|
|
img.onerror = (e) => reject(e);
|
|
|
|
|
|
img.src = url;
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化画布尺寸
|
|
|
|
|
|
const size = 600;
|
2026-01-28 09:31:58 +08:00
|
|
|
|
canvas.width = size;
|
|
|
|
|
|
canvas.height = size;
|
2026-01-28 10:35:31 +08:00
|
|
|
|
const avatarPath = await loadCanvasImage(currentAvatar.value.imageUrl);
|
2026-01-28 08:55:59 +08:00
|
|
|
|
ctx.clearRect(0, 0, size, size);
|
|
|
|
|
|
ctx.drawImage(avatarPath, 0, 0, size, size);
|
|
|
|
|
|
if (selectedFrame.value) {
|
2026-01-28 10:35:31 +08:00
|
|
|
|
const framePath = await loadCanvasImage(selectedFrame.value.imageUrl);
|
2026-01-28 08:55:59 +08:00
|
|
|
|
ctx.drawImage(framePath, 0, 0, size, size);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (selectedDecor.value) {
|
2026-01-28 10:35:31 +08:00
|
|
|
|
const decorPath = await loadCanvasImage(selectedDecor.value.imageUrl);
|
2026-01-28 08:55:59 +08:00
|
|
|
|
ctx.save();
|
|
|
|
|
|
// 映射 rpx 坐标到 Canvas 坐标 (假设 1rpx = 1 unit for 600x600 canvas logic)
|
|
|
|
|
|
// Canvas size is 600, Preview is 600rpx. Ratio is 1:1 in logical space.
|
|
|
|
|
|
ctx.translate(decorState.value.x, decorState.value.y);
|
|
|
|
|
|
ctx.rotate((decorState.value.rotate * Math.PI) / 180);
|
|
|
|
|
|
const scale = decorState.value.scale;
|
|
|
|
|
|
// 绘制图片,宽高 240
|
|
|
|
|
|
ctx.drawImage(
|
|
|
|
|
|
decorPath,
|
|
|
|
|
|
-120 * scale,
|
|
|
|
|
|
-120 * scale,
|
|
|
|
|
|
240 * scale,
|
|
|
|
|
|
240 * scale,
|
|
|
|
|
|
);
|
|
|
|
|
|
ctx.restore();
|
|
|
|
|
|
}
|
|
|
|
|
|
uni.canvasToTempFilePath({
|
|
|
|
|
|
canvas: canvas, // Canvas 2D 必须传 canvas 实例
|
|
|
|
|
|
width: 600,
|
|
|
|
|
|
height: 600,
|
|
|
|
|
|
destWidth: 600,
|
|
|
|
|
|
destHeight: 600,
|
|
|
|
|
|
success: (res) => {
|
|
|
|
|
|
if (save) saveImage(res.tempFilePath);
|
|
|
|
|
|
resolve(res.tempFilePath);
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (err) => reject(err),
|
|
|
|
|
|
});
|
|
|
|
|
|
// ctx.draw(false, () => {
|
|
|
|
|
|
// uni.canvasToTempFilePath({
|
|
|
|
|
|
// canvasId: "avatarCanvas",
|
|
|
|
|
|
// success: (res) => {
|
|
|
|
|
|
// uni.saveImageToPhotosAlbum({
|
|
|
|
|
|
// filePath: res.tempFilePath,
|
|
|
|
|
|
// success: () => {
|
|
|
|
|
|
// uni.showToast({ title: "已保存到相册", icon: "success" });
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
|
|
|
|
|
// });
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const saveImage = (path) => {
|
|
|
|
|
|
uni.saveImageToPhotosAlbum({
|
|
|
|
|
|
filePath: path,
|
|
|
|
|
|
success() {
|
|
|
|
|
|
uni.showToast({ title: "已保存到相册" });
|
|
|
|
|
|
},
|
|
|
|
|
|
fail() {
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
title: "提示",
|
|
|
|
|
|
content: "请授权保存到相册",
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-15 10:27:14 +08:00
|
|
|
|
const saveAndUse = async () => {
|
2026-01-28 08:55:59 +08:00
|
|
|
|
if (!isLoggedIn.value) {
|
|
|
|
|
|
loginPopupRef.value.open();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-01-23 14:18:00 +08:00
|
|
|
|
const abilityRes = await abilityCheck("avatar_download");
|
|
|
|
|
|
if (!abilityRes.canUse) {
|
|
|
|
|
|
if (
|
|
|
|
|
|
abilityRes?.blockType === "need_share" &&
|
|
|
|
|
|
abilityRes?.message === "分享可继续"
|
|
|
|
|
|
) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "分享到群聊可继续使用",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "您今日头像下载次数已用完,明日再试",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-01-28 09:31:58 +08:00
|
|
|
|
|
2026-01-31 20:59:51 +08:00
|
|
|
|
const tempPath = await saveByCanvas(true);
|
2026-01-28 10:35:31 +08:00
|
|
|
|
const id = createAvatarId();
|
|
|
|
|
|
saveRecordRequest(tempPath, id, "avatar_download");
|
|
|
|
|
|
completeCardInfo(id);
|
2026-01-28 09:31:58 +08:00
|
|
|
|
return;
|
2026-01-23 14:18:00 +08:00
|
|
|
|
// 调用avatarDownloadRecord API记录下载次数
|
2026-01-28 08:55:59 +08:00
|
|
|
|
// await avatarDownloadRecord({
|
|
|
|
|
|
// avatarUrl: currentAvatar.value,
|
|
|
|
|
|
// });
|
|
|
|
|
|
// saveRecordRequest('', )
|
2026-01-28 09:31:58 +08:00
|
|
|
|
// const ctx = uni.createCanvasContext("avatarCanvas");
|
|
|
|
|
|
// const size = 600;
|
|
|
|
|
|
// const avatarPath = await loadImage(currentAvatar.value);
|
|
|
|
|
|
// ctx.clearRect(0, 0, size, size);
|
|
|
|
|
|
// ctx.drawImage(avatarPath, 0, 0, size, size);
|
|
|
|
|
|
// if (selectedFrame.value) {
|
|
|
|
|
|
// const framePath = await loadImage(selectedFrame.value);
|
|
|
|
|
|
// ctx.drawImage(framePath, 0, 0, size, size);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (selectedDecor.value) {
|
|
|
|
|
|
// const decorPath = await loadImage(selectedDecor.value);
|
|
|
|
|
|
// ctx.save();
|
|
|
|
|
|
// // 映射 rpx 坐标到 Canvas 坐标 (假设 1rpx = 1 unit for 600x600 canvas logic)
|
|
|
|
|
|
// // Canvas size is 600, Preview is 600rpx. Ratio is 1:1 in logical space.
|
|
|
|
|
|
// ctx.translate(decorState.value.x, decorState.value.y);
|
|
|
|
|
|
// ctx.rotate((decorState.value.rotate * Math.PI) / 180);
|
|
|
|
|
|
// const scale = decorState.value.scale;
|
|
|
|
|
|
// // 绘制图片,宽高 240
|
|
|
|
|
|
// ctx.drawImage(
|
|
|
|
|
|
// decorPath,
|
|
|
|
|
|
// -120 * scale,
|
|
|
|
|
|
// -120 * scale,
|
|
|
|
|
|
// 240 * scale,
|
|
|
|
|
|
// 240 * scale,
|
|
|
|
|
|
// );
|
|
|
|
|
|
// ctx.restore();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// ctx.draw(false, () => {
|
|
|
|
|
|
// uni.canvasToTempFilePath({
|
|
|
|
|
|
// canvasId: "avatarCanvas",
|
|
|
|
|
|
// success: (res) => {
|
|
|
|
|
|
// uni.saveImageToPhotosAlbum({
|
|
|
|
|
|
// filePath: res.tempFilePath,
|
|
|
|
|
|
// success: () => {
|
|
|
|
|
|
// uni.showToast({ title: "已保存到相册", icon: "success" });
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
|
|
|
|
|
// });
|
2026-01-15 10:27:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-28 09:31:58 +08:00
|
|
|
|
const completeCardInfo = async (id) => {
|
|
|
|
|
|
const tempPath = await saveByCanvas(false);
|
|
|
|
|
|
const imageUrl = await uploadImage(tempPath);
|
2026-01-28 10:35:31 +08:00
|
|
|
|
avatarCreateComplete({
|
|
|
|
|
|
id,
|
|
|
|
|
|
imageUrl,
|
|
|
|
|
|
avatarId: currentAvatar?.value?.id,
|
|
|
|
|
|
decorId: selectedDecor?.value?.id,
|
|
|
|
|
|
frameId: selectedFrame?.value?.id,
|
|
|
|
|
|
});
|
2026-01-31 22:01:02 +08:00
|
|
|
|
return imageUrl;
|
2026-01-15 10:27:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-23 14:18:00 +08:00
|
|
|
|
onShareAppMessage(async () => {
|
2026-01-28 08:55:59 +08:00
|
|
|
|
getShareReward({ scene: "avatar_download" });
|
|
|
|
|
|
if (!isLoggedIn.value) {
|
|
|
|
|
|
const shareTokenRes = await getShareToken("avatar_download_not_login", "");
|
|
|
|
|
|
return {
|
|
|
|
|
|
title: "新春祝福",
|
|
|
|
|
|
path: `/pages/index/index?shareToken=${shareTokenRes.shareToken}`,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2026-01-31 22:01:02 +08:00
|
|
|
|
uni.showLoading({ title: "分享中...", mask: true });
|
2026-01-28 08:55:59 +08:00
|
|
|
|
const id = createAvatarId();
|
2026-01-28 21:13:27 +08:00
|
|
|
|
const shareTokenRes = await getShareToken("avatar_download", id);
|
2026-01-31 22:01:02 +08:00
|
|
|
|
const imageUrl = await completeCardInfo(id);
|
|
|
|
|
|
uni.hideLoading();
|
2026-01-23 14:18:00 +08:00
|
|
|
|
return {
|
2026-01-31 22:01:02 +08:00
|
|
|
|
title: "我做了一个新头像,真的太好看了",
|
2026-01-27 23:01:47 +08:00
|
|
|
|
path: `/pages/avatar/detail?shareToken=${shareTokenRes.shareToken}`,
|
2026-01-31 22:01:02 +08:00
|
|
|
|
imageUrl, // 使用默认封面或 popularCards 的封面
|
2026-01-23 14:18:00 +08:00
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// onShareTimeline(() => {
|
|
|
|
|
|
// return {
|
|
|
|
|
|
// title: "制作我的新春头像",
|
|
|
|
|
|
// imageUrl:
|
|
|
|
|
|
// "https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
|
|
|
|
|
|
// };
|
|
|
|
|
|
// });
|
2026-01-15 10:27:14 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.avatar-page {
|
|
|
|
|
|
min-height: 100vh;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
background: #f8f8f8;
|
|
|
|
|
|
padding-bottom: 200rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.top-steps {
|
2026-01-15 10:27:14 +08:00
|
|
|
|
background: #fff;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
padding: 30rpx 0;
|
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
|
position: sticky;
|
|
|
|
|
|
z-index: 100;
|
|
|
|
|
|
|
|
|
|
|
|
.step-bar {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 0 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.step-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
|
|
.step-num-wrap {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
margin-bottom: 12rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.step-line {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: -50%;
|
|
|
|
|
|
right: 50%;
|
|
|
|
|
|
top: 20rpx;
|
|
|
|
|
|
height: 2rpx;
|
|
|
|
|
|
background: #eee;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.step-num {
|
|
|
|
|
|
width: 40rpx;
|
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.step-text {
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
.step-num {
|
|
|
|
|
|
background: #ff3b30;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
transform: scale(1.2);
|
|
|
|
|
|
box-shadow: 0 4rpx 12rpx rgba(255, 59, 48, 0.3);
|
|
|
|
|
|
}
|
|
|
|
|
|
.step-text {
|
|
|
|
|
|
color: #ff3b30;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-15 10:27:14 +08:00
|
|
|
|
}
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
2026-01-15 10:27:14 +08:00
|
|
|
|
.preview-card {
|
|
|
|
|
|
background: #fff;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
margin: 0 30rpx 30rpx;
|
|
|
|
|
|
padding: 40rpx;
|
|
|
|
|
|
border-radius: 32rpx;
|
2026-02-05 22:26:13 +08:00
|
|
|
|
position: relative;
|
2026-01-23 09:55:32 +08:00
|
|
|
|
display: flex;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
flex-direction: column;
|
2026-01-23 09:55:32 +08:00
|
|
|
|
align-items: center;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
2026-02-05 22:26:13 +08:00
|
|
|
|
.premium-tag {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 20rpx;
|
|
|
|
|
|
right: 0rpx;
|
|
|
|
|
|
background: linear-gradient(90deg, #ff8d42, #ff3b30);
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
|
padding: 8rpx 30rpx 8rpx 20rpx;
|
|
|
|
|
|
border-radius: 20rpx 0 0 20rpx;
|
|
|
|
|
|
z-index: 10;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6rpx;
|
|
|
|
|
|
box-shadow: 0 4rpx 12rpx rgba(255, 59, 48, 0.3);
|
|
|
|
|
|
transform: translateX(10rpx);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
.preview-square {
|
2026-02-05 22:26:13 +08:00
|
|
|
|
position: relative;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
width: 600rpx;
|
|
|
|
|
|
height: 600rpx;
|
2026-02-05 22:26:13 +08:00
|
|
|
|
background: #fff;
|
|
|
|
|
|
border-radius: 32rpx;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
2026-02-05 22:26:13 +08:00
|
|
|
|
.watermark {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%) rotate(-45deg);
|
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.2);
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
z-index: 10;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
.avatar-img {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.frame-img {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.decor-img {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 240rpx;
|
|
|
|
|
|
height: 240rpx;
|
|
|
|
|
|
z-index: 3;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.interaction-tip {
|
|
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #ff3b30;
|
|
|
|
|
|
background: rgba(255, 59, 48, 0.1);
|
|
|
|
|
|
padding: 10rpx 30rpx;
|
|
|
|
|
|
border-radius: 100rpx;
|
|
|
|
|
|
|
|
|
|
|
|
.tip-divider {
|
|
|
|
|
|
margin: 0 15rpx;
|
|
|
|
|
|
opacity: 0.3;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-tip {
|
|
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
}
|
2026-01-23 09:55:32 +08:00
|
|
|
|
}
|
2026-01-23 14:18:00 +08:00
|
|
|
|
|
|
|
|
|
|
.action-buttons {
|
2026-02-05 21:58:56 +08:00
|
|
|
|
padding: 0 30rpx;
|
2026-01-15 10:27:14 +08:00
|
|
|
|
display: flex;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
gap: 20rpx;
|
2026-02-05 22:26:13 +08:00
|
|
|
|
margin-bottom: 30rpx;
|
2026-01-23 14:18:00 +08:00
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
.btn {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
height: 88rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
border-radius: 44rpx;
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
font-weight: bold;
|
2026-01-15 10:27:14 +08:00
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
&.primary {
|
|
|
|
|
|
background: #ff3b30;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.secondary {
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
border: 2rpx solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-15 10:27:14 +08:00
|
|
|
|
}
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
.resource-selector {
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
margin: 0 30rpx 30rpx;
|
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
|
border-radius: 32rpx;
|
|
|
|
|
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
|
|
|
|
|
.section-title {
|
2026-02-05 22:17:52 +08:00
|
|
|
|
font-size: 30rpx;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
font-weight: bold;
|
2026-02-05 22:17:52 +08:00
|
|
|
|
margin-bottom: 24rpx;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
color: #333;
|
2026-02-05 22:17:52 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
&::before {
|
|
|
|
|
|
content: "";
|
|
|
|
|
|
width: 8rpx;
|
|
|
|
|
|
height: 32rpx;
|
|
|
|
|
|
background: #ff3b30;
|
|
|
|
|
|
border-radius: 4rpx;
|
|
|
|
|
|
margin-right: 16rpx;
|
|
|
|
|
|
}
|
2026-02-05 21:58:56 +08:00
|
|
|
|
}
|
2026-01-15 10:27:14 +08:00
|
|
|
|
}
|
2026-02-05 21:58:56 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
.grid {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: repeat(4, 1fr);
|
|
|
|
|
|
gap: 20rpx;
|
2026-02-03 02:56:17 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
.grid-item {
|
|
|
|
|
|
aspect-ratio: 1;
|
|
|
|
|
|
background: #f5f5f5;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
border: 4rpx solid transparent;
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
border-color: #ff3b30;
|
|
|
|
|
|
}
|
2026-02-03 02:56:17 +08:00
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
.grid-img {
|
2026-02-03 02:56:17 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.check {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
background: #ff3b30;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
|
padding: 4rpx 8rpx;
|
|
|
|
|
|
border-radius: 0 0 0 16rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-05 22:17:52 +08:00
|
|
|
|
&.upload-card {
|
2026-02-03 02:56:17 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
background: #fdf2f2;
|
|
|
|
|
|
border: 2rpx dashed #ffcbcb;
|
|
|
|
|
|
|
|
|
|
|
|
.wechat-avatar-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.upload-icon {
|
|
|
|
|
|
font-size: 40rpx;
|
|
|
|
|
|
margin-bottom: 8rpx;
|
|
|
|
|
|
}
|
2026-02-03 02:56:17 +08:00
|
|
|
|
|
2026-02-05 21:58:56 +08:00
|
|
|
|
.upload-text {
|
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
|
color: #ff3b30;
|
2026-02-03 02:56:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-05 21:58:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-more,
|
|
|
|
|
|
.no-more {
|
2026-01-15 10:27:14 +08:00
|
|
|
|
text-align: center;
|
2026-02-05 21:58:56 +08:00
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
padding: 30rpx 0;
|
2026-01-15 10:27:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.hidden-canvas {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
left: -9999px;
|
|
|
|
|
|
top: -9999px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
2026-02-05 21:58:56 +08:00
|
|
|
|
"}]} ```
|