学员端小程序
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.

224 lines
4.9 KiB

1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我要咨询"></topNavbar>
  4. <view class="pad">
  5. <view class="card">
  6. <view class="h2">咨询内容</view>
  7. <view class="textareaBg">
  8. <view class="flex">
  9. <view class="icon">
  10. <image src="@/static/images/index/edit.png" mode=""></image>
  11. </view>
  12. <view class="inputBox">
  13. <u-textarea v-model="value" ref="textarea" placeholder="详细说明问题,以便获得更好的回答~"></u-textarea>
  14. </view>
  15. </view>
  16. <view class="phoneBox">
  17. <view class="imgBox">
  18. <view class="img">
  19. <view class="minusCircle">
  20. <u-icon name="close-circle-fill" size="20" color="#b9061d"></u-icon>
  21. </view>
  22. <image src="../../../../static/logo.png" mode=""></image>
  23. </view>
  24. </view>
  25. <view class="phone" @click="chooseImages">
  26. <view class="phoneIcon">
  27. <image src="@/static/images/index/btn_tupian.png" mode=""></image>
  28. </view>
  29. <view class="lab">添加图片</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="card" style="padding-bottom: 0;">
  35. <view class="phone_row">
  36. <view class="label">联系电话</view>
  37. <view class="uInput my">
  38. <u--input placeholder="输入手机号码,以便我们回复您!" v-model="value" border="none" type="number" fontSize="14"></u--input>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="btn active">提交</view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import { APP_API, APP_HOST } from '@/site.config.js';
  48. const _url = APP_HOST + APP_API + '/util/manage/uploadFile.do';
  49. export default {
  50. data() {
  51. return {
  52. value: '',
  53. imgArr: [],
  54. }
  55. },
  56. methods: {
  57. //选择图片
  58. chooseImages(type) {
  59. let imgNum = 3 - (this.imgArr.length)
  60. uni.chooseImage({
  61. count: imgNum, //允许选择的数量
  62. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  63. sourceType: ['album', 'camera'], //从相册选择
  64. success: res => {
  65. uni.showLoading({
  66. title: '图片上传中...'
  67. });
  68. res.tempFilePaths.forEach( (item,index)=>{
  69. this.uploadImgApi(item)
  70. })
  71. }
  72. })
  73. },
  74. uploadImgApi(filePath) {
  75. console.log(filePath)
  76. let _this = this
  77. // 上传图片到服务器
  78. uni.uploadFile({
  79. url: _url,//接口
  80. filePath: filePath,//要上传的图片的本地路径
  81. name: 'file',
  82. formData: {
  83. fileType: 1,
  84. fileSuffix: "png"
  85. },
  86. header: {
  87. token: uni.getStorageSync("Authorization") || '',
  88. },
  89. success(res) {
  90. console.log('上传成功')
  91. let res2 = JSON.parse(res.data)
  92. _this.imgArr.push(res2.data)
  93. console.log(res2)
  94. uni.hideLoading();
  95. },
  96. complete: ()=> {}
  97. })
  98. },
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .pageBgImg {
  104. .pad {}
  105. .card {
  106. padding: 0 24rpx 24rpx 24rpx ;
  107. .h2 {
  108. font-size: 32rpx;
  109. font-weight: 600;
  110. line-height: 96rpx;
  111. }
  112. .textareaBg {
  113. min-height: 364rpx;
  114. background: #F8F8F8;
  115. border-radius: 16rpx;
  116. border: 2rpx solid #E8E9EC;
  117. display: flex;
  118. flex-direction: column;
  119. justify-content: space-between;
  120. .flex {
  121. padding: 20rpx;
  122. align-items: flex-start;
  123. .icon {
  124. width: 24rpx;
  125. height: 24rpx;
  126. margin: 0 14rpx 0 24rpx;
  127. }
  128. .inputBox {
  129. flex: 1;
  130. }
  131. /deep/ .inputBox .u-textarea {
  132. padding: 0 !important;
  133. border: none !important;
  134. background: none !important;
  135. font-size: 24rpx
  136. }
  137. }
  138. .phoneBox {
  139. display: flex;
  140. padding: 0 10rpx 20rpx 20rpx;
  141. .imgBox {
  142. display: flex;
  143. .img {
  144. margin-right: 14rpx;
  145. position: relative;
  146. image {
  147. width: 160rpx;
  148. height: 160rpx;
  149. border-radius: 8rpx;
  150. overflow: hidden;
  151. }
  152. .minusCircle {
  153. position: absolute;
  154. right: -14rpx;
  155. top: -20rpx;
  156. z-index: 9;
  157. }
  158. }
  159. }
  160. .phone {
  161. border: 2rpx dashed #CDCED0;
  162. width: 160rpx;
  163. height: 160rpx;
  164. background: #F8F8F8;
  165. border-radius: 8rpx;
  166. overflow: hidden;
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. flex-direction: column;
  171. .phoneIcon {
  172. width: 60rpx;
  173. height: 60rpx;
  174. }
  175. .lab {
  176. font-size: 20rpx;
  177. color: #686B73;
  178. margin-top: 8rpx;
  179. }
  180. }
  181. }
  182. }
  183. }
  184. .phone_row {
  185. display: flex;
  186. height: 104rpx;
  187. padding: 0 28rpx;
  188. line-height: 104rpx;
  189. .label {
  190. font-size: 32rpx;
  191. font-weight: 600;
  192. margin-right: 50rpx;
  193. }
  194. .uInput {
  195. flex: 1;
  196. }
  197. }
  198. .btn {
  199. width: 396rpx;
  200. height: 72rpx;
  201. background: #D1E7FE;
  202. border-radius: 8rpx;
  203. font-size: 28rpx;
  204. text-align: center;
  205. line-height: 72rpx;
  206. margin: 100rpx auto 114rpx auto;
  207. color: #fff;
  208. &.active {
  209. background: $themC;
  210. }
  211. }
  212. }
  213. </style>