背景图设置
This commit is contained in:
@@ -9,7 +9,11 @@
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
import api from "@/api/index.js"
|
||||
import util from "@/utils"
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
if(uni.getStorageSync('userInfo')) {
|
||||
userInfo.value = JSON.parse( uni.getStorageSync('userInfo'))
|
||||
}
|
||||
// console.log(e)
|
||||
// a_info.value = JSON.parse(decodeURIComponent(e.info))
|
||||
if(!e.id) {
|
||||
@@ -24,6 +28,7 @@
|
||||
getDetail(e.id)
|
||||
})
|
||||
// 变量
|
||||
const userInfo = ref(null)
|
||||
// const content = ref(null)
|
||||
const a_info = ref(null)
|
||||
// 函数
|
||||
@@ -41,7 +46,27 @@
|
||||
}
|
||||
}
|
||||
async function starFunc(type) { // 点击收藏
|
||||
if(!userInfo.value) {
|
||||
store.afterFailLogin(2000)
|
||||
return
|
||||
}
|
||||
console.log(a_info.value)
|
||||
if(type) { // 添加收藏
|
||||
const res = await api.getArticleFavorite({
|
||||
wz_id:a_info.value.ID,
|
||||
userId:userInfo.value.userId,
|
||||
cover:a_info.value.cover_img,
|
||||
title:a_info.value.title,
|
||||
introductions:''
|
||||
},userInfo.value.userId)
|
||||
}
|
||||
else{ // 取消收藏
|
||||
const res = await api.delArticleFavorite({
|
||||
id:a_info.value.ID,
|
||||
},userInfo.value.userId)
|
||||
}
|
||||
a_info.value.isStar = type
|
||||
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@@ -57,7 +82,7 @@
|
||||
<view style="color: gray;">{{a_info?.reading_num}}</view>
|
||||
</view>
|
||||
<view class="ab-item">
|
||||
<uni-icons color="#26758d" @tap="starFunc(0)" v-if="a_info?.isStar" type="star-filled" size="30"></uni-icons>
|
||||
<uni-icons color="#26758d" @tap="starFunc(0)" v-if="a_info?.is_favorite" type="star-filled" size="30"></uni-icons>
|
||||
<uni-icons color="gray" @tap="starFunc(1)" v-else type="star" size="30"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
@@ -56,7 +56,7 @@
|
||||
}
|
||||
}
|
||||
function toDetail(item) {
|
||||
let info = encodeURIComponent(JSON.stringify(item))
|
||||
// let info = encodeURIComponent(JSON.stringify(item))
|
||||
// console.log(info)
|
||||
uni.navigateTo({
|
||||
url:"./detail?id="+item.ID
|
||||
|
Reference in New Issue
Block a user