teamHonor.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view>
  3. <u-navbar :title="title"></u-navbar>
  4. <view class="tabs">
  5. <u-tabs bar-width="60" inactive-color="#777777" active-color="#018bb9" height="88" :list="tabList" :is-scroll="false" :current="current" @change="change"></u-tabs>
  6. </view>
  7. <view class="commend-box" v-for="(item,i) in list" :key="i" @click="ckItem(item)">
  8. <view class="commend-content">
  9. <view class="title">
  10. {{item.orgName?item.orgName:item.typeName}}
  11. </view>
  12. <view class="commendation">
  13. {{item.content}}
  14. </view>
  15. <view class="integral">
  16. <view class="icon">
  17. <img src="../../../assets/img/riFill-copper-diamond-fill@2x.png" alt="">
  18. </view>
  19. <view class="text">
  20. {{item.scoreInfo}}积分
  21. </view>
  22. </view>
  23. </view>
  24. <view class="gainer">
  25. <template v-if="type=='team'">
  26. <img v-if="item.badge&&item.badge.imgUrl" :src="item.badge.imgUrl" alt="">
  27. <u-avatar v-else size="136" ></u-avatar>
  28. </template>
  29. <template v-if="type=='my'">
  30. <img v-if="item.regUser&&item.regUser.headImg" :src="item.regUser.headImg" alt="">
  31. <u-avatar v-else size="136" ></u-avatar>
  32. </template>
  33. <view class="name">
  34. {{item.userName?item.userName:item.badgeName}}
  35. </view>
  36. </view>
  37. </view>
  38. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider>
  39. </view>
  40. </template>
  41. <script>
  42. import * as API from '@/apis/pagejs/cite.js'
  43. export default {
  44. data() {
  45. return {
  46. title:'',
  47. type:'',
  48. listForm:{
  49. pageIndex:1,
  50. pageSize:20,
  51. },
  52. list:[],
  53. recordsTotal:0,
  54. tabList: [{
  55. name: '全部'
  56. }, {
  57. name: '荣誉类型'
  58. }, {
  59. name: '荣誉类型',
  60. }],
  61. current: 0
  62. }
  63. },
  64. onLoad(op){
  65. if(op.type){
  66. this.type=op.type
  67. if(this.type=='my'){
  68. this.listForm.isTeam=false
  69. this.title="公司表彰"
  70. }else if(this.type=='team'){
  71. this.listForm.isTeam=true
  72. this.title="团队荣誉"
  73. }
  74. }
  75. this.getByType()
  76. this.getList()
  77. },
  78. onReachBottom() {
  79. if (this.list.length < this.recordsTotal) {
  80. this.myLoadmore();
  81. }
  82. },
  83. methods: {
  84. ckItem(item){
  85. if(item.badgeId){
  86. var url="/pages/staffHome/teamHonor/badgeDetails?type="+item.badgeId+"&id="+item.type;
  87. uni.navigateTo({
  88. url:url
  89. })
  90. }
  91. },
  92. myLoadmore(){
  93. this.listForm.pageIndex += 1;
  94. this.getList();
  95. },
  96. getList(){
  97. uni.showLoading({
  98. title: "加载中",
  99. mask: true,
  100. })
  101. API.pageList(this.listForm).then((res) => {
  102. uni.hideLoading();
  103. //this.list=response.data.data
  104. if(this.listForm.pageIndex==1){
  105. this.list = res.data.data;
  106. }else{
  107. this.list = [
  108. ...this.list,
  109. ...res.data.data
  110. ];
  111. }
  112. this.recordsTotal = res.data.recordsTotal;
  113. }).catch(error => {
  114. uni.showToast({
  115. title: error,
  116. icon: "none"
  117. })
  118. })
  119. },
  120. getByType(){
  121. uni.showLoading({
  122. title: "加载中",
  123. mask: true,
  124. })
  125. API.getByType(this.type).then((response) => {
  126. uni.hideLoading();
  127. this.tabList=[
  128. {
  129. id:'',
  130. name:'全部'
  131. },
  132. ...response.data
  133. ]
  134. }).catch(error => {
  135. uni.showToast({
  136. title: error,
  137. icon: "none"
  138. })
  139. })
  140. },
  141. change(index) {
  142. this.current = index;
  143. this.listForm.pageIndex = 1;
  144. this.listForm.type=this.tabList[index].id
  145. this.getList()
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .tabs{
  152. background-color: rgba(255, 255, 255, 1);
  153. /deep/.u-tabs{
  154. width: 408rpx;
  155. }
  156. margin-bottom: 24rpx;
  157. }
  158. .commend-box{
  159. background-color: #fff;
  160. border-radius: 8px;
  161. margin: 0 32rpx 24rpx 32rpx;
  162. padding: 24rpx;
  163. display: flex;
  164. justify-content: space-between;
  165. .commend-content{
  166. .title{
  167. color: rgba(51, 51, 51, 1);
  168. font-size: 16px;
  169. line-height: 23px;
  170. font-family: 'Medium';
  171. }
  172. .commendation{
  173. color: rgba(119, 119, 119, 1);
  174. font-size: 12px;
  175. line-height: 17px;
  176. margin-top: 4rpx;
  177. width: 430rpx;
  178. }
  179. .integral{
  180. font-family: 'Regular';
  181. margin-top: 14rpx;
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. background-color: rgba(230, 239, 255, 1);
  186. width: 260rpx;
  187. border-radius: 50px;
  188. height: 28px;
  189. font-size: 24rpx;
  190. .icon{
  191. width: 32rpx;
  192. height: 32rpx;
  193. img{
  194. width: 100%;
  195. }
  196. }
  197. .text{
  198. font-size: 24rpx;
  199. color: rgba(119, 119, 119, 1);
  200. }
  201. }
  202. }
  203. .gainer{
  204. img{
  205. width: 136rpx;
  206. height: 140rpx;
  207. border-radius: 50px;
  208. }
  209. .name{
  210. text-align: center;
  211. color: rgba(51, 51, 51, 1);
  212. font-family: 'Regular';
  213. }
  214. }
  215. }
  216. </style>