景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
3.9 KiB

  1. <template>
  2. <!-- 我要帮助 -->
  3. <view class="help">
  4. <navbar title="我要帮助" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="help-box">
  6. <view>
  7. <view class="help-issue">
  8. <text>问题和意见</text>
  9. <text style="color: #BD3624;">*</text>
  10. </view>
  11. <uv-textarea v-model="value" :count="true" border="none" height="400"
  12. placeholder="请把游览中发现的问题提交给我们,感谢您的参与(必填)" :text-style="{color:'#BCB7B7',fontSize:'28rpx'}" />
  13. </view>
  14. <view>
  15. <view class="help-issue">
  16. <text>问题截图</text>
  17. <text style="color: #BD3624;">*</text>
  18. </view>
  19. <view class="help-screenshot">
  20. <uv-upload :fileList="fileList1" accept="all " name="1" multiple :maxCount="3" width="220"
  21. height="220" multiple @afterRead="afterRead" @delete="deletePic">
  22. <image src="../static/help/uploading.png" mode="aspectFit"
  23. style="width: 220rpx;height: 220rpx;" />
  24. </uv-upload>
  25. </view>
  26. </view>
  27. <view>
  28. <view class="help-issue">
  29. <text>联系方式</text>
  30. <text style="color: #BD3624;">*</text>
  31. </view>
  32. <uv-input placeholder="请输入联系方式" fontSize="24rpx" border="bottom"
  33. :custom-style="{backgroundColor: '#fff'}">
  34. <template #prefix>
  35. <uv-text text="联系姓名" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
  36. </template>
  37. </uv-input>
  38. <uv-input placeholder="请输入联系姓名" border="none" fontSize="24rpx"
  39. :custom-style="{backgroundColor: '#fff'}">
  40. <template #prefix>
  41. <uv-text text="联系方式" size="24rpx" margin="20rpx 10rpx 20rpx 10rpx" />
  42. </template>
  43. </uv-input>
  44. </view>
  45. <view class="help-button">
  46. <view>历史反馈</view>
  47. <view>确认</view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. value: "",
  57. fileList1: []
  58. }
  59. },
  60. onLoad(args) {
  61. },
  62. methods: {
  63. // 删除图片
  64. deletePic(event) {
  65. this[`fileList${event.name}`].splice(event.index, 1)
  66. },
  67. // 新增图片
  68. async afterRead(event) {
  69. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  70. let lists = [].concat(event.file)
  71. let fileListLen = this[`fileList${event.name}`].length
  72. lists.map((item) => {
  73. this[`fileList${event.name}`].push({
  74. ...item,
  75. status: 'uploading',
  76. message: '上传中'
  77. })
  78. })
  79. for (let i = 0; i < lists.length; i++) {
  80. const result = await this.uploadFilePromise(lists[i].url)
  81. let item = this[`fileList${event.name}`][fileListLen]
  82. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  83. status: 'success',
  84. message: '',
  85. url: result
  86. }))
  87. fileListLen++
  88. }
  89. },
  90. uploadFilePromise(url) {
  91. return new Promise((resolve, reject) => {
  92. let a = uni.uploadFile({
  93. url: 'http://127.0.0.1/upload', // 仅为示例,非真实的接口地址
  94. filePath: url,
  95. name: 'file',
  96. formData: {
  97. user: 'test'
  98. },
  99. success: (res) => {
  100. setTimeout(() => {
  101. resolve(res.data.data)
  102. }, 1000)
  103. }
  104. });
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .help {
  112. .help-box {
  113. width: 92%;
  114. margin-left: 4%;
  115. .help-issue {
  116. margin: 20rpx;
  117. font-size: 28rpx;
  118. font-weight: 600;
  119. color: #333333;
  120. }
  121. .help-screenshot {
  122. display: flex;
  123. align-items: center;
  124. background-color: #fff;
  125. image {
  126. padding: 60rpx;
  127. }
  128. }
  129. .help-button {
  130. display: flex;
  131. justify-content: space-between;
  132. font-size: 24rpx;
  133. flex-shrink: 0;
  134. margin-top: 60rpx;
  135. view {
  136. padding: 14rpx 120rpx;
  137. border-radius: 38rpx;
  138. }
  139. view:nth-child(1) {
  140. color: #C8C8C8;
  141. background-color: #FFFDF6;
  142. border: 2rpx solid #C8C8C8;
  143. }
  144. view:nth-child(2) {
  145. color: #FFFDF6;
  146. background-color: #C83741;
  147. }
  148. }
  149. }
  150. }
  151. </style>