licailing пре 3 година
родитељ
комит
04bca68ab2

+ 62 - 0
src/main/java/com/izouma/nineth/domain/Message.java

@@ -0,0 +1,62 @@
+package com.izouma.nineth.domain;
+
+import com.izouma.nineth.annotations.Searchable;
+import com.izouma.nineth.converter.StringArrayConverter;
+import com.izouma.nineth.dto.MessageDTO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@ApiModel("留言")
+public class Message extends BaseEntity {
+
+    @ApiModelProperty("用户ID")
+    private Long userId;
+
+    @Searchable
+    @ApiModelProperty("昵称")
+    private String nickname;
+
+//    @Searchable
+//    @ApiModelProperty("手机号")
+//    private String phone;
+
+    private String type;
+
+    @ApiModelProperty("详情")
+    private String detail;
+
+    @ApiModelProperty("图片")
+    @Column(columnDefinition = "TEXT")
+    @Convert(converter = StringArrayConverter.class)
+    private List<String> pic;
+
+    @ApiModelProperty("是否回复")
+    private boolean reply;
+
+    @Column(columnDefinition = "TEXT")
+    @ApiModelProperty("回复详情")
+    private String replyDetail;
+
+    @ApiModelProperty("回复时间")
+    private LocalDateTime repliedAt;
+
+    public Message(MessageDTO dto) {
+        BeanUtils.copyProperties(dto, this);
+    }
+}

+ 6 - 0
src/main/java/com/izouma/nineth/domain/Showroom.java

@@ -75,4 +75,10 @@ public class Showroom extends BaseEntity {
     @Transient
     private boolean liked;
 
+    private int views;
+
+    private int buys;
+
+    private int registers;
+
 }

+ 26 - 0
src/main/java/com/izouma/nineth/domain/ViewInfo.java

@@ -0,0 +1,26 @@
+package com.izouma.nineth.domain;
+
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+@Data
+@Entity
+@Table(name = "view_info", indexes =
+        {@Index(columnList = "userId"), @Index(columnList = "showroomId")})
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("浏览")
+public class ViewInfo extends BaseEntity {
+
+    private Long userId;
+
+    private Long showroomId;
+}

+ 25 - 0
src/main/java/com/izouma/nineth/dto/MessageDTO.java

@@ -0,0 +1,25 @@
+package com.izouma.nineth.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@ApiModel("留言")
+public class MessageDTO {
+
+    @ApiModelProperty("详情")
+    private String detail;
+
+    @ApiModelProperty("图片")
+    private List<String> pic;
+
+}

+ 16 - 0
src/main/java/com/izouma/nineth/repo/MessageRepo.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.Message;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface MessageRepo extends JpaRepository<Message, Long>, JpaSpecificationExecutor<Message> {
+    @Query("update Message t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+}

+ 6 - 0
src/main/java/com/izouma/nineth/repo/ShowroomRepo.java

@@ -36,4 +36,10 @@ public interface ShowroomRepo extends JpaRepository<Showroom, Long>, JpaSpecific
     @Cacheable(value = "showroom", key = "#id")
     Optional<Showroom> findById(@Nonnull Long id);
 
+    @Query("update Showroom t set t.views = t.views + ?2 where t.id = ?1")
+    @Modifying
+    @Transactional
+    void addView(Long id, int num);
+
+
 }

+ 13 - 0
src/main/java/com/izouma/nineth/repo/ViewInfoRepo.java

@@ -0,0 +1,13 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.ViewInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.util.List;
+
+public interface ViewInfoRepo extends JpaRepository<ViewInfo, Long>, JpaSpecificationExecutor<ViewInfo> {
+
+    List<ViewInfo> findByUserIdAndShowroomId(Long userId, Long showroomId);
+
+}

+ 10 - 0
src/main/java/com/izouma/nineth/service/CacheService.java

@@ -108,4 +108,14 @@ public class CacheService {
     @CacheEvict(value = "priceList", allEntries = true)
     public void clearPriceList() {
     }
+
+    @CacheEvict(value = "news", key = "#id")
+    public void clearNews(Long id) {
+    }
+
+    @Scheduled(cron = "0 0 0 * * ?")
+    @CacheEvict(value = "fixedTop", allEntries = true)
+    public void clearFixedTop() {
+    }
+
 }

+ 20 - 0
src/main/java/com/izouma/nineth/service/MessageService.java

@@ -0,0 +1,20 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.domain.Message;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.repo.MessageRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class MessageService {
+
+    private MessageRepo messageRepo;
+
+    public Page<Message> all(PageQuery pageQuery) {
+        return messageRepo.findAll(JpaUtils.toSpecification(pageQuery, Message.class), JpaUtils.toPageRequest(pageQuery));
+    }
+}

+ 0 - 2
src/main/java/com/izouma/nineth/web/AuthenticationController.java

@@ -5,7 +5,6 @@ import com.izouma.nineth.enums.AuthorityName;
 import com.izouma.nineth.exception.AuthenticationException;
 import com.izouma.nineth.security.JwtTokenUtil;
 import com.izouma.nineth.security.JwtUserFactory;
-import com.izouma.nineth.service.CaptchaService;
 import com.izouma.nineth.service.UserService;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -27,7 +26,6 @@ public class AuthenticationController {
     private final AuthenticationManager authenticationManager;
     private final JwtTokenUtil          jwtTokenUtil;
     private final UserService           userService;
-    private final CaptchaService        captchaService;
 
     @PostMapping("/login")
     public String loginByUserPwd(String username, String password, Integer expiration) {

+ 87 - 0
src/main/java/com/izouma/nineth/web/MessageController.java

@@ -0,0 +1,87 @@
+package com.izouma.nineth.web;
+
+import com.izouma.nineth.domain.Message;
+import com.izouma.nineth.domain.User;
+import com.izouma.nineth.dto.MessageDTO;
+import com.izouma.nineth.service.MessageService;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.MessageRepo;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.SecurityUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@RestController
+@RequestMapping("/message")
+@AllArgsConstructor
+public class MessageController extends BaseController {
+    private MessageService messageService;
+    private MessageRepo    messageRepo;
+
+    @PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public Message save(@RequestBody Message record) {
+        if (record.getId() != null) {
+            Message orig = messageRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            orig.setReply(true);
+            orig.setRepliedAt(LocalDateTime.now());
+            return messageRepo.save(orig);
+        }
+        return messageRepo.save(record);
+    }
+
+    @ApiOperation("管理员用")
+    @PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<Message> all(@RequestBody PageQuery pageQuery) {
+        return messageService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public Message get(@PathVariable Long id) {
+        return messageRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        messageRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<Message> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+
+    @ApiOperation("用户用")
+    @PostMapping("/my")
+    public Page<Message> my(@RequestBody PageQuery pageQuery) {
+        pageQuery.getQuery().put("userId", SecurityUtils.getAuthenticatedUser().getId());
+        return messageService.all(pageQuery);
+    }
+
+    @ApiOperation("用户提交留言")
+    @PostMapping("/create")
+    public Message create(@RequestBody MessageDTO record) {
+        Message message = new Message(record);
+
+        User user = SecurityUtils.getAuthenticatedUser();
+        message.setUserId(user.getId());
+        message.setNickname(user.getNickname());
+//        message.setPhone(user.getPhone());
+        return messageRepo.save(message);
+    }
+}
+

+ 8 - 2
src/main/java/com/izouma/nineth/web/NewsController.java

@@ -5,6 +5,7 @@ import com.izouma.nineth.domain.News;
 import com.izouma.nineth.domain.NewsLike;
 import com.izouma.nineth.domain.User;
 import com.izouma.nineth.repo.NewsLikeRepo;
+import com.izouma.nineth.service.CacheService;
 import com.izouma.nineth.service.NewsService;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
@@ -29,6 +30,7 @@ public class NewsController extends BaseController {
     private NewsService  newsService;
     private NewsRepo     newsRepo;
     private NewsLikeRepo newsLikeRepo;
+    private CacheService cacheService;
 
     @PreAuthorize("hasAnyRole('ADMIN','NEWS')")
     @PostMapping("/save")
@@ -36,9 +38,13 @@ public class NewsController extends BaseController {
         if (record.getId() != null) {
             News orig = newsRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
             ObjUtils.merge(orig, record);
-            return newsRepo.save(orig);
+            orig = newsRepo.save(orig);
+            cacheService.clearNews(orig.getId());
+            return orig;
         }
-        return newsRepo.save(record);
+        record = newsRepo.save(record);
+        cacheService.clearNews(record.getId());
+        return record;
     }
 
 

+ 22 - 8
src/main/java/com/izouma/nineth/web/ShowroomController.java

@@ -1,18 +1,12 @@
 package com.izouma.nineth.web;
 
 import cn.hutool.core.collection.CollUtil;
+import com.izouma.nineth.domain.*;
 import com.izouma.nineth.domain.Collection;
-import com.izouma.nineth.domain.NewsLike;
-import com.izouma.nineth.domain.ShowCollection;
-import com.izouma.nineth.domain.Showroom;
-import com.izouma.nineth.domain.User;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.enums.AuthStatus;
 import com.izouma.nineth.exception.BusinessException;
-import com.izouma.nineth.repo.CollectionRepo;
-import com.izouma.nineth.repo.NewsLikeRepo;
-import com.izouma.nineth.repo.ShowCollectionRepo;
-import com.izouma.nineth.repo.ShowroomRepo;
+import com.izouma.nineth.repo.*;
 import com.izouma.nineth.service.ShowroomService;
 import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
@@ -36,6 +30,7 @@ public class ShowroomController extends BaseController {
     private ShowCollectionRepo showCollectionRepo;
     private NewsLikeRepo       newsLikeRepo;
     private CollectionRepo     collectionRepo;
+    private ViewInfoRepo       viewInfoRepo;
 
     @PostMapping("/save")
     public Showroom save(@RequestBody Showroom record) {
@@ -137,6 +132,25 @@ public class ShowroomController extends BaseController {
         showroomRepo.addShare(id, 1);
     }
 
+    //加浏览
+    @GetMapping("/{id}/view")
+    public void addView(@PathVariable Long id) {
+        //增加浏览量
+        Long userId = SecurityUtils.getAuthenticatedUser().getId();
+
+        if (ObjectUtils.isEmpty(userId)) {
+            return;
+        }
+        List<ViewInfo> list = viewInfoRepo.findByUserIdAndShowroomId(userId, id);
+        if (!list.isEmpty()) return;
+        viewInfoRepo.save(ViewInfo.builder()
+                .userId(userId)
+                .showroomId(id)
+                .build());
+        showroomRepo.addLike(id, 1);
+    }
+
+
     @PostMapping("/pass")
     public void pass(@RequestParam Long id) {
         showroomService.audit(id, AuthStatus.SUCCESS, null);

+ 7 - 0
src/main/java/com/izouma/nineth/web/StatisticController.java

@@ -103,4 +103,11 @@ public class StatisticController {
     public void clearUser() {
         cacheService.clearUser();
     }
+
+    @GetMapping("/fixedTop")
+    @Cacheable("fixedTop")
+    public String fixedTop() {
+        LocalDateTime start = LocalDateTime.of(2022, 5, 30, 20, 0, 0);
+        return statisticService.top(start, LocalDateTime.now(), 50);
+    }
 }

+ 1 - 0
src/main/resources/genjson/Message.json

@@ -0,0 +1 @@
+{"tableName":"Message","className":"Message","remark":"留言","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/sunnianwen/Desktop/project/raex_back/src/main/java/com/izouma/nineth","viewPath":"/Users/sunnianwen/Desktop/project/raex_back/src/main/vue/src/views","routerPath":"/Users/sunnianwen/Desktop/project/raex_back/src/main/vue/src","resourcesPath":"/Users/sunnianwen/Desktop/project/raex_back/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"userId","modelName":"userId","remark":"用户ID","showInList":true,"showInForm":true,"formType":"number"},{"name":"nickname","modelName":"nickname","remark":"昵称","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"phone","modelName":"phone","remark":"手机号","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"detail","modelName":"detail","remark":"详情","showInList":true,"showInForm":true,"formType":"textarea"},{"name":"pic","modelName":"pic","remark":"图片","showInList":true,"showInForm":true,"formType":"multiImage"},{"name":"reply","modelName":"reply","remark":"是否回复","showInList":true,"showInForm":true,"formType":"switch"},{"name":"replyDetail","modelName":"replyDetail","remark":"回复详情","showInList":true,"showInForm":true,"formType":"textarea"},{"name":"repliedAt","modelName":"repliedAt","remark":"回复时间","showInList":true,"showInForm":true,"formType":"datetime"}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.nineth","tablePackage":"com.izouma.nineth.domain.Message"}

+ 16 - 0
src/main/vue/src/router.js

@@ -739,6 +739,22 @@ const router = new Router({
                     meta: {
                        title: 'pricelist',
                     },
+               },
+                {
+                    path: '/messageEdit',
+                    name: 'MessageEdit',
+                    component: () => import(/* webpackChunkName: "messageEdit" */ '@/views/MessageEdit.vue'),
+                    meta: {
+                       title: '留言编辑',
+                    },
+                },
+                {
+                    path: '/messageList',
+                    name: 'MessageList',
+                    component: () => import(/* webpackChunkName: "messageList" */ '@/views/MessageList.vue'),
+                    meta: {
+                       title: '留言',
+                    },
                }
                 /**INSERT_LOCATION**/
             ]

+ 151 - 0
src/main/vue/src/views/MessageEdit.vue

@@ -0,0 +1,151 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                删除
+            </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form
+                    :model="formData"
+                    :rules="rules"
+                    ref="form"
+                    label-width="80px"
+                    label-position="right"
+                    size="small"
+                    style="max-width: 600px;"
+                >
+                    <el-form-item prop="userId" label="用户信息">
+                        <el-input-number type="number" v-model="formData.userId" disabled></el-input-number>
+                        <el-input
+                            v-model="formData.nickname"
+                            disabled
+                            style="margin-left: 6px; width: 180px"
+                        ></el-input>
+                        <!-- <el-input v-model="formData.phone" disabled style="margin-left: 6px; width: 180px"></el-input> -->
+                    </el-form-item>
+                    <el-form-item prop="detail" label="详情">
+                        <el-input type="textarea" :rows="6" v-model="formData.detail" disabled></el-input>
+                    </el-form-item>
+                    <el-form-item prop="pic" label="图片">
+                        <!-- <multi-upload v-model="formData.pic"></multi-upload> -->
+                        <el-image
+                            v-for="item in formData.pic"
+                            :key="item"
+                            :src="item"
+                            style="width: 100px; height: 100px"
+                            :preview-src-list="formData.pic"
+                        />
+                    </el-form-item>
+                    <!-- <el-form-item prop="reply" label="是否回复">
+                        <el-switch v-model="formData.reply"></el-switch>
+                    </el-form-item> -->
+                    <el-form-item prop="replyDetail" label="回复详情">
+                        <el-input type="textarea" :rows="6" v-model="formData.replyDetail"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="repliedAt" label="回复时间" v-if="formData.reply">
+                        <el-date-picker
+                            v-model="formData.repliedAt"
+                            type="datetime"
+                            value-format="yyyy-MM-dd HH:mm:ss"
+                            placeholder="选择日期时间"
+                        >
+                        </el-date-picker>
+                    </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary">
+                            保存
+                        </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    name: 'MessageEdit',
+    created() {
+        if (this.$route.query.id) {
+            this.$http
+                .get('message/get/' + this.$route.query.id)
+                .then(res => {
+                    this.formData = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {},
+            rules: {}
+        };
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            let data = { ...this.formData };
+
+            this.saving = true;
+            this.$http
+                .post('/message/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.$message.error(e.error);
+                });
+        },
+        onDelete() {
+            this.$confirm('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/message/del/${this.formData.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+/deep/.el-input.is-disabled .el-input__inner {
+    color: #7c7e7e;
+}
+/deep/.el-radio__input.is-disabled + span.el-radio__label {
+    color: #7c7e7e;
+}
+/deep/.el-textarea.is-disabled .el-textarea__inner {
+	color: #7c7e7e;
+}
+</style>

+ 207 - 0
src/main/vue/src/views/MessageList.vue

@@ -0,0 +1,207 @@
+<template>
+    <div class="list-view">
+        <page-title>
+            <!-- <el-button
+                @click="addRow"
+                type="primary"
+                icon="el-icon-plus"
+                :disabled="fetchingData || downloading"
+                class="filter-item"
+            >
+                新增
+            </el-button> -->
+            <!-- <el-button
+                @click="download"
+                icon="el-icon-upload2"
+                :loading="downloading"
+                :disabled="fetchingData"
+                class="filter-item"
+            >
+                导出
+            </el-button> -->
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                placeholder="搜索昵称..."
+                v-model="search"
+                clearable
+                class="filter-item search"
+                @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+            <el-radio-group v-model="reply" @change="getData">
+                <el-radio-button label="">所有</el-radio-button>
+                <el-radio-button :label="true">已回复</el-radio-button>
+                <el-radio-button :label="false">未回复</el-radio-button>
+            </el-radio-group>
+        </div>
+        <el-table
+            :data="tableData"
+            row-key="id"
+            ref="table"
+            header-row-class-name="table-header-row"
+            header-cell-class-name="table-header-cell"
+            row-class-name="table-row"
+            cell-class-name="table-cell"
+            :height="tableHeight"
+            v-loading="fetchingData"
+        >
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+            <el-table-column prop="id" label="ID" width="80"> </el-table-column>
+            <el-table-column prop="userId" label="用户ID" width="80"> </el-table-column>
+            <el-table-column prop="nickname" label="昵称"> </el-table-column>
+            <!-- <el-table-column prop="phone" label="手机号" min-width="100"> </el-table-column> -->
+            <el-table-column prop="createdAt" label="留言时间" min-width="140"> </el-table-column>
+            <el-table-column prop="detail" label="详情" show-overflow-tooltip> </el-table-column>
+            <el-table-column prop="pic" label="图片">
+                <template slot-scope="{ row }">
+                    <el-image
+                        style="width: 30px; height: 30px"
+                        :src="row.pic[0]"
+                        fit="cover"
+                        :preview-src-list="row.pic"
+                    ></el-image>
+                </template>
+            </el-table-column>
+            <el-table-column prop="reply" label="已回复" width="70">
+                <template slot-scope="{ row }">
+                    <el-tag v-if="row.reply">是</el-tag>
+                    <el-tag v-else type="info">否</el-tag>
+                </template>
+            </el-table-column>
+            <el-table-column prop="replyDetail" label="回复详情" show-overflow-tooltip> </el-table-column>
+            <el-table-column prop="repliedAt" label="回复时间" min-width="140"> </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" width="150">
+                <template slot-scope="{ row }">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>查看</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination
+                background
+                @size-change="onSizeChange"
+                @current-change="onCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalElements"
+            >
+            </el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+
+export default {
+    name: 'MessageList',
+    mixins: [pageableTable],
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/message/all',
+            downloading: false,
+            reply: ''
+        };
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            return {
+                sort: 'id,desc',
+                search: this.search,
+                query: { del: false, reply: this.reply }
+            };
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        addRow() {
+            this.$router.push({
+                path: '/messageEdit',
+                query: {
+                    ...this.$route.query
+                }
+            });
+        },
+        editRow(row) {
+            this.$router.push({
+                path: '/messageEdit',
+                query: {
+                    id: row.id
+                }
+            });
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get('/message/excel', {
+                    responseType: 'blob',
+                    params: { size: 10000 }
+                })
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement('a');
+                    link.href = downloadUrl;
+                    link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/message/del/${row.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 0 - 2
src/main/vue/src/views/MintOrderEdit.vue

@@ -21,8 +21,6 @@
                     </el-form-item>
                     <el-form-item prop="userId" label="用户信息">
                         <el-input-number type="number" v-model="formData.userId" disabled></el-input-number>
-                        <!-- </el-form-item>
-                    <el-form-item prop="phone" label="手机号"> -->
                         <el-input v-model="formData.phone" disabled style="margin-left: 6px; width: 180px"></el-input>
                     </el-form-item>
                     <el-form-item prop="mintActivity" label="铸造活动">

+ 4 - 1
src/main/vue/src/views/NewsEdit.vue

@@ -58,6 +58,7 @@
                             v-model="formData.linkContent"
                             placeholder="输入藏品名称"
                         ></el-input>
+                        <el-input v-else-if="formData.linkType === 'hyperlink'" v-model="formData.linkContent" placeholder="输入链接"></el-input>
                         <el-input v-else v-model="formData.linkContent" placeholder="输入ID"></el-input>
                     </el-form-item>
                     <el-form-item class="form-submit">
@@ -118,7 +119,9 @@ export default {
                 { label: '藏品/盲盒', value: 'collection' },
                 { label: '铸造者', value: 'user' },
                 { label: '活动', value: 'activity' },
-                { label: '多个藏品', value: 'collections' }
+                { label: '多个藏品', value: 'collections' },
+                { label: '指定链接', value: 'hyperlink' },
+                { label: '展厅', value: 'showroom' }
             ]
         };
     },

+ 5 - 4
src/main/vue/src/views/NewsList.vue

@@ -64,7 +64,7 @@
                     <el-tag type="info" v-else>否</el-tag>
                 </template>
             </el-table-column>
-             <el-table-column prop="link" label="跳转">
+            <el-table-column prop="link" label="跳转">
                 <template slot-scope="{ row }">
                     <el-tag :type="row.link ? 'success' : 'info'">{{ row.link ? '是' : '否' }}</el-tag>
                 </template>
@@ -124,7 +124,9 @@ export default {
                 { label: '藏品/盲盒', value: 'collection' },
                 { label: '铸造者', value: 'user' },
                 { label: '活动', value: 'activity' },
-                { label: '多个藏品', value: 'collections' }
+                { label: '多个藏品', value: 'collections' },
+                { label: '指定链接', value: 'hyperlink' },
+                { label: '展厅', value: 'showroom' }
             ]
         };
     },
@@ -213,5 +215,4 @@ export default {
     }
 };
 </script>
-<style lang="less" scoped>
-</style>
+<style lang="less" scoped></style>