|
@@ -200,7 +200,11 @@
|
200
|
200
|
<img v-if="miniprogram.pic_url" :src="miniprogram.pic_url" class="fm_img">
|
201
|
201
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
202
|
202
|
</el-upload>
|
203
|
|
- <el-button type="primary" plain size="mini">裁剪</el-button>
|
|
203
|
+ <div style="margin-left:40px;">
|
|
204
|
+ <el-button type="danger" size="mini" style="height:30px;margin-bottom:0px;" @click="openImgCutter">图片裁剪</el-button>
|
|
205
|
+ <p class="uploadImgHint" style="margin:0">可根据需要对图片进行裁剪。</p>
|
|
206
|
+ </div>
|
|
207
|
+
|
204
|
208
|
</div>
|
205
|
209
|
<p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
|
206
|
210
|
<div class="buttons">
|
|
@@ -276,8 +280,10 @@
|
276
|
280
|
@confirm="onConfirmMultipleLink"
|
277
|
281
|
@cancel="onCancelMultipleLink"
|
278
|
282
|
/>
|
279
|
|
-
|
280
|
|
- <!-- <imgCutter></imgCutter> -->
|
|
283
|
+ <!-- 图片裁剪弹框 -->
|
|
284
|
+ <el-dialog width="840px" title="图片裁剪" :visible.sync="imgCutterVisible" append-to-body>
|
|
285
|
+ <imgCutter v-if="imgCutterVisible" :target="oss_url"></imgCutter>
|
|
286
|
+ </el-dialog>
|
281
|
287
|
</div>
|
282
|
288
|
</template>
|
283
|
289
|
<script>
|
|
@@ -285,9 +291,10 @@ import draggable from "vuedraggable"
|
285
|
291
|
import phonePreview from './phonePreview.vue'
|
286
|
292
|
import radarEntrance from './radarEntrance.vue'
|
287
|
293
|
import multipleLink from './multipleLink.vue'
|
288
|
|
-// import imgCutter from './imgCutter.vue'
|
|
294
|
+import imgCutter from './imgCutter.vue'
|
289
|
295
|
export default {
|
290
|
296
|
components: {
|
|
297
|
+ imgCutter,
|
291
|
298
|
draggable,
|
292
|
299
|
phonePreview,
|
293
|
300
|
radarEntrance,
|
|
@@ -376,6 +383,8 @@ export default {
|
376
|
383
|
has_attachLen: 0,//除雷达外,附件的长度
|
377
|
384
|
|
378
|
385
|
multipleLinkVisible: false,
|
|
386
|
+ imgCutterVisible: false,
|
|
387
|
+ oss_url: '', // 需要裁剪并转化后的图片链接
|
379
|
388
|
}
|
380
|
389
|
},
|
381
|
390
|
created () {
|
|
@@ -385,6 +394,39 @@ export default {
|
385
|
394
|
}
|
386
|
395
|
},
|
387
|
396
|
methods: {
|
|
397
|
+ openImgCutter(){ // 打开图片裁剪
|
|
398
|
+ if ( this.miniprogram.pic_url ) {
|
|
399
|
+ this.$loading(this.$loadingConfig)
|
|
400
|
+ if ( this.miniprogram.pic_url.indexOf('http://playlet.oss-cn-beijing.aliyuncs.com/') != -1 ){
|
|
401
|
+ this.oss_url = this.miniprogram.pic_url.replace('http://playlet.oss-cn-beijing.aliyuncs.com/','http://dj.wenxingshuju.com/oss_image/');
|
|
402
|
+ this.imgCutterVisible = true
|
|
403
|
+ this.$loading(this.$loadingConfig).close()
|
|
404
|
+ } else {
|
|
405
|
+ if (this.oss_url) { // oss_url存在,说明已经通过服务端转化过,不需要重复转化
|
|
406
|
+ this.imgCutterVisible = true
|
|
407
|
+ this.$loading(this.$loadingConfig).close()
|
|
408
|
+ return
|
|
409
|
+ }
|
|
410
|
+ // 图片通过服务器转化,解决图片裁剪跨域问题
|
|
411
|
+ this.$axios.post(this.URL.BASEURL + this.URL.material_uploadFileByUrl, {
|
|
412
|
+ img_url: this.miniprogram.pic_url
|
|
413
|
+ }).then((res) => {
|
|
414
|
+ var res = res.data
|
|
415
|
+ if (res && res.errno == 0) {
|
|
416
|
+ this.oss_url = res.rst.oss_url.replace('http://playlet.oss-cn-beijing.aliyuncs.com/','http://dj.wenxingshuju.com/oss_image/');
|
|
417
|
+ this.imgCutterVisible = true
|
|
418
|
+ this.$loading(this.$loadingConfig).close()
|
|
419
|
+ } else if (res.errno != 4002) {
|
|
420
|
+ this.$message({ message: res.err, type: "error" })
|
|
421
|
+ }
|
|
422
|
+ }).catch((err) => {
|
|
423
|
+ this.$message({ message: '服务器错误,获取裁剪图片失败', type: "error" })
|
|
424
|
+ });
|
|
425
|
+ }
|
|
426
|
+ } else {
|
|
427
|
+ this.imgCutterVisible = true
|
|
428
|
+ }
|
|
429
|
+ },
|
388
|
430
|
radarids_reset () { //雷达id回显
|
389
|
431
|
this.has_attachLen = 0
|
390
|
432
|
this.radarIds = []
|