乡村相册

This commit is contained in:
yanran200730
2022-05-17 18:00:35 +08:00
parent c38c92f19a
commit 9043377f2c
9 changed files with 258 additions and 29 deletions

View File

@@ -99,7 +99,6 @@
count: 1,
sizeType: ['compressed'],
success: res => {
console.log(res.tempFiles[0])
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {

View File

@@ -22,7 +22,7 @@
</div>
</div>
<div class="add">
<div class="add-btn" @click="choose">
<div class="add-btn">
<span>添加图片</span>
</div>
<div class="add-btn">

View File

@@ -66,7 +66,7 @@
.top {
width: 100%;
height: 16px;
background: url(./../images/xc-icon.png) repeat;
background: url(./../../images/xc-icon.png) repeat;
background-size: 16px 16px;
}

View File

@@ -1,28 +1,26 @@
<template>
<div class="WorkReport">
<div class="top">
<span>请输入汇报单位</span>
<span>2022-03-09</span>
<div class="WorkReport" ref="report">
<div class="top" @click="linkTo('./ReportConfig')">
<span>{{ form.unit || '请输入汇报单位' }}</span>
<span>{{ form.date || '请选择日期' }}</span>
</div>
<div class="body">
<div class="body" @click="linkTo('./ReportConfig')">
<h2>工作汇报</h2>
<div class="subtitle">千言街巡查情况汇报</div>
<div class="subtitle">{{ form.title || '请输入标题' }}</div>
<div class="partition">
<div><i></i></div>
</div>
</div>
<div class="bottom">
<div class="bottom-item__wrapper">
<div class="bottom-item__wrapper" @click="linkTo('./ReportConfig')">
<div class="bottom-item">
<label>汇报人</label>
<span>鄢然</span>
<label>汇报人{{ form.name || '请输入汇报人姓名' }}</label>
</div>
<div class="bottom-item">
<label>备注</label>
<span>鄢然</span>
<span>备注{{ '请输入备注' }}</span>
</div>
</div>
<div class="add">
<div class="add" data-html2canvas-ignore ref="add">
<div class="add-btn">
<span>添加图片</span>
</div>
@@ -31,10 +29,12 @@
</div>
</div>
</div>
<image v-if="waterSrc" :src="waterSrc" />
</div>
</template>
<script>
import html2canvas from 'html2canvas'
export default {
name: 'WorkReport',
@@ -42,16 +42,71 @@
data () {
return {
waterSrc: '',
form: {
unit: '',
title: '',
date: '',
name: ''
}
}
},
onLoad () {
mounted () {
uni.$on('change', e => {
console.log(e)
e.forEach(v => {
this.form[v.key] = v.value
})
})
},
methods: {
save () {
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
html2canvas(this.$refs.report, {
allowTaint: true,
useCORS: true,
height
}).then((canvas) => {
let dataURL = canvas.toDataURL('image/png')
this.waterSrc = dataURL
}).catch(e => {
console.log(e)
})
},
linkTo (path) {
const data = [
{
type: 'text',
key: 'unit',
value: '',
label: '汇报单位'
},
{
type: 'text',
key: 'title',
value: '',
label: '标题'
},
{
type: 'text',
key: 'name',
value: '',
label: '汇报人'
},
{
type: 'date',
key: 'date',
value: '',
label: '汇报日期'
}
]
uni.navigateTo({
url: `${path}?params=${JSON.stringify(data)}`
})
}
}
}
</script>
@@ -146,6 +201,11 @@
color: #333333;
font-size: 32px;
span {
flex: 1;
text-align: justify;
}
&:last-child {
margin-bottom: 0;
}