|
@@ -5,9 +5,6 @@
|
|
|
<div class="w_1200">
|
|
|
<el-col :span="24" class="one">
|
|
|
<el-row :span="24" class="list">
|
|
|
- <div class="join" :class="[info.match_status == '0' ? 'join0' : 'join1']">
|
|
|
- {{ getDict(info.match_status, 'status') }}
|
|
|
- </div>
|
|
|
<el-col :span="4" class="left">
|
|
|
<el-image
|
|
|
v-if="info.file && info.file.length > 0"
|
|
@@ -17,7 +14,10 @@
|
|
|
/>
|
|
|
<el-image v-else class="image" :src="news" fit="fill" />
|
|
|
</el-col>
|
|
|
- <el-col :span="20" class="right">
|
|
|
+ <el-col :span="18" class="right">
|
|
|
+ <div class="join" :class="[info.match_status == '0' ? 'join0' : 'join1']">
|
|
|
+ {{ getDict(info.match_status, 'status') }}
|
|
|
+ </div>
|
|
|
<el-col :span="24" class="right_1">
|
|
|
<span class="type">{{ getDict(info.form, 'form') }}</span>
|
|
|
<span class="title">{{ info.name || '暂无比赛名称' }}</span>
|
|
@@ -37,6 +37,14 @@
|
|
|
<el-tag type="primary">{{ getDict(info.type, 'type') }}</el-tag>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
+ <el-col :span="2" class="file" @click="toCollection(0)" v-if="info.is_collection">
|
|
|
+ <el-icon :size="16"><StarFilled /></el-icon>
|
|
|
+ <span>已收藏</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="2" class="file" @click="toCollection(1)" v-else>
|
|
|
+ <el-icon :size="16"><Star /></el-icon>
|
|
|
+ <span>收藏</span>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two">
|
|
@@ -142,10 +150,12 @@ import { UserStore } from '@/store/user'
|
|
|
const userStore = UserStore()
|
|
|
const user = computed(() => userStore.user)
|
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
+import { CollectionStore } from '@/store/api/platform/collection'
|
|
|
import { MatchStore } from '@/store/api/platform/match'
|
|
|
import { SignStore } from '@/store/api/platform/sign'
|
|
|
const store = MatchStore()
|
|
|
const signStore = SignStore()
|
|
|
+const collectionStore = CollectionStore()
|
|
|
const dictDataStore = DictDataStore()
|
|
|
// 图片引入
|
|
|
import news from '@/assets/news.png'
|
|
@@ -245,7 +255,7 @@ const searchMatch = async () => {
|
|
|
const search = async () => {
|
|
|
let id = route.query.id
|
|
|
if (id) {
|
|
|
- let res = await store.fetch(id)
|
|
|
+ let res = await store.detail(id)
|
|
|
if (res.errcode == '0') {
|
|
|
info.value = res.data
|
|
|
rulesInfo.value = { title: '大赛背景', key: 'rules1', content: res.data.rules.rules1 }
|
|
@@ -264,7 +274,7 @@ const getDict = (data, model) => {
|
|
|
const getTime = (data) => {
|
|
|
if (data) return `${data[0]} - ${data[1]}`
|
|
|
}
|
|
|
-const selectOpen = (key, keyPath) => {
|
|
|
+const selectOpen = (key) => {
|
|
|
const res = menuList.value.find((f) => f.label == key)
|
|
|
if (res) {
|
|
|
rulesInfo.value = { title: get(res, 'title'), key, content: get(info.value.rules, key) }
|
|
@@ -282,6 +292,38 @@ const toClose = () => {
|
|
|
dialog.value = false
|
|
|
form.value = {}
|
|
|
}
|
|
|
+// 收藏
|
|
|
+const toCollection = async (status) => {
|
|
|
+ if (user.value._id) {
|
|
|
+ let res
|
|
|
+ let message
|
|
|
+ const data = {
|
|
|
+ user: user.value._id,
|
|
|
+ source: info.value._id,
|
|
|
+ type: 'match',
|
|
|
+ time: moment().format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ if (status == '1') {
|
|
|
+ message = '收藏成功'
|
|
|
+ res = await collectionStore.create(data)
|
|
|
+ } else {
|
|
|
+ message = '取消收藏成功'
|
|
|
+ res = await collectionStore.cancel(data)
|
|
|
+ }
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ await search()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: '未登录无法进行收藏 请登录',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
// 报名
|
|
|
const submitForm = async (formEl) => {
|
|
|
if (!formEl) return
|
|
@@ -407,6 +449,17 @@ provide('submitForm', submitForm)
|
|
|
border-top: 1px solid #f3f3f3;
|
|
|
}
|
|
|
}
|
|
|
+ .file {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-family: PingFangSC-Regular;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #2374ff;
|
|
|
+ span {
|
|
|
+ margin: 0 0 0 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
.join {
|
|
|
position: absolute;
|
|
|
right: -23px;
|