feedback.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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/05/29/ebaaeb8a-ca70-4caa-b55a-87ba3bd5de23.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/05/29/8e24c230-a530-48ae-a2ed-d41262b9a051.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/05/29/8e24c230-a530-48ae-a2ed-d41262b9a051.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/05/29/8e24c230-a530-48ae-a2ed-d41262b9a051.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="less">
  137. .page{
  138. background: #F7F6F9;
  139. padding: 0 30rpx 30rpx;
  140. box-sizing: border-box;
  141. .topbg{
  142. width: 100%;
  143. position: fixed;
  144. left: 0;
  145. top: 0;
  146. }
  147. .box{
  148. width: 100%;
  149. background: #FFFFFF;
  150. border-radius: 24rpx;
  151. margin-top: 20rpx;
  152. padding: 40rpx 24rpx;
  153. box-sizing: border-box;
  154. position: relative;
  155. .title{
  156. font-family: PingFang-SC, PingFang-SC;
  157. font-weight: bold;
  158. font-size: 32rpx;
  159. color: #111111;
  160. line-height: 32rpx;
  161. span{
  162. color: #F31616;
  163. &.tip{
  164. font-weight: 400;
  165. font-size: 24rpx;
  166. color: #A6A6A6;
  167. margin-left: 10rpx;
  168. }
  169. }
  170. }
  171. &.lxfs{
  172. .title{
  173. width: 154rpx;
  174. }
  175. .contact{
  176. width: calc(100% - 154rpx);
  177. }
  178. }
  179. }
  180. .list{
  181. margin-top: 48rpx;
  182. .pre{
  183. width: calc(100% / 3 - 14rpx);
  184. height: 80rpx;
  185. background: #FFFFFF;
  186. border-radius: 16rpx;
  187. border: 1rpx solid #C7C7C7;
  188. font-family: PingFangSC, PingFang SC;
  189. font-weight: 400;
  190. font-size: 28rpx;
  191. color: #333333;
  192. line-height: 80rpx;
  193. text-align: center;
  194. position: relative;
  195. image{
  196. width: 48rpx;
  197. height: 48rpx;
  198. position: absolute;
  199. right: 0;
  200. bottom: 0;
  201. }
  202. &.active{
  203. background: #D9F159;
  204. border: 1rpx solid #D9F159;
  205. font-weight: bold;
  206. color: #111111;
  207. }
  208. }
  209. }
  210. .desc{
  211. margin-top: 40rpx;
  212. }
  213. .upload{
  214. margin-top: 54rpx;
  215. width: 148rpx;
  216. height: 148rpx;
  217. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/45ebe996-192d-47ec-a749-33ddb3869a23.png') no-repeat;
  218. background-size: 100% 100%;
  219. }
  220. .zt_btn{
  221. margin-top: 30rpx;
  222. }
  223. }
  224. </style>