manager_suggestion.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view style="padding-bottom: 10px;">
  3. <!-- 建议列表 -->
  4. <view class="suggestContainer">
  5. <view class="suggest" @click="toSuggestDetail(item)" v-for="(item, index) in suggestion" :key="index">
  6. <view class="suggestion">
  7. <view class="suggestHead">
  8. <view>标题</view>
  9. <view class="suggestTitle">{{item.adviseTitle}}</view>
  10. </view>
  11. <view class="suggestBody">
  12. <view>日期</view>
  13. <view class="suggestContent">{{item.fistDatetime}}</view>
  14. </view>
  15. </view>
  16. <view>
  17. <view class="dispose">{{item.status}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. suggestion: [],
  28. obj: {
  29. pageSize: 6,
  30. pageNum: 1
  31. },
  32. total: 0,
  33. isloading: false
  34. };
  35. },
  36. onShow(){
  37. this.obj.pageNum = 1
  38. this.suggestion = []
  39. this.init();
  40. },
  41. methods:{
  42. async init(cb){
  43. // 打开节流阀
  44. this.isloading = true
  45. const { data: result } =await uni.$http.get('/education/my-suggestion/findAllAdvise',this.obj)
  46. // 关闭节流阀
  47. this.isloading = false
  48. // 只要数据请求完毕,就立即按需调用 cb 回调函数
  49. cb && cb()
  50. this.suggestion = [...this.suggestion, ...result.data.data]
  51. this.total = result.data.count;
  52. },
  53. // 下拉刷新
  54. onPullDownRefresh() {
  55. if (this.isloading) return
  56. this.obj.pageNum = 1
  57. this.total = 0
  58. this.suggestion = []
  59. this.isloading = false
  60. this.init(() => uni.stopPullDownRefresh())
  61. },
  62. // 触底事件
  63. onReachBottom() {
  64. // 判断是否有下一页
  65. if (this.obj.pageNum * this.obj.pageSize >= this.total) return uni.$showMsg('数据加载完毕!')
  66. // 判断是否正在请求数据
  67. if (this.isloading) return
  68. this.obj.pageNum += 1
  69. this.init()
  70. },
  71. // 点击建议列表,跳转到对应的建议详情页
  72. toSuggestDetail(item){
  73. let suggestion = JSON.stringify(item)
  74. uni.navigateTo({
  75. url: '/subpkg/manager/suggestion/manager_suggestion_detail?item=' + encodeURIComponent(suggestion)
  76. })
  77. },
  78. }
  79. }
  80. </script>
  81. <style lang="scss"scoped>
  82. .toWriteSuggestion{
  83. display: flex;
  84. position: relative;
  85. justify-content: center;
  86. }
  87. /* 页面背景 */
  88. page{
  89. /* height: 100%; */
  90. /* height: auto !important; */
  91. background-color: #E2F0D9;
  92. }
  93. /* 建议列表区 */
  94. .suggestContainer{
  95. height: 100%;
  96. padding-bottom: 10rpx;
  97. }
  98. /* 单条建议的背景 */
  99. .suggest{
  100. display: flex;
  101. padding: 20rpx;
  102. margin: 20rpx 10rpx;
  103. height: 140rpx;
  104. border-radius: 30rpx;
  105. background-color: #FFF2CC;
  106. }
  107. /* 单条建议左侧标题和内容摘要 */
  108. .suggestion{
  109. width: 75%;
  110. }
  111. /* 标题和内容摘要布局 */
  112. .suggestHead,
  113. .suggestBody{
  114. display: flex;
  115. }
  116. /* 摘要 */
  117. .suggestBody{
  118. margin-top: 10rpx;
  119. }
  120. /* 标题详情和内容详情左边距 */
  121. .suggestTitle,
  122. .suggestContent{
  123. margin-left: 20rpx;
  124. }
  125. /* 标题内容详情 */
  126. .suggestTitle{
  127. width: 65%;
  128. white-space: nowrap;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. }
  132. /* 内容摘要详情 */
  133. .suggestContent{
  134. width: 80%;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. display: -webkit-box;
  138. -webkit-box-orient: vertical;
  139. -webkit-line-clamp: 2;
  140. }
  141. /* 处理状态 */
  142. .dispose{
  143. font-weight: bold;
  144. color: red;
  145. margin-left: 30rpx;
  146. }
  147. /* 写建议按钮 */
  148. .toWriteSuggestion{
  149. display: flex;
  150. position: relative;
  151. justify-content: center;
  152. }
  153. .writeSuggestion{
  154. background-color: #ffffff;
  155. font-size: 35rpx;
  156. color: gray;
  157. border: lawngreen solid 1px;
  158. padding: 10rpx 20rpx;
  159. margin-left: 6px;
  160. }
  161. </style>