This commit is contained in:
xulu
2022-03-10 17:34:35 +08:00
parent 4f5e6e1f78
commit a2a8a06ff6
44 changed files with 9609 additions and 969 deletions

View File

@@ -0,0 +1,97 @@
<!--对话模块-->
<template>
<div class="kuang_communtion">
<h2>
Communication
</h2>
<div v-for="(item, index) in talkMsgs" class="kuang_communtion_conmt">
<div v-if="item.username != username" class="talk_aued">
<p>
Author :
</p>
<el-card>
<p>{{ item.ad_content }}</p>
</el-card>
<b>{{formatDate(item.ad_ctime)}}</b>
</div>
<div v-if="item.username == username" class="talk_aued talk_edit">
<p>
Editor :
</p>
<el-card>
<p>{{ item.ad_content }}</p>
</el-card>
<b>{{formatDate(item.ad_ctime)}}</b>
</div>
</div>
<div class="kuang_communtion_input">
<p v-if="talkMsgs"></p>
<el-input type="textarea" rows="3" v-model="msgform.ad_content" placeholder="Editor messages" resize="none"></el-input>
<div class="kuang_communtion_input_text">
Dear Editor, through this window, you can have informal communication with the author. Please be aware of the
prompt reply, standard use of English, and no offensive, insulting, discriminatory language.
<el-button type="primary" @click="saveMsg">Send</el-button>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
props: {
talkMsgs: {
type: Array,
required: true
},
msgform: {
type: Object,
required: true
},
// loading: {
// type: Boolean,
// required: true
// }
},
components: {},
data() {
return {
username: localStorage.getItem('U_name'),
}
},
computed: {},
methods: {
formatDate(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + ' ' + h + ':' + m + ':' + s;
},
// 留言弹出框
saveMsg() {
console.log(this.msgform)
if (this.msgform.ad_content == '') {
this.$message.error('Please input messages');
return false;
}
this.loading = true;
this.$api.post('api/Article/pushArticleDialog', this.msgform)
.then((res) => {
this.loading = false;
this.$message.success('Sent successfully');
this.$router.go(0);
});
},
}
}
</script>
<style scoped>
</style>