msb/feedback-masses.html

129 lines
5.0 KiB
HTML
Raw Normal View History

2022-07-04 09:07:39 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>Title</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/swiper.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/rem.js"></script>
</head>
<body>
<div id="app" v-cloak style="padding: 0;">
<a href="feedback-record.html?type=1" class="link-record">
<div class="record-title">反馈记录</div>
<img src="image/right-arrow.png" alt="">
</a>
<div class="feedback-main" style="padding: .2rem;">
<div class="feedback-title">您的问题或建议:</div>
<textarea placeholder="请输入个人意见反馈字数在200字以内" v-model="opinion.opinionContent"></textarea>
<!-- <div class="photo">-->
<!-- <div class="feedback-title">上传照片</div>-->
<!-- <div class="upload-photo-box" v-for="(photo,idx) in imgList">-->
<!-- <div class="img-box">-->
<!-- <img :src="requestUrl + 'news/route/file/downloadfile/true/' + photo" alt="">-->
<!-- </div>-->
<!-- <img src="image/delete.png" alt="" class="delete" @click="deleteImg(idx)">-->
<!-- </div>-->
<!-- <input type="file" id="upload-photo" @change="uploadPhoto()">-->
<!-- <label for="upload-photo" v-if="imgList.length < 9"><span>+</span></label>-->
<!-- </div>-->
<div class="contact">
<div class="feedback-title">您的联系方式:</div>
<input type="text" placeholder="请输入电话号码" v-model="opinion.opinionPhone">
<input type="text" placeholder="请输入电子邮箱" v-model="opinion.opinionEmail">
<div class="tip">留下您的联系方式,以使我们了解问题后及时反馈结果</div>
</div>
</div>
<div class="submit-feedback">
<div class="submit-feedback-btn" @click="submitFeedback">提交建议</div>
</div>
<div class="loading" v-if="isLoading">
<img src="image/loading.gif" alt="">
</div>
</div>
<script src="js/vue.js"></script>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/ajax.js"></script>
<script src="js/swiper.js"></script>
<script src="js/layer/layer.js"></script>
<script>
var vue = new Vue({
el: '#app',
data: {
requestUrl: 'http://219.159.20.131:8081/',
token: sessionStorage.getItem('token'),
imgList: [],
opinion: {
opinionContent: '',
opinionPhone: '',
opinionEmail: '',
opinionImage: ''
},
isLoading: false
},
methods: {
uploadPhoto: function (e) {
var file
var self = this
var url = self.requestUrl
this.isLoading = true
// self.isLoading = true
file = $('#upload-photo')[0].files[0]
url += 'news/app/file/uploadimage'
var formData = new FormData()
formData.append('image', file)
$.ajax({
url: url,
type: 'post',
data: formData,
contentType: false,
processData: false,
headers: {
token: self.token
},
success: function (data) {
self.imgList.push(data.data)
},
complete: function () {
self.isLoading = false
}
})
},
submitFeedback: function () {
var self = this
var photo = ''
if (this.imgList.length > 0) {
for (let i = 0; i < this.imgList.length;i++) {
if (i != this.imgList.length - 1) {
photo += this.imgList[i] + ','
} else {
photo += this.imgList[i]
}
}
this.opinion.opinionImage = photo
}
if (!this.isLoading) {
doPostJson(self.requestUrl + 'news/app/contentopinion/save/massesOpinionFeedback', self.opinion, {},function (code, data) {
console.log(data)
if (code == '200') {
layer.msg('提交成功')
}
}, null, function (res) {
res.setRequestHeader('token',self.token)
})
}
},
deleteImg: function (idx) {
this.imgList.splice(idx,1)
}
},
mounted: function () {
}
})
</script>
</body>
</html>