图片上传插件增加图片尺寸显示
This commit is contained in:
parent
3f233210e8
commit
4207ef5003
@ -4,11 +4,15 @@
|
||||
<div>
|
||||
<div class="avatar-uploader">
|
||||
<div tabindex="0" class="el-upload el-upload--text">
|
||||
<div class="tip-bar">
|
||||
{{width}} x {{height}}
|
||||
</div>
|
||||
<i class="el-icon-plus avatar-uploader-icon" @click="handleClick" v-if="!hasImg"></i>
|
||||
<img alt="" :src="initialImgUrl" @click="showInitImg" class="upload-preview-img" v-if="hasImg">
|
||||
<input type="file" name="file" ref="fileinput"
|
||||
@change="handleChange" accept="image/*"
|
||||
class="el-upload__input">
|
||||
|
||||
<div class="action-bar" v-if="hasImg">
|
||||
<el-button
|
||||
type="success"
|
||||
|
@ -593,3 +593,10 @@
|
||||
justify-content: space-between;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.upload-corp-container .tip-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 5px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
@ -11,14 +11,32 @@
|
||||
prop="game_main_pic"
|
||||
label="主页正中间图片"
|
||||
>
|
||||
<upload-image v-model="record.game_main_pic"/>
|
||||
<upload-corp-image
|
||||
field="image-file"
|
||||
@crop-upload-success="mainUploadSuccess"
|
||||
:width="583"
|
||||
:height="287"
|
||||
img-format="png"
|
||||
v-model="record.game_main_pic"
|
||||
>
|
||||
|
||||
</upload-corp-image>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
prop="bg_item_icon"
|
||||
label="背景图案"
|
||||
>
|
||||
<upload-image v-model="record.bg_item_icon"/>
|
||||
<upload-corp-image
|
||||
field="image-file"
|
||||
@crop-upload-success="bgUploadSuccess"
|
||||
:width="392"
|
||||
:height="396"
|
||||
img-format="png"
|
||||
v-model="record.bg_item_icon"
|
||||
>
|
||||
|
||||
</upload-corp-image>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
@ -64,6 +82,7 @@ import { Component, Vue } from 'vue-property-decorator'
|
||||
import Sticky from '@/components/Sticky/index.vue'
|
||||
import ElImageViewer from 'element-ui/packages/image/src/image-viewer.vue'
|
||||
import UploadImage from '@/components/UploadImage/index.vue'
|
||||
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
||||
|
||||
import { getGameTheme, saveGameTheme } from '@/api/shop'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
@ -73,7 +92,8 @@ import { UserModule } from '@/store/modules/user'
|
||||
components: {
|
||||
Sticky,
|
||||
ElImageViewer,
|
||||
UploadImage
|
||||
UploadImage,
|
||||
UploadCorpImage
|
||||
},
|
||||
filters: {
|
||||
parseGameType: (type: number) => {
|
||||
@ -167,6 +187,18 @@ export default class extends Vue {
|
||||
private inputBegin() {
|
||||
this.$forceUpdate()
|
||||
}
|
||||
|
||||
private mainUploadSuccess(imgUrl: string) {
|
||||
console.log('game main success: ' + imgUrl)
|
||||
this.record.game_main_pic = imgUrl
|
||||
this.$forceUpdate()
|
||||
}
|
||||
|
||||
private bgUploadSuccess(imgUrl: string) {
|
||||
console.log('bg item success: ' + imgUrl)
|
||||
this.record.bg_item_icon = imgUrl
|
||||
this.$forceUpdate()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user