list.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view>
  3. <u-navbar title="">
  4. </u-navbar>
  5. <view class="news">
  6. <table class="table" v-if="recordsTotalList" >
  7. <tr>
  8. <td class="tb31">荣誉类型</td>
  9. <td class="tb32">荣誉细则<span class="tb33"><br>(点击下方内容可查看详情)</span></td>
  10. </tr>
  11. <template v-for="(not,j) in noticeList">
  12. <template v-if="not.list.length">
  13. <tr v-for="(item,i) in not.list" :class="{trtop:i==0}" @click="ckInfo(item.id)" :key="i+'_'+j">
  14. <td v-if="i==0" class="tb1" :rowspan="not.list.length" v-html="htmlShow(not.name)" ></td> <td class="tb2">{{item.title}}</td>
  15. </tr>
  16. </template>
  17. </template>
  18. </table>
  19. </view>
  20. <u-divider v-if="recordsTotal==noticeList.length"
  21. :isnone="recordsTotalList==0" nonetext="没有找到相关内容"
  22. border-color="#CFD2D5">已经到底了</u-divider>
  23. </view>
  24. </template>
  25. <script>
  26. import * as API from '@/apis/pagejs/news.js'
  27. export default {
  28. data() {
  29. return {
  30. title:"列表",
  31. list:[],
  32. list2:[],
  33. listForm:{
  34. pageIndex:1,
  35. typeId:"",
  36. title:"",
  37. pageSize:999,
  38. },
  39. noticeList:[
  40. {
  41. id:"7288376a-b582-4e9a-98fa-c218e35b5c30",
  42. name:"个人荣誉",
  43. list:[]
  44. },
  45. {
  46. id:"86e29bf7-9e8f-4a28-9361-1001705d3dc6",
  47. name:"集体荣誉",
  48. list:[]
  49. }
  50. ],
  51. noticeList2:[
  52. {
  53. id:"9dbeddd2-a863-42d0-a145-260fe008bdbb",
  54. name:"个人荣誉",
  55. list:[]
  56. },
  57. {
  58. id:"412eff92-a443-42f7-98c6-5c67d9e64ad8",
  59. name:"集体荣誉",
  60. list:[]
  61. }
  62. ],
  63. recordsTotal:0,
  64. recordsTotalList:0,
  65. imgurl:'',
  66. listBl:false,
  67. listBl2:false,
  68. }
  69. },
  70. onLoad(op){
  71. },
  72. onReady() {
  73. uni.showLoading({
  74. title: "加载中",
  75. mask: true,
  76. })
  77. //86e29bf7-9e8f-4a28-9361-1001705d3dc6
  78. //7288376a-b582-4e9a-98fa-c218e35b5c30
  79. var _this=this;
  80. // this.getList("86e29bf7-9e8f-4a28-9361-1001705d3dc6","")
  81. // this.getList("7288376a-b582-4e9a-98fa-c218e35b5c30","2")
  82. this.getList2()
  83. // this.getList(this.list,"9dbeddd2-a863-42d0-a145-260fe008bdbb",this.listBl)
  84. // this.getList(this.list2,"412eff92-a443-42f7-98c6-5c67d9e64ad8",this.listBl2)
  85. },
  86. methods: {
  87. htmlShow(str){
  88. var t="";
  89. for(var i in str){
  90. t+=str[i]+"<br/>"
  91. }
  92. return t
  93. },
  94. ckInfo(id){
  95. var url="/pages/news/articleDetails?id="+id;
  96. uni.navigateTo({
  97. url:url
  98. })
  99. },
  100. getList2Set(i){
  101. var item=this.noticeList[i];
  102. API.pageList({
  103. pageIndex:1,
  104. typeId:item.id,
  105. pageSize:999,
  106. }).then((res) => {
  107. //bl=true
  108. item=this.noticeList[i];
  109. item.list=res.data.data
  110. this.recordsTotalList+=item.list.length
  111. this.recordsTotal++;
  112. if(this.recordsTotal==this.noticeList.length){
  113. uni.hideLoading()
  114. }
  115. }).catch(error => {
  116. uni.showToast({
  117. title: error,
  118. icon: "none"
  119. })
  120. })
  121. },
  122. getList2(){
  123. for(var i in this.noticeList){
  124. this.getList2Set(i)
  125. }
  126. },
  127. getList(id,cb){
  128. API.pageList({
  129. pageIndex:1,
  130. typeId:id,
  131. pageSize:999,
  132. }).then((res) => {
  133. //bl=true
  134. this['list'+cb]=res.data.data
  135. this['listBl'+cb]=true
  136. if(this.listBl2&&this.listBl2){
  137. uni.hideLoading()
  138. }
  139. }).catch(error => {
  140. uni.showToast({
  141. title: error,
  142. icon: "none"
  143. })
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .table{
  151. border-collapse:collapse;
  152. width: 100%;
  153. border: 1px solid;
  154. .trtop{
  155. border-top: 2px solid;
  156. }
  157. td{
  158. border: 1px solid;
  159. text-align: center;
  160. margin: 0;
  161. padding: 10px 0px;
  162. }
  163. .tb1{
  164. font-weight: bold;
  165. font-size: 18px;
  166. width: 20%;
  167. max-width: 200rpx;
  168. min-width: 150rpx;
  169. }
  170. .tb2{
  171. font-size: 14px;
  172. }
  173. .tb32,.tb31{
  174. font-weight: bold;
  175. font-size: 14px;
  176. }
  177. .tb33{
  178. font-weight: normal;
  179. font-size: 12px;
  180. color: #565656;
  181. }
  182. }
  183. page{
  184. background-color: #ffffff;
  185. font-family: 'Regular';
  186. }
  187. /deep/.u-slot-content {
  188. display: block;
  189. text-align: right !important;
  190. margin-right: 16px;
  191. color: #333333;
  192. }
  193. .news{
  194. padding: 40rpx 32rpx;
  195. .news-item{
  196. display: flex;
  197. justify-content: space-between;
  198. margin-bottom: 40rpx;
  199. max-height:100px;
  200. .content{
  201. display: flex;
  202. flex-direction: column;
  203. justify-content: space-between;
  204. .news-title{
  205. color: rgba(51, 51, 51, 1);
  206. font-size: 16px;
  207. text-align: justify;
  208. width: 438rpx;
  209. // white-space: nowrap;
  210. overflow: hidden;
  211. text-overflow: ellipsis;
  212. font-weight: bold;
  213. }
  214. .information{
  215. margin-top: 8rpx;
  216. display: flex;
  217. justify-content: space-between;
  218. color: #777777;
  219. }
  220. }
  221. }
  222. .img{
  223. width: 224rpx;
  224. border-radius: 5px;
  225. overflow: hidden;
  226. img{
  227. border-radius: 5px;
  228. width: 100%;
  229. height: 100%;
  230. }
  231. }
  232. }
  233. /deep/.u-divider{
  234. background-color: #ffffff !important;
  235. color: rgba(182, 189, 195, 1);
  236. font-size: 12px;
  237. font-weight: bold;
  238. }
  239. </style>