TestTypeDetail.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div class="home-wrapper">
  3. <div class="container" style="margin: 20px auto;">
  4. <div class="create-body" v-for="item in fields">
  5. <div class="title h2">
  6. <span style="display: inline-block;margin-right: 20px">{{item.name}}</span>
  7. <el-button @click="goToTask(item.code)" type="primary" size="mini">相关任务</el-button></div>
  8. <div class="h3">{{item.introduction}}</div>
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import {getAllServiceTypes} from '@/js/index.js'
  15. export default {
  16. name: "TestTypeDetail",
  17. data() {
  18. return {
  19. isLogin: false,
  20. fields: [],
  21. }
  22. },
  23. methods: {
  24. setFields(){
  25. getAllServiceTypes().then((res) => {
  26. this.fields = res
  27. })
  28. },
  29. goToTask(testType){
  30. console.log(testType)
  31. //type=1 表示是从测试类型跳转过去的
  32. this.$router.push({path:'/square',query:{type:testType}})
  33. }
  34. },
  35. mounted() {
  36. this.setFields();
  37. }
  38. }
  39. </script>
  40. <style scoped>
  41. .item-template {
  42. height: 80px;
  43. }
  44. </style>