|
|
@@ -1,27 +1,180 @@
|
|
|
<template>
|
|
|
- <div class="wrapper">
|
|
|
- <text class="title">{{ title }}</text>
|
|
|
+ <div class="content">
|
|
|
+ <div>
|
|
|
+ <div class="box">
|
|
|
+ <block if="{{!finishStatus}}">
|
|
|
+ <div class="title mgb-50">
|
|
|
+ <text> {{ curIndex + 1 }}、{{ QList[curIndex].title }}</text>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ for="(key, a) in QList[curIndex].AlistArr"
|
|
|
+ @click="chooseA(a.key)"
|
|
|
+ class="Aitem {{curChoose === a.key ? 'active' : ''}}">
|
|
|
+ <text>{{ a.key }}、</text>
|
|
|
+ <text>{{ a.value }}</text>
|
|
|
+ </div>
|
|
|
+ </block>
|
|
|
+ <block if="{{finishStatus}}">
|
|
|
+ <text>{{ resultText }}</text>
|
|
|
+ </block>
|
|
|
+ <div class="btn w-300 bottom-30" @click="nextFn">
|
|
|
+ <text class="btn-read" if="{{ curIndex == QList.length - 1 }}">
|
|
|
+ 显示结果
|
|
|
+ </text>
|
|
|
+ <text class="btn-read" if="{{ curIndex != QList.length - 1 }}">
|
|
|
+ 下一题
|
|
|
+ </text>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- private: {
|
|
|
- title: '欢迎体验快应用开发'
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ finishStatus: false,
|
|
|
+ QList: [
|
|
|
+ { title: '你更喜欢哪种社交场合?', Alist: { 'A': '大型会所', 'B': '小型会所', 'C': '与几位亲朋密友聚会', 'D': '独自一人' } },
|
|
|
+ { title: '你在做决定时更倾向于?', Alist: { 'A': '依靠逻辑和事实', 'B': '依靠直觉和感觉', 'C': '参考别人的意见', 'D': '随机应变' } },
|
|
|
+ { title: '你更喜欢哪种工作环境?', Alist: { 'A': '有条不紊的办公室', 'B': '灵活自由的环境', 'C': '家庭办公', 'D': '合作共享的空间' } },
|
|
|
+ { title: '在团队中,你通常扮演什么角色?', Alist: { 'A': '领导者', 'B': '执行者', 'C': '协调者', 'D': '创新者' } },
|
|
|
+ { title: '你更喜欢哪种娱乐方式?', Alist: { 'A': '阅读书籍', 'B': '参加派对', 'C': '看电影', 'D': '运动健身' } }
|
|
|
+ ],
|
|
|
+ curIndex: 0,
|
|
|
+ curChoose:null,
|
|
|
+ chooseList: [],
|
|
|
+ resultText: ''
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
- onInit() {}
|
|
|
-}
|
|
|
+ onInit() {
|
|
|
+ // 把 Alist 转成数组方便 for 渲染
|
|
|
+ this.QList.forEach(q => {
|
|
|
+ q.AlistArr = Object.keys(q.Alist).map(k => ({ key: k, value: q.Alist[k] }));
|
|
|
+ });
|
|
|
+ },
|
|
|
+ chooseA(key) {
|
|
|
+ this.curChoose = key
|
|
|
+ this.chooseList[this.curIndex] = key;
|
|
|
+ console.log('this.chooseList',this.chooseList)
|
|
|
+ // // 强制刷新
|
|
|
+ },
|
|
|
+ nextFn() {
|
|
|
+ if (!this.chooseList[this.curIndex]) {
|
|
|
+ $utils.showToast('请先选择选项')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.curIndex < this.QList.length - 1) {
|
|
|
+ this.curChoose = null;
|
|
|
+ this.curIndex += 1;
|
|
|
+ } else {
|
|
|
+ this.finishStatus = true;
|
|
|
+ this.resultText = this.generatePersonality();
|
|
|
+ $utils.showToast('提交成功!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ generatePersonality() {
|
|
|
+ if (this.chooseList.length !== 5) return "请完成所有问题";
|
|
|
+ const dimensionScores = { energy: 0, decision: 0, structure: 0, role: 0 };
|
|
|
+ // 第一题
|
|
|
+ if (this.chooseList[0] === 'A' || this.chooseList[0] === 'B') dimensionScores.energy += 2;
|
|
|
+ if (this.chooseList[0] === 'C') dimensionScores.energy += 1;
|
|
|
+ // 第二题
|
|
|
+ if (this.chooseList[1] === 'A') dimensionScores.decision += 2;
|
|
|
+ if (this.chooseList[1] === 'B') dimensionScores.decision += 1;
|
|
|
+ // 第三题
|
|
|
+ if (this.chooseList[2] === 'A') dimensionScores.structure += 2;
|
|
|
+ if (this.chooseList[2] === 'B' || this.chooseList[2] === 'D') dimensionScores.structure += 1;
|
|
|
+ // 第四题
|
|
|
+ if (this.chooseList[3] === 'A' || this.chooseList[3] === 'D') dimensionScores.role += 2;
|
|
|
+ if (this.chooseList[3] === 'B') dimensionScores.role += 1;
|
|
|
+ // 第五题
|
|
|
+ if (this.chooseList[4] === 'B') dimensionScores.energy += 2;
|
|
|
+ if (this.chooseList[4] === 'D') dimensionScores.energy += 1;
|
|
|
+ const energyType = dimensionScores.energy >= 3 ? "E" : "I";
|
|
|
+ const decisionType = dimensionScores.decision >= 2 ? "T" : "F";
|
|
|
+ const personalities = {
|
|
|
+ "ET": { name: "开拓型领袖", desc: "你是个充满活力的决策者!善于社交并理性分析问题,天生的领导者,擅长在大型社交场合中主导方向,偏好结构化的工作环境" },
|
|
|
+ "EF": { name: "魅力型协调者", desc: "你是个热情洋溢的沟通专家!善于在社交中感知他人情绪,喜欢团队合作,在灵活的环境中能发挥创造力,是优秀的协调者" },
|
|
|
+ "IT": { name: "分析型专家", desc: "你是个专注的思考者!偏好深度工作与理性分析,在小范围社交中表现出色,适合需要精密思考的结构化工作环境" },
|
|
|
+ "IF": { name: "关怀型创造者", desc: "你是个富有洞察力的创造者!重视内心感受和亲密关系,在自由环境中灵感迸发,常扮演团队中的创新者角色" }
|
|
|
+ };
|
|
|
+ const traits = [];
|
|
|
+ if (dimensionScores.structure >= 2) traits.push("有条理");
|
|
|
+ if (this.chooseList[3] === 'C') traits.push("善于调解");
|
|
|
+ if (this.chooseList[1] === 'D') traits.push("灵活应变");
|
|
|
+ if (this.chooseList[4] === 'A') traits.push("思想深刻");
|
|
|
+ const personalityKey = energyType + decisionType;
|
|
|
+ const result = personalities[personalityKey] || { name: "平衡型人才", desc: "你具有适应多种环境的优秀能力!能在不同情境中灵活调整自己的行为模式" };
|
|
|
+ let finalDesc = `${result.name}:${result.desc}`;
|
|
|
+ if (traits.length > 0) {
|
|
|
+ finalDesc += `,特别具有${traits.join('、')}的特质`;
|
|
|
+ }
|
|
|
+ return finalDesc;
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-.wrapper {
|
|
|
+<style lang="less">
|
|
|
+ @import '../../../assets/styles/index.less';
|
|
|
+
|
|
|
+.content {
|
|
|
+ padding: 28px;
|
|
|
+ background: linear-gradient(to bottom, #a9d4ff, #cce6ff);
|
|
|
+}
|
|
|
+.box {
|
|
|
+ margin-top: 100px;
|
|
|
+ height: 850px;
|
|
|
+ width: 100%;
|
|
|
flex-direction: column;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid #000;
|
|
|
+ position: relative;
|
|
|
+ border-radius:20px;
|
|
|
+ padding: 30px;
|
|
|
}
|
|
|
-.title {
|
|
|
+.btn-read {
|
|
|
+ color: @white;
|
|
|
+ border: 1px solid @brand;
|
|
|
+ background-color: @brand;
|
|
|
+ border-radius: 5px;
|
|
|
+ padding: 15px 0;
|
|
|
+ flex: 1;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.Aitem {
|
|
|
+ border: 1px solid #000;
|
|
|
+ height: 80px;
|
|
|
+ line-height: 80px;
|
|
|
+ border-radius: 22px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ padding: 0 20px;
|
|
|
+}
|
|
|
+.btn{
|
|
|
+ left: 380px;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ position: absolute;
|
|
|
+}
|
|
|
+/*
|
|
|
+
|
|
|
+.next_btn {
|
|
|
+ width: 320rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
text-align: center;
|
|
|
- color: #212121;
|
|
|
+ color: #fff;
|
|
|
+ background-color: #399bfc;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ border: 1px solid #000;
|
|
|
+ transform: translate(50%);
|
|
|
+ position: absolute;
|
|
|
+ bottom: 60rpx;
|
|
|
+} */
|
|
|
+.active {
|
|
|
+ border: 1px solid #399bfc;
|
|
|
+ color: #399bfc !important;
|
|
|
}
|
|
|
</style>
|