Przeglądaj źródła

:package: 页面资源管理、获取新闻顶部资源接口

Twelve615 1 rok temu
rodzic
commit
f2e68b7824

+ 19 - 8
jlsb-vue/src/views/aa/modules/AaPosterForm.vue

@@ -4,16 +4,19 @@
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <a-row>
           <a-col :span="24">
-            <a-form-model-item label="海报名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
+            <a-form-model-item label="资源名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
               <a-input v-model="model.name" placeholder="请输入海报名称"  ></a-input>
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="海报图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cover">
-              <j-image-upload isMultiple  v-model="model.cover" ></j-image-upload>
+            <a-form-model-item label="资源文件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cover">
+              <j-upload v-model="model.cover" :reNewFile="true" :multiple="false" :beforeUpload="this.beforeUploadHandler" ></j-upload>
+              <template slot="extra">
+                <span>推荐比例16:9</span>
+              </template>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+<!--          <a-col :span="24">
             <a-form-model-item label="链接" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="link">
               <a-input v-model="model.link" placeholder="请输入链接"  ></a-input>
             </a-form-model-item>
@@ -22,7 +25,7 @@
             <a-form-model-item label="权重" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort">
               <a-input-number v-model="model.sort" placeholder="请输入权重" style="width: 100%" />
             </a-form-model-item>
-          </a-col>
+          </a-col>-->
         </a-row>
       </a-form-model>
     </j-form-container>
@@ -61,10 +64,10 @@
         confirmLoading: false,
         validatorRules: {
            name: [
-              { required: true, message: '请输入海报名称!'},
+              { required: true, message: '请输入资源名称!'},
            ],
            cover: [
-              { required: true, message: '请输入海报图!'},
+              { required: true, message: '请上传资源文件!'},
            ],
         },
         url: {
@@ -117,9 +120,17 @@
               that.confirmLoading = false;
             })
           }
-         
+
         })
       },
+      beforeUploadHandler(file) {
+        let fileType = file.type;
+        if(fileType.indexOf('image')<0 && fileType.indexOf('video')<0){
+          this.$message.warning('请上传图片或视频');
+          return false;
+        }
+        return true;
+      },
     }
   }
 </script>

+ 9 - 0
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/controller/APIIndexenterController.java

@@ -439,6 +439,15 @@ public class APIIndexenterController {
             return result;
         }
     }
+    @ApiOperationSupport(order = 31)
+    @ApiOperation(value = "获取新闻页顶部资源", notes = "获取新闻页顶部资源")
+    @PostMapping(value = "/getNewsHeadAssets")
+    public Result<AaPoster> getNewsHeadAssets() {
+        AaPoster byId = aaPosterService.getById("1734144586119450625");
+        byId.setCover(host + "/sys/common/static/" + byId.getCover());
+        return Result.OK(byId);
+    }
+
 
     @ApiOperationSupport(order = 30)
     @ApiOperation(value="获取新闻分页列表", notes="获取新闻分页列表")

+ 8 - 8
jlsb/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aa/entity/AaPoster.java

@@ -27,7 +27,7 @@ import lombok.experimental.Accessors;
 @TableName("aa_poster")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@ApiModel(value="aa_poster对象", description="海报管理")
+@ApiModel(value="aa_poster对象", description="页面资源管理")
 public class AaPoster implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -36,21 +36,21 @@ public class AaPoster implements Serializable {
     @ApiModelProperty(value = "id")
     private String id;
 	/**海报名称*/
-	@Excel(name = "海报名称", width = 15)
-    @ApiModelProperty(value = "海报名称")
+	@Excel(name = "资源名称", width = 15)
+    @ApiModelProperty(value = "资源名称")
     private String name;
 	/**海报图*/
-	@Excel(name = "海报图", width = 15)
+	@Excel(name = "资源连接", width = 15)
     @ApiModelProperty(value = "海报图")
     private String cover;
 	/**链接*/
-	@Excel(name = "链接", width = 15)
+/*	@Excel(name = "链接", width = 15)
     @ApiModelProperty(value = "链接")
-    private String link;
+    private String link;*/
 	/**权重*/
-	@Excel(name = "权重", width = 15)
+/*	@Excel(name = "权重", width = 15)
     @ApiModelProperty(value = "权重")
-    private Integer sort;
+    private Integer sort;*/
 	/**创建时间*/
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")