fix: share token
This commit is contained in:
@@ -103,6 +103,13 @@ const nickname = ref("");
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const props = defineProps({
|
||||
shareToken: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["logind"]);
|
||||
|
||||
// 是否处于单页模式(朋友圈打开)
|
||||
@@ -206,6 +213,7 @@ const confirmLogin = async () => {
|
||||
nickname: nickname.value || getFestivalName(),
|
||||
avatarUrl: imageUrl,
|
||||
platform: "wx",
|
||||
shareToken: props.shareToken,
|
||||
});
|
||||
// 保存用户信息到store
|
||||
userStore.setUserInfo({
|
||||
|
||||
@@ -140,7 +140,11 @@
|
||||
/>
|
||||
|
||||
<!-- Login Popup -->
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<LoginPopup
|
||||
ref="loginPopupRef"
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
|
||||
<!-- More Avatar Popup -->
|
||||
<uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
||||
@@ -208,6 +212,7 @@ const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
const systemAvatars = ref([]);
|
||||
const frames = ref([]);
|
||||
const decors = ref([]);
|
||||
const shareToken = ref("");
|
||||
|
||||
// Panel and steps logic
|
||||
const activeTool = ref("avatar");
|
||||
@@ -351,6 +356,7 @@ onLoad((options) => {
|
||||
}
|
||||
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest("avatar_download", options.shareToken);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -109,7 +109,11 @@
|
||||
style="width: 300px; height: 500px; position: fixed; left: 9999px"
|
||||
></canvas> -->
|
||||
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<LoginPopup
|
||||
ref="loginPopupRef"
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -143,6 +147,7 @@ const remainingCount = ref(0);
|
||||
const allowShareCount = ref(0);
|
||||
const useShareCount = ref(0);
|
||||
const canUse = ref(true);
|
||||
const shareToken = ref("");
|
||||
|
||||
// 音效控制
|
||||
const audioContext = uni.createInnerAudioContext();
|
||||
@@ -158,6 +163,7 @@ audioContext.onEnded(() => {
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest(options.shareToken, "fortune_draw");
|
||||
}
|
||||
});
|
||||
@@ -192,6 +198,9 @@ onShareTimeline(async () => {
|
||||
});
|
||||
|
||||
const handleLogind = async () => {
|
||||
if (shareToken.value) {
|
||||
console.log(11111111, shareToken.value);
|
||||
}
|
||||
checkDrawStatus();
|
||||
};
|
||||
|
||||
|
||||
@@ -427,7 +427,11 @@
|
||||
style="width: 540px; height: 960px"
|
||||
/>
|
||||
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<LoginPopup
|
||||
ref="loginPopupRef"
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -653,8 +657,8 @@ const fontSize = ref(38);
|
||||
const fontWeight = ref("normal"); // 默认加粗
|
||||
|
||||
const textColors = [
|
||||
'#F8DA84',
|
||||
'#B4802C',
|
||||
"#F8DA84",
|
||||
"#B4802C",
|
||||
"#000000",
|
||||
"#ffffff",
|
||||
"#ff3b30",
|
||||
@@ -734,11 +738,15 @@ const bubbleOffsetY = ref(0);
|
||||
const bubbleMaxWidth = ref(400); // 默认宽度
|
||||
const userOffsetX = ref(0);
|
||||
const userOffsetY = ref(0);
|
||||
const shareToken = ref("");
|
||||
|
||||
onLoad((options) => {
|
||||
getTemplateList();
|
||||
getTemplateContentList();
|
||||
getTemplateTitleList();
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
}
|
||||
});
|
||||
|
||||
const syncUserInfo = () => {
|
||||
@@ -982,17 +990,18 @@ const onPanelScrollToLower = () => {
|
||||
};
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
getShareReward({ scene: "card_generate" });
|
||||
if (options.from === "button") {
|
||||
if (!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("card_generate_not_login", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
path: "/pages/index/index?shareToken=" + shareToken,
|
||||
title: "快来制作新春祝福卡片🎉",
|
||||
path: "/pages/make/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
|
||||
getShareReward({ scene: "card_generate" });
|
||||
if (options.from === "button") {
|
||||
// 1. 确保有 cardId (如果内容有变动,最好是新建)
|
||||
const id = createCard();
|
||||
|
||||
@@ -1007,8 +1016,8 @@ onShareAppMessage(async (options) => {
|
||||
} else {
|
||||
const shareToken = await getShareToken("card_generate_index", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
title: "快来制作新春祝福卡片🎉",
|
||||
path: `/pages/make/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
|
||||
@@ -74,21 +74,26 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<LoginPopup
|
||||
ref="loginPopupRef"
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { getWallpaperList, getWallpaperCategoryList } from "@/api/wallpaper.js";
|
||||
import {
|
||||
saveRemoteImageToLocal,
|
||||
saveRecordRequest,
|
||||
getShareToken,
|
||||
} from "@/utils/common.js";
|
||||
import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { onShareAppMessage, onShareTimeline, onLoad } from "@dcloudio/uni-app";
|
||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { saveViewRequest } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
@@ -102,6 +107,7 @@ const page = ref(1);
|
||||
const loading = ref(false);
|
||||
const hasMore = ref(true);
|
||||
const isRefreshing = ref(false);
|
||||
const shareToken = ref("");
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
if (!isLoggedIn.value) {
|
||||
@@ -144,8 +150,12 @@ onShareTimeline(async () => {
|
||||
};
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchCategories();
|
||||
onLoad((options) => {
|
||||
fetchCategories();
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest(options.shareToken, "wallpaper_download");
|
||||
}
|
||||
});
|
||||
|
||||
const getThumbUrl = (url) => {
|
||||
|
||||
Reference in New Issue
Block a user