fix: 修复部分问题
This commit is contained in:
parent
1f26bd7cf3
commit
849fc15748
13
App.vue
13
App.vue
|
|
@ -52,7 +52,6 @@
|
|||
// #endif
|
||||
},
|
||||
onShow: function() {
|
||||
|
||||
uni.getNetworkType({
|
||||
success: function (res) {
|
||||
console.log(res.networkType);
|
||||
|
|
@ -62,7 +61,15 @@
|
|||
console.log(res.isConnected);
|
||||
console.log(res.networkType);
|
||||
});
|
||||
console.log('App 开启')
|
||||
|
||||
// 刷新页面适配平板
|
||||
if (this.$store.getters['api/getApiToken']) {
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
onHide: function() {
|
||||
|
||||
|
|
@ -155,5 +162,5 @@
|
|||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
@import "@/common/css/common.scss";
|
||||
@import "~@/static/icon-font/css/iconfont.css"
|
||||
@import "~@/static/icon-font/css/iconfont.css";
|
||||
</style>
|
||||
|
|
@ -502,18 +502,18 @@
|
|||
.content-header {
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx;
|
||||
height: 600rpx;
|
||||
height: 300rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0rpx 0rpx 30rpx 0rpx;
|
||||
background-image: url('https://img.agrimedia.cn/watch-app/header-bg.png');
|
||||
// background-image: url('https://img.agrimedia.cn/watch-app/header-bg.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
position: relative;
|
||||
.sha-dow {
|
||||
width: 100%;
|
||||
height: 640rpx;
|
||||
height: 300rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
|
|
|||
10
pages.json
10
pages.json
|
|
@ -1,5 +1,9 @@
|
|||
{
|
||||
"pages": [ //pages数组中第一项表示应用启动页,
|
||||
"pages": [ //pages数组中第一项表示应用启动页,
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {}
|
||||
|
|
@ -15,10 +19,6 @@
|
|||
{
|
||||
"path": "pages/login/register",
|
||||
"style": {}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {}
|
||||
},
|
||||
{
|
||||
"path": "pages/device/device",
|
||||
|
|
|
|||
|
|
@ -275,12 +275,11 @@
|
|||
.content-header {
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx;
|
||||
height: 600rpx;
|
||||
height: 400rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0rpx 0rpx 30rpx 0rpx;
|
||||
background-image: url('https://img.agrimedia.cn/watch-app/header-bg.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
.login {
|
||||
width: 70%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content:center;
|
||||
/* margin-top: 128rpx; */
|
||||
}
|
||||
|
||||
/* 头部 logo */
|
||||
.header {
|
||||
width:161rpx;
|
||||
height:161rpx;
|
||||
box-shadow:0rpx 0rpx 60rpx 0rpx rgba(0,0,0,0.1);
|
||||
border-radius:50%;
|
||||
background-color: #000000;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.header image{
|
||||
width:161rpx;
|
||||
height:161rpx;
|
||||
border-radius:50%;
|
||||
}
|
||||
|
||||
/* 主体 */
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.tips {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
margin-top: 64rpx;
|
||||
margin-left: 48rpx;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.wbutton{
|
||||
margin-top: 96rpx;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.footer{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
margin-top: 64rpx;
|
||||
color: rgba(0,0,0,0.7);
|
||||
text-align: center;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.footer text{
|
||||
font-size: 24rpx;
|
||||
margin-left: 15rpx;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.back {
|
||||
position: fixed;
|
||||
top: 50rpx;
|
||||
left: 50rpx;
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<wButton
|
||||
class="wbutton"
|
||||
text="刷新二维码"
|
||||
:rotate="isRotate"
|
||||
:rotate="isRotate"
|
||||
@click="getLoginCode"
|
||||
></wButton>
|
||||
</view>
|
||||
|
|
@ -199,6 +199,76 @@
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import url("../../components/watch-login/css/icon.css");
|
||||
@import url("./css/main.css");
|
||||
@import url("../../components/watch-login/css/icon.css");
|
||||
|
||||
.login {
|
||||
width: 70%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content:center;
|
||||
/* margin-top: 128rpx; */
|
||||
}
|
||||
|
||||
/* 头部 logo */
|
||||
.header {
|
||||
width:161rpx;
|
||||
height:161rpx;
|
||||
box-shadow:0rpx 0rpx 60rpx 0rpx rgba(0,0,0,0.1);
|
||||
border-radius:50%;
|
||||
background-color: #000000;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.header image{
|
||||
width:161rpx;
|
||||
height:161rpx;
|
||||
border-radius:50%;
|
||||
}
|
||||
|
||||
/* 主体 */
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.tips {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
margin-top: 64rpx;
|
||||
margin-left: 48rpx;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.wbutton{
|
||||
margin-top: 96rpx;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.footer{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
margin-top: 64rpx;
|
||||
color: rgba(0,0,0,0.7);
|
||||
text-align: center;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.footer text{
|
||||
font-size: 24rpx;
|
||||
margin-left: 15rpx;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.back {
|
||||
position: fixed;
|
||||
top: 50rpx;
|
||||
left: 50rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/index/index","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/index/detail_info","pages/only_test/ot3","pages/only_test/ot5","pages/index/sleep_info","pages/index/body_info"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/login/login","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/login/login","meta":{"isQuit":true},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/detail_info","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/sleep_info","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/body_info","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
var __uniConfig = {"pages":["pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/index/index","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/only_test/ot3","pages/only_test/ot5"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/login/login","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/login/login","meta":{"isQuit":true},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -218,6 +218,9 @@
|
|||
var token = null;
|
||||
let times = null;
|
||||
|
||||
// 个人信息
|
||||
var user = userInfo(JSON.parse(getURLParameter('user')));
|
||||
|
||||
// 获取微软token
|
||||
fetch("https://eastasia.api.cognitive.microsoft.com/sts/v1.0/issueToken", {
|
||||
method: 'POST',
|
||||
|
|
@ -243,6 +246,14 @@
|
|||
for (let i = 0; i < exampleData.length; i++) {
|
||||
exampleData[i].name = demoData[exampleData[i].type]
|
||||
}
|
||||
// 过滤掉非对象类型的值
|
||||
const filteredData = Object.entries(exampleData).filter(([key, value]) => typeof value === 'object');
|
||||
|
||||
// 将键值对转换为所需格式的数组
|
||||
const arrayOfObjects = filteredData.map(([key, value]) => ({
|
||||
type: key,
|
||||
...value
|
||||
}));
|
||||
|
||||
/*
|
||||
* 实例化迅飞语音听写(流式版)WebAPI
|
||||
|
|
@ -272,103 +283,104 @@
|
|||
/*
|
||||
* 拿到匹配的文字下标
|
||||
*/
|
||||
let QSindex = containsKeywordRegex(params.msg);
|
||||
console.log(QSindex)
|
||||
|
||||
var QSindex = containsKeywordRegex(params.msg);
|
||||
if (QSindex == 0) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodGlucose");
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodGlucose");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 1) {
|
||||
const obj = exampleData.filter(item => item.type == "SleepDatas");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近睡眠时长为${obj[0].data_msg[0].sleepTotalTime}分钟`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 2) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodOxygen");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 3) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodPressure");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 4 || QSindex == 11) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodLiquid");
|
||||
if (obj[0].data_msg.cholesterol) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血脂状况为,
|
||||
尿酸为${obj[0].data_msg.uricAcidVal/10},
|
||||
总胆固醇为${obj[0].data_msg.cholesterol/100},
|
||||
甘油三酯为${obj[0].data_msg.cholesterol/100},
|
||||
高密度脂蛋白为${obj[0].data_msg.cholesterol/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.cholesterol/100}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 6) {
|
||||
const obj = exampleData.filter(item => item.type == "pulseReat");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 7) {
|
||||
const obj = exampleData.filter(item => item.type == "bodyTemperature");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 8) {
|
||||
const obj = exampleData.filter(item => item.type == "ECGData");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 9) {
|
||||
const obj = exampleData.filter(item => item.type == "bodyData");
|
||||
if (obj[0].data_msg.BMI) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近身体成分结果为${obj[0].data_msg.BMI}`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血糖数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (QSindex == 10) {
|
||||
const obj = exampleData.filter(item => item.type == "stepIndex");
|
||||
|
||||
if (QSindex == 1) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "SleepDatas");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的运动为${obj[0].data_msg.step}步数,
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近睡眠时长为${minutesToHoursMinutesStringSimplified(obj[0].data_msg[0].sleepTotalTime)}分钟`
|
||||
} else {
|
||||
speed(`睡眠数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 2) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodOxygen");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
speed(`血氧数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 3) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodPressure");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
speed(`血压数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 4 || QSindex == 11) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodLiquid");
|
||||
if (obj[0].data_msg.cholesterol) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血脂状况为,
|
||||
尿酸为${obj[0].data_msg.uricAcidVal/10},
|
||||
总胆固醇为${obj[0].data_msg.cholesterol/100},
|
||||
甘油三酯为${obj[0].data_msg.triacylglycerol/100},
|
||||
高密度脂蛋白为${obj[0].data_msg.highDensity/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.lowDensity/100}, `
|
||||
} else {
|
||||
speed(`血脂数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 6) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "pulseReat");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
speed(`心率数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 7) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bodyTemperature");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
speed(`体温数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 8) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "ECGData");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
speed(`心电图数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 9) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bodyData");
|
||||
if (obj[0].data_msg.BMI) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近身体成分结果为${obj[0].data_msg.BMI}`
|
||||
} else {
|
||||
speed(`身体成分数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 10) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "stepIndex");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的运动为${obj[0].data_msg.step}步数,
|
||||
${obj[0].data_msg.calorie/10}千卡,
|
||||
${obj[0].data_msg.distance/1000}公里`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`运动数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -405,7 +417,7 @@
|
|||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str.output.text}
|
||||
${filterString(str.output.text, ['*', ' '])}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
|
|
@ -491,7 +503,7 @@
|
|||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str.output.text}
|
||||
${filterString(str.output.text, ['*', ' '])}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
|
|
@ -591,13 +603,112 @@
|
|||
modal.style.display = 'block';
|
||||
dialog.style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
// 隐藏弹窗和遮罩
|
||||
function hideModal() {
|
||||
// overlay.style.display = 'none';
|
||||
modal.style.display = 'none';
|
||||
dialog.style.display = 'none';
|
||||
}
|
||||
|
||||
function speed(str) {
|
||||
fetch("https://eastasia.tts.speech.microsoft.com/cognitiveservices/v1", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Ocp-Apim-Subscription-Key': '58e9b39b8f6f48fe8d01f85b727ff737',
|
||||
'Content-Type': 'application/ssml+xml',
|
||||
'X-Microsoft-OutputFormat': 'audio-24khz-48kbitrate-mono-mp3'
|
||||
},
|
||||
responseType: 'arraybuffer',
|
||||
body: `<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="en-US">
|
||||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
</speak> `,
|
||||
}).then(async(response) => {
|
||||
const content_bytes = await response.arrayBuffer();
|
||||
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 设置音频源
|
||||
audioElement.src = blobUrl;
|
||||
|
||||
// 播放音频
|
||||
audioElement.play();
|
||||
|
||||
// 循环视频
|
||||
replayVideoSegment(60, 120);
|
||||
|
||||
// 计算所需时间
|
||||
const speakingTime = calculateSpeakingTime(content.data.choices[0].text);
|
||||
|
||||
// 开始倒计时
|
||||
var totalTime = speakingTime;
|
||||
var countdown = setInterval(function() {
|
||||
// 更新剩余时间
|
||||
totalTime --;
|
||||
if (totalTime <= 0) {
|
||||
// 停止倒计时
|
||||
clearInterval(countdown);
|
||||
replayVideoSegment(0, 60);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
hideModal()
|
||||
}).catch(e => {
|
||||
hideModal();
|
||||
});
|
||||
|
||||
startRec.style.display = 'block';
|
||||
runRec.style.display = 'none';
|
||||
}
|
||||
|
||||
// 防抖
|
||||
function throttle(fn, wait) {
|
||||
let lastTime = 0; // 上一次调用的时间
|
||||
|
||||
return function (...args) {
|
||||
const now = Date.now(); // 当前时间
|
||||
|
||||
// 如果距离上次调用已经超过设定时间,则调用函数
|
||||
if (now - lastTime > wait) {
|
||||
lastTime = now; // 更新上一次调用的时间
|
||||
fn.apply(this, args); // 以正确的`this`和参数调用函数
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 分钟转小时
|
||||
function minutesToHoursMinutesStringSimplified(minutes) {
|
||||
let hours = Math.floor(minutes / 60);
|
||||
let remainingMinutes = minutes % 60;
|
||||
|
||||
let formattedMinutes = remainingMinutes.toString().padStart(2, '0');
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}小时${formattedMinutes}分`;
|
||||
} else {
|
||||
return `${formattedMinutes}分`;
|
||||
}
|
||||
}
|
||||
|
||||
function filterString(str, charsToRemove) {
|
||||
// 这里的正则表达式是通过将charsToRemove数组中的字符转换为字符类(character class)来构建的
|
||||
// 例如,如果charsToRemove是['*', ' '],则正则表达式将是/[* ]/g
|
||||
const regex = new RegExp(`[${charsToRemove.join('')}]`, 'g');
|
||||
// 使用replace方法和正则表达式来移除所有匹配的字符
|
||||
return str.replace(regex, '');
|
||||
}
|
||||
|
||||
// 个人信息
|
||||
function userInfo(user) {
|
||||
return `年龄${user.birthday}, 身高${user.height}, 体重${user.weight}`
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/index/index","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/index/detail_info","pages/only_test/ot3","pages/only_test/ot5","pages/index/sleep_info","pages/index/body_info"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/login/login","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/login/login","meta":{"isQuit":true},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/detail_info","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/sleep_info","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/index/body_info","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
var __uniConfig = {"pages":["pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/index/index","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/only_test/ot3","pages/only_test/ot5"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/login/login","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/login/login","meta":{"isQuit":true},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -218,6 +218,9 @@
|
|||
var token = null;
|
||||
let times = null;
|
||||
|
||||
// 个人信息
|
||||
var user = userInfo(JSON.parse(getURLParameter('user')));
|
||||
|
||||
// 获取微软token
|
||||
fetch("https://eastasia.api.cognitive.microsoft.com/sts/v1.0/issueToken", {
|
||||
method: 'POST',
|
||||
|
|
@ -243,6 +246,14 @@
|
|||
for (let i = 0; i < exampleData.length; i++) {
|
||||
exampleData[i].name = demoData[exampleData[i].type]
|
||||
}
|
||||
// 过滤掉非对象类型的值
|
||||
const filteredData = Object.entries(exampleData).filter(([key, value]) => typeof value === 'object');
|
||||
|
||||
// 将键值对转换为所需格式的数组
|
||||
const arrayOfObjects = filteredData.map(([key, value]) => ({
|
||||
type: key,
|
||||
...value
|
||||
}));
|
||||
|
||||
/*
|
||||
* 实例化迅飞语音听写(流式版)WebAPI
|
||||
|
|
@ -272,103 +283,104 @@
|
|||
/*
|
||||
* 拿到匹配的文字下标
|
||||
*/
|
||||
let QSindex = containsKeywordRegex(params.msg);
|
||||
console.log(QSindex)
|
||||
|
||||
var QSindex = containsKeywordRegex(params.msg);
|
||||
if (QSindex == 0) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodGlucose");
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodGlucose");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 1) {
|
||||
const obj = exampleData.filter(item => item.type == "SleepDatas");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近睡眠时长为${obj[0].data_msg[0].sleepTotalTime}分钟`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 2) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodOxygen");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 3) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodPressure");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 4 || QSindex == 11) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodLiquid");
|
||||
if (obj[0].data_msg.cholesterol) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血脂状况为,
|
||||
尿酸为${obj[0].data_msg.uricAcidVal/10},
|
||||
总胆固醇为${obj[0].data_msg.cholesterol/100},
|
||||
甘油三酯为${obj[0].data_msg.cholesterol/100},
|
||||
高密度脂蛋白为${obj[0].data_msg.cholesterol/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.cholesterol/100}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 6) {
|
||||
const obj = exampleData.filter(item => item.type == "pulseReat");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 7) {
|
||||
const obj = exampleData.filter(item => item.type == "bodyTemperature");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 8) {
|
||||
const obj = exampleData.filter(item => item.type == "ECGData");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 9) {
|
||||
const obj = exampleData.filter(item => item.type == "bodyData");
|
||||
if (obj[0].data_msg.BMI) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近身体成分结果为${obj[0].data_msg.BMI}`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血糖数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (QSindex == 10) {
|
||||
const obj = exampleData.filter(item => item.type == "stepIndex");
|
||||
|
||||
if (QSindex == 1) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "SleepDatas");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的运动为${obj[0].data_msg.step}步数,
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近睡眠时长为${minutesToHoursMinutesStringSimplified(obj[0].data_msg[0].sleepTotalTime)}分钟`
|
||||
} else {
|
||||
speed(`睡眠数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 2) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodOxygen");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
speed(`血氧数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 3) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodPressure");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
speed(`血压数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 4 || QSindex == 11) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bloodLiquid");
|
||||
if (obj[0].data_msg.cholesterol) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的血脂状况为,
|
||||
尿酸为${obj[0].data_msg.uricAcidVal/10},
|
||||
总胆固醇为${obj[0].data_msg.cholesterol/100},
|
||||
甘油三酯为${obj[0].data_msg.triacylglycerol/100},
|
||||
高密度脂蛋白为${obj[0].data_msg.highDensity/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.lowDensity/100}, `
|
||||
} else {
|
||||
speed(`血脂数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 6) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "pulseReat");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
speed(`心率数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 7) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bodyTemperature");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
speed(`体温数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 8) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "ECGData");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
speed(`心电图数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 9) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "bodyData");
|
||||
if (obj[0].data_msg.BMI) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近身体成分结果为${obj[0].data_msg.BMI}`
|
||||
} else {
|
||||
speed(`身体成分数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (QSindex == 10) {
|
||||
const obj = arrayOfObjects.filter(item => item.type == "stepIndex");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的运动为${obj[0].data_msg.step}步数,
|
||||
${obj[0].data_msg.calorie/10}千卡,
|
||||
${obj[0].data_msg.distance/1000}公里`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`运动数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -405,7 +417,7 @@
|
|||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str.output.text}
|
||||
${filterString(str.output.text, ['*', ' '])}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
|
|
@ -491,7 +503,7 @@
|
|||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str.output.text}
|
||||
${filterString(str.output.text, ['*', ' '])}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
|
|
@ -591,13 +603,112 @@
|
|||
modal.style.display = 'block';
|
||||
dialog.style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
// 隐藏弹窗和遮罩
|
||||
function hideModal() {
|
||||
// overlay.style.display = 'none';
|
||||
modal.style.display = 'none';
|
||||
dialog.style.display = 'none';
|
||||
}
|
||||
|
||||
function speed(str) {
|
||||
fetch("https://eastasia.tts.speech.microsoft.com/cognitiveservices/v1", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Ocp-Apim-Subscription-Key': '58e9b39b8f6f48fe8d01f85b727ff737',
|
||||
'Content-Type': 'application/ssml+xml',
|
||||
'X-Microsoft-OutputFormat': 'audio-24khz-48kbitrate-mono-mp3'
|
||||
},
|
||||
responseType: 'arraybuffer',
|
||||
body: `<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="en-US">
|
||||
<voice name="zh-CN-XiaoxiaoNeural">
|
||||
<mstts:express-as style="Default" >
|
||||
<prosody rate="0%" pitch="0%">
|
||||
${str}
|
||||
</prosody>
|
||||
</mstts:express-as>
|
||||
</voice>
|
||||
</speak> `,
|
||||
}).then(async(response) => {
|
||||
const content_bytes = await response.arrayBuffer();
|
||||
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 设置音频源
|
||||
audioElement.src = blobUrl;
|
||||
|
||||
// 播放音频
|
||||
audioElement.play();
|
||||
|
||||
// 循环视频
|
||||
replayVideoSegment(60, 120);
|
||||
|
||||
// 计算所需时间
|
||||
const speakingTime = calculateSpeakingTime(content.data.choices[0].text);
|
||||
|
||||
// 开始倒计时
|
||||
var totalTime = speakingTime;
|
||||
var countdown = setInterval(function() {
|
||||
// 更新剩余时间
|
||||
totalTime --;
|
||||
if (totalTime <= 0) {
|
||||
// 停止倒计时
|
||||
clearInterval(countdown);
|
||||
replayVideoSegment(0, 60);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
hideModal()
|
||||
}).catch(e => {
|
||||
hideModal();
|
||||
});
|
||||
|
||||
startRec.style.display = 'block';
|
||||
runRec.style.display = 'none';
|
||||
}
|
||||
|
||||
// 防抖
|
||||
function throttle(fn, wait) {
|
||||
let lastTime = 0; // 上一次调用的时间
|
||||
|
||||
return function (...args) {
|
||||
const now = Date.now(); // 当前时间
|
||||
|
||||
// 如果距离上次调用已经超过设定时间,则调用函数
|
||||
if (now - lastTime > wait) {
|
||||
lastTime = now; // 更新上一次调用的时间
|
||||
fn.apply(this, args); // 以正确的`this`和参数调用函数
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 分钟转小时
|
||||
function minutesToHoursMinutesStringSimplified(minutes) {
|
||||
let hours = Math.floor(minutes / 60);
|
||||
let remainingMinutes = minutes % 60;
|
||||
|
||||
let formattedMinutes = remainingMinutes.toString().padStart(2, '0');
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}小时${formattedMinutes}分`;
|
||||
} else {
|
||||
return `${formattedMinutes}分`;
|
||||
}
|
||||
}
|
||||
|
||||
function filterString(str, charsToRemove) {
|
||||
// 这里的正则表达式是通过将charsToRemove数组中的字符转换为字符类(character class)来构建的
|
||||
// 例如,如果charsToRemove是['*', ' '],则正则表达式将是/[* ]/g
|
||||
const regex = new RegExp(`[${charsToRemove.join('')}]`, 'g');
|
||||
// 使用replace方法和正则表达式来移除所有匹配的字符
|
||||
return str.replace(regex, '');
|
||||
}
|
||||
|
||||
// 个人信息
|
||||
function userInfo(user) {
|
||||
return `年龄${user.birthday}, 身高${user.height}, 体重${user.weight}`
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/index/index","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/only_test/ot3","pages/only_test/ot5"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/login/login","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/login/login","meta":{"isQuit":true},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/index/index","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
var __uniConfig = {"pages":["pages/index/index","pages/login/login","pages/index/detail","pages/login/forget","pages/login/register","pages/device/device","pages/my/my","pages/login/explain","pages/index/echarts","pages/only_test/only_test","pages/only_test/ot1","pages/only_test/ot2","pages/only_test/ot3","pages/only_test/ot5"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"中鼎云医","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","navigationStyle":"custom","pageOrientation":"portrait"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"中鼎云医","compilerVersion":"4.15","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{}},{"path":"/pages/login/login","meta":{},"window":{}},{"path":"/pages/index/detail","meta":{},"window":{}},{"path":"/pages/login/forget","meta":{},"window":{}},{"path":"/pages/login/register","meta":{},"window":{}},{"path":"/pages/device/device","meta":{},"window":{}},{"path":"/pages/my/my","meta":{},"window":{}},{"path":"/pages/login/explain","meta":{},"window":{}},{"path":"/pages/index/echarts","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/only_test","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot1","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot2","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot3","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/only_test/ot5","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue