123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <view class="content">
- <view class="main">
- <!-- 建议 -->
- <view class="firstView">
- <view class="title">您的问题或建议</view>
- <view>
- <textarea placeholder-style="color:#999999" placeholder="输入个人意见反馈" v-model="exeContent"
- class="textareaCont" maxlength="-1" auto-height="true" @confirm="feedDone" />
- </view>
- </view>
- <!-- 图片 -->
- <view class="secondView">
- <view class="title">上传图片</view>
- <view class="imgBox">
- <view class="imgLine" v-for="(img,imgindex) in imgArr">
- <image :class="{img4:(imgindex+1)%4==0}" :src="img" mode="" class="itemImg"></image>
- <image src="../../static/img/icon_del_red.png" mode="" class="delImg" @click="delimg(imgindex)">
- </image>
- </view>
- <view class="imgLine" @click="uploadImg">
- <image src="../../static/img/btn_pic.png" mode="" class="itemImg"></image>
- </view>
- </view>
- </view>
- </view>
- <view class="bottom">
- <view class="shoreDz" @click="submit">提交</view>
- </view>
- </view>
- </template>
- <script>
- export default {
-
- data() {
- return {
- imgArr: [],
- exeContent: '',
- }
- },
- methods: {
- feedDone(e) {
- this.exeContent = e.target.value
- },
- uploadImg() {
- var that = this;
- var length = this.imgArr.length;
- var num = 9;
- if (length > 8) {
- uni.showToast({
- title: '最多上传9张',
- icon: 'none',
- duration: 2000,
- });
- return false;
- }
- uni.chooseImage({
- sourceType: ['album', 'camera'],
- count: num - length,
- success: (chooseImageRes) => {
- const tempFilePaths = chooseImageRes.tempFilePaths;
- /* uni.uploadFile({
- url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
- filePath: tempFilePaths[0],
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data).data );
- that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
-
- }
- }); */
- tempFilePaths.forEach(v => {
- console.log(that.$request.baseUrl + 'tuhuUploadFile');
- uni.uploadFile({
- url: that.$request.baseUrl + 'tuhuUploadFile',
- filePath: v,
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data).data);
- that.imgArr = that.imgArr.concat(JSON.parse(
- uploadFileRes.data).data);
- }
- });
- })
- /* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
-
- }) */
- }
- });
- },
- delimg(index) {
- this.imgArr.splice(index, 1)
- },
- submit() {
- if (!this.exeContent) {
- uni.showToast({
- title: '请输入个人意见反馈',
- icon: 'none',
- duration: 2000,
- });
- return;
- }
- // if (this.imgArr.length == 0) {
- // uni.showToast({
- // title: '请上传图片',
- // icon: 'none',
- // duration: 2000,
- // });
- // return ;
- // }
- uni.showLoading({
- title: '保存中'
- })
- var exeImg = this.imgArr.join(',')
- this.$http('openmy/addTMemberSuggest', {
- contents: this.exeContent,
- img: exeImg
- }, 'GET').then(res => {
- //this.submitSuperCheckSheet()
- if (res.code == 0) {
- uni.showToast({
- title: '提交成功',
- icon: 'none',
- duration: 2000,
- });
- setTimeout(function() {
- uni.navigateBack({
- })
- }, 2000);
- } else {
- uni.showToast({
- title: '提交失败',
- icon: 'none',
- duration: 2000,
- });
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .content {
- background: #F4F5F7;
- min-height: 100vh;
- }
- /* #ifdef H5 */
- .content {
- background: #F4F5F7;
- min-height: calc(100vh - 44px);
- }
- /* #endif */
- .main {
- background: #F4F5F7;
- padding: 20rpx 24rpx;
- }
- .firstView,
- .secondView {
- background-color: #FFFFFF;
- border-radius: 10rpx;
- }
- .firstView {
- margin-bottom: 20rpx;
- }
- .title {
- font-size: 30rpx;
- color: #3C3C3C;
- padding: 20rpx;
- }
- .textareaCont {
- padding: 20rpx;
- min-height: 150rpx;
- width: 95%;
- }
- .imgBox {
- display: flex;
- flex-wrap: wrap;
- padding: 20rpx;
- }
- .imgLine {
- position: relative;
- margin-right: 10rpx;
- }
- .itemImg {
- width: 150rpx;
- height: 150rpx;
- margin-right: 5rpx;
- }
- /* .img4 {
- margin-right: 20rpx;
-
- } */
- .delImg {
- width: 32rpx;
- height: 32rpx;
- position: absolute;
- right: 0rpx;
- top: 0rpx;
- }
- .bottom {
- width: 750rpx;
- height: 120rpx;
- background: #FFFFFF;
- box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
- position: fixed;
- left: 0;
- bottom: 0;
- display: flex;
- justify-content: space-around;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- }
- .shoreDz {
- width: 702rpx;
- height: 74rpx;
- background: #D53533;
- border-radius: 37rpx;
- text-align: center;
- line-height: 74rpx;
- color: #FFFFFF;
- font-size: 30rpx;
- margin-top: 24rpx;
- }
- </style>
|