|
@@ -6,7 +6,7 @@
|
|
|
<top topType="2" @upBack="upBack"></top>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
|
|
|
- <info :form="form"></info>
|
|
|
+ <info :form="form" @zanBtn="zanBtn"></info>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -18,6 +18,7 @@ import info from './parts/info.vue';
|
|
|
import top from '@/layout/common/top.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: mapRefute } = createNamespacedHelpers('refute');
|
|
|
+const { mapActions: mapThumbs } = createNamespacedHelpers('thumbs');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -28,15 +29,7 @@ export default {
|
|
|
data: function() {
|
|
|
return {
|
|
|
clientHeight: '',
|
|
|
- form: {
|
|
|
- // title: '全国七万硕士在送外卖?别被贩卖焦虑的自媒体忽悠',
|
|
|
- // origin: '系统管理员',
|
|
|
- // renew_time: '2021-03-25 10:00:00',
|
|
|
- // fileUrl: '',
|
|
|
- // website: 'http://broadcast.waityou24.cn/platlive/home.html',
|
|
|
- // zan: true,
|
|
|
- // content: '信息内容',
|
|
|
- },
|
|
|
+ form: {},
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
@@ -48,6 +41,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapRefute(['fetch']),
|
|
|
+ ...mapThumbs(['create']),
|
|
|
async search() {
|
|
|
if (this.id) {
|
|
|
let res = await this.fetch(this.id);
|
|
@@ -60,6 +54,19 @@ export default {
|
|
|
upBack() {
|
|
|
this.$router.push({ path: '/refute/index' });
|
|
|
},
|
|
|
+ // 点赞
|
|
|
+ async zanBtn() {
|
|
|
+ let data = {
|
|
|
+ openid: this.user.openid,
|
|
|
+ type: '0',
|
|
|
+ article_id: this.form.id,
|
|
|
+ };
|
|
|
+ let res = await this.create(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$toast({ type: 'success', message: this.form.thumbs ? '取消点赞' : '点赞成功' });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|