|
|
@@ -0,0 +1,211 @@
|
|
|
+<!-- -->
|
|
|
+<template>
|
|
|
+ <div class="messageM">
|
|
|
+ <div class="top">
|
|
|
+ <h3>留言板</h3>
|
|
|
+ <p>已有 {{ total }} 条留言</p>
|
|
|
+ </div>
|
|
|
+ <!-- 内容 -->
|
|
|
+ <div class="conten">
|
|
|
+ <div class="row" v-for="item in data" :key="item.id">
|
|
|
+ <div class="left">
|
|
|
+ <img src="../../assets/imgAdd/touxiang.png" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <p>
|
|
|
+ {{ item.creatorName }} <span>{{ item.createTime }}</span>
|
|
|
+ </p>
|
|
|
+ <div class="txt">{{ item.content }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 文本域和按钮 -->
|
|
|
+ <div class="bottmInp">
|
|
|
+ <div class="texe">
|
|
|
+ <el-input
|
|
|
+ maxlength="100"
|
|
|
+ show-word-limit
|
|
|
+ resize="none"
|
|
|
+ type="textarea"
|
|
|
+ :rows="3"
|
|
|
+ placeholder="请输入留言..."
|
|
|
+ v-model="textarea"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <div class="button">
|
|
|
+ <div class="button_left">
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ placeholder="请填写您的姓名"
|
|
|
+ v-model="name"
|
|
|
+ maxlength="8"
|
|
|
+ show-word-limit
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <div class="button_right">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="commentSave"
|
|
|
+ >提 交</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { commentSave, commentWebList } from '@/apis/tab7'
|
|
|
+export default {
|
|
|
+ name: 'messageM',
|
|
|
+ components: {},
|
|
|
+ data () {
|
|
|
+ // 这里存放数据
|
|
|
+ return {
|
|
|
+ textarea: '',
|
|
|
+ name: '',
|
|
|
+ data: [],
|
|
|
+ total: 0,
|
|
|
+ formData: {
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 99999,
|
|
|
+ searchKey: '',
|
|
|
+ status: 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听属性 类似于data概念
|
|
|
+ computed: {},
|
|
|
+ // 监控data中的数据变化
|
|
|
+ watch: {},
|
|
|
+ // 方法集合
|
|
|
+ methods: {
|
|
|
+ // 点击提交留言
|
|
|
+ async commentSave () {
|
|
|
+ if (this.textarea.trim() === '') return this.$message.warning('内容不能为空!')
|
|
|
+ if (this.name.trim() === '') return this.$message.warning('名字不能为空!')
|
|
|
+ const res = await commentSave({ content: this.textarea, creatorName: this.name })
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.textarea = this.name = ''
|
|
|
+ this.$message.success('提交成功,等待审核.')
|
|
|
+ } else this.$message.warning(res.msg)
|
|
|
+ },
|
|
|
+ // 封装获取列表的方法
|
|
|
+ async commentWebList (data) {
|
|
|
+ const res = await commentWebList(data)
|
|
|
+ this.total = res.data.total
|
|
|
+ this.data = res.data.records
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created () {
|
|
|
+ this.commentWebList(this.formData)
|
|
|
+ },
|
|
|
+ // 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted () {},
|
|
|
+ beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
+ beforeMount () {}, // 生命周期 - 挂载之前
|
|
|
+ beforeUpdate () {}, // 生命周期 - 更新之前
|
|
|
+ updated () {}, // 生命周期 - 更新之后
|
|
|
+ beforeDestroy () {}, // 生命周期 - 销毁之前
|
|
|
+ destroyed () {}, // 生命周期 - 销毁完成
|
|
|
+ activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang='less' scoped>
|
|
|
+.messageM {
|
|
|
+ background: url("../../assets/imgAdd/mesBac.png");
|
|
|
+ padding: 24px;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
+ /deep/::-webkit-scrollbar {
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ color: transparent;
|
|
|
+ }
|
|
|
+ .top {
|
|
|
+ & > h3 {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ & > p {
|
|
|
+ margin-top: 5px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #a19d97;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .conten {
|
|
|
+ height: calc(100vh - 230px);
|
|
|
+ overflow-y: auto;
|
|
|
+ .row {
|
|
|
+ border-bottom: 2px dashed #fff;
|
|
|
+ padding: 15px 0;
|
|
|
+ display: flex;
|
|
|
+ .left {
|
|
|
+ width: 46px;
|
|
|
+ height: 46px;
|
|
|
+ margin-right: 15px;
|
|
|
+ & > img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ & > p {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ font-size: 16px;
|
|
|
+ align-items: center;
|
|
|
+ & > span {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #a19d97;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .txt {
|
|
|
+ margin-top: 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bottmInp {
|
|
|
+ padding: 10px 0;
|
|
|
+ /deep/.el-textarea__inner:focus {
|
|
|
+ border-color: #b9412e;
|
|
|
+ }
|
|
|
+ /deep/.el-textarea__inner {
|
|
|
+ background-color: rgba(255, 255, 255, 0.3);
|
|
|
+ }
|
|
|
+ /deep/.el-input__inner {
|
|
|
+ background-color: rgba(255, 255, 255, 0.3);
|
|
|
+ }
|
|
|
+ /deep/.el-textarea .el-input__count {
|
|
|
+ background-color: transparent;
|
|
|
+ color: #878787;
|
|
|
+ }
|
|
|
+ /deep/.el-input__count-inner {
|
|
|
+ background-color: transparent;
|
|
|
+ color: #878787;
|
|
|
+ }
|
|
|
+ .button {
|
|
|
+ margin-top: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .button_left{
|
|
|
+ width: 75vh;
|
|
|
+ margin-right: 5vh;
|
|
|
+ }
|
|
|
+ .button_right{
|
|
|
+ width: 20vh;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|