feedback.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/fe42b211-b00a-41d8-866c-0af96ff6fe35.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="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/04b1514c-1024-4092-8be0-aa0af2e9b015.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="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/04b1514c-1024-4092-8be0-aa0af2e9b015.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="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/04b1514c-1024-4092-8be0-aa0af2e9b015.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.suggestion" 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.phone" 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. suggestion:'',
  57. pics:'',
  58. phone:''
  59. },
  60. fileList:[],
  61. }
  62. },
  63. methods:{
  64. changeType(type){
  65. this.tidx = type;
  66. this.dto.type = type;
  67. },
  68. // 删除图片
  69. deletePic(event) {
  70. this.fileList.splice(event.index, 1);
  71. },
  72. // 新增图片
  73. async afterRead(event) {
  74. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  75. let lists = [].concat(event.file);
  76. let fileListLen = this.fileList.length;
  77. lists.map((item) => {
  78. this.fileList.push({
  79. ...item,
  80. status: "uploading",
  81. message: "上传中",
  82. });
  83. });
  84. for (let i = 0; i < lists.length; i++) {
  85. const result = await this.uploadFilePromise(lists[i].url);
  86. let item = this.fileList[fileListLen];
  87. this.fileList.splice(
  88. fileListLen,
  89. 1,
  90. Object.assign(item, {
  91. status: "success",
  92. message: "",
  93. url: result,
  94. })
  95. );
  96. fileListLen++;
  97. }
  98. },
  99. uploadFilePromise(url) {
  100. return new Promise((resolve, reject) => {
  101. uni.uploadFile({
  102. url: baseApi.BaseApi + '/sys/oss/uploadFile',
  103. filePath: url,
  104. name: "file",
  105. header:{
  106. token: uni.getStorageSync('token')
  107. },
  108. success: (res) => {
  109. let data = JSON.parse(res.data);
  110. if(data){
  111. if(data.code!==0) return
  112. setTimeout(() => {
  113. resolve(data.data);
  114. }, 1000);
  115. }
  116. }
  117. });
  118. });
  119. },
  120. submit(){
  121. if(!this.dto.suggestion) return this.$showToast('请输入问题描述');
  122. if(this.fileList.length) this.dto.pics = this.fileList[0].url;
  123. this.$api.post('/sys/suggest/save',this.dto).then(res=>{
  124. if(res.data.code!==0) return this.$showToast(res.data.msg)
  125. this.$showToast('提交成功~');
  126. setTimeout(()=>{
  127. uni.reLaunch({
  128. url:'/pages/my'
  129. })
  130. },1500)
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped lang="scss">
  137. ::v-deep .u-icon__icon{
  138. font-size: 48rpx !important;
  139. }
  140. ::v-deep .u-upload__deletable{
  141. width: 48rpx !important;
  142. height: 48rpx !important;
  143. }
  144. ::v-deep .u-upload__deletable__icon{
  145. transform: scale(2.7) !important;
  146. top: 14rpx !important;
  147. right: 14rpx !important;
  148. }
  149. ::v-deep .u-upload__success{
  150. border-width:24rpx !important;
  151. }
  152. ::v-deep .u-upload__success__icon{
  153. transform: scale(2.7) !important;
  154. bottom: -16rpx !important;
  155. right: -16rpx !important;
  156. }
  157. .page{
  158. background: #F7F6F9;
  159. padding: 0 30rpx 30rpx;
  160. box-sizing: border-box;
  161. .topbg{
  162. width: 100%;
  163. position: fixed;
  164. left: 0;
  165. top: 0;
  166. }
  167. .box{
  168. width: 100%;
  169. background: #FFFFFF;
  170. border-radius: 24rpx;
  171. margin-top: 20rpx;
  172. padding: 40rpx 24rpx;
  173. box-sizing: border-box;
  174. position: relative;
  175. .title{
  176. font-family: PingFang-SC, PingFang-SC;
  177. font-weight: bold;
  178. font-size: 32rpx;
  179. color: #111111;
  180. line-height: 32rpx;
  181. span{
  182. color: #F31616;
  183. &.tip{
  184. font-weight: 400;
  185. font-size: 24rpx;
  186. color: #A6A6A6;
  187. margin-left: 10rpx;
  188. }
  189. }
  190. }
  191. &.lxfs{
  192. .title{
  193. width: 154rpx;
  194. }
  195. .contact{
  196. width: calc(100% - 154rpx);
  197. }
  198. }
  199. }
  200. .list{
  201. margin-top: 48rpx;
  202. .pre{
  203. width: calc(100% / 3 - 14rpx);
  204. height: 80rpx;
  205. background: #FFFFFF;
  206. border-radius: 16rpx;
  207. border: 1rpx solid #C7C7C7;
  208. font-family: PingFangSC, PingFang SC;
  209. font-weight: 400;
  210. font-size: 28rpx;
  211. color: #333333;
  212. line-height: 80rpx;
  213. text-align: center;
  214. position: relative;
  215. image{
  216. width: 48rpx;
  217. height: 48rpx;
  218. position: absolute;
  219. right: 0;
  220. bottom: 0;
  221. }
  222. &.active{
  223. background: #D9F159;
  224. border: 1rpx solid #D9F159;
  225. font-weight: bold;
  226. color: #111111;
  227. }
  228. }
  229. }
  230. .desc{
  231. margin-top: 40rpx;
  232. }
  233. .upload{
  234. margin-top: 54rpx;
  235. width: 148rpx;
  236. height: 148rpx;
  237. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/ee77704d-8cda-4cfb-a4d8-23a95040e8ad.png') no-repeat;
  238. background-size: 100% 100%;
  239. }
  240. .zt_btn{
  241. margin-top: 30rpx;
  242. }
  243. }
  244. </style>