volunteer-secondary/src/pages-sub/me/wishlist.vue

97 lines
3.8 KiB
Vue

<script lang="ts" setup>
import { deleteWishlist, getWishlist } from '@/service';
import { useWishlistStore } from "@/store"
definePage({
style: {
navigationBarTitleText: '我的志愿表',
},
})
const wishlistStore = useWishlistStore()
const wishlist = ref([])
const handleDeleteWishlist = (val,index) => {
uni.showModal({
title: "确认需要删除吗?", success: ({confirm,cancel}) => {
if(confirm){
deleteWishlist({data:{id:val.id}})
wishlist.value.splice(index,1)
}
}, fail: () => {
}
})
}
const getTag = (val) => {
let content = JSON.parse(val.contents)
let schools = content.schools
let zbsTag = schools.some(item => item.type === '指标生')
let adjustTag = content.adjust
return zbsTag ? "指标生" : adjustTag ? "服从调剂" : false
}
const navigateToDetail = (val) => {
let content = JSON.parse(val.contents)
wishlistStore.setExtendWishlist({title:val.title,contents:val.contents,adjust:content.adjust,batchName:val.batchName})
uni.navigateTo({url:"/pages-sub/me/wishlistInfo"})
}
onShow(() => {
getWishlist().then(resp => {
if (resp.code === 200) {
wishlist.value = resp.result
}
})
})
</script>
<template>
<view class="bg-[#F8F8F8] h-screen px-[30rpx] overflow-hidden">
<view v-for="(val, index) in wishlist" :key="index" class="flex first:mt-[30rpx]" v-if="wishlist.length > 0" @click="navigateToDetail(val)">
<view
class="text-[30rpx] text-[#333] grid gap-[8rpx] bg-white px-[30rpx] py-[20rpx] not-last:mb-[30rpx] rounded-[16rpx] w-full">
<view class="text-[32rpx] font-600">{{ val.title }}</view>
<view
class="text-[24rpx] text-[#333] bg-[url(https://lwzk.ycymedu.com/img/qt/wd_jianbian.png)] bg-no-repeat bg-origin-border bg-left px-[12rpx]">
{{ val.totalScore }} · {{ val.batchName }}</view>
<view class="flex items-center justify-between">
<view class="text-[#666] text-[24rpx]">
{{ val.createTime }}
</view>
<view class="flex items-center" @click.stop="handleDeleteWishlist(val,index)">
<view class="w-[32rpx] h-[32rpx] flex items-center">
<image src="https://lwzk.ycymedu.com/img/qt/wd_shanchu.png"
class="w-[32rpx] h-[32rpx]" />
</view>
<view class="text-[#999] text-[26rpx]">删除</view>
</view>
</view>
</view>
<view class="w-[86rpx] h-[56rpx] ml-[-76rpx] mt-[26rpx]">
<image src="https://lwzk.ycymedu.com/img/tianbao/tb_zhibiao.png" mode="scaleToFill"
class="w-[86rpx] h-[56rpx]" v-if="getTag(val) === '指标生'" />
<image src="https://lwzk.ycymedu.com/img/qt/wd_tiaoji.png" mode="scaleToFill"
class="w-[86rpx] h-[56rpx]" v-if="getTag(val) === '服从调剂'" />
</view>
</view>
<view class="flex flex-col items-center justify-center pt-[322rpx]" v-else>
<view class="w-[414rpx] h-[298rpx]">
<image src="https://lwzk.ycymedu.com/img/qt/wd_moren.png" mode="scaleToFill"
class="w-[414rpx] h-[298rpx]" />
</view>
<view class="text-[#636363] text-[24rpx]">暂无数据</view>
<view class="w-full mt-[70rpx]">
<view class="pb-safe px-[94rpx] py-[16rpx]">
<button class="rounded-full bg-[#1580FF] text-[#fff] "></button>
</view>
</view>
</view>
</view>
</template>
<style lang="scss" scoped></style>