Mine.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="mine-container">
  3. <div class="mine-top-wrapper">
  4. <el-row :gutter="0" style="height:100%">
  5. <el-col :span="16">
  6. <div class="advertise-imgs">
  7. <img
  8. src="http://sinastorage.com/storage.miaosha.sina.com.cn/products/201903/e496d11b3d74cf660c286fbd5ab8d0bb.png"
  9. >
  10. </div>
  11. </el-col>
  12. <el-col :span="8">
  13. <div class="user-banner">
  14. <p class="head">
  15. <a href="javascript:;" class="login-link">
  16. <img :src="user == null || user.userVO.photoUrl == null?defaultValue.image:user.userVO.photoUrl" class="user-img">
  17. <span class="vertify hide"></span>
  18. </a>
  19. </p>
  20. <div class="username_box">
  21. <div class="username_icon username_"></div>
  22. <span class="username">{{user == null?'...':user.userVO.name}}</span>
  23. </div>
  24. <!--<p class="name">-->
  25. <!--<a href="javascript:;" class="login-btn btn btn-medium btn-info">登录</a>-->
  26. <!--<a-->
  27. <!--href="https://login.sina.com.cn/signup/signup?entry=tech"-->
  28. <!--class="register-btn btn btn-medium btn-info"-->
  29. <!--target="_blank"-->
  30. <!--&gt;注册</a>-->
  31. <!--</p>-->
  32. <!--<p class="scores">-->
  33. <!--<a href="/rule/merit" target="_blank">-->
  34. <!--积分-->
  35. <!--<em class="num1">{{user.score}}</em>-->
  36. <!--</a>-->
  37. <!--<span class="line">|</span>-->
  38. <!--<a href="/rule/merit" target="_blank">-->
  39. <!--威望-->
  40. <!--<em class="num2">{{user.prestige}}</em>-->
  41. <!--</a>-->
  42. <!--</p>-->
  43. <p>
  44. <router-link :to="{ name: 'AuthenticationIndex'}">
  45. <div class="btn btn-medium">实名认证</div>
  46. </router-link>
  47. </p>
  48. </div>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. <div class="mine-body">
  53. <el-tabs tabPosition="top" type="card">
  54. <el-tab-pane v-if="rolesPermissions.isAgency" label="未完成任务">
  55. <span v-if="unFinishedTaskList == null || unFinishedTaskList.length == 0"> 暂无任务 </span>
  56. <task-item v-if="unFinishedTaskList != null || unFinishedTaskList.length > 0"
  57. v-for="(item,index) in unFinishedTaskList" :key="index" :task="item"/>
  58. </el-tab-pane>
  59. <el-tab-pane v-if="rolesPermissions.isAgency" label="已完成任务">
  60. <span v-if="finishedTaskList == null || finishedTaskList.length == 0"> 暂无任务 </span>
  61. <task-item v-if="finishedTaskList != null || finishedTaskList.length > 0"
  62. v-for="(item,index) in finishedTaskList" :key="index" :task="item"/>
  63. </el-tab-pane>
  64. <el-tab-pane label="我的项目">
  65. <span v-if="myProjects == null || myProjects.length == 0"> 暂无项目 </span>
  66. <project-item v-if="myProjects != null || myProjects.length > 0"
  67. v-for="(item,index) in myProjects" :key="index" :projectItem="item"/>
  68. </el-tab-pane>
  69. <el-tab-pane v-if="rolesPermissions.isRegionManager" label="处理中项目">
  70. <span v-if="handlingProjects == null || handlingProjects.length == 0"> 暂无项目 </span>
  71. <project-item v-if="handlingProjects != null || handlingProjects.length > 0"
  72. v-for="(item,index) in handlingProjects" :key="index" :projectItem="item"/>
  73. </el-tab-pane>
  74. <el-tab-pane v-if="rolesPermissions.isRegionManager" label="可接收项目">
  75. <span v-if="acceptableProjects == null || acceptableProjects.length == 0"> 暂无项目 </span>
  76. <project-item v-if="acceptableProjects != null || acceptableProjects.length > 0"
  77. v-for="(item,index) in acceptableProjects" :key="index" :projectItem="item"/>
  78. </el-tab-pane>
  79. </el-tabs>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import TaskItem from '@/components/commons/TaskItem'
  85. import ProjectItem from '@/components/commons/ProjectItem'
  86. import Http from '@/js/http.js'
  87. import Apis from '@/js/api.js'
  88. import {notify} from '@/constants/index'
  89. import {defaultValue, getRolesPermissions, storageGet} from '@/js/index'
  90. export default {
  91. name: 'Mine',
  92. components: {TaskItem, ProjectItem},
  93. watch: {
  94. user (val) {
  95. this.user = val
  96. },
  97. rolesPermissions (val) {
  98. this.rolesPermissions = val
  99. },
  100. deep: true
  101. },
  102. data () {
  103. return {
  104. unFinishedTaskList: [],
  105. finishedTaskList: [],
  106. appliedProjectList: [],
  107. myProjects: [],
  108. handlingProjects: [],
  109. acceptableProjects: [],
  110. defaultValue: defaultValue,
  111. rolesPermissions: {
  112. isRegionManager: false,
  113. isIndividualUser: false,
  114. isEnterpriseUser: false,
  115. isAgency: false,
  116. isSystemAdministrator: false
  117. },
  118. user: {
  119. userVO: {
  120. id: '',
  121. name: '',
  122. photo: '',
  123. roleList: []
  124. }
  125. }
  126. }
  127. },
  128. mounted () {
  129. this.$nextTick(() => {
  130. this.init()
  131. })
  132. },
  133. methods: {
  134. init () {
  135. this.setUserInfo()
  136. this.setRolesPermissions()
  137. this.loadData()
  138. // storageGet('user').then((res)=>{
  139. // this.user = res;
  140. // this.setRolesPermissions()
  141. // this.loadData()
  142. // })
  143. },
  144. loadData () {
  145. Http.get(Apis.PAGE.MY_CROWD_TEST_PAGE.replace('{userId}', this.user.userVO.id)).then((res) => {
  146. if (res.unfinishedTasks != null && res.unfinishedTasks.length > 0) {
  147. this.unFinishedTaskList = res.unfinishedTasks
  148. }
  149. if (res.finishedTasks != null && res.finishedTasks.length > 0) {
  150. this.finishedTaskList = res.finishedTasks
  151. }
  152. if (res.myProjects != null && res.myProjects.length > 0) {
  153. this.myProjects = res.myProjects
  154. }
  155. if (res.handlingProjects != null && res.handlingProjects.length > 0) {
  156. this.handlingProjects = res.handlingProjects
  157. }
  158. if (res.acceptableProjects != null && res.acceptableProjects.length > 0) {
  159. this.acceptableProjects = res.acceptableProjects
  160. }
  161. // if (res.userVO != null && res.userVO.length > 0) {
  162. // this.user = res.userVO
  163. // }
  164. })
  165. },
  166. setUserInfo () {
  167. this.user = storageGet('user')
  168. },
  169. setRolesPermissions () {
  170. this.rolesPermissions = storageGet('rolesPermissions')
  171. }
  172. },
  173. created: function () {
  174. }
  175. }
  176. </script>
  177. <style lang="less" scoped>
  178. .mine-container {
  179. padding: 0 80px 40px 80px;
  180. }
  181. .mine-top-wrapper {
  182. height: 350px;
  183. background-color: #fff;
  184. }
  185. [class*="el-col-"] {
  186. height: 100%;
  187. }
  188. .advertise-imgs {
  189. height: 100%;
  190. }
  191. .advertise-imgs img {
  192. width: 100%;
  193. height: 100%;
  194. }
  195. .user-banner {
  196. text-align: center;
  197. display: inline-table;
  198. height: 100%;
  199. width: 100%;
  200. margin-top: 40px;
  201. }
  202. .mine-body {
  203. margin-top: 30px;
  204. }
  205. </style>