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

233 lines
6.1 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="">
  3. <view class="pad">
  4. <view class="card">
  5. <view class="top_row">
  6. <view class="tit">{{ info.tit }}</view>
  7. <u-checkbox-group >
  8. <u-checkbox v-model="info.anonymity" shape="circle" label="匿名提交" :iconSize="12" name="匿名提交" :labelSize="12" @change="changeChe"></u-checkbox>
  9. </u-checkbox-group>
  10. </view>
  11. <view class="user_row">
  12. <view class="avatar">
  13. <image :src="info.photoPath" mode=""></image>
  14. </view>
  15. <view class="name">{{info.school? info.schoolName: info.coachName}}</view>
  16. </view>
  17. <view class="star_row">
  18. <view class="lab">服务态度</view>
  19. <view class="star">
  20. <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" v-model="info.serviceLevel" ></u-rate>
  21. </view>
  22. </view>
  23. <view class="star_row" v-if="info.school">
  24. <view class="lab">驾校风貌</view>
  25. <view class="star">
  26. <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" v-model="info.schoolLevel" ></u-rate>
  27. </view>
  28. </view>
  29. <view class="star_row">
  30. <view class="lab">教学安排</view>
  31. <view class="star">
  32. <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" v-model="info.teachLevel" ></u-rate>
  33. </view>
  34. </view>
  35. <view class="star_row">
  36. <view class="lab">教学质量</view>
  37. <view class="star">
  38. <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" v-model="info.qualityLevel" ></u-rate>
  39. </view>
  40. </view>
  41. <!-- 写内容上传图片 -->
  42. <view class="textareaBg">
  43. <view class="flex">
  44. <view class="icon">
  45. <image src="@/static/images/index/edit.png" mode=""></image>
  46. </view>
  47. <view class="inputBox">
  48. <u-textarea v-model="info.description" ref="textarea" placeholder="详细说明问题,以便获得更好的回答~" border="none"></u-textarea>
  49. </view>
  50. </view>
  51. <view class="phoneBox">
  52. <view class="imgBox">
  53. <view class="img" v-for="(item,index) in info.imgArr" :key="item">
  54. <view class="minusCircle" @click="deleteImg(item)">
  55. <u-icon name="close-circle-fill" size="20" color="#b9061d"></u-icon>
  56. </view>
  57. <image :src="item" mode=""></image>
  58. </view>
  59. </view>
  60. <view class="phone" @click="chooseImages" v-if="info.imgArr&&info.imgArr.length<3">
  61. <view class="phoneIcon">
  62. <image src="@/static/images/index/btn_tupian.png" mode=""></image>
  63. </view>
  64. <view class="lab">添加图片</view>
  65. </view>
  66. <view class="phone" @click="chooseVideo" v-if="!info.videoUrl" >
  67. <view class="phoneIcon">
  68. <image src="@/static/images/index/btn_tupian.png" mode=""></image>
  69. </view>
  70. <view class="lab">添加视频</view>
  71. </view>
  72. <view class="imgBox" style="margin-left: 16rpx;" v-else>
  73. <view class="img">
  74. <view class="minusCircle" @click="info.videoUrl=''">
  75. <u-icon name="close-circle-fill" size="20" color="#b9061d"></u-icon>
  76. </view>
  77. <video :src="info.videoUrl" style="width: 160rpx;height: 160rpx;display: block;" ></video>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import { uploadImgApi } from '@/config/utils.js'
  88. export default {
  89. props: [ 'info' ],
  90. data() {
  91. return {
  92. checked: false,
  93. imgArr:[]
  94. }
  95. },
  96. watch: {
  97. info: {
  98. handler(newVal) {
  99. if(newVal) {
  100. this.$emit('updatedForm', newVal)
  101. }
  102. },
  103. deep: true
  104. }
  105. },
  106. methods: {
  107. // 1是匿名 2是不匿名
  108. changeChe(val) {
  109. // console.log(this.info.anonymity)
  110. console.log(val)
  111. if(val) {
  112. this.info.anonymity = 1
  113. }else {
  114. this.info.anonymity = 2
  115. }
  116. },
  117. deleteImg(item) {
  118. let index = this.info.imgArr.findIndex(val=>val==item)
  119. this.info.imgArr.splice(index, 1)
  120. },
  121. chooseVideo() {
  122. uni.chooseVideo({
  123. sourceType: ['album', 'camera'],
  124. compressed: true,
  125. success: async (res)=> {
  126. // 在这里处理选定的视频文件
  127. console.log(res.tempFilePath);
  128. // 调用上传视频函数
  129. let videoUrl = await uploadImgApi(res.tempFilePath, res.name, 'video')
  130. if(videoUrl) this.info.videoUrl = videoUrl
  131. },
  132. fail: function (error) {
  133. console.log(error);
  134. }
  135. });
  136. },
  137. //选择图片
  138. chooseImages(type) {
  139. let imgNum = 3 - (this.imgArr.length)
  140. uni.chooseImage({
  141. count: imgNum, //允许选择的数量
  142. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  143. sourceType: ['album', 'camera'], //从相册选择
  144. success: res => {
  145. uni.showLoading({
  146. title: '图片上传中...'
  147. });
  148. console.log(res)
  149. res.tempFiles.forEach(async (item,index)=>{
  150. let imgLink = await uploadImgApi(item.path, index)
  151. if(imgLink) this.info.imgArr.push(imgLink)
  152. console.log('----------')
  153. console.log(this.info.imgArr)
  154. })
  155. }
  156. })
  157. },
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. @import '../../../../common/css/textareaBg.scss';
  163. .phoneBox {
  164. flex-wrap: wrap;
  165. .img {
  166. margin-bottom: 16rpx;
  167. }
  168. .phone {
  169. margin-right: 16rpx;
  170. }
  171. .imgBox {
  172. flex-wrap: wrap;
  173. }
  174. }
  175. .card {
  176. padding: 28rpx;
  177. margin-bottom: 20rpx;
  178. .top_row {
  179. display: flex;
  180. align-items: center;
  181. padding-bottom: 24rpx;
  182. border-bottom: 2rpx solid #E8E9EC;
  183. justify-content: space-between;
  184. .tit {
  185. font-weight: 600;
  186. color: #333333;
  187. font-size: 32rpx;
  188. }
  189. }
  190. .user_row {
  191. width: 100%;
  192. height: 100rpx;
  193. display: flex;
  194. align-items: center;
  195. .avatar {
  196. width: 60rpx;
  197. height: 60rpx;
  198. border-radius: 50%;
  199. overflow: hidden;
  200. }
  201. .name {
  202. font-size: 28rpx;
  203. font-weight: 500;
  204. padding-left: 26rpx;
  205. }
  206. }
  207. .star_row {
  208. padding: 14rpx 0;
  209. display: flex;
  210. align-items: center;
  211. .lab {
  212. font-size: 28rpx;
  213. font-weight: 500;
  214. padding-right: 32rpx;
  215. }
  216. .star {
  217. }
  218. }
  219. .textareaBg {
  220. margin-top: 22rpx;
  221. }
  222. }
  223. </style>