feedback.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='意见反馈' :titleStyle="{'color':'transparent'}" bgColor='transparent'></cus-header>
  4. <image class="topbg" src="http://106.54.209.120:8188/static/feedback_bg.png"></image>
  5. <div class="box" style="margin-top: 189rpx;">
  6. <div class="title adfac">选择问题类型<span>*</span></div>
  7. <div class="list adfacjb">
  8. <div class="pre adffcacjc" :class="{'active':tidx===1}" @tap="changeType(1)">
  9. <text>功能异常</text>
  10. <image src="http://106.54.209.120:8188/static/selected_dh.png" v-if="tidx===1"></image>
  11. </div>
  12. <div class="pre adffcacjc" :class="{'active':tidx===2}" @tap="changeType(2)">
  13. <text>新功能建议</text>
  14. <image src="http://106.54.209.120:8188/static/selected_dh.png" v-if="tidx===2"></image>
  15. </div>
  16. <div class="pre adffcacjc" :class="{'active':tidx===3}" @tap="changeType(3)">
  17. <text>其他</text>
  18. <image src="http://106.54.209.120:8188/static/selected_dh.png" v-if="tidx===3"></image>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="box">
  23. <div class="title adfac">问题描述<span>*</span></div>
  24. <div class="desc">
  25. <u-textarea height="160rpx" v-model="dto.desc" placeholder="尽量详细描述您遇到的问题、具体位置及体现形式等" border="none"></u-textarea>
  26. </div>
  27. </div>
  28. <div class="box">
  29. <div class="title adfac">图片补充<span class="tip">上传问题截图可以让问题快速解决哦!</span></div>
  30. <div class="upload">
  31. <u-upload width="148rpx" height="148rpx"
  32. :fileList="fileList"
  33. @afterRead="afterRead"
  34. @delete="deletePic"
  35. :maxCount="1"
  36. ></u-upload>
  37. </div>
  38. </div>
  39. <div class="box lxfs adfacjb">
  40. <div class="title">联系方式</div>
  41. <div class="contact">
  42. <u-input v-model="dto.contact" placeholder="手机号/QQ号/微信号,方便与您联系" border="none"></u-input>
  43. </div>
  44. </div>
  45. <div class="zt_btn" @tap="submit">提交</div>
  46. </view>
  47. </template>
  48. <script>
  49. const baseApi = require('@/http/baseApi.js')
  50. export default {
  51. data(){
  52. return {
  53. tidx:1,
  54. dto:{
  55. type:1,
  56. desc:'',
  57. photo:'',
  58. contact:''
  59. },
  60. fileList:[],
  61. }
  62. },
  63. methods:{
  64. changeType(type){
  65. this.tidx = type;
  66. },
  67. // 删除图片
  68. deletePic(event) {
  69. this.fileList.splice(event.index, 1);
  70. },
  71. // 新增图片
  72. async afterRead(event) {
  73. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  74. let lists = [].concat(event.file);
  75. let fileListLen = this.fileList.length;
  76. lists.map((item) => {
  77. this.fileList.push({
  78. ...item,
  79. status: "uploading",
  80. message: "上传中",
  81. });
  82. });
  83. for (let i = 0; i < lists.length; i++) {
  84. const result = await this.uploadFilePromise(lists[i].url);
  85. let item = this.fileList[fileListLen];
  86. this.fileList.splice(
  87. fileListLen,
  88. 1,
  89. Object.assign(item, {
  90. status: "success",
  91. message: "",
  92. url: result,
  93. })
  94. );
  95. fileListLen++;
  96. }
  97. },
  98. uploadFilePromise(url) {
  99. return new Promise((resolve, reject) => {
  100. let a = uni.uploadFile({
  101. url: baseApi.BaseApi + '/uploadFile',
  102. filePath: url,
  103. name: "file",
  104. success: (res) => {
  105. let data = JSON.parse(res.data);
  106. if(data){
  107. if(data.code!==0) return
  108. setTimeout(() => {
  109. resolve(data.data);
  110. }, 1000);
  111. }
  112. },
  113. });
  114. });
  115. },
  116. submit(){
  117. if(!this.dto.desc) return this.$showToast('请输入问题描述')
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="less">
  123. .page{
  124. background: #F7F6F9;
  125. padding: 0 30rpx 30rpx;
  126. box-sizing: border-box;
  127. .topbg{
  128. width: 100%;
  129. position: fixed;
  130. left: 0;
  131. top: 0;
  132. }
  133. .box{
  134. width: 100%;
  135. background: #FFFFFF;
  136. border-radius: 24rpx;
  137. margin-top: 20rpx;
  138. padding: 40rpx 24rpx;
  139. box-sizing: border-box;
  140. position: relative;
  141. .title{
  142. font-family: PingFang-SC, PingFang-SC;
  143. font-weight: bold;
  144. font-size: 32rpx;
  145. color: #111111;
  146. line-height: 32rpx;
  147. span{
  148. color: #F31616;
  149. &.tip{
  150. font-weight: 400;
  151. font-size: 24rpx;
  152. color: #A6A6A6;
  153. margin-left: 10rpx;
  154. }
  155. }
  156. }
  157. &.lxfs{
  158. .title{
  159. width: 154rpx;
  160. }
  161. .contact{
  162. width: calc(100% - 154rpx);
  163. }
  164. }
  165. }
  166. .list{
  167. margin-top: 48rpx;
  168. .pre{
  169. width: calc(100% / 3 - 14rpx);
  170. height: 80rpx;
  171. background: #FFFFFF;
  172. border-radius: 16rpx;
  173. border: 1rpx solid #C7C7C7;
  174. font-family: PingFangSC, PingFang SC;
  175. font-weight: 400;
  176. font-size: 28rpx;
  177. color: #333333;
  178. line-height: 80rpx;
  179. text-align: center;
  180. position: relative;
  181. image{
  182. width: 48rpx;
  183. height: 48rpx;
  184. position: absolute;
  185. right: 0;
  186. bottom: 0;
  187. }
  188. &.active{
  189. background: #D9F159;
  190. border: 1rpx solid #D9F159;
  191. font-weight: bold;
  192. color: #111111;
  193. }
  194. }
  195. }
  196. .desc{
  197. margin-top: 40rpx;
  198. }
  199. .upload{
  200. margin-top: 54rpx;
  201. width: 148rpx;
  202. height: 148rpx;
  203. background: url('http://106.54.209.120:8188/static/upload.png') no-repeat;
  204. background-size: 100% 100%;
  205. }
  206. .zt_btn{
  207. margin-top: 30rpx;
  208. }
  209. }
  210. </style>