欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

目錄

柚子快報(bào)邀請(qǐng)碼778899分享:MBTI答題應(yīng)用小程序

柚子快報(bào)邀請(qǐng)碼778899分享:MBTI答題應(yīng)用小程序

http://yzkb.51969.com/

源代碼

calmthink/mbti小程序 (gitee.com)

實(shí)現(xiàn)方案

題目結(jié)構(gòu)

[

{

"options": [

{

"result": "I",

"value": "獨(dú)自工作",

"key": "A"

},

{

"result": "E",

"value": "與他人合作",

"key": "B"

}

],

"title": "你通常更喜歡"

},

]

答案結(jié)構(gòu)

[

{

"resultProp": [

"I",

"S",

"T",

"J"

],

"resultDesc": "忠誠(chéng)可靠,被公認(rèn)為務(wù)實(shí),注重細(xì)節(jié)。",

"resultPicture": "icon_url_istj",//其他信息

"resultName": "ISTJ(物流師)"

},

]

評(píng)分算法

用戶每道題都必須選擇,不能為null 本地存儲(chǔ)用戶的結(jié)果列表 anserList = [‘A’,‘B’,‘C’,‘B’,‘B’] 初始化對(duì)象{},記錄IETPJNS每個(gè)的分?jǐn)?shù) 通過(guò)遍歷結(jié)果數(shù)組獲取最大的分?jǐn)?shù)確定人格類型

/**

* 獲取最佳題目評(píng)分結(jié)果

* @param answerList

* @param questions

* @param question_results

*/

export function getBestQuestionResult(answerList, questions, question_results) {

// 初始化一個(gè)對(duì)象,用于存儲(chǔ)每個(gè)選項(xiàng)的計(jì)數(shù)

const optionCount = {};

// 假設(shè) answerList 和 questions 的長(zhǎng)度相同且順序?qū)?yīng)

for (let i = 0; i < answerList.length; i++) {

const answer = answerList[i];

const question = questions[i]; // 直接從對(duì)應(yīng)的問(wèn)題中獲取選項(xiàng)

for (const option of question.options) {

if (option.key === answer) {

const result = option.result;

if (!optionCount[result]) {

optionCount[result] = 1;

} else {

optionCount[result]++;

}

break; // 找到匹配項(xiàng)后跳出循環(huán),因?yàn)槲覀円呀?jīng)找到了答案

}

}

}

// 初始化最高分?jǐn)?shù)和最高分?jǐn)?shù)對(duì)應(yīng)的評(píng)分結(jié)果

let maxScore = 0;

let maxScoreResult = null;

// 遍歷評(píng)分結(jié)果列表

for (const result of question_results) {

const score = result.resultProp.reduce((count, prop) => {

return count + (optionCount[prop] || 0);

}, 0);

if (score > maxScore) {

maxScore = score;

maxScoreResult = result;

}

}

// 返回最高分?jǐn)?shù)和最高分?jǐn)?shù)對(duì)應(yīng)的評(píng)分結(jié)果

return maxScoreResult;

}

技術(shù)選型

ReactTaro跨端框架TaroUI組件庫(kù)

配置eslint prettier

在webstorm中打開(kāi)自動(dòng)讀取

新增頁(yè)面組件

全局配置文件app.config.ts中新增頁(yè)面路由復(fù)制已有頁(yè)面文件,創(chuàng)造出新的頁(yè)面根據(jù)自己的需求定制開(kāi)發(fā)簡(jiǎn)單實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)

render () {

return (

{

Taro.navigateTo({

url:'/pages/index/index'

})

}}>

點(diǎn)擊跳轉(zhuǎn)

)

}

}

柚子快報(bào)邀請(qǐng)碼778899分享:MBTI答題應(yīng)用小程序

http://yzkb.51969.com/

文章鏈接

評(píng)論可見(jiàn),查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場(chǎng)。

轉(zhuǎn)載請(qǐng)注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://gantiao.com.cn/post/19194820.html

發(fā)布評(píng)論

您暫未設(shè)置收款碼

請(qǐng)?jiān)谥黝}配置——文章設(shè)置里上傳

掃描二維碼手機(jī)訪問(wèn)

文章目錄