t-o-news-tab-1.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view>
  3. <view class="list">
  4. <view class="item" v-for="(item,index) in list" :key="index">
  5. <view class="label" @click="change_active(index)">
  6. <view class="left">
  7. <view class="icon">
  8. <image src="./icon/icon.png" mode=""></image>
  9. </view>
  10. <view class="name">{{item.category}}</view>
  11. </view>
  12. <view class="right">
  13. <view class="tip" v-if="active != index && item.no_num != 0">
  14. <view class="tip_text">未处理</view>
  15. <view class="tip_num">{{item.no_num}}</view>
  16. </view>
  17. <view class="icon" v-if="active != index">
  18. <uni-icons type="bottom" size="20" color="#e5e5e5"></uni-icons>
  19. </view>
  20. <view class="icon" v-if="active == index">
  21. <uni-icons type="top" size="20" color="#e5e5e5"></uni-icons>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="content" v-if="active == index">
  26. <view class="item" v-for="(item_2,index_2) in item.children" :key="index_2">
  27. <view class="title">
  28. <view class="icon"></view>
  29. <view class="text">{{item_2.title}}</view>
  30. </view>
  31. <view class="btn_box">
  32. <view class="btn" @click.stop="go_list(item_2.title,item_2.table,item_2.num,2)">
  33. <view class="text">未完成:<text>{{item_2.series[1].value}} 个</text></view>
  34. </view>
  35. <view class="btn" @click.stop="go_statistical_chart(item_2.title,item_2.table)">
  36. <view class="text">查看统计</text></view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. name: "t-o-news-tab-1",
  48. data() {
  49. return {
  50. active:999,
  51. list:[]
  52. };
  53. },
  54. mounted() {
  55. this.get_data()
  56. },
  57. methods:{
  58. change_active(index) {
  59. console.log(index)
  60. if(this.active == index){
  61. this.active = 999
  62. }else{
  63. this.active = index
  64. }
  65. },
  66. get_data(){
  67. this.$api.five_fixed_fiveFixedNewCategory({
  68. }).then((res)=>{
  69. // console.log(res.data.content.data)
  70. this.list = res.data.content.data
  71. let num = 0
  72. this.list.forEach((item,index)=>{
  73. num = num + item.no_num
  74. })
  75. if(num > 0){
  76. uni.setTabBarBadge({
  77. index: 1,
  78. text: '' + num + ''
  79. })
  80. }
  81. })
  82. },
  83. go_list(title,table,num,status){
  84. console.log(title,table,num,status)
  85. uni.navigateTo({
  86. url: "../../origanization/news/tab_1/all_list/all_list?title=" + title + "&table=" + table + "&num=" + num + "&status=" + status
  87. })
  88. },
  89. // 统计详情
  90. go_statistical_chart(title,table){
  91. uni.navigateTo({
  92. url:"../../origanization/news/tab_1/statistical_chart/statistical_chart?title=" + title + "&table=" + table
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .list{
  100. box-sizing: border-box;
  101. padding: 25rpx;
  102. .item{
  103. margin-bottom: 20rpx;
  104. background-color: #FFFFFF;
  105. border-radius: 10rpx;
  106. .label{
  107. box-sizing: border-box;
  108. padding: 0 25rpx;
  109. display: flex;
  110. align-items: center;
  111. justify-content: space-between;
  112. height: 100rpx;
  113. .left{
  114. display: flex;
  115. align-items: center;
  116. .icon{
  117. margin-right: 20rpx;
  118. image{
  119. width: 32rpx;
  120. height: 32rpx;
  121. display: block;
  122. }
  123. }
  124. .name{
  125. width: 300rpx;
  126. white-space: nowrap;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. }
  130. }
  131. .right{
  132. display: flex;
  133. .tip{
  134. display: flex;
  135. align-items: center;
  136. .tip_text{
  137. font-size: 26rpx;
  138. color: #FE6A5C;
  139. }
  140. .tip_num{
  141. margin: 0 20rpx;
  142. font-size: 28rpx;
  143. color: #FFFFFF;
  144. background-color: #FE6A5C;
  145. border-radius: 10rpx;
  146. padding: 2rpx 10rpx;
  147. }
  148. }
  149. .icon{
  150. }
  151. }
  152. }
  153. .content{
  154. background-color: #FFFFFF;
  155. box-sizing: border-box;
  156. padding: 0 25rpx 10rpx;
  157. .item{
  158. border-top: 2rpx dashed #DCDCDC;
  159. .title{
  160. margin-left: 20rpx;
  161. display: flex;
  162. align-items: center;
  163. height: 90rpx;
  164. .icon{
  165. width: 16rpx;
  166. height: 16rpx;
  167. background-color: #01A0E8;
  168. border-radius: 50%;
  169. }
  170. .text{
  171. margin-left: 20rpx;
  172. font-size: 30rpx;
  173. font-weight: 700;
  174. }
  175. }
  176. .btn_box{
  177. display: flex;
  178. justify-content: space-around;
  179. .btn{
  180. width: 200rpx;
  181. text-align: center;
  182. color: #999999;
  183. font-size: 28rpx;
  184. padding: 6rpx 20rpx;
  185. border: 1rpx solid #999;
  186. border-radius: 30rpx;
  187. text{
  188. color: #FE6A5C;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. </style>