Files
dvcp_v2_wxcp_app/library/project/saas/AppInterview/interviewDetail.vue

187 lines
3.9 KiB
Vue
Raw Normal View History

2021-11-15 10:29:05 +08:00
<template>
<div class="interviewDetail">
<template v-if="isEdit">
2021-12-09 19:55:51 +08:00
<u-form ref="interviewForm" label-position="top" :model="form">
2022-01-26 10:37:19 +08:00
<u-form-item label="记录事项" prop="title" required>
2021-11-15 10:29:05 +08:00
<u-input v-model="form.title" placeholder="请输入最多30字" maxlength="30"/>
</u-form-item>
2022-01-26 10:37:19 +08:00
<u-form-item label="记录内容" prop="content">
2021-12-13 13:42:13 +08:00
<AiTextarea v-model="form.content" placeholder="请输入最多500字" :maxlength="500"/>
2021-11-15 10:29:05 +08:00
</u-form-item>
<u-form-item label="图片最多9张">
2021-12-13 11:56:11 +08:00
<AiUploader multiple :limit="9" :def.sync="form.fileList" action="/admin/file/add2"/>
2021-11-15 10:29:05 +08:00
</u-form-item>
</u-form>
<div bottom>
<u-button type="primary" @tap="submitForm">保存</u-button>
</div>
</template>
<template v-else>
<div class="headerPane">
<b>{{ form.title }}</b>
<div>记录时间{{ form.createTime }}</div>
</div>
<div class="contentPane">
<div v-html="form.content"/>
<div flex class="wrap">
2021-12-13 13:42:13 +08:00
<AiImage v-for="(op,i) in form.fileList" :src="op.accessUrl" preview :key="i"/>
2021-11-15 10:29:05 +08:00
</div>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'interviewDetail',
2021-11-23 14:58:51 +08:00
inject: {root: {}},
2021-11-15 10:29:05 +08:00
computed: {
isEdit() {
2021-12-10 18:03:07 +08:00
return this.$route.query?.detail != 1
2021-11-15 10:29:05 +08:00
}
},
data() {
return {
form: {
fileList: []
}
}
},
2021-12-09 19:45:17 +08:00
mounted() {
2021-12-13 13:42:13 +08:00
},
2021-11-15 10:29:05 +08:00
created() {
this.searchDetail();
},
2022-01-20 10:36:52 +08:00
onLoad () {
2022-01-26 10:37:19 +08:00
document.title = this.$route.query.id ? '记录详情' : '新增记录'
2022-01-20 10:36:52 +08:00
},
2021-11-15 10:29:05 +08:00
methods: {
submitForm() {
2021-12-09 19:55:51 +08:00
if (!this.form.title) {
2022-01-26 10:37:19 +08:00
return this.$u.toast("请输入记录事项")
2021-12-09 19:55:51 +08:00
}
2022-01-20 10:36:52 +08:00
this.$loading()
2021-11-15 10:29:05 +08:00
this.$refs.interviewForm?.validate(v => {
if (v) {
this.$http.post(`/app/appinterview/add-xcx`, {
...this.form
}).then(res => {
2022-01-20 10:36:52 +08:00
uni.hideLoading()
2021-11-15 10:29:05 +08:00
if (res?.code == 0) {
this.$u.toast("提交成功!")
2021-12-14 13:48:52 +08:00
setTimeout(() => {
uni.navigateBack({})
}, 1000)
2021-11-15 10:29:05 +08:00
}
2022-01-20 10:36:52 +08:00
}).catch(() => {
uni.hideLoading()
2021-11-15 10:29:05 +08:00
})
}
2022-01-20 10:36:52 +08:00
}).catch(() => {
uni.hideLoading()
2021-11-15 10:29:05 +08:00
})
},
searchDetail() {
let {id} = this.$route.query
id && this.$http.post(`/app/appinterview/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.form = {...res.data};
}
})
},
}
}
</script>
<style lang="scss" scoped>
.interviewDetail {
background: #F3F6F9;
2021-12-31 17:04:31 +08:00
height: 100vh;
2021-11-15 10:29:05 +08:00
.u-form {
width: 100%;
height: 100%;
overflow-y: auto;
background-color: #f3f6f9;
position: relative;
padding: 0 0 188px;
box-sizing: border-box;
font-size: 30px;
::v-deep textarea {
width: 100%;
}
::v-deep .u-form-item {
margin-bottom: 16px;
.u-form-item--left__content__label {
font-weight: 400;
}
div[flex] {
width: 100%;
}
}
}
div[bottom] {
z-index: 99;
padding: 0;
height: 112px;
.u-btn {
height: 100%;
border-radius: 0;
}
}
::v-deep .headerPane {
width: 100%;
background: #3975C6;
color: #fff;
padding: 24px 32px 32px;
box-sizing: border-box;
font-size: 28px;
b {
display: block;
font-size: 40px;
line-height: 64px;
letter-spacing: 2px;
margin-bottom: 16px;
}
}
::v-deep .contentPane {
padding: 32px;
width: 100%;
box-sizing: border-box;
font-size: 32px;
font-weight: 400;
color: #666;
line-height: 56px;
2021-12-31 17:04:31 +08:00
background: #F3F6F9;
2021-11-15 10:29:05 +08:00
.wrap {
margin-top: 32px;
}
.AiImage {
width: 31%;
margin-bottom: 16px;
margin-right: 16px;
image {
width: 100%;
height: 218px;
}
}
}
}
</style>