Mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <div class="mine-container">
  3. <div id="myChart" style="width: 100%;height: 200px;padding-top: 40px"></div>
  4. <!--<div class="mine-top-wrapper">-->
  5. <!--<el-row :gutter="0" style="height:100%">-->
  6. <!--<el-col :span="16">-->
  7. <!--<div class="advertise-imgs">-->
  8. <!--<img-->
  9. <!--src="http://sinastorage.com/storage.miaosha.sina.com.cn/products/201903/e496d11b3d74cf660c286fbd5ab8d0bb.png"-->
  10. <!--&gt;-->
  11. <!--</div>-->
  12. <!--</el-col>-->
  13. <!--<el-col :span="8">-->
  14. <!--<div class="user-banner">-->
  15. <!--<p class="head">-->
  16. <!--<a href="javascript:;" class="login-link">-->
  17. <!--<img :src="user == null || user.userVO.photoUrl == null?defaultValue.image:user.userVO.photoUrl"-->
  18. <!--class="user-img">-->
  19. <!--<span class="vertify hide"></span>-->
  20. <!--</a>-->
  21. <!--</p>-->
  22. <!--<div class="username_box">-->
  23. <!--<div class="username_icon username_"></div>-->
  24. <!--<span class="username">{{user == null?'...':user.userVO.name}}</span>-->
  25. <!--</div>-->
  26. <!--&lt;!&ndash;<p class="name">&ndash;&gt;-->
  27. <!--&lt;!&ndash;<a href="javascript:;" class="login-btn btn btn-medium btn-info">登录</a>&ndash;&gt;-->
  28. <!--&lt;!&ndash;<a&ndash;&gt;-->
  29. <!--&lt;!&ndash;href="https://login.sina.com.cn/signup/signup?entry=tech"&ndash;&gt;-->
  30. <!--&lt;!&ndash;class="register-btn btn btn-medium btn-info"&ndash;&gt;-->
  31. <!--&lt;!&ndash;target="_blank"&ndash;&gt;-->
  32. <!--&lt;!&ndash;&gt;注册</a>&ndash;&gt;-->
  33. <!--&lt;!&ndash;</p>&ndash;&gt;-->
  34. <!--&lt;!&ndash;<p class="scores">&ndash;&gt;-->
  35. <!--&lt;!&ndash;<a href="/rule/merit" target="_blank">&ndash;&gt;-->
  36. <!--&lt;!&ndash;积分&ndash;&gt;-->
  37. <!--&lt;!&ndash;<em class="num1">{{user.score}}</em>&ndash;&gt;-->
  38. <!--&lt;!&ndash;</a>&ndash;&gt;-->
  39. <!--&lt;!&ndash;<span class="line">|</span>&ndash;&gt;-->
  40. <!--&lt;!&ndash;<a href="/rule/merit" target="_blank">&ndash;&gt;-->
  41. <!--&lt;!&ndash;威望&ndash;&gt;-->
  42. <!--&lt;!&ndash;<em class="num2">{{user.prestige}}</em>&ndash;&gt;-->
  43. <!--&lt;!&ndash;</a>&ndash;&gt;-->
  44. <!--&lt;!&ndash;</p>&ndash;&gt;-->
  45. <!--<p>-->
  46. <!--<router-link :to="{ name: 'AuthenticationIndex'}">-->
  47. <!--<div class="btn btn-medium">实名认证</div>-->
  48. <!--</router-link>-->
  49. <!--</p>-->
  50. <!--</div>-->
  51. <!--</el-col>-->
  52. <!--</el-row>-->
  53. <!--</div>-->
  54. <div class="mine-body" style="text-align: center;">
  55. <el-tabs @tab-click="handleTabClick" v-loading="loading" style="width: 90%;margin-left: 5%">
  56. <el-tab-pane name="unFinishedTask">
  57. <span slot="label">
  58. <el-badge class="item" style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">未完成任务</el-badge>
  59. </span>
  60. <el-row v-if="unFinishedTaskList != null && unFinishedTaskList.length != 0" type="flex" align="middle"
  61. justify="center" style="font-size: 14px;">
  62. <el-col :span="6">任务封面</el-col>
  63. <el-col :span="5">任务名称</el-col>
  64. <el-col :span="5">任务类型</el-col>
  65. <el-col :span="4">任务预算</el-col>
  66. <el-col :span="4">操作</el-col>
  67. </el-row>
  68. <span v-if="unFinishedTaskList == null || unFinishedTaskList.length == 0"> 暂无任务 </span>
  69. <task-item v-if="unFinishedTaskList != null || unFinishedTaskList.length > 0"
  70. v-for="(item,index1) in unFinishedTaskList" :key="index1" :task="item"/>
  71. </el-tab-pane>
  72. <el-tab-pane name="finishedTask">
  73. <span slot="label">
  74. <el-badge class="item" style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">已完成任务</el-badge>
  75. </span>
  76. <el-row v-if="finishedTaskList != null && finishedTaskList.length != 0" type="flex" align="middle"
  77. justify="center" style="font-size: 14px;">
  78. <el-col :span="6">任务封面</el-col>
  79. <el-col :span="5">任务名称</el-col>
  80. <el-col :span="5">任务类型</el-col>
  81. <el-col :span="4">任务预算</el-col>
  82. <el-col :span="4">操作</el-col>
  83. </el-row>
  84. <span v-if="finishedTaskList == null || finishedTaskList.length == 0"> 暂无任务 </span>
  85. <task-item v-if="finishedTaskList != null || finishedTaskList.length > 0"
  86. v-for="(item,index2) in finishedTaskList" :key="index2" :task="item"/>
  87. </el-tab-pane>
  88. <el-tab-pane name="myProject">
  89. <span slot="label">
  90. <el-badge v-if="myProjectNoticeCount>0" :value="myProjectNoticeCount" class="item"
  91. style="height:auto;margin-top: 10px;margin-bottom: 25px; font-size: 16px;">我的项目</el-badge>
  92. <el-badge v-if="myProjectNoticeCount==0" class="item"
  93. style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">我的项目</el-badge>
  94. </span>
  95. <span v-if="myProjects == null || myProjects.length == 0"> 暂无项目 </span>
  96. <el-row v-if="myProjects != null && myProjects.length != 0" type="flex" align="middle" justify="center"
  97. style="font-size: 14px;">
  98. <el-col :span="6" type="flex" align="middle" justify="center">项目图片</el-col>
  99. <el-col :span="6" type="flex" align="middle" justify="center">项目名称</el-col>
  100. <el-col :span="6" type="flex" align="middle" justify="center">项目平台</el-col>
  101. <el-col :span="2" type="flex" align="middle" justify="center">项目预算</el-col>
  102. <el-col :span="4" type="flex" align="middle" justify="center">操作</el-col>
  103. </el-row>
  104. <project-item v-if="myProjects != null || myProjects.length > 0"
  105. v-for="(item,index3) in myProjects" :key="index3" :projectItem="item"/>
  106. </el-tab-pane>
  107. <el-tab-pane name="handlingProject">
  108. <span slot="label">
  109. <el-badge v-if="processProjectNoticeCount>0" :value="processProjectNoticeCount" class="item"
  110. style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">处理中项目</el-badge>
  111. <el-badge v-if="processProjectNoticeCount==0" class="item" style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">处理中项目</el-badge>
  112. </span>
  113. <el-row v-if="handlingProjects != null && handlingProjects.length != 0" type="flex" align="middle"
  114. justify="center" style="font-size: 14px;">
  115. <el-col :span="6">项目图片</el-col>
  116. <el-col :span="6">项目名称</el-col>
  117. <el-col :span="6">项目平台</el-col>
  118. <el-col :span="2">项目预算</el-col>
  119. <el-col :span="4">操作</el-col>
  120. </el-row>
  121. <span v-if="handlingProjects == null || handlingProjects.length == 0"> 暂无项目 </span>
  122. <project-item v-if="handlingProjects != null || handlingProjects.length > 0"
  123. v-for="(item,index4) in handlingProjects" :key="index4" :projectItem="item"/>
  124. </el-tab-pane>
  125. <el-tab-pane name="acceptableProject">
  126. <span slot="label">
  127. <el-badge class="item" style="margin-top: 10px;margin-bottom: 25px; font-size: 16px;">可接收项目</el-badge>
  128. </span>
  129. <el-row v-if="acceptableProjects != null && acceptableProjects.length != 0" type="flex" align="middle"
  130. justify="center" style="font-size: 14px;">
  131. <el-col :span="6">项目图片</el-col>
  132. <el-col :span="6">项目名称</el-col>
  133. <el-col :span="6">项目平台</el-col>
  134. <el-col :span="2">项目预算</el-col>
  135. <el-col :span="4">操作</el-col>
  136. </el-row>
  137. <span v-if="acceptableProjects == null || acceptableProjects.length == 0"> 暂无项目 </span>
  138. <project-item v-if="acceptableProjects != null || acceptableProjects.length > 0"
  139. v-for="(item,index) in acceptableProjects" :key="index" :projectItem="item"/>
  140. </el-tab-pane>
  141. </el-tabs>
  142. </div>
  143. </div>
  144. </template>
  145. <script>
  146. import TaskItem from '@/components/commons/TaskItem'
  147. import ProjectItem from '@/components/commons/ProjectItem'
  148. import Http from '@/js/http.js'
  149. import Apis from '@/js/api.js'
  150. import {notify} from '@/constants/index'
  151. import {defaultValue, getRolesPermissions, storageGet} from '@/js/index'
  152. import echarts from 'echarts'
  153. export default {
  154. name: 'Mine',
  155. components: {TaskItem, ProjectItem},
  156. watch: {
  157. user (val) {
  158. this.user = val
  159. },
  160. rolesPermissions (val) {
  161. this.rolesPermissions = val
  162. },
  163. deep: true
  164. },
  165. data () {
  166. return {
  167. loading: false,
  168. unFinishedTaskList: [],
  169. finishedTaskList: [],
  170. appliedProjectList: [],
  171. myProjects: [],
  172. handlingProjects: [],
  173. acceptableProjects: [],
  174. defaultValue: defaultValue,
  175. myProjectNoticeCount: 0,
  176. processProjectNoticeCount: 0,
  177. rolesPermissions: {
  178. isRegionManager: false,
  179. isIndividualUser: false,
  180. isEnterpriseUser: false,
  181. isAgency: false,
  182. isSystemAdministrator: false
  183. },
  184. user: {
  185. userVO: {
  186. id: '',
  187. name: '',
  188. photo: '',
  189. roleList: []
  190. }
  191. }
  192. }
  193. },
  194. mounted () {
  195. this.$nextTick(() => {
  196. this.init()
  197. })
  198. },
  199. methods: {
  200. init () {
  201. this.setUserInfo()
  202. this.setRolesPermissions()
  203. this.loadData()
  204. this.setEcharts()
  205. // storageGet('user').then((res)=>{
  206. // this.user = res;
  207. // this.setRolesPermissions()
  208. // this.loadData()
  209. // })
  210. },
  211. loadData () {
  212. this.showLoading()
  213. Http.get(Apis.PAGE.MY_CROWD_TEST_PAGE.replace('{userId}', this.user.userVO.id)).then((res) => {
  214. this.hideLoading()
  215. this.processProjectNoticeCount = res.processProjectNoticeCount
  216. this.myProjectNoticeCount = res.myProjectNoticeCount
  217. if (res.unfinishedTasks != null && res.unfinishedTasks.length > 0) {
  218. this.unFinishedTaskList = res.unfinishedTasks
  219. }
  220. if (res.finishedTasks != null && res.finishedTasks.length > 0) {
  221. this.finishedTaskList = res.finishedTasks
  222. }
  223. if (res.myProjects != null && res.myProjects.length > 0) {
  224. this.myProjects = res.myProjects
  225. }
  226. if (res.handlingProjects != null && res.handlingProjects.length > 0) {
  227. this.handlingProjects = res.handlingProjects
  228. }
  229. if (res.acceptableProjects != null && res.acceptableProjects.length > 0) {
  230. this.acceptableProjects = res.acceptableProjects
  231. }
  232. // if (res.userVO != null && res.userVO.length > 0) {
  233. // this.user = res.userVO
  234. // }
  235. }).catch((error) => {
  236. this.hideLoading()
  237. notify('error', '加载失败:' + error.data)
  238. })
  239. },
  240. setUserInfo () {
  241. this.user = storageGet('user')
  242. },
  243. setRolesPermissions () {
  244. this.rolesPermissions = storageGet('rolesPermissions')
  245. },
  246. setEcharts () {
  247. // 基于准备好的dom,初始化echarts实例
  248. let myChart = echarts.init(document.getElementById('myChart'))
  249. // 绘制图表
  250. var option = {
  251. title: {
  252. text: ''
  253. },
  254. tooltip: {
  255. //trigger: 'axis'
  256. },
  257. legend: {
  258. data: ['接收项目数量', '完成项目数量', '接收任务数量', '完成任务数量', '发布项目数量']
  259. },
  260. grid: {
  261. left: '5%',
  262. right: '8%',
  263. bottom: '3%',
  264. top: '10%',
  265. containLabel: true
  266. },
  267. toolbox: {
  268. feature: {
  269. saveAsImage: {
  270. title: '保存为图片',
  271. name: '我的众测'
  272. }
  273. },
  274. right: '20px'
  275. },
  276. xAxis: {
  277. type: 'category',
  278. boundaryGap: false,
  279. data: ['2019年5月', '2019年6月', '2019年7月', '2019年8月', '2019年9月', '2019年10月', '2019年11月']
  280. },
  281. yAxis: {
  282. type: 'value'
  283. },
  284. series: [
  285. {
  286. name: '接收项目数量',
  287. type: 'line',
  288. stack: '总量',
  289. data: [2, 3, 3, 2, 4, 5, 6]
  290. },
  291. {
  292. name: '完成项目数量',
  293. type: 'line',
  294. stack: '总量',
  295. data: [2, 3, 3, 2, 4, 5, 6]
  296. },
  297. {
  298. name: '接收任务数量',
  299. type: 'line',
  300. stack: '总量',
  301. data: [22, 33, 41, 14, 55, 33, 41]
  302. },
  303. {
  304. name: '完成任务数量',
  305. type: 'line',
  306. stack: '总量',
  307. data: [21, 33, 31, 14, 39, 33, 32]
  308. },
  309. {
  310. name: '发布项目数量',
  311. type: 'line',
  312. stack: '总量',
  313. data: [2, 3, 1, 0, 1, 2, 2]
  314. }
  315. ]
  316. }
  317. myChart.setOption(option)
  318. },
  319. showLoading () {
  320. this.loading = true
  321. },
  322. hideLoading () {
  323. this.loading = false
  324. },
  325. handleTabClick (event) {
  326. if (event.name == 'myProject') {
  327. //this.myProjectNoticeCount = 0
  328. }
  329. if (event.name == 'handlingProject') {
  330. //this.processProjectNoticeCount = 0
  331. }
  332. console.log('123')
  333. console.log(event)
  334. }
  335. },
  336. created: function () {
  337. }
  338. }
  339. </script>
  340. <style lang="less" scoped>
  341. .mine-container {
  342. padding: 0 80px 40px 80px;
  343. }
  344. .mine-top-wrapper {
  345. height: 350px;
  346. background-color: #fff;
  347. }
  348. [class*="el-col-"] {
  349. height: 100%;
  350. }
  351. .advertise-imgs {
  352. height: 100%;
  353. }
  354. .advertise-imgs img {
  355. width: 100%;
  356. height: 100%;
  357. }
  358. .user-banner {
  359. text-align: center;
  360. display: inline-table;
  361. height: 100%;
  362. width: 100%;
  363. margin-top: 40px;
  364. }
  365. .mine-body {
  366. margin-top: 30px;
  367. }
  368. </style>