fix: 语音识别拼音
This commit is contained in:
parent
3d55fca864
commit
c8aaa1e31a
|
|
@ -12,6 +12,9 @@
|
||||||
<script src="./js/voice.js"></script>
|
<script src="./js/voice.js"></script>
|
||||||
<script src="./js/crypto-js.min.js"></script>
|
<script src="./js/crypto-js.min.js"></script>
|
||||||
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
||||||
|
<!-- 文字转拼音 -->
|
||||||
|
<script src="./js/pinyin.js"></script>
|
||||||
|
|
||||||
<script src="js/w_md5.js"></script>
|
<script src="js/w_md5.js"></script>
|
||||||
|
|
||||||
<!-- 构建界面 -->
|
<!-- 构建界面 -->
|
||||||
|
|
@ -87,6 +90,8 @@
|
||||||
var Question = '';
|
var Question = '';
|
||||||
var Subtitles = '';
|
var Subtitles = '';
|
||||||
|
|
||||||
|
let { pinyin } = pinyinPro;
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
|
|
@ -330,7 +335,6 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
isCallbackExecuted = true;
|
isCallbackExecuted = true;
|
||||||
console.log(new Date().getTime(), 1)
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
|
|
@ -758,6 +762,7 @@
|
||||||
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
return bloodLiquidData.some(element => query.includes(element))
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
|
|
@ -778,6 +783,11 @@
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
|
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
|
||||||
|
return {
|
||||||
|
dataKey: 'bloodOxygen',
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,9 @@
|
||||||
<script src="./js/voice.js"></script>
|
<script src="./js/voice.js"></script>
|
||||||
<script src="./js/crypto-js.min.js"></script>
|
<script src="./js/crypto-js.min.js"></script>
|
||||||
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
||||||
|
<!-- 文字转拼音 -->
|
||||||
|
<script src="./js/pinyin.js"></script>
|
||||||
|
|
||||||
<script src="js/w_md5.js"></script>
|
<script src="js/w_md5.js"></script>
|
||||||
|
|
||||||
<!-- 构建界面 -->
|
<!-- 构建界面 -->
|
||||||
|
|
@ -87,6 +90,8 @@
|
||||||
var Question = '';
|
var Question = '';
|
||||||
var Subtitles = '';
|
var Subtitles = '';
|
||||||
|
|
||||||
|
let { pinyin } = pinyinPro;
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
|
|
@ -330,7 +335,6 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
isCallbackExecuted = true;
|
isCallbackExecuted = true;
|
||||||
console.log(new Date().getTime(), 1)
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
|
|
@ -758,6 +762,7 @@
|
||||||
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
return bloodLiquidData.some(element => query.includes(element))
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
|
|
@ -778,6 +783,11 @@
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
|
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
|
||||||
|
return {
|
||||||
|
dataKey: 'bloodOxygen',
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,9 @@
|
||||||
<script src="./js/voice.js"></script>
|
<script src="./js/voice.js"></script>
|
||||||
<script src="./js/crypto-js.min.js"></script>
|
<script src="./js/crypto-js.min.js"></script>
|
||||||
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
||||||
|
<!-- 文字转拼音 -->
|
||||||
|
<script src="./js/pinyin.js"></script>
|
||||||
|
|
||||||
<script src="js/w_md5.js"></script>
|
<script src="js/w_md5.js"></script>
|
||||||
|
|
||||||
<!-- 构建界面 -->
|
<!-- 构建界面 -->
|
||||||
|
|
@ -87,6 +90,8 @@
|
||||||
var Question = '';
|
var Question = '';
|
||||||
var Subtitles = '';
|
var Subtitles = '';
|
||||||
|
|
||||||
|
let { pinyin } = pinyinPro;
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
|
|
@ -330,7 +335,6 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
isCallbackExecuted = true;
|
isCallbackExecuted = true;
|
||||||
console.log(new Date().getTime(), 1)
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
|
|
@ -758,6 +762,7 @@
|
||||||
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
return bloodLiquidData.some(element => query.includes(element))
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
|
|
@ -778,6 +783,11 @@
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
|
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
|
||||||
|
return {
|
||||||
|
dataKey: 'bloodOxygen',
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,9 @@
|
||||||
<script src="./js/voice.js"></script>
|
<script src="./js/voice.js"></script>
|
||||||
<script src="./js/crypto-js.min.js"></script>
|
<script src="./js/crypto-js.min.js"></script>
|
||||||
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
||||||
|
<!-- 文字转拼音 -->
|
||||||
|
<script src="./js/pinyin.js"></script>
|
||||||
|
|
||||||
<script src="js/w_md5.js"></script>
|
<script src="js/w_md5.js"></script>
|
||||||
|
|
||||||
<!-- 构建界面 -->
|
<!-- 构建界面 -->
|
||||||
|
|
@ -87,6 +90,8 @@
|
||||||
var Question = '';
|
var Question = '';
|
||||||
var Subtitles = '';
|
var Subtitles = '';
|
||||||
|
|
||||||
|
let { pinyin } = pinyinPro;
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
|
|
@ -330,7 +335,6 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
isCallbackExecuted = true;
|
isCallbackExecuted = true;
|
||||||
console.log(new Date().getTime(), 1)
|
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
|
|
@ -758,6 +762,7 @@
|
||||||
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
return bloodLiquidData.some(element => query.includes(element))
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
|
|
@ -778,6 +783,11 @@
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
|
} else if (pinyin(query, { toneType: 'none' }).replace(/\s/g, '').includes("xueyang")) { // 不容易识别转拼音,上面其实都可以优化
|
||||||
|
return {
|
||||||
|
dataKey: 'bloodOxygen',
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue