|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="new-fire-details">
|
|
|
+ <div class="new-fire-details" v-if="allowEnter">
|
|
|
<!-- 顶部标题栏 -->
|
|
|
<headerTop :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" :showSave="showSave" @save="saveEditSub" @back="backEditSub" />
|
|
|
<editFilePage :caseId="caseId" :currentRecord="currentRecord" :editOrShow="editOrShow" ref="editFilePageRef" />
|
|
|
@@ -10,7 +10,7 @@
|
|
|
<!-- 编辑页 -->
|
|
|
<editIndex :caseId="caseId" :currentRecord="currentRecord" :fromRoute="fromRoute" :processingIds="processingIds" :recentAddedItem="recentAddedItem" @start="startShot" @playVideo="playVideo" v-else />
|
|
|
</div>
|
|
|
- <shot v-if="isShot" @close="closeHandler" @append="appendFragment" @playVideo="playVideo"
|
|
|
+ <shot v-if="isShot && allowEnter" @close="closeHandler" @append="appendFragment" @playVideo="playVideo"
|
|
|
@updateCover="(cover: string) => $emit('updateCover', cover)" @deleteRecord="$emit('delete')" :record="record" />
|
|
|
<el-dialog
|
|
|
v-model="previewVisible"
|
|
|
@@ -29,12 +29,27 @@
|
|
|
<source :src="palyUrl" />
|
|
|
</video>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 分享访问密码弹窗 -->
|
|
|
+ <el-dialog v-model="passwordDialogVisible" title="请输入访问密码" width="360px" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
|
|
|
+ <div style="padding: 4px 8px;">
|
|
|
+ <el-input v-model="inputPwd" maxlength="4" placeholder="请输入4位数字密码" style="width: 200px;" />
|
|
|
+ <p style="margin-top: 10px; color: #969799;">请填写分享链接设置的4位数字密码</p>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="cancelAccess">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmAccess">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, computed, onMounted, onUnmounted } from "vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
+import md5 from 'js-md5';
|
|
|
import showIndex from './showIndex.vue';
|
|
|
import editIndex from './editIndex.vue';
|
|
|
import { copyCase, getCaseSceneList, getCaseInfo, updateCaseInfo } from "@/store/case";
|
|
|
@@ -71,28 +86,75 @@ const pageTitle = computed(() => {
|
|
|
const cr: any = currentRecord.value || {};
|
|
|
return cr?.caseTitle || cr?.tmProject?.projectName || '';
|
|
|
});
|
|
|
+// 分享访问密码校验
|
|
|
+const allowEnter = ref(true);
|
|
|
+const passwordDialogVisible = ref(false);
|
|
|
+const inputPwd = ref('');
|
|
|
+const linkPwd = computed(() => {
|
|
|
+ try {
|
|
|
+ const p = String(route.query.p || '');
|
|
|
+ return p;
|
|
|
+ } catch (e) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+// 加载案件基本信息
|
|
|
+const loadCaseInfo = async () => {
|
|
|
+ try {
|
|
|
+ const caseInfo = await getCaseInfo(caseId.value!);
|
|
|
+ if (caseInfo && fromRoute.value == 'fire') {
|
|
|
+ currentRecord.value = caseInfo;
|
|
|
+ currentRecord.value.tmProject.mapUrl = caseInfo.mapUrl || '';
|
|
|
+ currentRecord.value.tmProject.latAndLong = caseInfo.latAndLong || '';
|
|
|
+ } else if (fromRoute.value == 'criminal') {
|
|
|
+ currentRecord.value = caseInfo;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ const msg = typeof error === 'string' ? error : (error?.msg || error?.message || '');
|
|
|
+ if (msg.includes('未登录') || msg.includes('失效')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vueRouter.replace({ name: RouteName.noCase, query: {} });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const cancelAccess = () => {
|
|
|
+ // 取消访问,返回上一页或者跳转无权限页
|
|
|
+ vueRouter.replace({ name: RouteName.noCase, query: {} });
|
|
|
+};
|
|
|
+const confirmAccess = () => {
|
|
|
+ const userPwd = String(inputPwd.value || '').trim();
|
|
|
+ if (!userPwd || userPwd.length !== 4) {
|
|
|
+ ElMessage.error('请输入4位数字密码');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (md5(userPwd) !== linkPwd.value) {
|
|
|
+ ElMessage.error('密码错误');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 验证通过,关闭弹窗并允许进入页面
|
|
|
+ passwordDialogVisible.value = false;
|
|
|
+ allowEnter.value = true;
|
|
|
+ ElMessage.success('验证成功');
|
|
|
+ // 验证成功后拉取基本信息
|
|
|
+ loadCaseInfo();
|
|
|
+};
|
|
|
onMounted(() => {
|
|
|
- setTimeout(async() => {
|
|
|
- try {
|
|
|
- console.log(caseId.value, fromRoute.value, 8888)
|
|
|
- const caseInfo = await getCaseInfo(caseId.value!);
|
|
|
- if (caseInfo && fromRoute.value == 'fire') {
|
|
|
- currentRecord.value = caseInfo;
|
|
|
- currentRecord.value.tmProject.mapUrl = caseInfo.mapUrl || '';
|
|
|
- currentRecord.value.tmProject.latAndLong = caseInfo.latAndLong || '';
|
|
|
- console.log(currentRecord.value, 8888)
|
|
|
- } else if (fromRoute.value == 'criminal') {
|
|
|
- currentRecord.value = caseInfo;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- // throw "该案件不存在!";
|
|
|
- //跳转到无权限页面
|
|
|
- vueRouter.replace({
|
|
|
- name: RouteName.noCase,
|
|
|
- query: {}
|
|
|
- });
|
|
|
+ // 分享访问控制:带 share=1 则弹窗输入密码后再进入
|
|
|
+ try {
|
|
|
+ const shareFlag = String(route.query.share || '') === '1';
|
|
|
+ if (shareFlag) {
|
|
|
+ allowEnter.value = false;
|
|
|
+ passwordDialogVisible.value = true;
|
|
|
}
|
|
|
+ } catch (e) {}
|
|
|
+
|
|
|
+ // 仅在允许进入时拉取基本信息
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!allowEnter.value) return;
|
|
|
+ loadCaseInfo();
|
|
|
}, 0);
|
|
|
|
|
|
// 监听标题更新事件:由 basicInfo 自动保存成功派发
|