|
@@ -2,16 +2,18 @@
|
|
|
<div class="pdf-hotspot-setting">
|
|
|
<button class="add-btn" v-if="!hotspot.pdfInfo.name" @click="onClickSelect">
|
|
|
<i class="iconfont icon-editor_add"></i>
|
|
|
- {{$i18n.t('hotspot.select_pdf')}}
|
|
|
+ {{ $i18n.t("hotspot.select_pdf") }}
|
|
|
</button>
|
|
|
<template v-else>
|
|
|
<div class="pdf-display">
|
|
|
- <div class="name" v-title="hotspot.pdfInfo.name">{{hotspot.pdfInfo.name}}</div>
|
|
|
+ <div class="name" v-title="hotspot.pdfInfo.name">
|
|
|
+ {{ hotspot.pdfInfo.name }}
|
|
|
+ </div>
|
|
|
<i class="iconfont icon-editor_list_delete" @click.stop="del"></i>
|
|
|
</div>
|
|
|
<button class="change-btn" @click="onClickSelect">
|
|
|
<i class="iconfont icon-editor_update"></i>
|
|
|
- {{$i18n.t('hotspot.change_pdf')}}
|
|
|
+ {{ $i18n.t("hotspot.change_pdf") }}
|
|
|
</button>
|
|
|
</template>
|
|
|
|
|
@@ -27,41 +29,56 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapGetters } from "vuex";
|
|
|
-
|
|
|
+import { uploadAttachment } from "@/api";
|
|
|
export default {
|
|
|
data() {
|
|
|
- return {
|
|
|
- }
|
|
|
+ return {};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters({
|
|
|
- hotspot: 'hotspot',
|
|
|
+ hotspot: "hotspot",
|
|
|
+ currentScene: "scene/currentScene",
|
|
|
}),
|
|
|
},
|
|
|
- methods:{
|
|
|
- del(){
|
|
|
- this.hotspot.pdfInfo = {}
|
|
|
+ methods: {
|
|
|
+ del() {
|
|
|
+ this.hotspot.pdfInfo = {};
|
|
|
},
|
|
|
- onClickSelect(){
|
|
|
- this.$refs['file-input'].click()
|
|
|
+ onClickSelect() {
|
|
|
+ this.$refs["file-input"].click();
|
|
|
},
|
|
|
- onFileInputChange(e) {
|
|
|
- console.log(e);
|
|
|
-
|
|
|
+ async onFileInputChange(e) {
|
|
|
+ console.log("onFileInputChange", e);
|
|
|
+ console.log("currentScene", this.currentScene.sceneCode);
|
|
|
// 检查格式和大小
|
|
|
- if (e.target.files[0].type !== 'application/pdf' || e.target.files[0].size / 1024 / 1024 > 50) {
|
|
|
- this.$msg.warning(this.$i18n.t('hotspot.pdf_invalid_tip'))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 上传pdf,拿到上传结果后给this.pdfInfo赋值
|
|
|
- this.hotspot.pdfInfo = {
|
|
|
- name: e.target.files[0].name,
|
|
|
- url: '',
|
|
|
+ if (
|
|
|
+ e.target.files[0].type !== "application/pdf" ||
|
|
|
+ e.target.files[0].size / 1024 / 1024 > 50
|
|
|
+ ) {
|
|
|
+ this.$msg.warning(this.$i18n.t("hotspot.pdf_invalid_tip"));
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
+ uploadAttachment(
|
|
|
+ { file: e.target.files[0], sceneCode: this.currentScene.sceneCode },
|
|
|
+ (res) => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.hotspot.pdfInfo = {
|
|
|
+ name: e.target.files[0].name,
|
|
|
+ url: res.data,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ // // 上传pdf,拿到上传结果后给this.pdfInfo赋值
|
|
|
+ // this.hotspot.pdfInfo = {
|
|
|
+ // name: e.target.files[0].name,
|
|
|
+ // url: "",
|
|
|
+ // };
|
|
|
+ },
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -70,11 +87,11 @@ export default {
|
|
|
margin-top: 16px;
|
|
|
width: 100%;
|
|
|
height: 40px;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
border-radius: 2px;
|
|
|
border: 1px solid #404040;
|
|
|
display: block;
|
|
|
- color: #0076F6;
|
|
|
+ color: #0076f6;
|
|
|
font-size: 14px;
|
|
|
cursor: pointer;
|
|
|
&:hover {
|
|
@@ -88,7 +105,7 @@ export default {
|
|
|
margin-top: 16px;
|
|
|
width: 100%;
|
|
|
height: 40px;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
border-radius: 2px;
|
|
|
border: 1px solid #404040;
|
|
|
color: #fff;
|
|
@@ -114,7 +131,7 @@ export default {
|
|
|
right: 18px;
|
|
|
cursor: pointer;
|
|
|
&:hover {
|
|
|
- color: #FA5555;
|
|
|
+ color: #fa5555;
|
|
|
}
|
|
|
}
|
|
|
&:hover {
|
|
@@ -127,11 +144,11 @@ export default {
|
|
|
margin-top: 16px;
|
|
|
width: 100%;
|
|
|
height: 40px;
|
|
|
- background: #1A1B1D;
|
|
|
+ background: #1a1b1d;
|
|
|
border-radius: 2px;
|
|
|
border: 1px solid #404040;
|
|
|
display: block;
|
|
|
- color: #0076F6;
|
|
|
+ color: #0076f6;
|
|
|
font-size: 14px;
|
|
|
cursor: pointer;
|
|
|
&:hover {
|