SquareCard.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <el-card class="square-card">
  3. <div class="card-title">
  4. {{card.name ? card.name :card.title}}
  5. </div>
  6. <div class="card-content">
  7. {{card.description}}
  8. </div>
  9. <div class="card-detail">
  10. <el-row>
  11. <el-col :lg="6" :md="24">
  12. <span class="card-detail-money" v-if="card.quotedPrice||card.quotedPrice === 0">¥{{card.quotedPrice > 10000 ? Math.floor(card.quotedPrice/10000) + 'w+' : card.quotedPrice}}</span>
  13. <span class="card-detail-money" v-else>¥{{card.quotePrice > 10000 ? Math.floor(card.quotePrice/10000)+'w+' : card.quotePrice}}</span>
  14. <!-- <span class="card-detail-money">¥{{(card.quotedPrice||card.quotedPrice === 0) ? card.quotedPrice : card.quotePrice}}</span>-->
  15. </el-col>
  16. <el-col :lg="18" :md="24">
  17. <span class="card-detail-info pull-right">{{card.time_interval}}/{{card.joinCount > 10000 ? Math.floor(card.joinCount/10000)+'w+': card.joinCount}}人参与</span>
  18. </el-col>
  19. </el-row>
  20. </div>
  21. <div class="card-footer">
  22. <el-row class="card-footer-row" v-if="!card.serviceType">
  23. <el-col :span="12" class="pull-left">
  24. {{card.applicationType}}
  25. </el-col>
  26. <el-col :span="12" class=" test-btn">
  27. <el-button type="primary" round size="mini" class="pull-right"
  28. @click="goToProjectDetail(card.code)">查看详情
  29. </el-button>
  30. </el-col>
  31. </el-row>
  32. <el-row class="card-footer-row" v-else>
  33. <el-col :span="12" class="pull-left">
  34. {{card.serviceType}}
  35. </el-col>
  36. <el-col :span="12" class=" test-btn">
  37. <el-button type="primary" round size="mini" class="pull-right"
  38. @click="goToTaskDetail(card.projectId, card.code)">我要众测
  39. </el-button>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. </el-card>
  44. </template>
  45. <script>
  46. import {notify} from "../../constants";
  47. import Http from '@/js/http.js';
  48. import {storageGet} from '@/js/index.js'
  49. import Apis from '@/js/api'
  50. export default {
  51. name: 'SquareCard',
  52. props: ['card'],
  53. data() {
  54. return {
  55. isLogin: false,
  56. user:{}
  57. }
  58. },
  59. methods: {
  60. onload() {
  61. if (storageGet('user') != null) {
  62. this.isLogin = true;
  63. }
  64. },
  65. checkCreateProjectAuth() {
  66. if (!this.isLogin) {
  67. console.log("请登录后访问");
  68. notify('warning', '请登录后访问');
  69. } else if (this.isLogin) {
  70. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  71. this.$router.push('/project/create');
  72. }).catch((error) => {
  73. notify('error', error.data)
  74. })
  75. }
  76. },
  77. goToProjectDetail(id) {
  78. if (!this.isLogin) {
  79. notify('warning', '请登录后访问');
  80. }
  81. // else if (this.isLogin) {
  82. // Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  83. // this.$router.push({name: 'Project', params: {projectId: id}})
  84. // }).catch((error) => {
  85. // notify('error', error.data)
  86. // })
  87. // }
  88. this.$router.push({name: 'Project', params: {projectId: id}})
  89. },
  90. goToTaskDetail(projectId, taskId) {
  91. if (!this.isLogin) {
  92. console.log("请登录后访问");
  93. notify('warning', '请登录后访问');
  94. } else if (this.isLogin) {
  95. Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
  96. this.$router.push({
  97. name: 'Task',
  98. params: {projectId: projectId, taskId: taskId}
  99. })
  100. }).catch((error) => {
  101. notify('error', error.data)
  102. })
  103. }
  104. },
  105. setUserInfo() {
  106. this.user = storageGet('user')&&storageGet('user').userVO;
  107. }
  108. },
  109. mounted() {
  110. this.onload();
  111. this.setUserInfo();
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. @import "../../style/main";
  117. .square-card .el-card__body {
  118. padding: 0 !important;
  119. }
  120. .square-card {
  121. .card-title {
  122. font-size: 16px;
  123. font-family: Source Han Sans CN;
  124. font-weight: 500;
  125. color: rgba(0, 0, 0, 1);
  126. line-height: 30px;
  127. margin: 10px 0;
  128. overflow: hidden; //超出的文本隐藏
  129. text-overflow: ellipsis; //溢出用省略号显示
  130. white-space: nowrap; //溢出不换行
  131. }
  132. .card-content {
  133. font-size: 14px;
  134. font-family: Source Han Sans CN;
  135. font-weight: 400;
  136. color: rgba(0, 0, 0, 1);
  137. height: 70px;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. display: -webkit-box; //作为弹性伸缩盒子模型显示。
  141. -webkit-box-orient: vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  142. -webkit-line-clamp: 3; //显示的行
  143. }
  144. .card-detail {
  145. margin: 10px 0;
  146. .card-detail-money {
  147. font-size: 14px;
  148. font-family: Source Han Sans CN;
  149. font-weight: bold;
  150. color: $--color-primary;
  151. }
  152. .card-detail-info {
  153. font-size: 14px;
  154. font-family: Roboto;
  155. font-weight: 400;
  156. color: rgba(153, 153, 153, 1);
  157. }
  158. }
  159. }
  160. .card-title, .card-content, .card-detail {
  161. padding: 0 10px !important;
  162. }
  163. .card-footer {
  164. /*<!--background-color: $&#45;&#45;color-primary-background;-->*/
  165. .card-footer-row {
  166. padding: 15px 10px;
  167. font-size: 14px;
  168. font-family: Source Han Sans CN;
  169. font-weight: bold;
  170. }
  171. }
  172. </style>