manager_suggestion.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. <!-- 设置页面背景 -->
  82. <style lang="scss">
  83. page{
  84. height: 100%;
  85. // background-color: #FFF;
  86. }
  87. </style>
  88. <style lang="scss" scoped>
  89. .toWriteSuggestion{
  90. display: flex;
  91. position: relative;
  92. justify-content: center;
  93. }
  94. /* 页面背景 */
  95. // page{
  96. // /* height: 100%; */
  97. // /* height: auto !important; */
  98. // background-color: #E2F0D9;
  99. // }
  100. /* 建议列表区 */
  101. .suggestContainer{
  102. height: 100%;
  103. padding-bottom: 10rpx;
  104. }
  105. /* 单条建议的背景 */
  106. .suggest{
  107. display: flex;
  108. padding: 20rpx;
  109. margin: 20rpx 10rpx;
  110. height: 100rpx;
  111. border-radius: 30rpx;
  112. background-color: #FFF;
  113. }
  114. /* 单条建议左侧标题和内容摘要 */
  115. .suggestion{
  116. width: 75%;
  117. }
  118. /* 标题和内容摘要布局 */
  119. .suggestHead,
  120. .suggestBody{
  121. display: flex;
  122. }
  123. /* 摘要 */
  124. .suggestBody{
  125. margin-top: 10rpx;
  126. }
  127. /* 标题详情和内容详情左边距 */
  128. .suggestTitle,
  129. .suggestContent{
  130. margin-left: 20rpx;
  131. }
  132. /* 标题内容详情 */
  133. .suggestTitle{
  134. width: 65%;
  135. white-space: nowrap;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. }
  139. /* 内容摘要详情 */
  140. .suggestContent{
  141. width: 80%;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. display: -webkit-box;
  145. -webkit-box-orient: vertical;
  146. -webkit-line-clamp: 2;
  147. }
  148. /* 处理状态 */
  149. .dispose{
  150. font-weight: bold;
  151. color: red;
  152. margin-left: 30rpx;
  153. }
  154. /* 写建议按钮 */
  155. .toWriteSuggestion{
  156. display: flex;
  157. position: relative;
  158. justify-content: center;
  159. }
  160. .writeSuggestion{
  161. background-color: #35b882;
  162. font-size: 35rpx;
  163. color: gray;
  164. border: lawngreen solid 1px;
  165. padding: 10rpx 20rpx;
  166. margin-left: 6px;
  167. }
  168. </style>