BUG 25116

This commit is contained in:
aixianling
2021-12-01 18:09:58 +08:00
parent 675933b067
commit 9715f2c568
4 changed files with 22 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
<div v-if="$slots.default" @tap="prev"> <div v-if="$slots.default" @tap="prev">
<slot/> <slot/>
</div> </div>
<u-image v-else :src="src" @tap="prev"> <u-image v-else :src="image" @tap="prev">
<image v-if="link" class="errorImage" slot="error" :src="$cdn+'link.png'"/> <image v-if="link" class="errorImage" slot="error" :src="$cdn+'link.png'"/>
<image v-else-if="miniapp" class="errorImage" slot="error" :src="$cdn+'miniwxmp.jpg'"/> <image v-else-if="miniapp" class="errorImage" slot="error" :src="$cdn+'miniwxmp.jpg'"/>
<image v-else class="errorImage" slot="error" :src="$cdn+'file.png'"/> <image v-else class="errorImage" slot="error" :src="$cdn+'file.png'"/>
@@ -21,6 +21,11 @@ export default {
dialog: false dialog: false
} }
}, },
computed:{
image(){
return this.src?.replace(/\\/g,'/')
}
},
props: { props: {
src: String, src: String,
preview: Boolean, preview: Boolean,
@@ -35,10 +40,10 @@ export default {
...mapActions(['previewFile', 'injectJWeixin']), ...mapActions(['previewFile', 'injectJWeixin']),
prev() { prev() {
if (this.preview) { if (this.preview) {
if (!!this.src) { if (!!this.image) {
uni.previewImage({ uni.previewImage({
current: this.src, current: this.image,
urls: [this.src] urls: [this.image]
}) })
} else { } else {
this.previewFile({size: 1, ...this.file}) this.previewFile({size: 1, ...this.file})

View File

@@ -65,10 +65,10 @@ export default {
watch: { watch: {
def: { def: {
handler(v) { handler(v) {
if (!!v?.toString() && v?.url) { if (!!v?.toString()) {
if (this.multiple) { if (this.multiple) {
this.fileList = v this.fileList = v
} else { } else if (v?.url) {
this.fileList = [v] this.fileList = [v]
} }
} }

View File

@@ -1,15 +1,18 @@
<template> <template>
<section class="mainEntry"> <section class="mainEntry">
<component ref="CurrentEntry" v-if="app" :is="app"/> <component ref="CurrentEntry" v-if="!!app" :is="app"/>
<div v-else> <div v-else>
<AiResult tips="应用建设中.." status="error" btn="返回主页" :btn-tap="back"/> <ai-result tips="应用建设中.." status="error" btn="返回主页" :btn-tap="back"/>
</div> </div>
</section> </section>
</template> </template>
<script> <script>
import AiResult from "../components/AiResult";
export default { export default {
name: "mainEntry", name: "mainEntry",
components: {AiResult},
inject: {root: {}}, inject: {root: {}},
data() { data() {
return { return {
@@ -24,9 +27,14 @@ export default {
}, },
onLoad(params) { onLoad(params) {
this.app = params.app || "" this.app = params.app || ""
sessionStorage.setItem("currentApp", params.app)
}, },
onShow() { onShow() {
this.app = this.$route.query.app || "" this.app = this.$route.query.app || ""
if (!this.app && sessionStorage.getItem("currentApp")) {
this.$router.push({query: {app: sessionStorage.getItem("currentApp")}})
location.reload()
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.CurrentEntry?.emitShow?.() this.$refs.CurrentEntry?.emitShow?.()
}) })