|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <div>
- <van-nav-bar
- title="投诉建议"
- left-arrow
- @click-left="$router.back(-1)"
- />
- <van-cell-group style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);">
- <van-cell>
- <template #title>
- <van-row style="">
- <van-col span="4" :offset="1">
- <h3 style="">类型:</h3>
- </van-col>
- <van-col span="10" >
- <van-radio-group v-model="form.type" direction="horizontal">
- <van-radio name="1">投诉</van-radio>
- <van-radio name="2">建议</van-radio>
- </van-radio-group>
- </van-col>
- </van-row>
- </template>
- </van-cell>
- <van-cell>
- <template #title>
- <van-row>
- <van-col span="24">
- <van-field
- v-model="form.adviceContent"
- rows="7"
- autosize
- type="textarea"
- maxlength="1000"
- placeholder="请输入您的反馈意见(字数1000以内)"
- show-word-limit
- />
- </van-col>
- </van-row>
- </template>
- </van-cell>
- </van-cell-group>
- <van-cell-group style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);">
- <van-cell>
- <template #title>
- <van-row style="">
- <van-col span="23" :offset="1">
- <van-field name="uploader" label="">
- <template #input>
- <van-uploader :after-read="afterRead" :before-delete="deleteFile" v-model="fileList" multiple :max-count="5" />
- </template>
- </van-field>
- </van-col>
- </van-row>
- </template>
- </van-cell>
- </van-cell-group>
- <van-row style="text-align: center;margin-top: 40px">
- <van-button color="#1D6FE9" style="border-radius: 6px;width: 90%;margin: 0 auto" @click="adviceAdd">提交</van-button>
- </van-row>
- </div>
- </template>
-
- <script>
- import onlineHomeIndex from "../onlineHomeIndex";
- import {adviceAdd} from "../../api/onlineHome/my";
- import * as Toast from "vant";
- import {uploadFileBase} from "../../api/authenticRight";
- import {Dialog} from "vant";
- import {base64Attach, deleteUserImg} from "../../api/user";
-
- export default {
- components: {
- onlineHomeIndex
- },
- name: "advice",
- data() {
- return {
- form:{
- id:'',
- type: '1',
- adviceContent:'',
- url:[],
- files:[],
- },
- file: {
- files:[],
- fileType:'',
- bizPath:'advice',
- tableName:'t_sys_advice',
- tableId:''
- },
- fileList:[],
- upLoadList:[],
- };
- },
- created() {
- this.reset();
- },
- methods: {
- reset(){
- this.form={
- id:'',
- type: '1',
- adviceContent:'',
- url:[],
- files:[],
- }
- },
- afterRead(file) {
- // 此时可以自行将文件上传至服务器
- for ( let i = 0 ; i < this.fileList.length ; i++){
- if(this.fileList[i].url == undefined&&this.fileList!='') {
- this.fileList[i] = {url:this.fileList[i].content, id: '', isImage: true};
- }
- }
- },
- deleteFile(elIndex){
- if(elIndex.id != ''){
- deleteUserImg(elIndex.id).then(response => {});
- }
- return (file, name) => {
- let fileIndex = name.index
- this.fileList[elIndex].splice(fileIndex, 1)
- this.upLoadList[elIndex].splice(fileIndex, 1)
- }
- },
- adviceAdd(){
- adviceAdd(this.form).then(res => {
- this.file.tableId = res.data;
- for(let i = 0 ; i < this.fileList.length ; i++){
- this.file.files.push(this.fileList[i].url);
- }
- base64Attach(this.file).then(response => {
- if (response.code == 200){
- Dialog.confirm({
- title: '系统提示',
- message: '发布成功',
- confirmButtonText: '确定',
- showCancelButton:false
- }).then(() => {
- self.location=document.referrer;
- })
- }
- });
-
- });
- }
- },
- }
- </script>
-
- <style scoped>
-
- </style>
|