fix: 修复部分问题
This commit is contained in:
parent
1749744e27
commit
15f947e329
|
|
@ -272,14 +272,13 @@
|
|||
/*
|
||||
* 拿到匹配的文字下标
|
||||
*/
|
||||
let QSindex = containsKeywordRegex(params.msg);
|
||||
console.log(QSindex)
|
||||
var QSindex = containsKeywordRegex(params.msg);
|
||||
if (QSindex == 0) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodGlucose");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血糖数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -288,7 +287,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近睡眠时长为${obj[0].data_msg[0].sleepTotalTime}分钟`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`睡眠数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -297,7 +296,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血氧数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -306,7 +305,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血压数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -320,7 +319,7 @@
|
|||
高密度脂蛋白为${obj[0].data_msg.cholesterol/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.cholesterol/100}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血脂数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +328,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`心率数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +337,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`体温数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +346,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`心电图数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -356,11 +355,10 @@
|
|||
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 (obj[0].data_msg) {
|
||||
|
|
@ -368,7 +366,7 @@
|
|||
${obj[0].data_msg.calorie/10}千卡,
|
||||
${obj[0].data_msg.distance/1000}公里`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`运动数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -598,6 +596,77 @@
|
|||
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`和参数调用函数
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<view>
|
||||
<navtab :current="0"></navtab>
|
||||
<view class="content">
|
||||
<z-paging ref="paging"refresher-only @onRefresh="onRefresh">
|
||||
<view class="flx jcsb ac">
|
||||
|
|
@ -18,8 +17,19 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="control flx flx_sb">
|
||||
<view class="btn">
|
||||
<liu-data-select elementId="data-select3" :dataList="deviceList" @change="changeDev" bgColor="#fff"
|
||||
color="#000">
|
||||
<view id="data-select3" class="btn-info1">{{name2 || '选择设备'}}</view>
|
||||
</liu-data-select>
|
||||
</view>
|
||||
<view class="btn" @click="outlogin">
|
||||
退出登录
|
||||
</view>
|
||||
</view>
|
||||
<view class="list-wrap">
|
||||
<view class="content-item row" @click="toPage('/pages/index/echarts?type=step&calorie='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.calorie:0)+'&step='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.step:0)+'&distance='+ (dataListsNew.stepIndex.data_msg?(dataListsNew.stepIndex.data_msg.distance / 1000).toFixed(2):0))">
|
||||
<view class="content-item row" style="padding-bottom: 60rpx;" @click="toPage('/pages/index/echarts?type=step&calorie='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.calorie:0)+'&step='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.step:0)+'&distance='+ (dataListsNew.stepIndex.data_msg?(dataListsNew.stepIndex.data_msg.distance / 1000).toFixed(2):0))">
|
||||
<view class="item">
|
||||
<view class="title">卡路里</view>
|
||||
<view class="row-date">
|
||||
|
|
@ -41,7 +51,6 @@
|
|||
<text>公里</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row-time" v-if="dataListsNew.stepIndex">
|
||||
{{(dataListsNew.stepIndex.device_real_time)}}
|
||||
</view>
|
||||
|
|
@ -49,7 +58,7 @@
|
|||
<!-- <image src="../../static/icon/血糖.png" mode="widthFix"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-item" @click="toPage('/pages/index/sleep_info')">
|
||||
<view class="content-item" style="padding-bottom: 60rpx;" @click="toPage('/pages/index/sleep_info')">
|
||||
<view class="title">
|
||||
{{getNameByKey('sleep')}}
|
||||
</view>
|
||||
|
|
@ -109,8 +118,6 @@
|
|||
<text class="icon">%</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="bg">
|
||||
<image src="../../static/icon/xueyang.png" mode="widthFix"></image>
|
||||
|
|
@ -224,28 +231,6 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="content-item" @click="toPage('/pages/index/detail?type=meiTuo')">
|
||||
<view class="title">
|
||||
{{getNameByKey('meiTuo')}}
|
||||
</view>
|
||||
<view class="time">
|
||||
{{dataListsNew.meiTuo.data_msg? dataListsNew.meiTuo.device_real_time + '更新' : '--'}}
|
||||
</view>
|
||||
<view class="date">
|
||||
<view class="flex_data">
|
||||
<view class="f_left">
|
||||
{{dataListsNew.meiTuo.data_msg? (dataListsNew.meiTuo.data_msg[0] / 10) : '--'}}
|
||||
</view>
|
||||
<view class="f_right">
|
||||
<text class="icon">MET</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg">
|
||||
<image src="../../static/icon/xinlv.png" mode="widthFix"></image>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodLiquid&desc=uricAcidVal')">
|
||||
<view class="title">
|
||||
尿酸
|
||||
|
|
@ -268,7 +253,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-item" style="height: 430rpx" @click="toPage('/pages/index/echarts?type=bloodLiquidAll')">
|
||||
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodLiquidAll')">
|
||||
<view class="title">
|
||||
{{getNameByKey('bloodLiquid')}}
|
||||
</view>
|
||||
|
|
@ -316,6 +301,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数字人webview原生页面 -->
|
||||
<view class="right">
|
||||
<web-view :src="urlLink"></web-view>
|
||||
</view>
|
||||
|
|
@ -362,7 +349,13 @@
|
|||
}
|
||||
},
|
||||
|
||||
urlLink: ''
|
||||
name: '',
|
||||
name1: '',
|
||||
name2: '',
|
||||
deviceList: [],
|
||||
|
||||
|
||||
urlLink: '',
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
|
@ -434,6 +427,10 @@
|
|||
this.$refs.paging.complete();
|
||||
}
|
||||
);
|
||||
|
||||
this.$store.dispatch('api/getBindUserDeviceId').then(res => {
|
||||
this.deviceList = res;
|
||||
});
|
||||
},
|
||||
mkHourMin(min){
|
||||
if(min < 60){
|
||||
|
|
@ -453,6 +450,22 @@
|
|||
if (dateTimeStr) {
|
||||
return dateTimeStr.replace(/-/g, ' ').replace(' ', ' ', 2).replace(' ', ':');
|
||||
}
|
||||
},
|
||||
// 退出登录
|
||||
outlogin() {
|
||||
this.$store.commit('api/setApiToken', '')
|
||||
this.$store.commit('api/setActiceDevice', '')
|
||||
this.$store.commit('api/setUserInfo', '')
|
||||
|
||||
uni.reLaunch({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
},
|
||||
|
||||
// 选中的设备
|
||||
changeDev(item) {
|
||||
this.$store.commit('api/setActiceDevice', item)
|
||||
this.onRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -549,6 +562,17 @@
|
|||
justify-content: space-between;
|
||||
padding: 0rpx 40rpx;
|
||||
}
|
||||
.control {
|
||||
margin: 0rpx 40rpx;
|
||||
.btn {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx 50rpx;
|
||||
border-radius: 20rpx ;
|
||||
-webkit-box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
|
||||
}
|
||||
}
|
||||
.content-item {
|
||||
width: 42%;
|
||||
margin: 20rpx 10rpx;
|
||||
|
|
@ -558,7 +582,6 @@
|
|||
-webkit-box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
|
||||
box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
overflow: hidden;
|
||||
.title {
|
||||
font-size: 38rpx;
|
||||
|
|
@ -567,7 +590,7 @@
|
|||
}
|
||||
.row-time {
|
||||
position: absolute;
|
||||
bottom: 30rpx;
|
||||
bottom: 10rpx;
|
||||
right: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: grey;
|
||||
|
|
@ -676,4 +699,32 @@
|
|||
margin: 0rpx 20rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.page-main {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 32rpx;
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
width: 600rpx;
|
||||
height: 88rpx;
|
||||
margin: 0 auto;
|
||||
margin-top: 30rpx;
|
||||
border: solid #f0f0f0 1px;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.btn-info1 {
|
||||
width: 300rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.card {
|
||||
width: 800rpx !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@
|
|||
@click="getLoginCode"
|
||||
></wButton>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<!-- <view class="footer">
|
||||
<view class="" @click="doLoginType(1)">
|
||||
密码登录{{sn}}
|
||||
</view>
|
||||
<text>|</text>
|
||||
<navigator url="register" open-type="navigate">注册账号</navigator>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -65,10 +65,6 @@
|
|||
<navigator url="forget" open-type="navigate">找回密码</navigator>
|
||||
<text>|</text>
|
||||
<navigator url="register" open-type="navigate">注册账号</navigator>
|
||||
<text>|</text>
|
||||
<view class="" @click="doLoginType(0)">
|
||||
扫码登录
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -99,9 +95,6 @@
|
|||
isRotate: false, //是否加载旋转
|
||||
isFocus: true // 是否聚焦
|
||||
};
|
||||
},
|
||||
watch(){
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
let token = this.$store.getters['api/getApiToken']
|
||||
|
|
@ -125,27 +118,16 @@
|
|||
_this= this;
|
||||
},
|
||||
methods: {
|
||||
|
||||
back() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
doLoginType(type){
|
||||
this.login_type = type
|
||||
if(type == 0){
|
||||
this.qrCodeMsg = '加载中...'
|
||||
this.qrCode = ''
|
||||
this.getLoginCode()
|
||||
}else{
|
||||
this.qrCodeMsg = '加载中...'
|
||||
this.qrCode = ''
|
||||
}
|
||||
},
|
||||
getLoginCode(){
|
||||
// 验证一下token是否有值
|
||||
let token = this.$store.getters['api/getApiToken']
|
||||
if(!token){
|
||||
console.log('无token')
|
||||
this.$store.dispatch('api/getLoginCode').then(res => {
|
||||
this.qrCode = 'https://ai.agrimedia.cn/qrcodeLogin/index?qrcode=' + res.key
|
||||
this.qrCodeVal = res.key
|
||||
|
|
@ -174,21 +156,6 @@
|
|||
}
|
||||
})
|
||||
},1000)
|
||||
// this.$store.dispatch('api/checkLoginCode',{
|
||||
// key:this.qrCodeVal
|
||||
// }).then(res => {
|
||||
// if(res.status == 0){
|
||||
// setTimeout(this.checkQrCode(),2000)
|
||||
// }
|
||||
// if(res.status == 1){
|
||||
// this.$store.commit('api/setApiToken',res.token)
|
||||
// console.log('123')
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/index/index'
|
||||
// })
|
||||
// }
|
||||
// //
|
||||
// })
|
||||
}
|
||||
},
|
||||
startLogin(e){
|
||||
|
|
@ -218,10 +185,9 @@
|
|||
uni.showLoading({
|
||||
title: '登录中'
|
||||
});
|
||||
this.$store.dispatch('api/dologin', { mobile: this.phoneData, password: this. passData }).then(res => {
|
||||
this.$store.dispatch('api/dologin', { mobile: this.phoneData, password: this.passData }).then(res => {
|
||||
if (res.token) {
|
||||
this.$store.commit('api/setApiToken',res.token)
|
||||
console.log('123')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -309,7 +309,8 @@
|
|||
options: {
|
||||
handler() {
|
||||
if (this.auto) {
|
||||
this.remake();
|
||||
console.log('3')
|
||||
// this.remake();
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
## 1.0.2(2023-06-09)
|
||||
增加预览二维码
|
||||
## 1.0.1(2023-05-10)
|
||||
增加示例
|
||||
## 1.0.0(2023-05-10)
|
||||
初始发布
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
<template>
|
||||
<view class="select-main">
|
||||
<view @click.stop="showCard">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view v-if="show">
|
||||
<!-- <view class="arrow" :style="{background:bgColor,left:(left+50)+'rpx'}"></view> -->
|
||||
<view class="arrow-tip"
|
||||
:style="{width:width+'rpx',background:bgColor,left:left+'rpx',borderRadius:radius+'rpx'}"></view>
|
||||
<view class="card"
|
||||
:style="'height:'+(dHeight?dHeight+'rpx':'auto')+';max-height:'+dMaxHeight+'rpx;background-color:'+bgColor+';border-radius:'+radius+'rpx;left:'+left+'rpx'">
|
||||
<view
|
||||
:class="item.device_id == getActiceDevice.device_id? 'active' : '' "
|
||||
class="card-list" v-for="(item,index) in dataList"
|
||||
:key="index"
|
||||
@click="clickItem(item)"
|
||||
:style="'color:'+color+';font-size:'+fontSize+'rpx;line-height:'+lineHeight+'rpx;'">
|
||||
{{item.device_id}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
props: {
|
||||
//所点击元素id
|
||||
elementId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
//下拉框数据源
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
//下拉框背景色
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: '#FFFFFF'
|
||||
},
|
||||
//下拉框圆角(rpx)
|
||||
radius: {
|
||||
type: Number,
|
||||
default: 8
|
||||
},
|
||||
//下拉框宽度(rpx),不传则默认取所点击元素的宽度
|
||||
dWidth: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//下拉框高度(rpx),不传则默认由内容撑开
|
||||
dHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//下拉框最大高度(rpx),超出则内部滚动
|
||||
dMaxHeight: {
|
||||
type: Number,
|
||||
default: 400
|
||||
},
|
||||
//字体颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333'
|
||||
},
|
||||
//字体大小(rpx)
|
||||
fontSize: {
|
||||
type: Number,
|
||||
default: 28
|
||||
},
|
||||
//字体行高(rpx)
|
||||
lineHeight: {
|
||||
type: Number,
|
||||
default: 66
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
width: 0,
|
||||
left: 0,
|
||||
top: 0,
|
||||
difference: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
getActiceDevice: "api/getActiceDevice"
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
if (!this.elementId) return
|
||||
// #ifdef MP-WEIXIN
|
||||
this.createSelectorQuery().select('.select-main').boundingClientRect(res => {
|
||||
this.difference = res.left
|
||||
uni.createSelectorQuery().select('#' + this.elementId).boundingClientRect(rect => {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
const screenWidth = systemInfo.screenWidth
|
||||
if (!this.dWidth) {
|
||||
this.width = this.px2rpx(rect.width, screenWidth)
|
||||
} else {
|
||||
this.width = this.dWidth
|
||||
}
|
||||
this.left = this.px2rpx(rect.left - this.difference, screenWidth)
|
||||
this.top = this.px2rpx((rect.height + 15), screenWidth)
|
||||
}).exec()
|
||||
}).exec()
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.createSelectorQuery().select('.select-main').boundingClientRect(res => {
|
||||
this.difference = res.left
|
||||
uni.createSelectorQuery().select('#' + this.elementId).boundingClientRect(rect => {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
const screenWidth = systemInfo.screenWidth
|
||||
if (!this.dWidth) {
|
||||
this.width = this.px2rpx(rect.width, screenWidth)
|
||||
} else {
|
||||
this.width = this.dWidth
|
||||
}
|
||||
this.left = this.px2rpx(rect.left - this.difference, screenWidth)
|
||||
this.top = this.px2rpx((rect.height + 15), screenWidth)
|
||||
}).exec()
|
||||
}).exec()
|
||||
// #endif
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
showCard() {
|
||||
if (!this.elementId) return
|
||||
else this.show = !this.show
|
||||
},
|
||||
px2rpx(px, screenWidth) {
|
||||
return px / (screenWidth / 750)
|
||||
},
|
||||
//点击选项
|
||||
clickItem(item) {
|
||||
this.show = false
|
||||
this.$emit('change', item)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.select-main {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
z-index: 99999;
|
||||
overflow: auto;
|
||||
padding: 26rpx 30rpx;
|
||||
font-size: 32rpxs;
|
||||
box-shadow: 0 2rpx 12rpx 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.arrow {
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
transform: rotate(135deg);
|
||||
bottom: -40rpx;
|
||||
box-shadow: -8rpx 6rpx 12rpx -4rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card-list {
|
||||
padding: 0rpx 20rpx;
|
||||
}
|
||||
.arrow-tip {
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #000;
|
||||
color: #fff !important;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
### 1、本插件可免费下载使用;
|
||||
### 2、未经许可,严禁复制本插件派生同类插件上传插件市场;
|
||||
### 3、未经许可,严禁在插件市场恶意复制抄袭本插件进行违规获利;
|
||||
### 4、对本软件的任何使用都必须遵守这些条款,违反这些条款的个人或组织将面临法律追究。
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"id": "liu-data-select",
|
||||
"displayName": "select下拉框选择器",
|
||||
"version": "1.0.2",
|
||||
"description": "非常简单好用的select下拉框选择器,可自定义选择框大小、颜色、内容等",
|
||||
"keywords": [
|
||||
"下拉",
|
||||
"下拉框",
|
||||
"下拉选择",
|
||||
"select",
|
||||
"选择器"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "component-vue",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "u"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "u",
|
||||
"app-nvue": "u"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "u",
|
||||
"IE": "u",
|
||||
"Edge": "u",
|
||||
"Firefox": "u",
|
||||
"Safari": "u"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "u",
|
||||
"百度": "u",
|
||||
"字节跳动": "u",
|
||||
"QQ": "u",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
### liu-data-select适用于uni-app项目的select下拉框选择器组件
|
||||
### 本组件目前兼容微信小程序、H5
|
||||
### 本组件是非常简单好用的select下拉框选择器,可点击任意元素弹出,可自定义选择框大小、颜色、内容等,源码简单易修改
|
||||
# --- 扫码预览、关注我们 ---
|
||||
|
||||
## 扫码关注公众号,查看更多插件信息,预览插件效果!
|
||||
|
||||

|
||||
|
||||
### 使用方式
|
||||
``` 示例
|
||||
<template>
|
||||
<view class="page-main">
|
||||
<view class="title">示例一:</view>
|
||||
<liu-data-select elementId="data-select1" :dataList="dataList" @change="change">
|
||||
<input id="data-select1" v-model="name" class="btn-info" placeholder="请选择" disabled />
|
||||
</liu-data-select>
|
||||
|
||||
<view class="title">示例二:</view>
|
||||
<liu-data-select elementId="data-select2" :dataList="dataList" @change="change1">
|
||||
<input id="data-select2" v-model="name1" class="btn-info1" placeholder="请选择" disabled />
|
||||
</liu-data-select>
|
||||
|
||||
<view class="title">示例三:</view>
|
||||
<liu-data-select elementId="data-select3" :dataList="dataList" @change="change2" bgColor="#000000"
|
||||
color="#FFFFFF">
|
||||
<view id="data-select3" class="btn-info1">{{name2 || '点击选择'}}</view>
|
||||
</liu-data-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
name1: '',
|
||||
name2: '',
|
||||
dataList: ['选项1', '选项2', '选项3', '选项4', '选项5', '选项6', '选项7', '选项8', '选项9', '选项10']
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.name = e
|
||||
console.log('点击示例一选项:', e)
|
||||
},
|
||||
change1(e) {
|
||||
this.name1 = e
|
||||
console.log('点击示例二选项:', e)
|
||||
},
|
||||
change2(e) {
|
||||
this.name2 = e
|
||||
console.log('点击示例三选项:', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-main {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 32rpx;
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
width: 600rpx;
|
||||
height: 88rpx;
|
||||
margin: 0 auto;
|
||||
margin-top: 30rpx;
|
||||
border: solid #f0f0f0 1px;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.btn-info1 {
|
||||
width: 300rpx;
|
||||
height: 88rpx;
|
||||
margin: 0 auto;
|
||||
margin-top: 30rpx;
|
||||
border: solid #f0f0f0 1px;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 30rpx;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### 属性说明
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| ----------------------------|---------------- | ---------------------- | ---------------|
|
||||
| elementId | String | | 所点击元素id(必须传)
|
||||
| dataList | Array | [] | 下拉框数据源
|
||||
| bgColor | String | #FFFFFF | 下拉框背景色
|
||||
| radius | Number | 8 | 下拉框圆角(rpx)
|
||||
| dWidth | Number | 0 | 下拉框宽度(rpx),不传则默认取所点击元素的宽度
|
||||
| dHeight | Number | 0 | 下拉框高度(rpx),不传则默认由内容撑开
|
||||
| dMaxHeight | Number | 0 | 下拉框最大高度(rpx),超出则内部滚动
|
||||
| color | String | #333333 | 字体颜色
|
||||
| fontSize | Number | 28 | 字体大小(rpx)
|
||||
| lineHeight | Number | 66 | 字体行高(rpx)
|
||||
| @change | Function | | 点击选项回调事件
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -272,14 +272,13 @@
|
|||
/*
|
||||
* 拿到匹配的文字下标
|
||||
*/
|
||||
let QSindex = containsKeywordRegex(params.msg);
|
||||
console.log(QSindex)
|
||||
var QSindex = containsKeywordRegex(params.msg);
|
||||
if (QSindex == 0) {
|
||||
const obj = exampleData.filter(item => item.type == "bloodGlucose");
|
||||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血糖为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血糖数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -288,7 +287,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近睡眠时长为${obj[0].data_msg[0].sleepTotalTime}分钟`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`睡眠数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -297,7 +296,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血氧为${obj[0].data_msg}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血氧数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -306,7 +305,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的血压为${obj[0].data_msg.bloodPressureLow}/${obj[0].data_msg.bloodPressureHigh}毫摩尔/升`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血压数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -320,7 +319,7 @@
|
|||
高密度脂蛋白为${obj[0].data_msg.cholesterol/100},
|
||||
低密度脂蛋白为${obj[0].data_msg.cholesterol/100}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`血脂数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +328,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的心率为${obj[0].data_msg[0]}, `
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`心率数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +337,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近测量的体温为${obj[0].data_msg}摄氏度`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`体温数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +346,7 @@
|
|||
if (obj[0].data_msg) {
|
||||
Question = `请模仿全科医生的口吻与我对话,我最近心电图测量结果为${obj[0].data_msg.heartRate}次/分`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`心电图数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -356,11 +355,10 @@
|
|||
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 (obj[0].data_msg) {
|
||||
|
|
@ -368,7 +366,7 @@
|
|||
${obj[0].data_msg.calorie/10}千卡,
|
||||
${obj[0].data_msg.distance/1000}公里`
|
||||
} else {
|
||||
alert ('当前数据为空');
|
||||
speed(`运动数据为空, 请连接或同步设备数据`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -598,6 +596,63 @@
|
|||
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';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue