|
@@ -31,9 +31,11 @@
|
|
|
<script setup lang="ts">
|
|
|
import { getJSON } from "@/api/jsonMark";
|
|
|
import { store } from "./store";
|
|
|
-import { ref, watch } from "vue";
|
|
|
+import { onUpdated, ref, watch } from "vue";
|
|
|
import { renderRichText } from "@/utils/renderJSON";
|
|
|
import type { RichTextJSON } from "@/types";
|
|
|
+import "viewerjs/dist/viewer.css";
|
|
|
+import Viewer from "viewerjs";
|
|
|
|
|
|
interface StudentAnswer {
|
|
|
mainNumber: number;
|
|
@@ -49,7 +51,6 @@ interface QuestionForRender {
|
|
|
standardAnswerr: Array<RichTextJSON> | null;
|
|
|
}
|
|
|
|
|
|
-const rendered = ref(null as unknown as HTMLDivElement);
|
|
|
const questions = ref([] as Array<QuestionForRender>);
|
|
|
async function updateStudentAnswerJSON() {
|
|
|
return getJSON(store.currentTask?.jsonUrl as string);
|
|
@@ -108,6 +109,22 @@ watch(
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
);
|
|
|
+
|
|
|
+let viewer: Viewer = null as unknown as Viewer;
|
|
|
+onUpdated(() => {
|
|
|
+ viewer && viewer.destroy();
|
|
|
+ viewer = new Viewer(
|
|
|
+ document.querySelector(".rich-text-question-container") as HTMLElement,
|
|
|
+ // document.querySelector("#app") as HTMLElement,
|
|
|
+ {
|
|
|
+ // inline: true,
|
|
|
+ viewed() {
|
|
|
+ // viewer.zoomTo(1);
|
|
|
+ },
|
|
|
+ zIndex: 10000,
|
|
|
+ }
|
|
|
+ );
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -124,4 +141,7 @@ watch(
|
|
|
.rich-text-question-container img.inline {
|
|
|
display: inline;
|
|
|
}
|
|
|
+.rich-text-question-container img {
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|