|
@@ -13,10 +13,11 @@
|
|
|
</div>
|
|
|
<div class="cell">
|
|
|
<div class="title">提交截图(最多3张)</div>
|
|
|
- <el-upload action="" list-type="picture-card" :on-preview="handlePictureCardPreview" :http-request="submitUpload">
|
|
|
+ <el-upload action="" list-type="picture-card" :on-preview="handlePictureCardPreview" :on-remove="removeImg" :http-request="submitUpload">
|
|
|
<i class="el-icon-plus"></i>
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
+ <el-button type="primary" :loading="loading" @click="submit">提交</el-button>
|
|
|
<el-dialog :visible.sync="dialogVisible">
|
|
|
<img width="100%" :src="dialogImageUrl" alt="">
|
|
|
</el-dialog>
|
|
@@ -24,7 +25,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { uploadFeedbackImg } from "../../api/setting.js";
|
|
|
+import { uploadFeedbackImg, saveFeedback } from "../../api/setting.js";
|
|
|
export default {
|
|
|
name: "feedbackInfo",
|
|
|
data() {
|
|
@@ -49,11 +50,15 @@ export default {
|
|
|
],
|
|
|
params: {
|
|
|
type: 1,
|
|
|
+ content: "",
|
|
|
+ pictures: [],
|
|
|
},
|
|
|
+ pictures: [],
|
|
|
baseUrl: process.env.VUE_APP_BASE_URL,
|
|
|
dialogImageUrl: "",
|
|
|
dialogVisible: false,
|
|
|
fileList: [],
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
// 监听属性 类似于data概念
|
|
@@ -62,9 +67,44 @@ export default {
|
|
|
watch: {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ submit() {
|
|
|
+ if (!this.params.content.trim()) {
|
|
|
+ return this.$message.warning("请描述你的问题");
|
|
|
+ }
|
|
|
+ this.params.pictures = this.pictures.map((v) => v.url);
|
|
|
+ console.log(this.params);
|
|
|
+ this.loading = true;
|
|
|
+ saveFeedback(this.params).then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success("反馈成功");
|
|
|
+ this.params = {
|
|
|
+ type: 1,
|
|
|
+ content: "",
|
|
|
+ pictures: [],
|
|
|
+ };
|
|
|
+ this.pictures = [];
|
|
|
+ this.$bus.$emit('goFeedbackList',1)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeImg(file) {
|
|
|
+ console.log(file, fileList);
|
|
|
+ this.pictures = this.pictures.filter((v) => {
|
|
|
+ return v.fileName !== file.name;
|
|
|
+ });
|
|
|
+ },
|
|
|
submitUpload(params) {
|
|
|
- console.log(arguments);
|
|
|
- uploadFeedbackImg({ imageUrl: params.file, name: "file" }).then((res) => {
|
|
|
+ let file = new FormData();
|
|
|
+ file.append("file", params.file);
|
|
|
+ uploadFeedbackImg(file).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.pictures.push(res.data);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
console.log(res);
|
|
|
});
|
|
|
},
|