userCenterMyActivityParticipation.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="container-box">
  3. <div class="filter-box">
  4. <el-radio-group v-model="auditStatusDict" id="radioGroup">
  5. <el-radio-button label="">{{$i18n.locale=='en'? 'All': '全部'}}({{listTotal}})</el-radio-button>
  6. <el-radio-button label="0">{{$i18n.locale=='en'? 'In the activity':'活动中'}}({{numMap.inActivity}})</el-radio-button>
  7. <el-radio-button label="1">{{$i18n.locale=='en'? 'Finished': '已结束'}}({{numMap.close}})</el-radio-button>
  8. </el-radio-group>
  9. </div>
  10. <div v-show="listData.length!=0&&listData.length!=undefined">
  11. <div style="min-height: 20px;">
  12. <div v-for="(item,index) in listData"
  13. style="width: 430px;height: 260px;"
  14. :style="{float:index%2==0?'left':'right',marginTop:index!=0&&index!=1?'20px':'0'}"
  15. id="list">
  16. <!--<div v-for="(item,index) in listData"
  17. style="width: 430px;height: 281px;"
  18. :style="{float:index%2==0?'left':'right',marginTop:index!=0&&index!=1?'20px':'0'}"
  19. id="list">-->
  20. <div style="width: 100%;height: 146px;position: relative">
  21. <img v-if="item.activityLogo" :src="'api/file/pub/'+ item.activityLogo" alt="" style="width: 100%;height: 100%;">
  22. <img v-else :src="'api/file/pub/'+'/def/def1.png'" alt="" style="width: 100%;height: 100%;">
  23. <span style="position: absolute;top: 0;right: 0;width: 82px;height: 25px;display: inline-block;background-color: #ff9933;color: white;text-align: center;line-height: 25px;">
  24. {{item.activityStatusDict==3?$t("common.Finished"):item.activityStatusDict==2?$t("common.Inaction"):$t("common.SigningUp")}}
  25. </span>
  26. </div>
  27. <div style="width: 100%;height: calc(100% - 146px);border: 1px solid #f2f2f2;box-sizing: border-box;padding-left: 8px;">
  28. <p style="margin: 7px 0 0 0;font-size: 16px;font-weight: 600;height: 42px;" class="twoLine">{{item.activityName}}</p>
  29. <p style="margin: 7px 0 0 0;font-size: 12px;">
  30. <span>{{item.activityCity}}</span>
  31. <!--报名时间-->
  32. <!--<span style="margin-left: 50px;">{{item.registrationTime}}</span>-->
  33. <!--活动时间-->
  34. <span style="margin-left: 50px;">{{item.activityStartTime}}--{{item.activityEndTime}}</span>
  35. </p>
  36. <p style="margin: 7px 0 0 0;font-size: 12px;">
  37. <span style="display: inline-block;width: 100%;" class="oneLine" :title="item.activityIntroduce">{{item.activityIntroduce}}</span>
  38. </p>
  39. <!--<p style="margin: 7px 0 0 0;font-size: 12px;color: #1990fe;text-align: left;">
  40. <span style="background-color: #f0f9eb;color: #67c23a;border: 1px solid #e1f3d8;" class="hoverShow">{{$t('common.look')}}</span>
  41. <span style="background-color: #f4f4f5;color: #909399;border: 1px solid #e9e9eb;" class="hoverShow">{{$t('common.edit')}}</span>
  42. </p>-->
  43. </div>
  44. </div>
  45. <div style="clear: both;"></div>
  46. </div>
  47. <div style="width: 100%;text-align: center;">
  48. <el-pagination
  49. style="margin-top: 20px"
  50. layout="prev, pager, next"
  51. @current-change="currentChange"
  52. :total="totalNum">
  53. </el-pagination>
  54. </div>
  55. </div>
  56. <ul style="margin:30px;width: 90%;" v-show="listData.length==0||listData.length==undefined">
  57. <img v-if="this.$i18n.locale.toUpperCase()=='ZH'" src="@/assets/img/noData.png" alt=""
  58. style="width: 100%;height: 100%;">
  59. <img v-if="this.$i18n.locale.toUpperCase()=='EN'" src="@/assets/img/noDataEn.png" alt=""
  60. style="width: 100%;height: 100%;">
  61. </ul>
  62. </div>
  63. </template>
  64. <script>
  65. import Base from "@/views/base/Base";
  66. import { getDicts } from "@/api/dict";
  67. import { formatDate } from "@/utils/formatUtils";
  68. import { getMyActivityByIdForWeb } from "@/api/meeting/meetingApply";
  69. export default {
  70. name: 'userCenterMyActivityParticipation',
  71. extends: Base,
  72. data() {
  73. return {
  74. language:'',
  75. userId: JSON.parse(localStorage.getItem('user')).userId,
  76. // 检索
  77. auditStatusDict:'',
  78. // 分页
  79. cureentPage: 1,
  80. totalNum: 0,
  81. // 数据
  82. listData:[],
  83. numMap:[],
  84. }
  85. },
  86. mounted() {
  87. const that = this;
  88. this.$nextTick(function () {
  89. that.getActivity();
  90. })
  91. },
  92. watch:{
  93. "$i18n.locale"() {
  94. this.numMap = [];
  95. this.cureentPage = 1;
  96. this.$nextTick(function () {
  97. this.getActivity();
  98. })
  99. },
  100. 'auditStatusDict'(val,oldVal){
  101. this.getActivity();
  102. },
  103. },
  104. // 计数总数
  105. computed: {
  106. 'listTotal'(){
  107. let num = (this.numMap.close-0)+(this.numMap.inActivity-0);
  108. if( (typeof num) === 'number' && window.isNaN(num)){
  109. num = 0
  110. }
  111. return num
  112. }
  113. },
  114. methods: {
  115. // 获取数据
  116. getActivity(){
  117. const that = this;
  118. let params = {
  119. // pageNo:this.cureentPage,
  120. // pageSize:10,
  121. language:that.$i18n.locale.toUpperCase(),
  122. id:that.userId,
  123. type:that.auditStatusDict,
  124. // type:null,
  125. };
  126. getMyActivityByIdForWeb(params).then(res => {
  127. if (res.data) {
  128. if (res.data.activityInfos) {
  129. that.listData = res.data.activityInfos;
  130. that.listData.forEach((i)=>{
  131. // i.activityIntroductionUe = i.activityIntroductionUe.replace(/<[^>]+>/ig, '')
  132. i.activityStartTime = i.activityStartTime ? formatDate(i.activityStartTime, "YYYY-MM-DD") : "";
  133. i.activityEndTime = i.activityEndTime ? formatDate(i.activityEndTime, "YYYY-MM-DD") : "";
  134. })
  135. /*if(that.auditStatusDict == ''){
  136. }*/
  137. that.totalNum = Number(res.data.count);
  138. if(that.numMap.length==0){
  139. if (res.data.numMap) {
  140. that.numMap = res.data.numMap
  141. }else{
  142. that.numMap = {
  143. inActivity: "0",
  144. close: "0",
  145. }
  146. }
  147. }
  148. }else{
  149. that.listData = []
  150. }
  151. } else {
  152. that.listData = []
  153. }
  154. })
  155. },
  156. // 分页
  157. currentChange(p) {
  158. this.cureentPage = p;
  159. this.getActivity();
  160. },
  161. toView(router,json){
  162. this.$router.push({name:router,params:json})
  163. },
  164. }
  165. }
  166. </script>
  167. <style scoped>
  168. .oneLine{
  169. /* 隐藏溢出元素 */
  170. overflow: hidden;
  171. /* 单行显示 */
  172. white-space: nowrap;
  173. /* 溢出显示省略号 */
  174. text-overflow: ellipsis;
  175. }
  176. .twoLine{
  177. overflow : hidden;
  178. text-overflow: ellipsis;
  179. display: -webkit-box;
  180. -webkit-line-clamp: 2;
  181. -webkit-box-orient: vertical;
  182. }
  183. .container-box {
  184. padding: 20px;
  185. }
  186. .filter-box {
  187. display: flex;
  188. justify-content: space-between;
  189. padding: 20px 0;
  190. }
  191. /deep/ #radioGroup .el-radio-button__inner{
  192. border: none;
  193. }
  194. /deep/ #radioGroup .el-radio-button.is-active .el-radio-button__inner{
  195. background-color: white;
  196. color: #ff3b00;
  197. box-shadow: none;
  198. }
  199. .hoverShow{
  200. margin-right: 25px;
  201. cursor: pointer;
  202. display: inline-block;
  203. padding: 2px 10px;
  204. }
  205. </style>