HomeSlice.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="home-slice">
  3. <!-- <el-row style="padding-top: 40px" v-loading="loading" element-loading-text="权限检查中...">-->
  4. <el-row style="padding-top: 40px">
  5. <el-col :span="14">
  6. <div class="slice-wrapper" style="padding-left: 20%">
  7. <div class="slice-title"><img src="../../assets/img/homeslice1.png" alt="slice1"></div>
  8. <div class="slice-info">1分钟带你玩转众测服务平台</div>
  9. <div class="slice-btn" @click="goToCreateProject" style="cursor: pointer">立即进入<img src="../../assets/img/home-btn1.png" style="margin-left: 5px"></div>
  10. </div>
  11. </el-col>
  12. <el-col :span="10">
  13. <div class="slice-wrapper">
  14. <div class="slice-title"><img src="../../assets/img/homeslice2.png" alt="slice2"></div>
  15. <div class="slice-info">入住众测服务平台流程</div>
  16. <div class="slice-btn" @click="goToCreateTask" style="cursor: pointer">立即进入<img src="../../assets/img/home-btn2.png" style="margin-left: 5px"></div>
  17. </div>
  18. </el-col>
  19. </el-row>
  20. </div>
  21. </template>
  22. <script>
  23. import Apis from '@/js/api'
  24. import Http from '@/js/http'
  25. import {storageGet} from '@/js/index.js'
  26. import {notify} from "../../constants";
  27. export default {
  28. name: 'HomeSlice',
  29. data() {
  30. return {
  31. user: {},
  32. isLogin: false,
  33. loading:false
  34. }
  35. },
  36. methods: {
  37. showLoading() {
  38. this.loading = true
  39. },
  40. hideLoading() {
  41. this.loading = false
  42. },
  43. loadData(){
  44. if (storageGet('user') != null) {
  45. this.isLogin = true;
  46. this.user = storageGet('user').userVO;
  47. }
  48. },
  49. checkCreateProjectAuth() {
  50. if (!this.isLogin) {
  51. console.log("请登录后访问");
  52. notify('warning', '请登录后访问');
  53. }
  54. else if(this.isLogin){
  55. this.showLoading();
  56. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  57. console.log(res)
  58. this.hideLoading()
  59. this.$router.push('/project/create');
  60. }).catch((error) => {
  61. this.hideLoading()
  62. notify('error', error.data)
  63. })
  64. }
  65. },
  66. checkCreateTaskAuth() {
  67. if (!this.isLogin) {
  68. console.log("请登录后访问");
  69. notify('warning', '请登录后访问');
  70. }
  71. else if(this.isLogin){
  72. this.showLoading();
  73. Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
  74. console.log(res)
  75. this.hideLoading()
  76. this.$router.push('/square');
  77. }).catch((error) => {
  78. this.hideLoading()
  79. notify('error', error.data)
  80. })
  81. }
  82. },
  83. goToCreateProject(){
  84. this.checkCreateProjectAuth();
  85. },
  86. goToCreateTask(){
  87. this.checkCreateTaskAuth();
  88. },
  89. },
  90. mounted() {
  91. this.loadData();
  92. }
  93. }
  94. </script>
  95. <style scoped lang="less">
  96. .slice-info {
  97. font-size: 16px;
  98. font-family: Source Han Sans CN;
  99. color: rgba(243, 224, 10, 1);
  100. }
  101. .slice-btn {
  102. display: flex;
  103. margin-top: 5px;
  104. line-height: 30px;
  105. color: white;
  106. font-weight: 400;
  107. }
  108. </style>