|
@@ -10,7 +10,7 @@
|
|
|
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
- <!--<ImgCutter v-on:cutDown="cutDown"></ImgCutter>-->
|
|
|
|
|
|
|
+ <ImgCutter v-on:cutDown="cutDown"></ImgCutter>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -28,11 +28,17 @@
|
|
|
// domain: 'https://up-z1.qiniup.com',
|
|
// domain: 'https://up-z1.qiniup.com',
|
|
|
// 这是七牛云空间的外链默认域名
|
|
// 这是七牛云空间的外链默认域名
|
|
|
// qiniuaddr: 'qjzpcd34v.hb-bkt.clouddn.com',
|
|
// qiniuaddr: 'qjzpcd34v.hb-bkt.clouddn.com',
|
|
|
|
|
+ // domain: 'https://up-z1.qiniup.com', // 这是七牛云空间的外链默认域名
|
|
|
domain: 'https://up-z1.qiniup.com', // 这是七牛云空间的外链默认域名
|
|
domain: 'https://up-z1.qiniup.com', // 这是七牛云空间的外链默认域名
|
|
|
qiniuaddr: 'xhead.beswell.com',//xhead.beswell.com 旧的 qjzpcd34v.hb-bkt.clouddn.com
|
|
qiniuaddr: 'xhead.beswell.com',//xhead.beswell.com 旧的 qjzpcd34v.hb-bkt.clouddn.com
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ cutDown(e){
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ this.imageUrl = e.dataURL;
|
|
|
|
|
+ this.upqiniu(e);
|
|
|
|
|
+ },
|
|
|
// 上传文件到七牛云
|
|
// 上传文件到七牛云
|
|
|
upqiniu(req) {
|
|
upqiniu(req) {
|
|
|
const config = {
|
|
const config = {
|
|
@@ -64,13 +70,13 @@
|
|
|
},
|
|
},
|
|
|
// 验证文件合法性
|
|
// 验证文件合法性
|
|
|
beforeUpload(file) {
|
|
beforeUpload(file) {
|
|
|
- const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
|
|
- if (!isJPG) {
|
|
|
|
|
- this.$message.error('上传头像图片只能是 JPG 格式!')
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 70;
|
|
|
|
|
+ // if (!isJPG) {
|
|
|
|
|
+ // this.$message.error('上传头像图片只能是 JPG 格式!')
|
|
|
|
|
+ // }
|
|
|
if (!isLt2M) {
|
|
if (!isLt2M) {
|
|
|
- this.$message.error('上传头像图片大小不能超过 2MB!')
|
|
|
|
|
|
|
+ this.$message.error('上传头像图片大小不能超过 70MB!')
|
|
|
}
|
|
}
|
|
|
return isJPG && isLt2M
|
|
return isJPG && isLt2M
|
|
|
}
|
|
}
|