feedback.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
  4. <view class="arrow-left" :style="{top: statusBarHeight + 'px'}" @click="goBack"><u-icon name="arrow-left" size="24"></u-icon></view>
  5. <view class="header-title" :style="{height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">投诉反馈</view>
  6. </view>
  7. <view class="container" :style="{paddingTop: `calc(88rpx + ${statusBarHeight}px)`}">
  8. <view class="list-item title">{{pageIndex==0 ? '请选择反馈类型':'请选择'}}</view>
  9. <view class="list-item" v-for="(item, index) in feedbackItems" :key="index" @click="handleClick(item,index)">
  10. {{ item.complaintTypeName }}
  11. </view>
  12. <view class="list-item" @click="goBack">
  13. 返回上一层
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import{ getTypeTree, complaintRecord } from "@/api/course.js"
  20. export default {
  21. data() {
  22. return {
  23. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  24. menuButtonH: 45,
  25. pageIndex: 0,
  26. list:[],
  27. feedbackItems: [],
  28. userId:'',
  29. courseId: '',
  30. videoId:''
  31. };
  32. },
  33. onLoad(option) {
  34. this.userId = option.userId || ''
  35. this.courseId = option.courseId || ''
  36. this.videoId = option.videoId || ''
  37. this.getMenuButton()
  38. this.getList()
  39. },
  40. methods: {
  41. getMenuButton(){
  42. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  43. this.menuButtonH = menuButtonInfo.height
  44. },
  45. goBack() {
  46. // 返回上一层逻辑
  47. if(this.pageIndex == 0){
  48. uni.navigateBack();
  49. }else {
  50. this.pageIndex = 0
  51. this.feedbackItems = this.list
  52. }
  53. },
  54. handleClick(item,index) {
  55. if(this.pageIndex ==0) {
  56. this.feedbackItems = this.list[index].childrenType || [];
  57. this.pageIndex = 1;
  58. } else if(this.pageIndex ==1){
  59. const param = {
  60. userId: this.userId,
  61. complaintTypeId: item.complaintTypeId,
  62. complaintContent: item.complaintContent,
  63. courseId: this.courseId,
  64. videoId: this.videoId,
  65. }
  66. complaintRecord(param).then(res=>{
  67. uni.showModal({
  68. title: '',
  69. content: '我们已收到您的反馈,谢谢',
  70. showCancel: false
  71. });
  72. })
  73. }
  74. },
  75. getList(){
  76. getTypeTree().then(res=>{
  77. if(res.code == 200) {
  78. this.list = res.data
  79. this.pageIndex = 0
  80. this.feedbackItems = this.list
  81. }
  82. })
  83. }
  84. }
  85. };
  86. </script>
  87. <style scoped lang="scss">
  88. .header-nav {
  89. height: 88rpx;
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. overflow: hidden;
  94. background-color: #fff;
  95. box-sizing: border-box;
  96. width: 100%;
  97. position: fixed;
  98. top: 0;
  99. left: 0;
  100. .header-title {
  101. flex: 1;
  102. text-align: center;
  103. overflow: hidden;
  104. white-space: nowrap;
  105. text-overflow: ellipsis;
  106. font-family: PingFang SC,PingFang SC;
  107. font-weight: 500;
  108. font-size: 15px;
  109. color: #000;
  110. box-sizing: border-box;
  111. }
  112. }
  113. .arrow-left {
  114. position: absolute;
  115. left: 24rpx;
  116. height: 88rpx;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. overflow: hidden;
  121. }
  122. .list-item {
  123. background-color: #fff;
  124. padding: 24rpx;
  125. border-bottom: 1rpx solid #f4f4f4;
  126. font-size: 15px;
  127. color: #333;
  128. }
  129. .title {
  130. background-color: #f4f4f4;
  131. }
  132. </style>