|
@@ -6,9 +6,13 @@
|
|
|
<el-col :span="24" class="one">
|
|
|
<el-row :span="24" class="one_1">
|
|
|
<el-col :span="20" class="title">{{ info.name || '暂无标题' }}</el-col>
|
|
|
- <el-col :span="4" class="file" @click="toCollection" v-if="info.status == '1'">
|
|
|
- <el-icon><Star /></el-icon>
|
|
|
- 收藏
|
|
|
+ <el-col :span="4" class="file" @click="toCollection(0)" v-if="info.is_collection">
|
|
|
+ <el-icon :size="16"><StarFilled /></el-icon>
|
|
|
+ <span>已收藏</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" class="file" @click="toCollection(1)" v-else>
|
|
|
+ <el-icon :size="16"><Star /></el-icon>
|
|
|
+ <span>收藏</span>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
@@ -55,11 +59,11 @@
|
|
|
<el-row :span="24" class="thr_2">
|
|
|
<el-col :span="17" class="left">
|
|
|
<el-col :span="24" class="name">
|
|
|
- {{ unit.name || '暂无' }}
|
|
|
+ {{ userInfo.name || '暂无单位' }}
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="other">
|
|
|
<span>联系人</span>
|
|
|
- {{ unit.contacts || '暂无' }}
|
|
|
+ {{ userInfo.name || '暂无联系人' }}
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
<el-col :span="4" class="right" v-if="info.status == '1'">
|
|
@@ -131,14 +135,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import moment from 'moment'
|
|
|
// 基础
|
|
|
import { MessageOutlined } from '@ant-design/icons-vue'
|
|
|
import { get } from 'lodash-es'
|
|
|
const $checkRes = inject('$checkRes')
|
|
|
// 接口
|
|
|
import { ProjectStore } from '@/store/api/platform/project'
|
|
|
+import { CollectionStore } from '@/store/api/platform/collection'
|
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
const store = ProjectStore()
|
|
|
+const collectionStore = CollectionStore()
|
|
|
const dictDataStore = DictDataStore()
|
|
|
import { UserStore } from '@/store/user'
|
|
|
const userStore = UserStore()
|
|
@@ -149,7 +156,7 @@ const router = useRouter()
|
|
|
// 加载中
|
|
|
const loading = ref(false)
|
|
|
const info = ref({})
|
|
|
-const unit = ref({ name: '吉林大学', contacts: '陈老师' })
|
|
|
+const userInfo = ref({})
|
|
|
// 字典表
|
|
|
const fieldList = ref([])
|
|
|
const typeList = ref([])
|
|
@@ -172,8 +179,11 @@ onMounted(async () => {
|
|
|
const search = async () => {
|
|
|
let id = route.query.id
|
|
|
if (id) {
|
|
|
- let res = await store.fetch(id)
|
|
|
- if (res.errcode == '0') info.value = res.data
|
|
|
+ let res = await store.detail(id)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ info.value = res.data
|
|
|
+ userInfo.value = res.data.userInfo
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
const searchAchieve = async (query = { skip: 0, limit }) => {
|
|
@@ -231,8 +241,36 @@ const toDocking = () => {
|
|
|
console.log('我要对接')
|
|
|
}
|
|
|
// 收藏
|
|
|
-const toCollection = () => {
|
|
|
- console.log('收藏')
|
|
|
+const toCollection = async (status) => {
|
|
|
+ if (user.value._id) {
|
|
|
+ let res
|
|
|
+ let message
|
|
|
+ const data = {
|
|
|
+ user: user.value._id,
|
|
|
+ source: info.value._id,
|
|
|
+ type: 'project',
|
|
|
+ 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 toView = (item) => {
|
|
@@ -272,11 +310,13 @@ const sizeChange = (limits) => {
|
|
|
.file {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- justify-content: end;
|
|
|
+ justify-content: flex-end;
|
|
|
font-family: PingFangSC-Regular;
|
|
|
font-size: 14px;
|
|
|
color: #2374ff;
|
|
|
- text-align: right;
|
|
|
+ span {
|
|
|
+ margin: 0 0 0 5px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|