|
@@ -8,8 +8,8 @@
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
import NavbarEvo from '@/components/navbar-evo.vue'
|
|
|
-import { getDesignerInfo } from '../../../../core/libs/requests'
|
|
|
-import { Badge } from '../../../../core/libs/models'
|
|
|
+import { getBanners,getDesignerInfo } from '../../../../core/libs/requests'
|
|
|
+import { Badge, BannerMode } from '../../../../core/libs/models'
|
|
|
import { NetImages } from '../../../../core/libs/net-images'
|
|
|
import { useMessage } from 'wot-design-uni'
|
|
|
import { pick } from 'radash'
|
|
@@ -103,6 +103,7 @@ const cancelSaveImage = () => {
|
|
|
}
|
|
|
const data = ref<{
|
|
|
name: string
|
|
|
+ userId: number
|
|
|
quantity: number
|
|
|
// 已获取的图片和未获取的图片
|
|
|
image: string
|
|
@@ -129,9 +130,17 @@ const setBadgesPath = (type: string) => {
|
|
|
url: `/pages-sub/home/offline-activity/index`,
|
|
|
})
|
|
|
} else if(type === '游学徽章' || type === '典藏勋章') {
|
|
|
- uni.switchTab({
|
|
|
- url: `/pages/home/index`,
|
|
|
- })
|
|
|
+ if(banners.value?.length > 0){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages-sub/home/study-tour/list?designStudyAbroadYear=${banners.value[0].designStudyAbroadYear}&designDesc=${banners.value[0].designDesc}`,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title:"暂无游学计划",
|
|
|
+ icon:"none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
uni.switchTab({
|
|
|
url: `/pages/home/index`,
|
|
@@ -151,12 +160,18 @@ const select = (item: any) => {
|
|
|
save()
|
|
|
}
|
|
|
}
|
|
|
-onLoad(async (query: { type: 'badge' | 'certificate'; data: string }) => {
|
|
|
+const { data: banners, run: setBanners } = useRequest(
|
|
|
+ () => getBanners({ mode: BannerMode.StudyTour }),
|
|
|
+ { initialData: [] },
|
|
|
+)
|
|
|
+onLoad(async (query: { type: 'badge' | 'certificate'; data: string; id: number }) => {
|
|
|
console.log(query, 'query2')
|
|
|
if (query.type === 'badge') {
|
|
|
const badge = JSON.parse(query.data) as Badge
|
|
|
+ console.log(badge)
|
|
|
data.value = {
|
|
|
name: badge.badgeName,
|
|
|
+ userId:query.id,
|
|
|
quantity: badge.quantity,
|
|
|
image: badge.badgeNotObtainedImage,
|
|
|
activedImage: badge.badgeYesObtainedImage,
|
|
@@ -164,9 +179,12 @@ onLoad(async (query: { type: 'badge' | 'certificate'; data: string }) => {
|
|
|
badgeDescription: badge.badgeDescription,
|
|
|
createTime: badge.createTime,
|
|
|
}
|
|
|
+ await setBanners()
|
|
|
if (data.value.quantity > 0) {
|
|
|
- await setData()
|
|
|
- posterUrl.value = await createPoster()
|
|
|
+ await setData();
|
|
|
+ if(data.value.userId == userInfo.value.userId){
|
|
|
+ posterUrl.value = await createPoster()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -226,20 +244,22 @@ onLoad(async (query: { type: 'badge' | 'certificate'; data: string }) => {
|
|
|
累计参与{{ data.quantity }}次
|
|
|
</div>
|
|
|
</div>
|
|
|
- <wd-button
|
|
|
- custom-class="w-[161px] h-12 bg-[#0cbe7c]! rounded-[30px]"
|
|
|
- @click="showActions"
|
|
|
- v-if="data.quantity > 0"
|
|
|
- >
|
|
|
- 去分享
|
|
|
- </wd-button>
|
|
|
- <wd-button
|
|
|
- custom-class="w-[161px] h-12 bg-[#0cbe7c]! rounded-[30px]"
|
|
|
- @click="setBadgesPath(data.badgeType)"
|
|
|
- v-else
|
|
|
- >
|
|
|
- 去获得
|
|
|
- </wd-button>
|
|
|
+ <template v-if="data.userId == userInfo.userId">
|
|
|
+ <wd-button
|
|
|
+ custom-class="w-[161px] h-12 bg-[#0cbe7c]! rounded-[30px]"
|
|
|
+ @click="showActions"
|
|
|
+ v-if="data.quantity > 0"
|
|
|
+ >
|
|
|
+ 去分享
|
|
|
+ </wd-button>
|
|
|
+ <wd-button
|
|
|
+ custom-class="w-[161px] h-12 bg-[#0cbe7c]! rounded-[30px]"
|
|
|
+ @click="setBadgesPath(data.badgeType)"
|
|
|
+ v-else
|
|
|
+ >
|
|
|
+ 去获得
|
|
|
+ </wd-button>
|
|
|
+ </template>
|
|
|
<canvas
|
|
|
class="w-[347px] h-[494px] absolute rounded-[20px] top--1000"
|
|
|
canvas-id="firstCanvas"
|