瀏覽代碼

feat:期刊模块(从his_scrm移动过来)

caoliqin 16 小時之前
父節點
當前提交
5060edc7fb

+ 53 - 0
src/api/store/homeArticle.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询期刊列表
+export function listHomeArticle(query) {
+  return request({
+    url: '/store/homeArticle/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询期刊详细
+export function getHomeArticle(articleId) {
+  return request({
+    url: '/store/homeArticle/' + articleId,
+    method: 'get'
+  })
+}
+
+// 新增期刊
+export function addHomeArticle(data) {
+  return request({
+    url: '/store/homeArticle',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改期刊
+export function updateHomeArticle(data) {
+  return request({
+    url: '/store/homeArticle',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除期刊
+export function delHomeArticle(articleId) {
+  return request({
+    url: '/store/homeArticle/' + articleId,
+    method: 'delete'
+  })
+}
+
+// 导出期刊
+export function exportHomeArticle(query) {
+  return request({
+    url: '/store/homeArticle/export',
+    method: 'get',
+    params: query
+  })
+}

+ 62 - 0
src/api/store/homeCategory.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询期刊分类列表
+export function listHomeCategory(query) {
+  return request({
+    url: '/store/homeCategory/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询期刊分类详细
+export function getHomeCategory(categoryId) {
+  return request({
+    url: '/store/homeCategory/' + categoryId,
+    method: 'get'
+  })
+}
+
+// 新增期刊分类
+export function addHomeCategory(data) {
+  return request({
+    url: '/store/homeCategory',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改期刊分类
+export function updateHomeCategory(data) {
+  return request({
+    url: '/store/homeCategory',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除期刊分类
+export function delHomeCategory(categoryId) {
+  return request({
+    url: '/store/homeCategory/' + categoryId,
+    method: 'delete'
+  })
+}
+
+// 导出期刊分类
+export function exportHomeCategory(query) {
+  return request({
+    url: '/store/homeCategory/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询期刊分类列表(所有)
+export function allListHomeCategory(query) {
+  return request({
+    url: '/store/homeCategory/allList',
+    method: 'get',
+    params: query
+  })
+}

+ 53 - 0
src/api/store/homeView.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询期刊阅读列表
+export function listHomeView(query) {
+  return request({
+    url: '/store/homeView/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询期刊阅读详细
+export function getHomeView(viewId) {
+  return request({
+    url: '/store/homeView/' + viewId,
+    method: 'get'
+  })
+}
+
+// 新增期刊阅读
+export function addHomeView(data) {
+  return request({
+    url: '/store/homeView',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改期刊阅读
+export function updateHomeView(data) {
+  return request({
+    url: '/store/homeView',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除期刊阅读
+export function delHomeView(viewId) {
+  return request({
+    url: '/store/homeView/' + viewId,
+    method: 'delete'
+  })
+}
+
+// 导出期刊阅读
+export function exportHomeView(query) {
+  return request({
+    url: '/store/homeView/export',
+    method: 'get',
+    params: query
+  })
+}

+ 55 - 0
src/components/Editor/wang.vue

@@ -115,9 +115,64 @@
                 }
             }
             this.editor.create()
+            // 自定义音频上传,使用setTimeout确保编辑器完全渲染后添加按钮
+            setTimeout(() => {
+              try {
+                // 查找工具栏元素
+                const toolbar = document.querySelector('.w-e-toolbar')
+                if (toolbar) {
+                  // 创建音频按钮
+                  const audioBtn = document.createElement('div')
+                  audioBtn.className = 'w-e-menu'
+                  audioBtn.style.fontSize = '14px'
+                  // 使用SVG图标 + Unicode音乐符号作为备用
+                  audioBtn.innerHTML = `
+                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
+                      <path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
+                    </svg>`
+                  audioBtn.title = '上传音频'
+
+                  // 添加点击事件
+                  audioBtn.addEventListener('click', function() {
+                    const input = document.createElement('input')
+                    input.type = 'file'
+                    input.accept = 'audio/*'
+                    input.onchange = function() {
+                      const file = input.files[0]
+                      if (file) {
+                        const formData = new FormData()
+                        formData.append('file', file)
+                        fetch(that.uploadUrl, {
+                          method: 'POST',
+                          body: formData
+                        })
+                        .then(res => res.json())
+                        .then(result => {
+                          if (result.data && result.data.length > 0) {
+                            const url = result.data[0].url
+                            that.editor.txt.append(`<audio src="${url}" controls></audio>`)
+                          }
+                        })
+                      }
+                    }
+                    input.click()
+                  })
+
+                  // 插入到工具栏
+                  toolbar.appendChild(audioBtn)
+                }
+              } catch (error) {
+                console.error('添加音频按钮失败:', error)
+              }
+            }, 200)  // 等待200毫秒
         }
         this.editor.txt.html("");
       },
+      beforeDestroy() {
+      if (this.editor) {
+        this.editor.destroy()
+      }
+    },
       setText(text){
         if(this.editor==null){
           this.initEditor()

+ 3 - 3
src/views/store/article/index.vue

@@ -107,7 +107,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -117,7 +117,7 @@
     />
 
     <!-- 添加或修改文章对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="分类" prop="cateId">
            <el-select style="width: 200px" v-model="form.cateId" placeholder="请选择分类" clearable size="small" >
@@ -329,7 +329,7 @@ export default {
           else{
             this.$refs.myeditor.setText(this.form.contents);
           }
-          
+
         }, 200);
       });
     },

+ 2 - 2
src/views/store/articleCate/index.vue

@@ -88,7 +88,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -98,7 +98,7 @@
     />
 
     <!-- 添加或修改文章分类对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="分类名称" prop="cateName">
           <el-input v-model="form.cateName" placeholder="请输入分类名称" />

+ 18 - 7
src/views/store/doctorArticle/index.vue

@@ -148,7 +148,7 @@
       @pagination="getList"
     />
 
-    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :rules="rules">
+    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :rules="rules" :close-on-click-modal="false">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="分类" prop="cateId">
           <el-select v-model="form.cateId" placeholder="分类" clearable size="small">
@@ -179,6 +179,8 @@
 
         <el-form-item label="视频地址" prop="videoUrl">
             <div>
+              <el-radio v-model="form.videoType" label="1">横屏视频</el-radio>
+              <el-radio v-model="form.videoType" label="2">竖屏视频</el-radio>
                 <el-upload
                   ref="upload"
                   class="upload-demo"
@@ -293,7 +295,9 @@ export default {
         status: null,
       },
       // 表单参数
-      form: {},
+      form: {
+        videoType: "1"
+      },
       // 表单校验
       rules: {
         cateId: [
@@ -305,9 +309,9 @@ export default {
         imageUrl: [
           { required: true, message: "封面图不能为空", trigger: "blur" }
         ],
-        content: [
-          { required: true, message: "内容不能为空", trigger: "blur" }
-        ],
+        // content: [
+        //   { required: true, message: "内容不能为空", trigger: "blur" }
+        // ],
         status: [
           { required: true, message: "状态不能为空", trigger: "blur" }
         ],
@@ -413,10 +417,11 @@ export default {
         title: null,
         content: null,
         views: null,
-        videoUrl:null,
+        videoUrl: null,
         status: null,
         createTime: null,
-        updateTime: null
+        updateTime: null,
+        videoType: "1",
       };
       this.resetForm("form");
     },
@@ -462,12 +467,18 @@ export default {
         this.title = "修改养生讲堂文章";
         this.form.status = String(this.form.status)
         this.form.cateId = String(this.form.cateId)
+        this.form.videoType = String(this.form.videoType)
       });
     },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          //手动判断 如果没有视频,那么内容就必传
+          if(!(this.form.videoUrl != null || this.form.content.length !== 0)){
+            this.$message.warning('请填写文章内容或上传视频');
+            return;
+          }
           if (this.form.articleId != null) {
             updateArticle(this.form).then(response => {
               this.msgSuccess("修改成功");

+ 490 - 0
src/views/store/homeArticle/index.vue

@@ -0,0 +1,490 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="分类" prop="categoryId">
+        <el-select v-model="queryParams.categoryId" placeholder="请选择分类" clearable size="small">
+          <el-option
+            v-for="dict in categoryOptions"
+            :key="dict.categoryId"
+            :label="dict.categoryName"
+            :value="dict.categoryId"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="发布状态" prop="publicStatus">
+        <el-select v-model="queryParams.publicStatus" placeholder="请选择发布状态" clearable size="small">
+          <el-option label="已发布" value="1" />
+          <el-option label="草稿" value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['store:homeArticle:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['store:homeArticle:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['store:homeArticle:remove']"
+        >删除</el-button>
+      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['store:homeArticle:export']"-->
+<!--        >导出</el-button>-->
+<!--      </el-col>-->
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="homeArticleList" @selection-change="handleSelectionChange" border>
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="分类" align="center" prop="categoryName" />
+      <el-table-column label="标题" align="center" prop="title" />
+      <el-table-column label="封面图片" align="center" prop="imageUrl">
+        <template slot-scope="scope">
+          <el-image
+            style="width: 80px; height: 50px"
+            :src="scope.row.imageUrl"
+            :preview-src-list="[scope.row.imageUrl]"
+            fit="cover">
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="浏览数" align="center" prop="views" width="80" />
+      <el-table-column label="发布时间" align="center" prop="publishTime" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="160"/>
+      <el-table-column label="发布状态" align="center" prop="publicStatus" width="100">
+        <template slot-scope="scope">
+          <el-tag type="success" v-if="scope.row.publicStatus == 1">已发布</el-tag>
+          <el-tag type="info" v-else-if="scope.row.publicStatus == 2">草稿</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['store:homeArticle:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['store:homeArticle:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改文章对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body :close-on-click-modal="false">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="分类" prop="categoryId">
+          <el-select v-model="form.categoryId" placeholder="请选择分类" filterable>
+            <el-option
+              v-for="dict in categoryOptions"
+              :key="dict.categoryId"
+              :label="dict.categoryName"
+              :value="dict.categoryId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="标题" prop="title">
+          <el-input v-model="form.title" placeholder="请输入标题" maxlength="100"/>
+        </el-form-item>
+        <el-form-item label="描述" prop="description">
+          <el-input v-model="form.description" placeholder="请输入描述内容" maxlength="200"/>
+        </el-form-item>
+        <el-form-item label="封面图片" prop="imageUrl">
+          <el-upload
+            class="avatar-uploader"
+            :action="uploadUrl"
+            :show-file-list="false"
+            :on-success="handleImageUrlSuccess"
+            :before-upload="beforeImageUrlUpload">
+            <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" width="200px">
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="是否推荐" prop="isTui">
+          <el-radio-group v-model="form.isTui">
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="0">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="视频地址" prop="videoUrl">
+          <div>
+            <el-upload
+              ref="upload"
+              class="upload-demo"
+              :action="uploadUrl"
+              :on-success="handleVideoSuccess"
+              :before-upload="beforeVideoUpload"
+              :limit="1"
+              :accept="videoAccept"
+            >
+              <el-button size="small" type="primary">点击上传视频</el-button>
+            </el-upload>
+            <video v-if="form.videoUrl" :src="form.videoUrl" controls style="max-width: 400px; max-height: 200px;"></video>
+          </div>
+        </el-form-item>
+        <el-form-item label="内容" prop="content">
+          <Editor ref="myeditor" @on-text-change="updateText"/>
+        </el-form-item>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="浏览数" prop="views">
+              <el-input-number v-model="form.views" :min="0" placeholder="请输入浏览数" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="排序" prop="sort">
+              <el-input-number v-model="form.sort" :min="0" placeholder="请输入排序" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="发布状态" prop="publicStatus">
+          <el-select v-model="form.publicStatus" placeholder="请选择发布状态">
+            <el-option label="已发布" value="1" />
+            <el-option label="草稿" value="2" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listHomeArticle, getHomeArticle, delHomeArticle, addHomeArticle, updateHomeArticle, exportHomeArticle } from "@/api/store/homeArticle";
+import { listHomeCategory, allListHomeCategory } from "@/api/store/homeCategory";
+import Editor from '@/components/Editor/wang';
+
+export default {
+  name: "HomeArticle",
+  components: { Editor },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 文章表格数据
+      homeArticleList: [],
+      // 分类选项
+      categoryOptions: [],
+      // 上传URL
+      uploadUrl: process.env.VUE_APP_BASE_API + "/common/uploadOSS",
+      // 视频接受类型
+      videoAccept: "video/*",
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        categoryId: null,
+        title: null,
+        publicStatus: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        categoryId: [
+          { required: true, message: "分类不能为空", trigger: "change" }
+        ],
+        title: [
+          { required: true, message: "标题不能为空", trigger: "blur" }
+        ],
+        description: [
+          { required: true, message: "发布状态不能为空", trigger: "change" }
+        ],
+        imageUrl: [
+          { required: true, message: "封面图片不能为空", trigger: "change" }
+        ],
+        publicStatus: [
+          { required: true, message: "发布状态不能为空", trigger: "change" }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getCategoryOptions();
+  },
+  methods: {
+    /** 获取分类选项 */
+    getCategoryOptions() {
+      allListHomeCategory().then(response => {
+        this.categoryOptions = response.rows;
+      });
+    },
+    /** 查询文章列表 */
+    getList() {
+      this.loading = true;
+      listHomeArticle(this.queryParams).then(response => {
+        this.homeArticleList = response.rows.list;
+        this.total = response.rows.total;
+        this.loading = false;
+      });
+    },
+    // 视频上传成功处理
+    handleVideoSuccess(response, file) {
+      if (response.code == 200) {
+        this.form.videoUrl = response.url;
+        this.$refs.upload.clearFiles();
+      } else {
+        this.msgError(response.msg);
+      }
+    },
+    // 视频上传前的验证
+    beforeVideoUpload(file) {
+      const isLt200M = file.size / 1024 / 1024 < 200;
+      if (!isLt200M) {
+        this.$message.error('上传视频文件大小不能超过200MB!');
+        return false;
+      }
+      return isLt200M;
+    },
+    // 更新富文本内容
+    updateText(text) {
+      this.form.content = text;
+    },
+    // 图片上传成功处理
+    handleImageUrlSuccess(res, file) {
+      if (res.code == 200) {
+        this.form.imageUrl = res.url;
+        this.$forceUpdate();
+      } else {
+        this.msgError(res.msg);
+      }
+    },
+    // 图片上传前的验证
+    beforeImageUrlUpload(file) {
+      const isLt1M = file.size / 1024 / 1024 < 1;
+      if (!isLt1M) {
+        this.$message.error('上传图片大小不能超过1MB!');
+      }
+      return isLt1M;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        articleId: null,
+        categoryId: null,
+        title: null,
+        description: null,
+        imageUrl: null,
+        isTui: 0,
+        videoUrl: null,
+        content: null,
+        views: 0,
+        sort: 0,
+        publishTime: null,
+        publicStatus: "1"
+      };
+      this.resetForm("form");
+      if (this.$refs.myeditor) {
+        this.$refs.myeditor.setText("");
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.articleId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加文章";
+      setTimeout(() => {
+        if (this.$refs.myeditor) {
+          this.$refs.myeditor.setText("");
+        }
+      }, 100);
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const articleId = row.articleId || this.ids
+      getHomeArticle(articleId).then(response => {
+        this.form = response.data;
+        // 确保状态是字符串类型
+        this.form.publicStatus = this.form.publicStatus ? this.form.publicStatus.toString() : "1";
+        this.open = true;
+        this.title = "修改文章";
+        setTimeout(() => {
+          if (this.$refs.myeditor) {
+            if (this.form.content == null) {
+              this.$refs.myeditor.setText("");
+            } else {
+              this.$refs.myeditor.setText(this.form.content);
+            }
+          }
+        }, 100);
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.articleId != null) {
+            updateHomeArticle(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addHomeArticle(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const articleIds = row.articleId || this.ids;
+      this.$confirm('是否确认删除该文章?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delHomeArticle(articleIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm('是否确认导出所有文章数据项?', "警告", {
+    //       confirmButtonText: "确定",
+    //       cancelButtonText: "取消",
+    //       type: "warning"
+    //     }).then(function() {
+    //       return exportHomeArticle(queryParams);
+    //     }).then(response => {
+    //       this.download(response.msg);
+    //     }).catch(function() {});
+    // }
+  }
+};
+</script>
+
+<style>
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 150px;
+  height: 150px;
+  line-height: 150px;
+  text-align: center;
+}
+.avatar {
+  width: 150px;
+  height: 150px;
+  display: block;
+}
+</style>

+ 365 - 0
src/views/store/homeCategory/index.vue

@@ -0,0 +1,365 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="分类名称" prop="categoryName">
+        <el-input
+          v-model="queryParams.categoryName"
+          placeholder="请输入分类名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
+          <el-option label="正常" value="1" />
+          <el-option label="禁用" value="0" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['store:homeCategory:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['store:homeCategory:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['store:homeCategory:remove']"
+        >删除</el-button>
+      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['store:homeCategory:export']"-->
+<!--        >导出</el-button>-->
+<!--      </el-col>-->
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="homeCategoryList" @selection-change="handleSelectionChange" border>
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="分类名称" align="center" prop="categoryName" />
+      <el-table-column label="封面图片" align="center" prop="imageUrl">
+        <template slot-scope="scope">
+          <el-image
+            style="width: 80px; height: 50px"
+            :src="scope.row.imageUrl"
+            :preview-src-list="[scope.row.imageUrl]"
+            fit="cover">
+          </el-image>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-tag type="success" v-if="scope.row.status == 1">正常</el-tag>
+          <el-tag type="danger" v-else>禁用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="排序" align="center" prop="sort" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['store:homeCategory:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['store:homeCategory:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改文章分类对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="分类名称" prop="categoryName">
+          <el-input v-model="form.categoryName" placeholder="请输入分类名称" />
+        </el-form-item>
+        <el-form-item label="封面图片" prop="imageUrl">
+          <el-upload
+            class="avatar-uploader"
+            :action="uploadUrl"
+            :show-file-list="false"
+            :on-success="handleImageUrlSuccess"
+            :before-upload="beforeImageUrlUpload">
+            <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" width="200px">
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="form.sort" placeholder="请输入排序" :min="0" controls-position="right" />
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-radio-group v-model="form.status">
+            <el-radio :label="1">正常</el-radio>
+            <el-radio :label="0">禁用</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listHomeCategory, getHomeCategory, delHomeCategory, addHomeCategory, updateHomeCategory, exportHomeCategory } from "@/api/store/homeCategory";
+
+export default {
+  name: "HomeCategory",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 文章分类表格数据
+      homeCategoryList: [],
+      // 上传URL
+      uploadUrl: process.env.VUE_APP_BASE_API + "/common/uploadOSS",
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        categoryName: null,
+        status: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        categoryName: [
+          { required: true, message: "分类名称不能为空", trigger: "blur" }
+        ],
+        imageUrl: [
+          { required: true, message: "封面图片不能为空", trigger: "change" }
+        ],
+        status: [
+          { required: true, message: "状态不能为空", trigger: "change" }
+        ],
+        sort: [
+          { required: true, message: "排序不能为空", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询文章分类列表 */
+    getList() {
+      this.loading = true;
+      listHomeCategory(this.queryParams).then(response => {
+        this.homeCategoryList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        categoryId: null,
+        categoryName: null,
+        imageUrl: null,
+        status: 1,
+        sort: 0
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.categoryId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加文章分类";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const categoryId = row.categoryId || this.ids
+      getHomeCategory(categoryId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改文章分类";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.categoryId != null) {
+            updateHomeCategory(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addHomeCategory(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const categoryIds = row.categoryId || this.ids;
+      if (row.status === 1) {
+        this.$message.warning('非禁用的分类不能删除');
+      } else {
+        this.$confirm('是否确认删除该文章分类?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delHomeCategory(categoryIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {
+        });
+      }
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm('是否确认导出所有文章分类数据项?', "警告", {
+    //       confirmButtonText: "确定",
+    //       cancelButtonText: "取消",
+    //       type: "warning"
+    //     }).then(function() {
+    //       return exportHomeCategory(queryParams);
+    //     }).then(response => {
+    //       this.download(response.msg);
+    //     }).catch(function() {});
+    // },
+    // 图片上传成功处理
+    handleImageUrlSuccess(res, file) {
+      if (res.code == 200) {
+        this.form.imageUrl = res.url;
+        this.$forceUpdate();
+      } else {
+        this.msgError(res.msg);
+      }
+    },
+    // 图片上传前的验证
+    beforeImageUrlUpload(file) {
+      const isLt1M = file.size / 1024 / 1024 < 1;
+      if (!isLt1M) {
+        this.$message.error('上传图片大小不能超过1MB!');
+      }
+      return isLt1M;
+    }
+  }
+};
+</script>
+
+<style>
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 150px;
+  height: 150px;
+  line-height: 150px;
+  text-align: center;
+}
+.avatar {
+  width: 150px;
+  height: 150px;
+  display: block;
+}
+</style>

+ 289 - 0
src/views/store/homeView/index.vue

@@ -0,0 +1,289 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="文章标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入文章标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户电话" prop="phone">
+        <el-input
+          v-model="queryParams.phone"
+          placeholder="请输入用户电话"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+<!--    <el-row :gutter="10" class="mb8">-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="primary"-->
+<!--          icon="el-icon-plus"-->
+<!--          size="mini"-->
+<!--          @click="handleAdd"-->
+<!--          v-hasPermi="['store:homeView:add']"-->
+<!--        >新增</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="success"-->
+<!--          icon="el-icon-edit"-->
+<!--          size="mini"-->
+<!--          :disabled="single"-->
+<!--          @click="handleUpdate"-->
+<!--          v-hasPermi="['store:homeView:edit']"-->
+<!--        >修改</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="danger"-->
+<!--          icon="el-icon-delete"-->
+<!--          size="mini"-->
+<!--          :disabled="multiple"-->
+<!--          @click="handleDelete"-->
+<!--          v-hasPermi="['store:homeView:remove']"-->
+<!--        >删除</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['store:homeView:export']"-->
+<!--        >导出</el-button>-->
+<!--      </el-col>-->
+<!--	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
+<!--    </el-row>-->
+
+    <el-table v-loading="loading" :data="homeViewList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="文章标题" align="center" prop="title" :show-overflow-tooltip="true" />
+      <el-table-column label="用户昵称" align="center" prop="nickname" />
+      <el-table-column label="用户电话" align="center" prop="phone" />
+<!--      <el-table-column label="用户头像" align="center" prop="avatar">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-image-->
+<!--            style="width: 50px; height: 50px"-->
+<!--            :src="scope.row.avatar"-->
+<!--            fit="cover"-->
+<!--            :preview-src-list="[scope.row.avatar]">-->
+<!--          </el-image>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
+<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-edit"-->
+<!--            @click="handleUpdate(scope.row)"-->
+<!--            v-hasPermi="['store:homeView:edit']"-->
+<!--          >修改</el-button>-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-delete"-->
+<!--            @click="handleDelete(scope.row)"-->
+<!--            v-hasPermi="['store:homeView:remove']"-->
+<!--          >删除</el-button>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改倍力之家_文章阅读对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="文章标题" prop="title">
+          <el-input v-model="form.title" placeholder="请输入文章标题" />
+        </el-form-item>
+        <el-form-item label="用户昵称" prop="nickname">
+          <el-input v-model="form.nickname" placeholder="请输入用户昵称" />
+        </el-form-item>
+        <el-form-item label="用户头像" prop="avatar">
+          <el-input v-model="form.avatar" placeholder="请输入用户头像URL" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listHomeView, getHomeView, delHomeView, addHomeView, updateHomeView, exportHomeView } from "@/api/store/homeView";
+
+export default {
+  name: "HomeView",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 倍力之家_文章阅读表格数据
+      homeViewList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        nickname: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询倍力之家_文章阅读列表 */
+    getList() {
+      this.loading = true;
+      listHomeView(this.queryParams).then(response => {
+        console.log(response)
+        this.homeViewList = response.rows.list;
+        this.total = response.rows.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        viewId: null,
+        title: null,
+        nickname: null,
+        avatar: null,
+        createTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.viewId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加倍力之家_文章阅读";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const viewId = row.viewId || this.ids
+      getHomeView(viewId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改倍力之家_文章阅读";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.viewId != null) {
+            updateHomeView(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addHomeView(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const viewIds = row.viewId || this.ids;
+      this.$confirm('是否确认删除倍力之家_文章阅读编号为"' + viewIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delHomeView(viewIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有倍力之家_文章阅读数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportHomeView(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    }
+  }
+};
+</script>