Commit e4e08c94 authored by leidahong's avatar leidahong

事件处理跳转

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