1.修改水印 2.修改三册在线预览

This commit is contained in:
yangzhq68909 2025-05-29 18:25:16 +08:00
parent 23ff8c1d65
commit 88962d4dbd
8 changed files with 42 additions and 44 deletions

View File

@ -1,7 +1,6 @@
<template> <template>
<view :class="['pageLayout', { 'gray': appStore.isGray == 1 }]"> <view :class="['pageLayout', { 'gray': appStore.isGray == 1 }]">
<wd-watermark :content="userStore.userInfo.realname + ' '+ userStore.userInfo.username" <wd-watermark :content="content1" :width="200" :height="200" :opacity="0.3" :size="16" ></wd-watermark>
:width="200" :height="200" :opacity="0.2"></wd-watermark>
<view v-if="navbarShow" :class="{ pageNav: true, transparent: navBgTransparent, fixed: navFixed }" <view v-if="navbarShow" :class="{ pageNav: true, transparent: navBgTransparent, fixed: navFixed }"
:style="{ height: `${statusBarHeight + navHeight}px` }"> :style="{ height: `${statusBarHeight + navHeight}px` }">
<view class="statusBar" :style="{ height: `${statusBarHeight}px` }"></view> <view class="statusBar" :style="{ height: `${statusBarHeight}px` }"></view>
@ -29,6 +28,7 @@
import { useParamsStore } from '@/store/page-params' import { useParamsStore } from '@/store/page-params'
import { useAppStore } from '@/store' import { useAppStore } from '@/store'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import dayjs from 'dayjs';
defineOptions({ defineOptions({
name: 'pageLayout', name: 'pageLayout',
options: { options: {
@ -41,6 +41,7 @@
const userStore = useUserStore() const userStore = useUserStore()
const paramsStore = useParamsStore() const paramsStore = useParamsStore()
const router = useRouter() const router = useRouter()
const content1 = userStore.userInfo.realname + ' ' + userStore.userInfo.workNo + ' ' + dayjs().format('YYYY-MM-DD')
const props = defineProps({ const props = defineProps({
backRouteName: { backRouteName: {
type: String, type: String,

View File

@ -56,10 +56,6 @@
const type = ref('') // const type = ref('') //
var ifH5 = false; var ifH5 = false;
const handleClickLeft = () => {
uni.navigateBack()
}
const getList = (e) => { const getList = (e) => {
loading = true; loading = true;
const handlers = { const handlers = {
@ -69,7 +65,6 @@
'厂级制度': getFactorySystemList, '厂级制度': getFactorySystemList,
'法律法规': getRegulationsList '法律法规': getRegulationsList
}; };
if (e === 1) { if (e === 1) {
handlers[type.value]?.(); handlers[type.value]?.();
} else if (type.value == '厂级制度') { } else if (type.value == '厂级制度') {
@ -183,7 +178,6 @@
} }
const onlinePreView = (e) => { const onlinePreView = (e) => {
console.log(e)
uni.navigateTo({ uni.navigateTo({
url: `/pages/onlinePreview/detail?data=${e}` url: `/pages/onlinePreview/detail?data=${e}`
}); });

View File

@ -12,33 +12,30 @@
<wd-col-picker label="选择目录" v-model="selectedValue" :columns="dataSource" :column-change="columnChange" <wd-col-picker label="选择目录" v-model="selectedValue" :columns="dataSource" :column-change="columnChange"
@confirm="handleConfirm" :display-format="displayFormat"></wd-col-picker> @confirm="handleConfirm" :display-format="displayFormat"></wd-col-picker>
<iframe id="bdIframe" :src="fileUrl" ref="bdIframe" style="border: none;" class="iframe" v-if="fileUrl" /> <iframe id="bdIframe" :src="fileUrl" ref="bdIframe" style="border: none;" class="iframe" v-if="fileUrl" />
<view v-else @click="onlinePreview(item.path)" v-for="(item, i) in fileUrl2" style="padding: 15px 0 0 0"> <view v-else class="bdIframe" @click="onlinePreview(item.path)" v-for="(item, i) in fileUrl2" style="padding: 15px 0 0 0">
<wd-card :title="item.name"></wd-card> <wd-card :title="item.name"></wd-card>
</view> </view>
</PageLayout> </PageLayout>
</template> </template>
<script setup> <script setup>
import {
ref,
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
import { import {
useUserStore useUserStore
} from '@/store/user'; } from '@/store/user'
import { import {
getListApi, getListApi,
getJobDesIdByDepAndName, getJobDesIdByDepAndName,
getPathByInsflagQuote, getPathByInsflagQuote,
queryByIdApi queryByIdApi
} from '@/api/pages/sc'; } from '@/api/pages/sc'
import Base64 from '@/utils/code'; import {
Base64
} from 'js-base64'
import base64 from '@/utils/code';
import { import {
getEnvBaseUrl getEnvBaseUrl
} from '@/utils/index' } from '@/utils/index'
const baseUrl = 'https://10.75.166.6/jeecg-boot/sys/common/static/';
const data = ref([]) const data = ref([])
const dataSource = ref([]) const dataSource = ref([])
const selectedValue = ref([]); const selectedValue = ref([]);
@ -70,14 +67,18 @@
const handleConfirm = ({ const handleConfirm = ({
value value
}) => { }) => {
let base64 = new Base64();
queryByIdApi(value[value.length - 1]).then(res => { queryByIdApi(value[value.length - 1]).then(res => {
let url = res.result.path let url = res.result.path
let quote = res.result.quote let quote = res.result.quote
let insFlag = res.result.insFlag let insFlag = res.result.insFlag
if (url) { if (url) {
fileUrl.value = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(base64 if (isH5()) {
.encode(getEnvBaseUrl() + '/sys/common/static/' + url)) fileUrl.value = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(
Base64.encode(baseUrl + url))
} else {
fileUrl.value = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(
new base64().encode(baseUrl + url))
}
} else if (/^-?\d+$/.test(quote) && !insFlag) { } else if (/^-?\d+$/.test(quote) && !insFlag) {
getJobDesIdByDepAndName({ getJobDesIdByDepAndName({
jobname: quote, jobname: quote,
@ -122,7 +123,7 @@
const onlinePreview = (e) => { const onlinePreview = (e) => {
uni.navigateTo({ uni.navigateTo({
url: `/pages/onlinePreview/${path}?data=${e}` url: `/pages/onlinePreview/detail?data=${e}`
}); });
}; };
@ -160,10 +161,11 @@
</script> </script>
<style lang="scss"> <style lang="scss">
#bdIframe { #bdIframe {
position: absolute; height: calc(100vh - 230rpx);
top: 10; /* 使用视口高度减去顶部固定高度 */
left: 0; border: none;
width: 100%; /* 移除absolute定位改用普通文档流 */
height: 100%; position: relative;
top: 0;
} }
</style> </style>

View File

@ -53,7 +53,6 @@
const captureText = (text) => { // const captureText = (text) => { //
const match = text.match(/\/([^_]+)(?=_)/); const match = text.match(/\/([^_]+)(?=_)/);
console.log(match)
return match ? match[1] : ''; return match ? match[1] : '';
} }

View File

@ -17,7 +17,7 @@
import { import {
onLoad onLoad
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import Base64 from '@/utils/code'; import base64 from '@/utils/code';
import { import {
getEnvBaseUrl getEnvBaseUrl
} from '@/utils/index' } from '@/utils/index'
@ -25,9 +25,9 @@
var fileUrl = ""; var fileUrl = "";
onLoad((options) => { onLoad((options) => {
let base64 = new Base64(); let Base64 = new base64();
var url = baseUrl + JSON.parse(options.data); var url = baseUrl + JSON.parse(options.data);
fileUrl = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(base64.encode(url)) fileUrl = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
}) })
</script> </script>

View File

@ -27,7 +27,6 @@
const baseUrl = 'https://10.75.166.6/jeecg-boot/sys/common/static/'; const baseUrl = 'https://10.75.166.6/jeecg-boot/sys/common/static/';
onLoad((options) => { onLoad((options) => {
console.log(options)
let url = JSON.parse(options.data) let url = JSON.parse(options.data)
url = baseUrl + url; url = baseUrl + url;
fileUrl = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(Base64.encode(url)) fileUrl = 'https://36.112.48.190/preview/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))

View File

@ -1,4 +1,4 @@
export default class Base64 { export default class base64 {
// //
private readonly _keyStr: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; private readonly _keyStr: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

View File

@ -216,7 +216,10 @@ export function formatDate(value, fmt) {
export const hasNewVersion = (version, isWgt = false) => { export const hasNewVersion = (version, isWgt = false) => {
// #ifdef APP_PLUS // #ifdef APP_PLUS
return new Promise((resolve) => { return new Promise((resolve) => {
const transfer = (str) => str.replace(/\./g, '') const transfer = (str) => {
const parts = str.split('.').map(part => part.padStart(4, '0'))
return parts.join('')
}
if (isWgt) { if (isWgt) {
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
const currentVersion = widgetInfo.version const currentVersion = widgetInfo.version
@ -438,7 +441,7 @@ export function getFileAccessHttpUrl(avatar,subStr) {
if (avatar && avatar.startsWith(subStr)) { if (avatar && avatar.startsWith(subStr)) {
return avatar; return avatar;
} else { } else {
if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){ if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
return getEnvBaseUrl() + "/sys/common/static/" + avatar; return getEnvBaseUrl() + "/sys/common/static/" + avatar;
} }
} }