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