Commit e4e08c94 authored by leidahong's avatar leidahong

事件处理跳转

parent a884876e
......@@ -10,13 +10,21 @@
<div class="handle-item">
<div class="label">上传处理前图片</div>
<div class="val">
<van-uploader v-model="beforeHandleImgs" :after-read="beforeHandleUpload" multiple />
<van-uploader
v-model="beforeHandleImgs"
:after-read="beforeHandleUpload"
multiple
/>
</div>
</div>
<div class="handle-item">
<div class="label">上传处理后图片</div>
<div class="val">
<van-uploader v-model="afterHandleImgs" :after-read="afterHandleUpload" multiple />
<van-uploader
v-model="afterHandleImgs"
:after-read="afterHandleUpload"
multiple
/>
</div>
</div>
<div class="handle-item">
......@@ -26,123 +34,138 @@
</div>
</div>
<div class="btn-box">
<van-button type="info" style="height: .86rem; background-color: #3978F8;" round size="large" @click="submit">提交</van-button>
<van-button
type="info"
style="height: 0.86rem; background-color: #3978f8"
round
size="large"
@click="submit"
>提交</van-button
>
</div>
</div>
</div>
</template>
<script>
import { Toast } from 'vant'
import { handleEvent, uploadImg } from '../api/index'
import { Toast } from "vant";
import { handleEvent, uploadImg } from "../api/index";
export default {
data() {
return {
content: '',
content: "",
beforeHandleImgs: [],
afterHandleImgs: [],
fileList: []
}
fileList: [],
};
},
methods: {
submit() {
let data = {
beforeProcessImgList: this.beforeHandleImgs.map(item => item.url).join(','),
afterProcessImgList: this.afterHandleImgs.map(item => item.url).join(','),
beforeProcessImgList: this.beforeHandleImgs
.map((item) => item.url)
.join(","),
afterProcessImgList: this.afterHandleImgs
.map((item) => item.url)
.join(","),
eventId: this.$route.query.id,
processContent: this.content,
fileUrlList: this.fileList.map(item => item.url).join(',')
fileUrlList: this.fileList.map((item) => item.url).join(","),
};
handleEvent(data).then((res) => {
if (this.content.trim() === "") {
Toast.fail("请填写处理内容");
return;
}
handleEvent(data).then(res => {
if (res.code === 200) {
Toast.success('提交成功')
this.$router.go(-1)
Toast.success("提交成功");
this.$router.replace("/home");
}
})
});
},
beforeHandleUpload(files) {
let fileArr = []
let fileArr = [];
if (!Array.isArray(files)) {
fileArr.push(files.file)
fileArr.push(files.file);
} else {
fileArr = files
fileArr = files;
}
let startIndex = this.beforeHandleImgs.length - fileArr.length
for(let i = startIndex; i < this.beforeHandleImgs.length; i ++) {
this.beforeHandleImgs[i].status = 'uploading'
let startIndex = this.beforeHandleImgs.length - fileArr.length;
for (let i = startIndex; i < this.beforeHandleImgs.length; i++) {
this.beforeHandleImgs[i].status = "uploading";
let formData = new FormData();
formData.append("file", this.beforeHandleImgs[i].file);
uploadImg(formData).then(res => {
uploadImg(formData).then((res) => {
if (res.code === 200) {
this.beforeHandleImgs[i].status = 'done'
this.beforeHandleImgs[i].url = res.data.url
this.beforeHandleImgs[i].status = "done";
this.beforeHandleImgs[i].url = res.data.url;
} else {
this.beforeHandleImgs[i].status = 'failed'
this.beforeHandleImgs[i].status = "failed";
}
})
});
}
},
afterHandleUpload(files) {
let fileArr = []
let fileArr = [];
if (!Array.isArray(files)) {
fileArr.push(files.file)
fileArr.push(files.file);
} else {
fileArr = files
fileArr = files;
}
let startIndex = this.afterHandleImgs.length - fileArr.length
for(let i = startIndex; i < this.afterHandleImgs.length; i ++) {
this.afterHandleImgs[i].status = 'uploading'
let startIndex = this.afterHandleImgs.length - fileArr.length;
for (let i = startIndex; i < this.afterHandleImgs.length; i++) {
this.afterHandleImgs[i].status = "uploading";
let formData = new FormData();
formData.append("file", this.afterHandleImgs[i].file);
uploadImg(formData).then(res => {
uploadImg(formData).then((res) => {
if (res.code === 200) {
this.afterHandleImgs[i].status = 'done'
this.afterHandleImgs[i].url = res.data.url
this.afterHandleImgs[i].status = "done";
this.afterHandleImgs[i].url = res.data.url;
} else {
this.afterHandleImgs[i].status = 'failed'
}
})
}
this.afterHandleImgs[i].status = "failed";
}
});
}
}
},
},
};
</script>
<style lang="scss" scoped>
.handle-container{
.handle-form{
border-top: 14px solid #F7F7F7;
.handle-item{
padding: .24rem .46rem .2rem;
.label{
font-size: .31rem;
}
.val{
margin-top: .2rem;
textarea{
.handle-container {
.handle-form {
border-top: 14px solid #f7f7f7;
.handle-item {
padding: 0.24rem 0.46rem 0.2rem;
.label {
font-size: 0.31rem;
}
.val {
margin-top: 0.2rem;
textarea {
width: 100%;
height: 1.8rem;
font-size: .3rem;
font-size: 0.3rem;
}
}
}
.content{
border-bottom: 14px solid #F7F7F7;
.label{
.content {
border-bottom: 14px solid #f7f7f7;
.label {
position: relative;
&::before{
content: '*';
color: #F74C31;
&::before {
content: "*";
color: #f74c31;
position: absolute;
left: -.2rem;
top: .05rem;
font-size: .3rem;
left: -0.2rem;
top: 0.05rem;
font-size: 0.3rem;
}
}
}
}
.btn-box{
padding: .6rem .62rem 0;
.btn-box {
padding: 0.6rem 0.62rem 0;
}
}
</style>
......@@ -6,7 +6,7 @@
>123123123</a
> -->
<p>Hello!</p>
<p style="margin-top: 0.3rem">欢迎登录XXXX物业管理端</p>
<p style="margin-top: 0.3rem">欢迎登录望春街道物业管理端</p>
</div>
<div class="form-container">
<div class="form-item">
......@@ -40,8 +40,8 @@ export default {
return {
codeUrl: "",
form: {
username: "tyjy",
password: "xcsq1234,",
username: "",
password: "",
code: "",
uuid: "",
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment