Commit 3f270845 by chenwq1

fix:报告管理分享

1 parent 7ccf15f2
<template> <template>
<view class="material-detail"> <view class="material-detail">
<view class="nav-bar"> <!-- App+html+保存:顶部通栏大按钮 + 可选标题,无返回;其它:返回+标题+右上角保存 -->
<view class="back" @click.stop="back"> <view class="nav-chrome">
<uni-icons type="left" :size="20" color="#000"></uni-icons> <template v-if="appHtmlFullSaveMode">
</view>
<!-- 勿撑满整行;中间层会挡住右侧「保存」的点击,返回在左侧故正常 --> <view class="nav-app-html-tool">
<view class="nav-title">{{ title }}</view> <view
<view class="nav-app-html-tool__btn"
v-if="showSaveEntry" hover-class="nav-app-html-tool__btn--hover"
class="nav-save-hit" @click.stop="saveReportImage"
@click.stop="saveReportImage" @tap.stop="saveReportImage"
@tap.stop="saveReportImage" >保存图片</view>
@longpress.stop="saveReportImage" </view>
> </template>
<view class="nav-save-btn">保存图片</view> <view v-else class="nav-bar">
<view class="nav-leading">
<view class="back" @click.stop="back" @tap.stop="back">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
</view>
<view class="nav-title">{{ title }}</view>
<view
v-if="showSaveEntry"
class="nav-save-hit"
@click.stop="saveReportImage"
@tap.stop="saveReportImage"
@longpress.stop="saveReportImage"
>
<view class="nav-save-btn">保存图片</view>
</view>
</view> </view>
</view> </view>
<!-- App:web-view 勿再包一层 view,否则 $getAppWebview().children()[0] 可能不是子 webview -->
<web-view <web-view
v-if="fileUrltype === 'html' && isAppClient" v-if="fileUrltype === 'html' && isAppClient"
:src="previewUrl" :src="previewUrl"
:webview-styles="htmlWebviewInsetStyle" :webview-styles="htmlWebviewInsetStyle"
></web-view> ></web-view>
<!-- H5 等:用外壳把 iframe 限制在导航下方 -->
<view <view
v-else-if="fileUrltype === 'html'" v-else-if="fileUrltype === 'html' && !isAppClient"
class="html-webview-shell" class="html-webview-shell"
:style="htmlWebviewShellStyle" :style="htmlWebviewShellStyle"
> >
...@@ -91,11 +104,21 @@ export default { ...@@ -91,11 +104,21 @@ export default {
showSaveEntry () { showSaveEntry () {
return this.showSaveBtn && !!this.reportImageUrl return this.showSaveBtn && !!this.reportImageUrl
}, },
/** 未测到布局前的兜底:与 .nav-bar 设计稿 top+height 一致 */ /** App+html+保存:顶部通栏大按钮,无返回 icon */
appHtmlFullSaveMode () {
return this.showSaveEntry && this.isAppClient && this.fileUrltype === 'html'
},
/** 未测到布局前:与 .nav-chrome(含通栏工具条)高度兜底一致 */
htmlReportNavTopPx () { htmlReportNavTopPx () {
const sys = uni.getSystemInfoSync() const sys = uni.getSystemInfoSync()
const rpxPx = sys.windowWidth / 750 const r = sys.windowWidth / 750
return Math.ceil((48 + 96) * rpxPx) const topOffset = Math.ceil(48 * r)
if (this.appHtmlFullSaveMode) {
const titleH = this.title ? Math.ceil(72 * r) : 0
const toolH = Math.ceil((12 + 88 + 16) * r)
return topOffset + titleH + toolH
}
return Math.ceil((48 + 96) * r)
}, },
/** 子 web-view 的 top:优先用实测导航栏底边,消除「预留导航」与真机之间的多余白缝 */ /** 子 web-view 的 top:优先用实测导航栏底边,消除「预留导航」与真机之间的多余白缝 */
effectiveHtmlWebviewTopPx () { effectiveHtmlWebviewTopPx () {
...@@ -123,7 +146,7 @@ export default { ...@@ -123,7 +146,7 @@ export default {
height: h height: h
} }
}, },
/** H5 等无 plus:用 fixed 容器把 web-view 限制在导航下方,避免 iframe 全屏挡导航 */ /** H5:fixed 外壳把 iframe 限制在导航下方 */
htmlWebviewShellStyle () { htmlWebviewShellStyle () {
if (this.fileUrltype !== 'html' || this.isAppClient) { if (this.fileUrltype !== 'html' || this.isAppClient) {
return {} return {}
...@@ -162,7 +185,7 @@ export default { ...@@ -162,7 +185,7 @@ export default {
const run = () => { const run = () => {
uni.createSelectorQuery() uni.createSelectorQuery()
.in(this) .in(this)
.select('.nav-bar') .select('.nav-chrome')
.boundingClientRect(rect => { .boundingClientRect(rect => {
if (!rect || rect.bottom <= 0) return if (!rect || rect.bottom <= 0) return
const bottom = Math.ceil(rect.bottom) const bottom = Math.ceil(rect.bottom)
...@@ -292,31 +315,75 @@ export default { ...@@ -292,31 +315,75 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.nav-bar { .nav-chrome {
position: fixed; position: fixed;
width: 100%;
height: toRpx(96);
left: 0; left: 0;
top: toRpx(48); top: toRpx(48);
/* App 端 html 已用 webview-styles 下移,导航需压在内容之上 */ width: 100%;
z-index: 99999; z-index: 999999;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
}
.nav-app-html-title {
padding: toRpx(20) toRpx(40) toRpx(8);
text-align: center;
font-size: toRpx(30);
font-weight: 700;
color: #1a1a1a;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.nav-app-html-tool {
padding: toRpx(12) toRpx(32) toRpx(20);
}
.nav-app-html-tool__btn {
width: toRpx(188);
height: toRpx(88);
line-height: toRpx(88);
text-align: center;
border-radius: toRpx(44);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: toRpx(28);
font-weight: 600;
}
.nav-app-html-tool__btn--hover {
opacity: 0.9;
}
.nav-bar {
position: relative;
width: 100%;
height: toRpx(96);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-weight: 700; font-weight: 700;
font-size: toRpx(32); font-size: toRpx(32);
color: #1a1a1a; color: #1a1a1a;
.back { }
position: absolute; .nav-leading {
left: 0; position: absolute;
top: 0; left: 0;
height: 100%; top: 0;
aspect-ratio: 1/1; bottom: 0;
display: flex; z-index: 10;
align-items: center; display: flex;
justify-content: center; flex-direction: row;
z-index: 2; align-items: center;
} max-width: 56%;
padding-left: toRpx(8);
box-sizing: border-box;
}
.back {
flex-shrink: 0;
width: toRpx(88);
height: 100%;
display: flex;
align-items: center;
justify-content: center;
} }
.nav-title { .nav-title {
flex: 0 1 auto; flex: 0 1 auto;
......
...@@ -568,7 +568,7 @@ export default { ...@@ -568,7 +568,7 @@ export default {
if (i.status === 1) { if (i.status === 1) {
const reportUrl = i.reportUrl const reportUrl = i.reportUrl
const reportImageUrl = encodeURIComponent(i.reportImageUrl || '') const reportImageUrl = encodeURIComponent(i.reportImageUrl || '')
const url = `/pages/evaluationForm/components/pdfPreView?fileUrl=${reportUrl}&fileUrltype=html&Signature=false&showSaveBtn=1&reportImageUrl=https://qcimg01.glsx.com.cn/group1/M00/11/2D/wKgD3mlp5bOARKAEAAIuA5mRcio993.jpg` const url = `/pages/evaluationForm/components/pdfPreView?fileUrl=${reportUrl}&fileUrltype=html&Signature=false&showSaveBtn=1&reportImageUrl=${reportImageUrl}`
uni.navigateTo({ uni.navigateTo({
url: `${url}` url: `${url}`
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!