|
@@ -7,7 +7,7 @@
|
|
|
class="test-item"
|
|
class="test-item"
|
|
|
:key="item.id"
|
|
:key="item.id"
|
|
|
:to="`${$route.path}/unit/${item.id}`"
|
|
:to="`${$route.path}/unit/${item.id}`"
|
|
|
- v-for="item in projectDetail.unitTestList"
|
|
|
|
|
|
|
+ v-for="item in unitTestList"
|
|
|
tag="div"
|
|
tag="div"
|
|
|
>
|
|
>
|
|
|
<div><strong>UNIT TEST : #</strong> {{ item.id }}</div>
|
|
<div><strong>UNIT TEST : #</strong> {{ item.id }}</div>
|
|
@@ -20,12 +20,22 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="column">
|
|
<div class="column">
|
|
|
<div class="page-section">
|
|
<div class="page-section">
|
|
|
- <h5 class="title is-5">页面测试:</h5>
|
|
|
|
|
|
|
+ <h5 class="test-title title is-5">
|
|
|
|
|
+ 页面测试:
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="functionTestList && functionTestList.length > 0"
|
|
|
|
|
+ :class="{ 'is-loading': testing }"
|
|
|
|
|
+ @click="makeTest"
|
|
|
|
|
+ class="button is-primary test-title__action"
|
|
|
|
|
+ >
|
|
|
|
|
+ 触发测试
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </h5>
|
|
|
<router-link
|
|
<router-link
|
|
|
class="test-item"
|
|
class="test-item"
|
|
|
:key="item.id"
|
|
:key="item.id"
|
|
|
:to="`${$route.path}/functional/${item.id}`"
|
|
:to="`${$route.path}/functional/${item.id}`"
|
|
|
- v-for="item in projectDetail.functionTestList"
|
|
|
|
|
|
|
+ v-for="item in functionTestList"
|
|
|
tag="div"
|
|
tag="div"
|
|
|
>
|
|
>
|
|
|
<div><strong>FUNCTIONAL TEST : #</strong> {{ item.id }}</div>
|
|
<div><strong>FUNCTIONAL TEST : #</strong> {{ item.id }}</div>
|
|
@@ -42,6 +52,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
|
|
import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
|
|
|
import timeMixins from "@/mixins/time";
|
|
import timeMixins from "@/mixins/time";
|
|
|
|
|
+import { makeFunctionalTest } from "@/api/codehw";
|
|
|
export default {
|
|
export default {
|
|
|
components: { PassTag },
|
|
components: { PassTag },
|
|
|
props: {
|
|
props: {
|
|
@@ -53,7 +64,54 @@ export default {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- mixins: [timeMixins]
|
|
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ unitTestList() {
|
|
|
|
|
+ return this.sortTestList(this.projectDetail.unitTestList);
|
|
|
|
|
+ },
|
|
|
|
|
+ functionTestList() {
|
|
|
|
|
+ return this.sortTestList(this.projectDetail.functionTestList);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ testing: false
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ mixins: [timeMixins],
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ async makeTest() {
|
|
|
|
|
+ const { functionTestList } = this;
|
|
|
|
|
+ if (functionTestList && functionTestList.length > 0) {
|
|
|
|
|
+ this.testing = true;
|
|
|
|
|
+ const { deployId } = functionTestList[0];
|
|
|
|
|
+ const { homeworkId, projectId } = this.$route.params;
|
|
|
|
|
+ const { data } = await makeFunctionalTest({
|
|
|
|
|
+ homeworkId,
|
|
|
|
|
+ projectId,
|
|
|
|
|
+ deployId
|
|
|
|
|
+ });
|
|
|
|
|
+ this.testing = false;
|
|
|
|
|
+ if (data.success) {
|
|
|
|
|
+ this.$toast.open({
|
|
|
|
|
+ message: `测试触发成功`,
|
|
|
|
|
+ type: "is-success"
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$toast.open({
|
|
|
|
|
+ message: `测试触发失败`,
|
|
|
|
|
+ type: "is-danger"
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ sortTestList(list) {
|
|
|
|
|
+ console.log(list);
|
|
|
|
|
+ if (!list) return [];
|
|
|
|
|
+ const copyList = list.slice(0);
|
|
|
|
|
+ copyList.sort((a, b) => b.time - a.time);
|
|
|
|
|
+ return copyList;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -65,6 +123,15 @@ export default {
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.test-title {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ &__action {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ transform: translateY(-20%);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.test-item:hover,
|
|
.test-item:hover,
|
|
|
.test-item:nth-child(even):hover {
|
|
.test-item:nth-child(even):hover {
|
|
|
background-color: #dde3ef;
|
|
background-color: #dde3ef;
|