上传之前格式校验,修正因水印导致无法触发uploadBefore问题,注释掉水印

main
xuechunyuan 3 years ago
parent 1a1671cdff
commit 279ce51e89
  1. BIN
      dist.zip
  2. 30
      src/option/user/info.js
  3. 26
      src/views/system/dept.vue
  4. 7
      src/views/system/userinfo.vue

Binary file not shown.

@ -1,4 +1,5 @@
import website from "../../config/website" import website from "../../config/website";
import { Message } from 'element-ui';
export default { export default {
tabs: true, tabs: true,
tabsActive: 1, tabsActive: 1,
@ -8,6 +9,7 @@ export default {
prop: 'info', prop: 'info',
column: [{ column: [{
label: '头像', label: '头像',
prop: 'avatar',
type: 'upload', type: 'upload',
listType: 'picture-img', listType: 'picture-img',
propsHttp: { propsHttp: {
@ -15,15 +17,31 @@ export default {
res: 'data', res: 'data',
url: 'link', url: 'link',
}, },
canvasOption: { // canvasOption: {
text: ' ', // text: ' ',
ratio: 0.1 // ratio: 0.1
}, // },
fileType: 'img',//img/video/audio,
accept: 'image/png, image/jpeg',
action: '/api/blade-resource/oss/endpoint/put-file', action: '/api/blade-resource/oss/endpoint/put-file',
tip: '只能上传jpg/png用户头像,且不超过500kb', tip: '只能上传jpg/png用户头像,且不超过500kb',
span: 12, span: 12,
row: true, row: true,
prop: 'avatar' prop: 'avatar',
tip: '只能上传jpg/png用户头像,且不超过500kb',
action: '/api/blade-resource/oss/endpoint/put-file',
uploadBefore: (file, done, loading) => {
if (['image/png', 'image/jpeg'].indexOf(file.type) == -1) {
Message({
message: '只能上传jpg/png用户头像',
type: 'error'
});
loading();
}
else {
done();
}
}
}, { }, {
label: '姓名', label: '姓名',
span: 12, span: 12,

@ -16,8 +16,8 @@
</el-button> </el-button>
</template> </template>
<template slot-scope="{row}" slot="imgUrl2"> <template slot-scope="{row}" slot="imgUrl2">
<img v-if="row.imgUrl" :src="website.filePrex + row.imgUrl" style="width:30px;height:30px;"/> <img v-if="row.imgUrl" :src="website.filePrex + row.imgUrl" style="width:30px;height:30px;" />
<img v-else src="@/assets/image/hospital_logo.png" style="width:30px;height:30px;"/> <img v-else src="@/assets/image/hospital_logo.png" style="width:30px;height:30px;" />
</template> </template>
<template slot-scope="{row}" slot="deptCategory"> <template slot-scope="{row}" slot="deptCategory">
{{ row.deptCategoryName }} {{ row.deptCategoryName }}
@ -37,6 +37,7 @@ import {
} from "@/api/system/dept"; } from "@/api/system/dept";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
// import website from '@/config/website'; // import website from '@/config/website';
import { Message } from 'element-ui';
export default { export default {
data() { data() {
@ -90,15 +91,28 @@ export default {
type: 'upload', type: 'upload',
listType: 'picture-img', listType: 'picture-img',
span: 24, span: 24,
fileType: 'img',//img/video/audio fileType: 'img',//img/video/audio,
accept: 'image/png, image/jpeg',
propsHttp: { propsHttp: {
home: this.website.filePrex, home: this.website.filePrex,
res: 'data', res: 'data',
url: "link", url: "link",
}, },
tip: '只能上传jpg/png用户头像,且不超过500kb', tip: '只能上传jpg/png格式文件,且不超过500kb',
action: '/api/blade-resource/oss/endpoint/put-file', action: '/api/blade-resource/oss/endpoint/put-file',
hide: true, hide: true,
uploadBefore: (file, done, loading) => {
if (['image/png', 'image/jpeg'].indexOf(file.type) == -1) {
Message({
message: '只能上传jpg/png格式文件',
type: 'error'
});
loading();
}
else {
done();
}
}
}, },
{ {
label: "机构全称", label: "机构全称",
@ -343,6 +357,4 @@ export default {
}; };
</script> </script>
<style> <style></style>
</style>

@ -1,7 +1,8 @@
<template> <template>
<div> <div>
<basic-container> <basic-container>
<avue-form :option="option" v-model="form" @tab-click="handleTabClick" @submit="handleSubmit"></avue-form> <avue-form :option="option" v-model="form" @tab-click="handleTabClick"
@submit="handleSubmit"></avue-form>
</basic-container> </basic-container>
</div> </div>
</template> </template>
@ -87,6 +88,4 @@ export default {
}; };
</script> </script>
<style> <style></style>
</style>

Loading…
Cancel
Save