task.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. $title = '我的任务';
  3. $view
  4. # 公共页面,这种方式不会更改前端代码,还有一种方式可以参考manage组件
  5. ->import('inc/head,inc/menu')
  6. # 设置全局变量
  7. ->set('title', $title)
  8. # 这个变量控制不同页面的样式和js文件
  9. ->set('name', 'mytask')
  10. ->set('nav', 'user_task')
  11. # 定义header>span的html为$title
  12. ->fetch('header span', $title)
  13. ->append('header', '<a href="<{Dever::url("user/account", "main")}>" class="back"></a>')
  14. ->fetch(array('.tabs a@class', 0), '<{Dever::input("type", 1) == 1 ? "cur" : ""}>')
  15. ->fetch(array('.tabs a@class', 1), '<{Dever::input("type", 1) == 2 ? "cur" : ""}>')
  16. ->fetch(array('.tabs a@href', 0), '<{Dever::url("user/task?type=1", "main")}>')
  17. ->fetch(array('.tabs a@href', 1), '<{Dever::url("user/task?type=2", "main")}>')
  18. # 循环
  19. ->loop
  20. (
  21. '.tasklist .task',
  22. 'task/info.user',
  23. array
  24. (
  25. 'dt' => '$v.name',
  26. '.tk-column' => array
  27. (
  28. 'style' => '<{$v.score.total ? "" : "display:none;"}>',
  29. '.ico-person' => array
  30. (
  31. 'html' => '$v.score.report',
  32. ),
  33. '.ico-team' => array
  34. (
  35. 'html' => '$v.score.group',
  36. ),
  37. ),
  38. '.ico-team' => array
  39. (
  40. 'style' => '<{$v.score.group ? "" : "display:none;"}>',
  41. ),
  42. '.tk-coin' => array
  43. (
  44. 'style' => '<{$v.score.total ? "" : "display:none;"}>',
  45. '.ico-count' => array
  46. (
  47. 'html' => '$v.score.total',
  48. ),
  49. ),
  50. '.org' => array
  51. (
  52. 'href' => '$v.link',
  53. ),
  54. '.button|1' => array
  55. (
  56. 'href' => '<{Dever::url("user/report?type=".Dever::input("type", 1)."&id=".$v.id, "main")}>',
  57. ),
  58. )
  59. )
  60. # 暂无记录
  61. ->append('.wrapper', '<div id="page" dever-page-link="<{Dever::pageInfo()["link"]}>" dever-page-list=".wrapper"></div><{Dever::load("task/info.user") ? "" : \'<section class="no-result"><section class="no-notice-wrapper"><img src="'.Dever::assets("images/6713b0c1.no-report.png", "images").'" alt=""><p>暂无记录</p><a href="'.Dever::url("task/list", "main").'" class="button">领取任务</a></section></section>\'}>')
  62. ->import('inc/foot')
  63. ->display();