|
|
@@ -0,0 +1,219 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <van-form @submit="submit">
|
|
|
+ <van-field
|
|
|
+ class="textarea"
|
|
|
+ name="问题描述"
|
|
|
+ label="问题描述"
|
|
|
+ placeholder="请详细说明,以便于我们解决问题,您最多可填300字。"
|
|
|
+ v-model="form.detail"
|
|
|
+ clearable
|
|
|
+ rows="4"
|
|
|
+ autosize
|
|
|
+ required
|
|
|
+ type="textarea"
|
|
|
+ maxlength="300"
|
|
|
+ show-word-limit
|
|
|
+ :rules="[{ required: true, message: '请填写用户名' }]"
|
|
|
+ />
|
|
|
+ <van-field name="uploader" label="上传凭证">
|
|
|
+ <template #label>
|
|
|
+ <div class="title">
|
|
|
+ <span>上传凭证</span>
|
|
|
+ <span>最多上传3张</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #input>
|
|
|
+ <van-uploader :max-count="3" v-model="form.pic" :after-read="afterRead" />
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <div class="bottom">
|
|
|
+ <van-button round block type="primary" native-type="submit">提交</van-button>
|
|
|
+ </div>
|
|
|
+ </van-form>
|
|
|
+
|
|
|
+ <van-dialog v-model:show="show" @closed="closed" :showConfirmButton="false" closeOnClickOverlay>
|
|
|
+ <div class="dialog-box">
|
|
|
+ <img src="@assets/png-tijiaochenggong.png" alt="" />
|
|
|
+ <div class="dialog-title">提交成功</div>
|
|
|
+ <div class="dialog-text">
|
|
|
+ 感谢您的宝贵意见与建议,我们将于24小时内给您相关答案,感谢您的耐心,愿您有美好的一天!
|
|
|
+ </div>
|
|
|
+ <img src="@assets/close3.png" @click="show = false" class="close" alt="" />
|
|
|
+ </div>
|
|
|
+ </van-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Compressor from 'compressorjs';
|
|
|
+export default {
|
|
|
+ setup() {
|
|
|
+ const beforeRead = file =>
|
|
|
+ new Promise(resolve => {
|
|
|
+ // compressorjs 默认开启 checkOrientation 选项
|
|
|
+ // 会将图片修正为正确方向
|
|
|
+ new Compressor(file, {
|
|
|
+ success: resolve,
|
|
|
+ error(err) {
|
|
|
+ console.log(err.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ return {
|
|
|
+ beforeRead
|
|
|
+ };
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ detail: '',
|
|
|
+ pic: []
|
|
|
+ },
|
|
|
+ show: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ closed() {
|
|
|
+ this.$router.back();
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.$toast.loading({
|
|
|
+ message: '加载中...',
|
|
|
+ forbidClick: true
|
|
|
+ });
|
|
|
+ let form = { ...this.form };
|
|
|
+ form.pic = form.pic.map(item => {
|
|
|
+ return item.url;
|
|
|
+ });
|
|
|
+ this.$http
|
|
|
+ .post('/message/create', form, { body: 'json' })
|
|
|
+ .then(res => {
|
|
|
+ this.$toast.clear();
|
|
|
+ this.show = true;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$toast(e.error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ afterRead(file, e) {
|
|
|
+ this.updateFile(file, 'id', 1000).then(img => {
|
|
|
+ console.log(img);
|
|
|
+ file.url = img;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+/deep/.van-cell {
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .van-field__label {
|
|
|
+ color: #000000;
|
|
|
+ line-height: 24px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+/deep/.textarea {
|
|
|
+ .van-field__body {
|
|
|
+ background: #f5f7fa;
|
|
|
+ border-radius: 8px 8px 0 0;
|
|
|
+ padding: 10px;
|
|
|
+ }
|
|
|
+ .van-field__control {
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .van-field__word-limit {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #c8c9cc;
|
|
|
+ line-height: 17px;
|
|
|
+ background: #f5f7fa;
|
|
|
+ margin-top: 0;
|
|
|
+ padding: 10px;
|
|
|
+ border-radius: 0 0 8px 8px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/deep/ .van-uploader__upload {
|
|
|
+ border: 1px dashed #c8c9cc;
|
|
|
+ border-radius: 8px;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/.van-uploader__preview-image {
|
|
|
+ border-radius: 8px;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+}
|
|
|
+
|
|
|
+.bottom {
|
|
|
+ padding: 9px 52px;
|
|
|
+ .bottom(9px);
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ background-color: #fff;
|
|
|
+ border-top: 1px solid #f2f3f5;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/.van-cell__title {
|
|
|
+ width: auto;
|
|
|
+}
|
|
|
+.title {
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: normal;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 24px;
|
|
|
+
|
|
|
+ &:nth-child(2) {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #aaabad;
|
|
|
+ margin-left: 2px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.dialog-box {
|
|
|
+ background: linear-gradient(180deg, #ffeddd 0%, #fff9f4 100%);
|
|
|
+ .flex-col();
|
|
|
+ align-items: center;
|
|
|
+ padding: 24px 16px;
|
|
|
+ position: relative;
|
|
|
+ img {
|
|
|
+ width: 128px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ .dialog-title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 22px;
|
|
|
+ padding: 12px;
|
|
|
+ }
|
|
|
+ .dialog-text {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #939599;
|
|
|
+ line-height: 20px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .close {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ position: absolute;
|
|
|
+ right: 16px;
|
|
|
+ top: 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/deep/.van-dialog {
|
|
|
+ width: 260px;
|
|
|
+}
|
|
|
+</style>
|