|
@@ -7,26 +7,27 @@
|
|
</Header>
|
|
</Header>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
- <div class="mySwiper" v-if="loaded">
|
|
|
|
|
|
+ <div v-show="!isWrite" class="mySwiper" v-if="loaded">
|
|
<div class="swiper-wrapper">
|
|
<div class="swiper-wrapper">
|
|
<div class="swiper-slide" v-for="(i, index) in eleList">
|
|
<div class="swiper-slide" v-for="(i, index) in eleList">
|
|
- <div class="warpper" :class="{ downMode, 'no-padding': tableType == 'law' }" :id="`layoutRef${index}`">
|
|
|
|
- <component :downMode="downMode" :is="i"></component>
|
|
|
|
|
|
+ <div class="warpper" :class="{ downMode, 'no-padding': tableType == 'law' }" :id="`layoutRef${index}`">
|
|
|
|
+ <component :page="askPage" :pageIndex="index" :text="text" @onTextChange="onTextChange" @onTextConfirm="onTextConfirm" @goWrite="goWrite" :downMode="downMode" :is="i"></component>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <Write v-if="isWrite" :text="text" :textIndex="textIndex" @onTextConfirm="onTextConfirm"> </Write>
|
|
</MainPanel>
|
|
</MainPanel>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { reactive, ref, toRefs, onBeforeMount, onMounted, nextTick, onActivated, onDeactivated } from 'vue';
|
|
|
|
|
|
+import { reactive, ref, watch, onMounted, nextTick, onActivated, onDeactivated } from 'vue';
|
|
import { router } from '@/router';
|
|
import { router } from '@/router';
|
|
import Swiper from 'swiper';
|
|
import Swiper from 'swiper';
|
|
-import 'swiper/swiper.min.css';
|
|
|
|
import html2canvas from 'html2canvas';
|
|
import html2canvas from 'html2canvas';
|
|
import { downloadImage, uploadImage } from '@/store/sync';
|
|
import { downloadImage, uploadImage } from '@/store/sync';
|
|
import { genUseLoading } from '@/hook';
|
|
import { genUseLoading } from '@/hook';
|
|
|
|
+import Write from './write/index.vue';
|
|
import Message from '@/components/base/components/message/message.vue';
|
|
import Message from '@/components/base/components/message/message.vue';
|
|
import Header from '@/components/photos/header.vue';
|
|
import Header from '@/components/photos/header.vue';
|
|
import MainPanel from '@/components/main-panel/index.vue';
|
|
import MainPanel from '@/components/main-panel/index.vue';
|
|
@@ -48,16 +49,49 @@ import extract from './extract.vue';
|
|
import legacy from './legacy.vue';
|
|
import legacy from './legacy.vue';
|
|
//询问、讯问
|
|
//询问、讯问
|
|
import ask from './ask.vue';
|
|
import ask from './ask.vue';
|
|
|
|
+import doc from './write/doc.vue';
|
|
|
|
|
|
//法规
|
|
//法规
|
|
import law from './law.vue';
|
|
import law from './law.vue';
|
|
-import { transform } from 'html2canvas/dist/types/css/property-descriptors/transform';
|
|
|
|
// const eleList = ref([one, two, three, four]);
|
|
// const eleList = ref([one, two, three, four]);
|
|
// const eleList = ref([authorOne, authorTwo]);
|
|
// const eleList = ref([authorOne, authorTwo]);
|
|
|
|
+
|
|
const eleList = ref([]);
|
|
const eleList = ref([]);
|
|
const headerTitle = ref('');
|
|
const headerTitle = ref('');
|
|
const tableType = ref<string | string[]>();
|
|
const tableType = ref<string | string[]>();
|
|
const downMode = ref(false);
|
|
const downMode = ref(false);
|
|
|
|
+const askPage = ref(1);
|
|
|
|
+const askText = ref('');
|
|
|
|
+
|
|
|
|
+const isWrite = ref(false);
|
|
|
|
+const text = ref('');
|
|
|
|
+const textIndex = ref(0);
|
|
|
|
+
|
|
|
|
+const setAskPage = () => {
|
|
|
|
+ loaded.value = false;
|
|
|
|
+ eleList.value = [ask];
|
|
|
|
+ if (askPage.value > 1) {
|
|
|
|
+ for (let i = 0; i < askPage.value - 1; i++) {
|
|
|
|
+ eleList.value.push(doc);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ initSwiper();
|
|
|
|
+};
|
|
|
|
+const goWrite = (data) => {
|
|
|
|
+ console.error(data)
|
|
|
|
+ isWrite.value = true;
|
|
|
|
+ textIndex.value = data.textIndex;
|
|
|
|
+};
|
|
|
|
+const onTextConfirm = (data) => {
|
|
|
|
+ console.error(data)
|
|
|
|
+ askPage.value = data.page;
|
|
|
|
+ text.value = data.text;
|
|
|
|
+ isWrite.value = false;
|
|
|
|
+ setAskPage();
|
|
|
|
+};
|
|
|
|
+const onTextChange = (data) => {
|
|
|
|
+ text.value = data.text;
|
|
|
|
+};
|
|
|
|
|
|
const saveHandler = genUseLoading(async () => {
|
|
const saveHandler = genUseLoading(async () => {
|
|
await getLayoutImage();
|
|
await getLayoutImage();
|
|
@@ -72,9 +106,12 @@ const getLayoutImage = async () => {
|
|
eleList.value.forEach(async (element, index) => {
|
|
eleList.value.forEach(async (element, index) => {
|
|
// console.error(layoutRef.value);
|
|
// console.error(layoutRef.value);
|
|
let ele = document.getElementById(`layoutRef${index}`);
|
|
let ele = document.getElementById(`layoutRef${index}`);
|
|
|
|
+
|
|
const canvas = await html2canvas(ele);
|
|
const canvas = await html2canvas(ele);
|
|
Message.success({ msg: '已保存至相册', time: 2000 });
|
|
Message.success({ msg: '已保存至相册', time: 2000 });
|
|
- const blob = await new Promise<Blob>((resolve) => canvas.toBlob(resolve, 'image/jpeg', 0.95));
|
|
|
|
|
|
+ const blob = await new Promise<Blob>((resolve) => {
|
|
|
|
+ return canvas.toBlob(resolve, 'image/jpeg', 0.95);
|
|
|
|
+ });
|
|
await downloadImage(blob, `tables_${index}.jpg`);
|
|
await downloadImage(blob, `tables_${index}.jpg`);
|
|
num++;
|
|
num++;
|
|
|
|
|
|
@@ -128,9 +165,10 @@ const initTables = () => {
|
|
};
|
|
};
|
|
const mySwiper = ref(null);
|
|
const mySwiper = ref(null);
|
|
const loaded = ref(false);
|
|
const loaded = ref(false);
|
|
-onActivated(() => {
|
|
|
|
- initTables();
|
|
|
|
-
|
|
|
|
|
|
+const initSwiper = () => {
|
|
|
|
+ if (mySwiper.value) {
|
|
|
|
+ mySwiper.value.destroy(true);
|
|
|
|
+ }
|
|
loaded.value = true;
|
|
loaded.value = true;
|
|
mySwiper.value = null;
|
|
mySwiper.value = null;
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -147,6 +185,10 @@ onActivated(() => {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+};
|
|
|
|
+onActivated(() => {
|
|
|
|
+ initTables();
|
|
|
|
+ initSwiper();
|
|
});
|
|
});
|
|
const scale = ref('1');
|
|
const scale = ref('1');
|
|
const initPage = () => {
|
|
const initPage = () => {
|