evaluteOne.vue
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
<div class="evalute_one">
<div class="evalute_main">
<!-- 标题 -->
<div class="evalute_title_wrap layout flex_row align_left">
<div class="evalute_title_l"></div>
<div class="evalute_title_c">
<span class="evalute_title">
测评
<!-- Evaluation -->
</span>
</div>
<div class="evalute_title_r"></div>
</div>
<!-- 测试内容 -->
<div class="test_content">
<!-- 步骤条 -->
<div class="step_bar layout align_left">
<div class="step_single active_step">
第一步:国家选择
<!-- FIRST: Select country -->
</div>
<div class="step_img">
<img src="@/assets/img_12.png" alt />
</div>
<div class="step_single">
第二步:基本调查
<!-- SECOND: Questionnaire -->
</div>
<div class="step_img">
<img src="@/assets/img_11.png" alt />
</div>
<div class="step_single">
第三步:客户信息
<!-- THIRD: Customer Information -->
</div>
</div>
<!-- 测试问题 -->
<div class="test_question_wrap">
<div class="test_single">
<!-- 题目 -->
<div class="test_title">
1. *您想移民的国家?
<!-- * The country you want to immigrate to? -->
</div>
<!-- 答案 -->
<div class="test_answer layout align_left flex_row flex-wrap">
<div
class="answer_single"
:class="{active_ans:isChoice == index}"
v-for="(item,index) in ansList"
:key="index"
@click="choiceAns(item,index)"
>
{{item.country_name}}
<div class="choice_img" v-show="isChoice == item.id">
<img src="@/assets/img_10.png" alt />
</div>
</div>
</div>
</div>
<!-- 下一步 -->
<div class="next_step_wrap">
<div
class="next_step layout flex_row justify_center align_center"
@click="nextSecond()"
>
<div>
下一步
<!-- Next -->
</div>
<div class="next_icon">
<img src="@/assets/img_30.png" alt />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { Message } from "element-ui";
import { post } from "../../../api/http";
export default {
data() {
return {
ansList: [],
// 选中答案
isChoice: -1,
id: ""
};
},
methods: {
// 选择答案
choiceAns(item, index) {
this.isChoice = item.id;
this.id = item.id;
if (this.id != localStorage.getItem("countryId")) {
localStorage.removeItem("uploadAnswer");
localStorage.removeItem("choicedAnswer");
localStorage.removeItem("countryId");
localStorage.removeItem("formMsg");
localStorage.removeItem("evalute_result");
}
},
// 去第二步
nextSecond() {
if (this.id) {
localStorage.setItem("countryId", this.id);
this.$router.push({ path: "/evaluteTwo" });
} else {
this.$message({
showClose: true,
message: "Please choose",
type: "warning"
});
}
},
// 获取国家列表
getCountry() {
let url = "/api/template/get_country";
post(url).then(res => {
this.ansList = res;
});
}
},
mounted() {
this.isChoice = this.id = localStorage.getItem("countryId");
// 获取国家列表
this.getCountry();
}
};
</script>
<style scoped>
@import "../../../style/evalute.css";
</style>