Files
sifa-mp/legalLegalDoc/pages/result.vue
T
2025-05-22 10:33:32 +08:00

143 lines
4.9 KiB
Vue

<template>
<view class="min-height bg-main-light p-30">
<HeaderItem :title="title"/>
<view class="text-30 font-bold text-center">{{ title }}</view>
<u-textarea v-model="contentDetail" border="none" maxlength="-1" :disabled="disabled" autoHeight
:customStyle="{background: 'transparent'}" :confirmType="null"/>
<view class="footer flex justify-center items-center text-white text-25" v-if="disabled">
<view class="bg-linear flex-1 p-20 flex justify-center items-center" @click="make('email')">
<u-icon name="email" color="white" size="40rpx"/>
<text>发送至邮箱</text>
</view>
<view class="bg-white flex-1 p-20 flex justify-center items-center text-black" @click="make('download')">
<u-icon name="/legalLegalDoc/static/mobile.png" size="40rpx"/>
<text>下载至手机</text>
</view>
<view class="bg-linear flex-1 p-20 flex justify-center items-center" @click="disabled = false">
<u-icon name="edit-pen" color="white" size="40rpx"/>
<text>我要编辑</text>
</view>
</view>
<view class="footer flex justify-center items-center text-white text-25 bg-linear" v-else>
<view class="flex-1 p-20 text-center" @click="disabled = true">我要带走</view>
</view>
<u-popup :show="showEmail" close-on-click-overlay @close="showEmail = false" round="10"
:closeable="false" mode="center" :customStyle="{width: '80%'}"
:safe-area-inset-bottom="false">
<view class="p-50 pos-r" v-if="showEmail">
<u-input v-model="email" placeholder="请填写邮箱地址"/>
</view>
<view class="flex justify-center items-center text-25">
<view class="flex-1 p-20 text-center" @click="showEmail = false">取消发送</view>
<view class="flex-1 p-20 bg-linear text-white text-center" style="border-radius: 0 0 10px 0" @click="doSend">
确认发送
</view>
</view>
</u-popup>
</view>
</template>
<script>
import HeaderItem from "@/components/HeaderItem.vue";
import {listArticleReq} from "@/api/common";
import {listLegalOrgCheckTypeInfoReq} from "@/api/legalOrgCheck";
import piaoyiProgressBar
from '@/uni_modules/piaoyi-progress-bar/components/piaoyi-progress-bar/piaoyi-progress-bar.vue';
import {legalDocMakeReq, legalDocSendEmailReq, legalDocTypeInfoReq} from "@/api/legalDoc";
import {API, MAIN_API} from "@/config";
export default {
name: "result",
components: {HeaderItem, piaoyiProgressBar},
data() {
return {
title: '',
typeId: null,
content: [],
config: null,
articleList: [],
point: 0,
levelStyle: {
color: 'white',
background: 'linear-gradient(97.98deg, rgba(255,201,35,1) 30.49%,rgba(255,144,10,1) 78.96%)',
border: 0,
width: '300rpx'
},
disabled: false,
showEmail: false,
contentDetail: '',
email: '',
file: '',
}
},
methods: {
back() {
uni.navigateBack()
},
async getConfig() {
const {data} = await legalDocTypeInfoReq(this.typeId)
this.config = data
this.contentDetail = `${this.config.topContent}\n`
this.content.map(item => {
this.contentDetail += `${item.quest}\n`
item.answer.map(answer => {
this.contentDetail += `${answer}\n`
})
this.contentDetail += `\n`
})
this.contentDetail += ` 此致\n`
this.contentDetail += ` 人民法院\n`
this.contentDetail += ` 申请人(签字):\n`
this.contentDetail += ` 年 月 日\n`
this.contentDetail += `${this.config.extraContent}\n`
},
async make(method) {
const {data} = await legalDocMakeReq({
title: this.title,
userContent: this.contentDetail
})
this.file = data
if (method === 'download') {
uni.showLoading({
title: '下载中'
})
uni.downloadFile({
url: `${API}${data}`,
success: function (res) {
uni.hideLoading()
uni.openDocument({
showMenu: true,
filePath: res.tempFilePath
})
}
})
} else {
this.email = ''
this.showEmail = true
}
},
async doSend() {
if (!this.email) return this.$toast('请输入邮箱地址')
await legalDocSendEmailReq({
email: this.email,
title: this.title,
file: this.file
})
this.showEmail = false
this.$toast('已发送,请注意查收')
}
},
onLoad({title, typeId, point}) {
this.title = title
this.typeId = typeId
this.point = point
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('content', async data => {
this.content = data
console.log(this.content)
await this.getConfig()
})
}
}
</script>