Home.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="home" v-if="category">
  3. <div class="categorytab">
  4. <!-- <div class="category-ico" @click="$router.push('/editcategory')"><van-icon name="setting-o" /></div> -->
  5. <van-nav-bar
  6. title="首页"
  7. :left-arrow="false"
  8. />
  9. <div class="index_header">
  10. <div class="inhe_one">
  11. <p>
  12. <span><i>1346</i>项</span>
  13. <span>总流程审批</span>
  14. </p>
  15. <p>
  16. <span><i>1346</i>项</span>
  17. <span>总流程审批</span>
  18. </p>
  19. </div>
  20. <div class="inhe_two">
  21. <img src="../assets/img/icon_hp_spjl.png" alt="">
  22. </div>
  23. </div>
  24. <div class="index_header index_headertr">
  25. <div class="inhe_one">
  26. <p>
  27. <span><i>1346</i>项</span>
  28. <span>总流程审批</span>
  29. </p>
  30. <p>
  31. <span><i>1346</i>项</span>
  32. <span>总流程审批</span>
  33. </p>
  34. </div>
  35. <div class="inhe_two">
  36. <img src="../assets/img/icon_hp_spjl.png" alt="">
  37. </div>
  38. </div>
  39. <div class="index_nav">
  40. <p @click="lock">
  41. <span>考勤打卡</span>
  42. <img src="../assets/img/icon_hp_kqdk.png" alt="">
  43. </p>
  44. <p @click="application">
  45. <span>请假申请</span>
  46. <img src="../assets/img/icon_hp_qjsq.png" alt="">
  47. </p>
  48. <p @click="pproved">
  49. <span>待审批</span>
  50. <img src="../assets/img/icon_hp_dsp.png" alt="">
  51. </p>
  52. </div>
  53. </div>
  54. <nav-bar v-bind:active=0></nav-bar>
  55. </div>
  56. </template>
  57. <script>
  58. import NavBar from "@/components/common/Navbar.vue";
  59. import cover from "./cover";
  60. export default {
  61. data() {
  62. return {
  63. category: [],
  64. active: 0
  65. };
  66. },
  67. components: {
  68. NavBar,
  69. cover
  70. },
  71. // activated() {
  72. // if(localStorage.getItem('newCat')) {
  73. // let newCat = JSON.parse(localStorage.getItem('newCat'))
  74. // this.category = this.changeCategory(newCat)
  75. // this.selectArticle();
  76. // }
  77. // },
  78. methods: {
  79. async selectCategory() {
  80. if(localStorage.getItem('newCat')) {
  81. return
  82. }
  83. const res = await this.$http.get("/category");
  84. this.category = this.changeCategory(res.data);
  85. this.selectArticle();
  86. },
  87. changeCategory(data) {
  88. const category1 = data.map((item, index) => {
  89. item.list = [];
  90. item.page = 0;
  91. item.finished = false;
  92. item.loading = true;
  93. item.pagesize = 10;
  94. return item;
  95. });
  96. return category1;
  97. },
  98. async selectArticle() {
  99. const categoryitem = this.categoryItem();
  100. const res = await this.$http.get("/detail/" + categoryitem._id, {
  101. params: {
  102. page: categoryitem.page,
  103. pagesize: categoryitem.pagesize
  104. }
  105. });
  106. categoryitem.list.push(...res.data);
  107. categoryitem.loading = false;
  108. if (res.data.length < categoryitem.pagesize) {
  109. categoryitem.finished = true;
  110. }
  111. },
  112. onLoad() {
  113. // const categoryitem = this.categoryItem();
  114. // setTimeout(() => {
  115. // categoryitem.page += 1;
  116. // this.selectArticle();
  117. // }, 1000);
  118. console.log(456)
  119. },
  120. // categoryItem() {
  121. // const categoryitem = this.category[this.active];
  122. // return categoryitem;
  123. // }
  124. // 考勤打卡
  125. lock(){
  126. this.$router.push("/lock");
  127. },
  128. // 请假申请
  129. application(){
  130. this.$router.push("/leave");
  131. },
  132. // 待审批
  133. pproved(){
  134. this.$router.push("/approval");
  135. }
  136. },
  137. watch: {
  138. // active() {
  139. // const categoryitem = this.categoryItem();
  140. // if (!categoryitem.list.length) {
  141. // this.selectArticle();
  142. // }
  143. // }
  144. },
  145. mounted(){
  146. console.log(345)
  147. },
  148. created() {
  149. console.log(this.active)
  150. console.log(345)
  151. // this.selectCategory();
  152. }
  153. };
  154. </script>
  155. <style lang="less" scoped="">
  156. .home {
  157. background-color: #fff;
  158. padding: 7.999px;
  159. .categorytab{
  160. width: 100%;
  161. height: 100%;
  162. .index_header{
  163. position: relative;
  164. height: 29.333vw;
  165. background: url('../assets/img/pic_bg_spjl.png') no-repeat ;
  166. background-size: 100% 100%;
  167. display: flex;
  168. margin-bottom: 2.933vw;
  169. .inhe_one{
  170. width: 70%;
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. p{
  175. flex: 1;
  176. display: flex;
  177. flex-direction: column;
  178. text-align: center;
  179. line-height: 9.333vw;
  180. span{
  181. font-size: 2.667vw;
  182. font-family: PingFang SC ;
  183. font-weight: 500;
  184. color: #666666;
  185. line-height: 6.933vw;
  186. i{
  187. font-style: normal;
  188. font-size: 6.4vw;
  189. font-family: PingFang SC;
  190. font-weight: 800;
  191. color: #2D6B89;
  192. line-height: 1.6vw;
  193. }
  194. }
  195. }
  196. p:nth-child(1){
  197. border-right: 1px solid #80B1C8;
  198. }
  199. }
  200. .inhe_two{
  201. width: 30%;
  202. display: flex;
  203. justify-content: center;
  204. // align-items: center;
  205. margin-top: 8vw;
  206. img{
  207. width: 12.267vw;
  208. height: 12.267vw;
  209. }
  210. }
  211. }
  212. .index_headertr{
  213. background: url('../assets/img/pic_bg_qjjl.png') no-repeat ;
  214. background-size: 100% 100%;
  215. .inhe_one{
  216. p:nth-child(1){
  217. border-right: 1px solid #E09404;
  218. }
  219. }
  220. }
  221. // 第三部分样式
  222. .index_nav{
  223. display: flex;
  224. justify-content: space-around;
  225. align-items: center;
  226. p{
  227. flex: 1;
  228. display: flex;
  229. flex-direction: column-reverse;
  230. align-items: center;
  231. justify-content: center;
  232. span{
  233. font-size: 3.467vw;
  234. font-family: PingFang SC;
  235. font-weight: 400;
  236. color: #343434;
  237. }
  238. img{
  239. width: 18.4vw;
  240. height: 18.4vw;
  241. margin-bottom: 3.467vw;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. </style>