lrf402788946 5 роки тому
батько
коміт
ed5cdcfc7b
3 змінених файлів з 37 додано та 11 видалено
  1. 16 8
      components/form.md
  2. 14 3
      components/upload.vue
  3. 7 0
      config/menu-config.js

+ 16 - 8
components/form.md

@@ -54,11 +54,19 @@
 
 
 ***
 ***
 #### upload
 #### upload
->#### url
-String类型 必填 上传地址 
->#### limit
-Number类型 必填 限制数量
->#### data
-任意类型 必填 已经上传的图片
->#### type
-任意类型 必填 传回父组件有两个参数 type 和 data,type自己传的,自己怎么用都行;data是upload上传完后返回的信息
+|参数|类型|默认值|是否必填|说明|
+|:-:|:-:|:-:|:-:|:-:|
+|url|String|`-`|是|上传地址|
+|limit|Number|`-`|是|限制上传数量|
+|data|any|`-`|否|上传数据|
+|type|String|`-`|否|上传返回的字段|
+|isBtn|Boolean|false|否|是否只显示按钮|
+|showList|Boolean|true|否|是否显示上传列表|
+|accept|String|`-`|否|可以上传的文件类型,不写就没限制|
+|tip|String|`-`|否|提示信息|
+|listType|String|picture-card|否|上传文件列表显示类型|
+
+>##### method
+>|方法名|返回参数|说明|
+|:-:|:-:|:-:|
+|upload|{type,data}|上传成功返回

+ 14 - 3
components/upload.vue

@@ -4,17 +4,23 @@
       v-if="url"
       v-if="url"
       ref="upload"
       ref="upload"
       :action="url"
       :action="url"
-      list-type="picture-card"
+      :list-type="listType"
       :file-list="fileList"
       :file-list="fileList"
       :limit="limit"
       :limit="limit"
       :on-exceed="outLimit"
       :on-exceed="outLimit"
       :on-preview="handlePictureCardPreview"
       :on-preview="handlePictureCardPreview"
       :before-remove="handleRemove"
       :before-remove="handleRemove"
       :on-success="onSuccess"
       :on-success="onSuccess"
+      :show-file-list="showList"
+      :accept="accept"
     >
     >
-      <template>
+      <el-button size="small" type="primary" v-if="isBtn">点击上传</el-button>
+      <template v-else>
         <i class="el-icon-plus"></i>
         <i class="el-icon-plus"></i>
       </template>
       </template>
+      <template #tip v-if="tip">
+        {{ tip }}
+      </template>
     </el-upload>
     </el-upload>
     <el-dialog :visible.sync="dialogVisible">
     <el-dialog :visible.sync="dialogVisible">
       <img width="100%" :src="dialogImageUrl" alt="" />
       <img width="100%" :src="dialogImageUrl" alt="" />
@@ -31,6 +37,11 @@ export default {
     limit: { type: Number },
     limit: { type: Number },
     data: { type: null },
     data: { type: null },
     type: { type: String },
     type: { type: String },
+    isBtn: { type: Boolean, default: false },
+    showList: { type: Boolean, default: true },
+    accept: { type: String },
+    tip: { type: String, default: undefined },
+    listType: { type: String, default: 'picture-card' },
   },
   },
   components: {},
   components: {},
   data: () => ({
   data: () => ({
@@ -60,7 +71,7 @@ export default {
       return true;
       return true;
     },
     },
     outLimit() {
     outLimit() {
-      this.$message.error('只允许上传1');
+      this.$message.error('只允许上传1个文件');
     },
     },
     onSuccess(response, file, fileList) {
     onSuccess(response, file, fileList) {
       //将文件整理好传回父组件
       //将文件整理好传回父组件

+ 7 - 0
config/menu-config.js

@@ -143,4 +143,11 @@ export const devMenu = [
     name: '班级管理',
     name: '班级管理',
     module: 'director',
     module: 'director',
   },
   },
+
+  //学校
+  {
+    path: '/plan/index',
+    name: '查看计划', //上报名单
+    module: 'teacher',
+  },
 ];
 ];