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

267 lines
7.2 KiB

12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months 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 iconPlacement="right" :size="14" >
  8. <u-checkbox v-model="info.anonymity" shape="circle" label="匿名提交" :iconSize="12" :labelSize="12" ></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.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 { WX_API, H5_API, prefix } from '@/config/site.config.js';
  88. var _url = H5_API+ WX_API
  89. export default {
  90. props: [ 'info' ],
  91. data() {
  92. return {
  93. checked: false,
  94. imgArr:[]
  95. }
  96. },
  97. methods: {
  98. deleteImg(item) {
  99. let index = this.info.imgArr.findIndex(val=>val==item)
  100. this.info.imgArr.splice(index, 1)
  101. },
  102. chooseVideo() {
  103. uni.chooseVideo({
  104. sourceType: ['album', 'camera'],
  105. compressed: true,
  106. success: (res)=> {
  107. // 在这里处理选定的视频文件
  108. console.log(res.tempFilePath);
  109. // 调用上传视频函数
  110. this.uploadImgApi(res.tempFilePath, res.name, 'video')
  111. },
  112. fail: function (error) {
  113. console.log(error);
  114. }
  115. });
  116. },
  117. uploadVideo(filePath) {
  118. uni.uploadFile({
  119. url: 'https://your-upload-api.com/upload-video',
  120. filePath: filePath,
  121. name: 'video',
  122. formData: {
  123. // 你可能需要传递其他表单数据
  124. },
  125. success: function (res) {
  126. var data = JSON.parse(res.data);
  127. if (data.code === 0) {
  128. // 上传成功,处理服务器返回的数据
  129. console.log('上传成功', data);
  130. } else {
  131. // 上传失败,处理错误信息
  132. console.log('上传失败', data);
  133. }
  134. },
  135. fail: function (error) {
  136. console.log('上传失败', error);
  137. }
  138. });
  139. },
  140. //选择图片
  141. chooseImages(type) {
  142. let imgNum = 3 - (this.imgArr.length)
  143. uni.chooseImage({
  144. count: imgNum, //允许选择的数量
  145. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  146. sourceType: ['album', 'camera'], //从相册选择
  147. success: res => {
  148. uni.showLoading({
  149. title: '图片上传中...'
  150. });
  151. console.log(res)
  152. res.tempFiles.forEach( (item,index)=>{
  153. this.uploadImgApi(item.path, item.name)
  154. })
  155. }
  156. })
  157. },
  158. uploadImgApi(filePath, imgName, vdo) {
  159. console.log(filePath)
  160. let token = 'Bearer '+ this.$store.state.user.vuex_loginInfo.accessToken
  161. let _this = this
  162. let timer = new Date() * 1
  163. // 上传图片到服务器
  164. uni.uploadFile({
  165. url: _url + 'app-api/infra/file/upload',//接口
  166. filePath: filePath,//要上传的图片的本地路径
  167. name: 'file',
  168. formData: {
  169. path: 'complain/'+ uni.$u.date(name, 'yyyy-mm-dd')+'/'+timer + '-'+ imgName,
  170. type: 1,
  171. fileSuffix: "png"
  172. },
  173. header: {
  174. Authorization: token,
  175. 'tenant-id': 1
  176. },
  177. success(res) {
  178. console.log('上传成功')
  179. let res2 = JSON.parse(res.data)
  180. if(vdo) {
  181. _this.info.videoUrl = res2.data
  182. }else {
  183. _this.info.imgArr.push(res2.data)
  184. }
  185. console.log(res2)
  186. uni.hideLoading();
  187. },
  188. complete: (err)=> {
  189. console.log(err)
  190. }
  191. })
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. @import '../../../../common/css/textareaBg.scss';
  198. .phoneBox {
  199. flex-wrap: wrap;
  200. .img {
  201. margin-bottom: 16rpx;
  202. }
  203. .phone {
  204. margin-right: 16rpx;
  205. }
  206. .imgBox {
  207. flex-wrap: wrap;
  208. }
  209. }
  210. .card {
  211. padding: 28rpx;
  212. margin-bottom: 20rpx;
  213. .top_row {
  214. display: flex;
  215. align-items: center;
  216. padding-bottom: 24rpx;
  217. border-bottom: 2rpx solid #E8E9EC;
  218. justify-content: space-between;
  219. .tit {
  220. font-weight: 600;
  221. color: #333333;
  222. font-size: 32rpx;
  223. }
  224. }
  225. .user_row {
  226. width: 100%;
  227. height: 100rpx;
  228. display: flex;
  229. align-items: center;
  230. .avatar {
  231. width: 60rpx;
  232. height: 60rpx;
  233. border-radius: 50%;
  234. overflow: hidden;
  235. }
  236. .name {
  237. font-size: 28rpx;
  238. font-weight: 500;
  239. padding-left: 26rpx;
  240. }
  241. }
  242. .star_row {
  243. padding: 14rpx 0;
  244. display: flex;
  245. align-items: center;
  246. .lab {
  247. font-size: 28rpx;
  248. font-weight: 500;
  249. padding-right: 32rpx;
  250. }
  251. .star {
  252. }
  253. }
  254. .textareaBg {
  255. margin-top: 22rpx;
  256. }
  257. }
  258. </style>