123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428 |
- <template>
- <view class="watch-con">
- <view class="userbox">
- <image class="home_top_bg" src="@/static/images/pages_watch/images/home_top_bg.png" mode="widthFix"></image>
- <view class="user">
- <view class="user-navbox">
- <scroll-view class="tab-bar" :scroll-x="true" :show-scrollbar="false"
- :scroll-into-view="scrollInto">
- <view :class="selectUser == index ? 'user-navitem user-navitem-active':'user-navitem'" :id="'tab'+index"
- v-for="(item,index) in userList" :key="index" @click="handleUser(index)">
- <view>{{item.name}}</view>
- <view class="user-navbox-line" :style="{display: selectUser == index ? 'flex':'none'}">
- <image src="@/static/images/pages_watch/icons/tag_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="user-family" @click="navigateToUrl('/pages_watch/index/myfamily/index')">
- <image src="@/static/images/pages_watch/icons/my_family_icon.png" mode="aspectFill"></image>
- <view>我的家人</view>
- </view>
- </view>
- </view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" top="0" bottom="0" :down="downOption" :up="upOption" @down="downCallback">
-
- <view class="watch-con-body">
- <!-- banner -->
- <swiper v-if="userList[selectUser] && userList[selectUser].deviceId && userList[selectUser].deviceId.length > 0" style="height: 350rpx;padding: 0 12rpx;box-sizing: border-box;"
- :current="activeTab" :duration="300" :previous-margin="userDeviceList.length > 0 &&activeTab == userDeviceList.length ? '92rpx':'0'" :next-margin="activeTab == userDeviceList.length ? '0':'92rpx'" @change="onSwiperChange">
- <swiper-item class="swiper-item" v-for="(item,index) in userDeviceList" :key="index">
- <view class="bindbox-banner" :style="{height: activeTab == index ?'308rpx':'260rpx'}">
- <view class="bindbox-head">
- <image class="bindbox-img" src="@/static/images/pages_watch/images/watch_icon.png" mode="aspectFill"></image>
- <view class="bindbox-headr" @tap="navigateToUrl('/pages_watch/index/targetInfo?selectUser='+selectUser+'&selectUserInfo='+ JSON.stringify(userList[selectUser]))">
- <view>
- <view class="bindbox-title textOne" v-show="selectUser == 0">
- {{item.user && item.user.nickName ? item.user.nickName : defaultName || '--' }}
- </view>
- <view class="bindbox-title textOne" v-show="selectUser != 0">
- {{userList[selectUser].name}}
- </view>
- <view>点击查看佩戴者信息</view>
- </view>
- <image src="@/static/images/pages_watch/icons/edit_white_arrow_right_icon.png"></image>
- </view>
- </view>
- <view class="bindbox-info">
- <view class="bindbox-info-l">
- <view class="bindbox-info-name">
- <view>手表</view>
- <view class="bindbox-info-desc">{{item.ble || '--'}}</view>
- </view>
- <view class="bindbox-info-status">
- <view>状态</view>
- <!-- 0-OFFLINE 1-ONLINE 2-UNACTIVE 3-DISABLE 4-NOT EXIST -->
- <view class="bindbox-info-desc">
- {{item.status == 1 ? '在线' : '离线'}}
- <navigator url="/pages_watch/index/equipment/offlineReason" hover-class="none" style="display: inherit;">
- <image class="question_mark_icon" src="@/static/images/pages_watch/icons/question_mark_icon.png" mode="aspectFill"></image>
- </navigator>
- </view>
- </view>
- </view>
- <view style="flex-shrink: 0;margin-left: 30rpx;">
- <view class="status_btn demonstrate_btn" style="margin-bottom: 20rpx;width: 192rpx;" @click="handleGuide">操作视频<image src="@/static/images/pages_watch/icons/edit_white_arrow_right_icon.png"></image>
- </view>
- <view class="bindbox-info-r" @tap="navigateToUrl('/pages_watch/index/equipment/index?selectUser='+selectUser)">
- 设备管理
- <image src="@/static/images/pages_watch/icons/arrow_right_orange_icon.png"></image>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- <swiper-item class="swiper-item">
- <view class="add-device" :style="{height: activeTab == userDeviceList.length ?'308rpx':'260rpx', width:activeTab == userDeviceList.length ?'308rpx':'260rpx'}" @click="handleBind">
- <view class="add-device-icon">
- <image src="@/static/images/pages_watch/icons/add_watch_icon.png" mode="aspectFill"></image>
- </view>
- <text>添加手表</text>
- </view>
- </swiper-item>
- </swiper>
- <view class="banner" v-else>
- <image class="banner_bg" src="@/static/images/pages_watch/images/gold_circle_bg.png" mode="heightFix"></image>
- <image class="banner_bg_watch" src="@/static/images/pages_watch/images/watch_img.png" mode="heightFix"></image>
- <view style="position: relative;z-index: 1;">
- <view class="status_text">未绑定</view>
- <view class="status_desc">还没绑定健康手表,扫描 手表二维码去绑定</view>
- <view class="status_btnbox">
- <button class="status_btn binding_btn" :loading="btnLoading" :disabled="btnLoading" @click="handleBind">
- {{btnLoading ? "绑定中...":"立即绑定"}}
- <image v-show="!btnLoading" src="@/static/images/pages_watch/icons/arrow_right_orange_icon.png"></image>
- </button>
- <view class="status_btn demonstrate_btn" @click="handleGuide">操作视频<image src="@/static/images/pages_watch/icons/edit_white_arrow_right_icon.png"></image>
- </view>
- </view>
- </view>
- </view>
- <view style="padding: 0 24rpx;">
- <!-- 健康风险 -->
- <view class="health-risks">
- <view class="health-risks-title">
- <view class="health-risks-titlel"><text>健康</text>风险</view>
- <navigator url="/pages_watch/message/detail?title=手表通知" hover-class="none" class="health-risks-titler" >
- <text>更多提醒</text>
- <text class="health-risks-msgnum" v-show="alarmTotal > 0">{{alarmTotal}}</text>
- <image src="@/static/images/pages_watch/icons/arrow_right_icon.png"></image>
- </navigator>
- </view>
- <view class="health-risks-msg">
- <view class="health-risks-msgitem" v-for="(item,index) in alarmInfoList" :key="index">
- <view class="textOne health-risks-msgtxt">{{item.description}}</view>
- <view class="health-risks-msgbtn" @tap="navigateToUrl('/pages_watch/message/detail?title=手表通知')">{{item.type == "event"? '去就医':"去查看"}}</view>
- </view>
- </view>
- </view>
- <view class="navbox">
- <view class="tongue-diagnosis" @tap="navigateToUrl('/pages/user/healthRecords/index','健康档案')">
- <view>
- <view class="tongue-diagnosis-title">健康档案</view>
- <view>为您精准诊断</view>
- </view>
- <image src="@/static/images/pages_watch/icons/jkda.png" mode="aspectFill"></image>
- </view>
- <!-- <view class="health-report" @tap="navigateToUrl('/pages_watch/health/healthReport?selectUser='+selectUser,'健康报告')">
- <view>
- <view class="health-report-title">健康报告</view>
- <view>分析健康状态</view>
- </view>
- <image src="@/static/images/pages_watch/icons/health_report_icon.png" mode="aspectFill"></image>
- </view> -->
- <view class="health-report" @tap="navigateToUrl('/pages_watch/health/healthWeekReport?selectUser='+selectUser,'健康周报')">
- <view>
- <view class="health-report-title">健康周报</view>
- <view>分析健康状态</view>
- </view>
- <image src="@/static/images/pages_watch/icons/health_report_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- <!-- 健康检测 -->
- <view class="box-title">
- <text class="box-title-left">健康监测</text>
- <view class="box-title-right">
- <view class="box-title-rightedit" @tap="navigateToUrl('/pages_watch/healthMonitoring/index')">
- <image src="@/static/images/pages_watch/icons/edit_add_icon.png"></image>
- <text>编辑卡片</text>
- </view>
- </view>
- </view>
- <sports ref='sports' v-if="showSports"></sports>
- <view class="health-monitoring">
- <view class="health-monitoring-item" v-for="(item,index) in indexInfo" :key="index"
- @tap="handleMonitoring(item)">
- <view class="health-monitoring-title">
- <view>
- <view class="health-monitoring-maintitle">{{item.type.type}}</view>
- <view>{{item.type.title}}</view>
- </view>
- <image :src="item.type.icon" mode="aspectFill"></image>
- </view>
- <view class="health-monitoring-res resnum">{{item.data || '--'}}</view>
- <view class="health-monitoring-time">{{item.date && item.date.substring(5,16)}}</view>
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import sports from "@/pages_watch/components/sports/sports.vue";
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import mescrollBody from "@/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue";
- import permision from "@/utils/permission.js";
- import { getWatchUserInfo,getStatus,editUser,editMyfamily,editDevice } from "@/api/pages_watch/user.js";
- import { alarmInfo, queryIndexWatchData,getBatchData,getInfoByDeviceIds } from "@/api/pages_watch/index.js";
- import { getAppVersion } from '@/api/pages_watch/common.js';
- // import { appCheckUdate,openDownload } from '@/utils/APPUpdate.js'
- const avatar="/static/images/pages_watch/images/my_heads_icon.png";
-
- export default {
- mixins: [MescrollMixin], // 使用mixin
- components: {
- mescrollBody,
- sports
- },
- data() {
- return {
- avatar,
- mescroll: null,
- downOption: { //下拉刷新
- auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
- },
- upOption: { //上拉加载
- auto: false, // 不自动加载
- page: {
- num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量
- },
- noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- tip: '~ 暂无疗法 ~' // 提示
- // btnText: '去看看'
- },
- use:false
- },
- userboxWidth: "",
- scrollInto: "tab0",
- activeTab: 0,
- userDeviceList: [],
- // 当前的设备编号
- deviceId: uni.getStorageSync("deviceId"),
- // 当前登录用户的信息
- userInfo: {},
- // 所有家庭成员(包括自己)
- userList: [{
- name: "自己",
- deviceId: [],
- relationship: ""
- }],
- // 选中的家庭成员
- selectUser: 0,
- // 立即绑定按钮loading
- btnLoading: false,
- // 健康风险
- alarmInfoList: [],
- // 健康风险未读提醒
- alarmTotal: 0,
- // 健康监测信息
- indexInfo: [
- {
- data: "",
- date: "",
- type: {
- type: "血糖",
- title: "血糖健康监测",
- icon: "/static/images/pages_watch/icons/blood_sugar_icon.png"
- }
- }
- ,{
- data: "",
- date: "",
- type: {
- type: "血压",
- title: "血压健康监测",
- icon:"/static/images/pages_watch/icons/blood_pressure_icon.png"
- }
- },{
- data: "",
- date: "",
- type: {
- type: "心率",
- title: "心脏健康管理",
- icon:"/static/images/pages_watch/icons/heart_rate_icon.png"
- }
- },{
- data: "",
- date: "",
- type: {
- type: "血氧",
- title: "血氧风险管控",
- icon:"/static/images/pages_watch/icons/blood_oxygen_icon.png"
- }
- },{
- data: "",
- date: "",
- type: {
- type: "体温",
- title: "体温健康监测",
- icon:"/static/images/pages_watch/icons/temperature_icon.png"
- }
- },{
- data: "",
- date: "",
- type: {
- type: "血脂",
- title: "血脂健康监测",
- icon:"/static/images/pages_watch/icons/blood_fat_icon.png"
- }
- },{
- data: "",
- date: "",
- type: {
- type: "尿酸",
- title: "尿酸健康监测",
- icon:"/static/images/pages_watch/icons/uric_acid_icon.png"
- }
- },
- // {
- // data: "",
- // date: "",
- // type: {
- // type: "血酮",
- // title: "血酮健康监测",
- // icon:"/static/images/pages_watch/icons/blood_ketone_icon.png"
- // }
- // },
- {
- data: "",
- date: "",
- type: {
- type: "睡眠",
- title: "睡眠健康监测",
- icon:"/static/images/pages_watch/icons/sleep_icon.png"
- }
- },
- ],
- isForce:false,
- showSports: false,
- defaultName: ''
- }
- },
- watch: {
- deviceId: {
- handler(oldVal,newVal) {
- this.getAlarmInfo()
- if(this.$refs.sports) {
- const isFamily = this.selectUser != 0
- this.$refs.sports.getServerData(isFamily)
- }
- },
- immediate: true
- }
- },
- created() {
- //#ifndef H5 || APP-PLUS
- this.userboxWidth = `width:${uni.getStorageSync('menuInfo').menuLeft}`
- //#endif
- uni.$on('getScanCodeInfo',(data)=>{
- const deviceId = data.imei || ""
- this.verifyDeviceId(data,deviceId)
- })
- },
- beforeDestroy() {
- uni.$off("getScanCodeInfo")
- },
- methods: {
- initReady() {
-
- },
- initShow() {
- this.showSports = true
- if (this.$isLogin()) {
- const acindex = this.userDeviceList.length > 0 && this.userDeviceList.length == this.activeTab ? this.userDeviceList.length - 1 : this.activeTab
- this.activeTab = acindex
- const user = uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')): {}
- this.defaultName = user.nickName
- this.getUser()
- this.getAlarmInfo()
- this.$nextTick(()=>{
- const isFamily = this.selectUser != 0
- this.$refs.sports.getServerData(isFamily)
- })
- } else {
- setTimeout(()=>{
- this.mescroll.endSuccess();
- }, 500)
- }
- // #ifdef APP-PLUS
- // this.checkUpdateApp();
- // #endif
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- this.initShow()
- },
- onChangeSubnav(e) {
- this.$emit("onChangeSubnav",e)
- },
- handleGuide() {
- uni.navigateTo({
- url: "/pages_watch/index/equipment/instructions"
- })
- },
- // swiper划动
- onSwiperChange(e) {
- this.activeTab = e.detail.current
- const acindex = this.userDeviceList.length > 0 && this.userDeviceList.length == this.activeTab ? this.userDeviceList.length - 1 : this.activeTab
- this.deviceId = this.userList[this.selectUser].deviceId[acindex] || ""
- uni.setStorageSync("deviceId",this.deviceId)
- // 所有成员的健康监测卡片展示类别一致
- this.getIndexInfo(this.userInfo.monitorDataTypeOrder)
- if(this.$refs.sports) {
- const isFamily = this.selectUser != 0
- this.$refs.sports.getServerData(isFamily)
- }
- },
- getUser() {
- getWatchUserInfo({isFamily: false}).then(res => {
- setTimeout(()=>{
- this.mescroll.endSuccess();
- }, 500)
- if (res.code == 200) {
- this.userInfo = res.user
- uni.setStorageSync("userWatchInfo", JSON.stringify(res.user))
- let otherDevice = this.userInfo.otherDevice ? JSON.parse(this.userInfo.otherDevice) : []
- otherDevice = otherDevice.map(item=>({
- ...item,
- deviceId: item.deviceId ? item.deviceId.split(',') : []
- }))
- const arry = [{
- name: "自己",
- deviceId: this.userInfo.deviceId || [],
- relationship: ""
- }]
-
- this.userList = arry.concat(otherDevice)
- if(this.$isEmpty(this.userList[this.selectUser])) {
- // 用户删除家人后没有选中的信息就选中第一个
- this.selectUser = 0
- this.activeTab = 0
- }
- this.deviceId = this.userList[this.selectUser].deviceId&&this.userList[this.selectUser].deviceId.length > 0 ? this.userList[this.selectUser].deviceId[this.activeTab] : ''
- uni.setStorageSync("deviceId",this.deviceId)
- this.getInfoByDeviceIds()
- this.getIndexInfo(this.userInfo.monitorDataTypeOrder)
- }
- }).catch(()=>{
- setTimeout(()=>{
- this.mescroll.endSuccess();
- }, 500)
- })
- },
- // 首页轮播绑定信息
- getInfoByDeviceIds() {
- let ids = this.userList[this.selectUser].deviceId
- if(ids&&ids.length> 0) {
- const param = {
- deviceIds: ids.join(','),
- isFamily: this.selectUser != 0
- }
- getInfoByDeviceIds(param).then(res=>{
- if(res.code == 200) {
- this.userDeviceList = res.data && res.data.length > 0 ? res.data : []
- }
- })
- } else {
- this.userDeviceList = []
- }
- },
- // 绑定
- async handleBind() {
- if (!this.$isLogin()) {
- this.$showLoginPage()
- } else {
- // #ifdef APP-PLUS
- if(!plus.runtime.isAgreePrivacy()) {
- uni.showToast({title: "请同意隐私政策",icon: "none"});
- return;
- }
- let status = await this.checkAppCamera()
- if(status == 1) {
- uni.navigateTo({
- url: '/pages_watch/healthMonitoring/scanCode?typeFun=getScanCodeInfo'
- })
- }
- // #endif
- // #ifdef MP-WEIXIN
- this.checkWXCamera()
- // #endif
- }
- },
- scanQRCode() {
- uni.scanCode({
- success(res) {
- if (res.result) {
- // 扫描成功,处理二维码内容
- console.log('扫描结果:', res.scanType,res.result);
- const scanInfo = JSON.parse(res.result)
- const deviceId = scanInfo.dev_info.imei || ""
- this.verifyDeviceId(scanInfo.dev_info,deviceId)
- } else {
- // 扫描失败
- uni.showToast({
- title: '扫描失败',
- icon: 'none'
- });
- }
- },
- fail() {}
- });
- },
- // 验证设备
- verifyDeviceId(scanInfo,deviceId) {
- // index,0表示自己,如果是自己绑定直接调用修改用户信息接口
- this.btnLoading = true
- if(this.selectUser == 0) {
- editDevice(scanInfo).then(res=>{
- this.btnLoading = false
- if(res.code == 200) {
- uni.showToast({
- title: res.msg,
- icon: "none",
- position: 'top',
- duration: 2000
- })
- this.getUser()
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none",
- position: 'top',
- duration: 2000
- })
- }
- }).catch(err=>{
- this.btnLoading = false
- })
- } else {
- this.bindDeviceId(deviceId)
- // getStatus({deviceId: deviceId}).then(res=>{
- // if(res.code == 200) {
- // if(res.data === 0 || res.data === 1 || res.data === 2 || res.data === 3) {
- // this.bindDeviceId(deviceId)
- // } else {
- // this.btnLoading = false
- // uni.showToast({
- // title: '绑定失败',
- // icon: "none",
- // position: 'top',
- // duration: 2000
- // })
- // }
- // }else {
- // this.btnLoading = false
- // uni.showToast({
- // title: res.msg,
- // icon: "none",
- // position: 'top',
- // duration: 2000
- // })
- // }
- // }).catch(err=>{
- // this.btnLoading = false
- // })
- }
- },
- // 绑定设备
- bindDeviceId(deviceId) {
- let param = this.userList.map((item,idx)=>({
- ...item,
- deviceId: idx == this.selectUser && !item.deviceId.includes(deviceId) ? item.deviceId.concat([deviceId]).join(','): item.deviceId.join(',')
- }))
- // 去掉自己
- param.splice(0,1)
- editMyfamily({otherDevice: JSON.stringify(param)}).then(res=>{
- this.btnLoading = false
- if(res.code == 200) {
- uni.showToast({
- title: "绑定成功",
- icon: "none",
- position: 'top',
- duration: 2000
- })
- this.getUser()
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none",
- position: 'top',
- duration: 2000
- })
- }
- }).catch(err => {
- this.btnLoading = false
- console.log('err', err);
- })
- },
- // 切换绑定的成员信息
- handleUser(index) {
- this.selectUser = index
- this.activeTab = 0
- this.scrollInto = 'tab' + index
- this.deviceId = this.userList[index].deviceId[this.activeTab] || ""
- uni.setStorageSync("deviceId",this.deviceId)
- this.getInfoByDeviceIds()
- // 所有成员的健康监测卡片展示类别一致
- this.getIndexInfo(this.userInfo.monitorDataTypeOrder)
- },
- navigateToUrl(url,title) {
- if (this.$isLogin()) {
- if((title == "健康报告" || title == "健康周报") && !this.deviceId) {
- uni.showToast({
- title: "请先绑定设备",
- icon: "none"
- })
- return
- }
- uni.navigateTo({
- url: url
- })
- } else {
- this.$showLoginPage()
- }
- },
- // 健康风险预警信息
- getAlarmInfo() {
- if(!this.deviceId) {
- this.alarmInfoList = []
- this.alarmTotal = 0
- return
- }
- const param = {
- deviceId: this.deviceId,
- pageNum: 1,
- pageSize: 3,
- }
- alarmInfo(param).then((res) => {
- if (res.code == 200) {
- this.alarmInfoList = res.rows
- this.alarmTotal = res.unreadNum
- }
- }).catch((err) => {});
- },
- // 健康监测信息
- getIndexInfo(monitorDataTypeOrder) {
- if(!this.deviceId) {
- getBatchData({ids: monitorDataTypeOrder}).then(res => {
- if (res.code == 200) {
- this.indexInfo = res.data.map(item=>({
- data: "",
- date: "",
- type: item
- }))
- }
- }).catch((err) => {});
- } else {
- const param = {
- deviceId: this.deviceId,
- type: monitorDataTypeOrder
- }
- queryIndexWatchData(param).then(res => {
- if (res.code == 200) {
- this.indexInfo = res.data
- }
- }).catch((err) => {});
- }
- },
- handleMonitoring(item) {
- if (this.$isLogin()) {
- if(!this.deviceId) {
- uni.showToast({
- title: "请先绑定设备",
- icon: "none"
- })
- return
- }
- let url = ""
- switch (item.type.type) {
- case "血糖":
- url = "/pages_watch/healthMonitoring/bloodSugar"
- break;
- case "血压":
- url = "/pages_watch/healthMonitoring/bloodPressure"
- break;
- case "心率":
- url = "/pages_watch/healthMonitoring/heartRate"
- break;
- case "血氧":
- url = "/pages_watch/healthMonitoring/bloodOxygen"
- break;
- case "睡眠":
- url = "/pages_watch/healthMonitoring/sleep"
- break;
- case "舌诊":
- url = "/pages/user/tongue/tongueList"
- break;
- case "体温":
- url = "/pages_watch/healthMonitoring/bodyTemperature"
- break;
- case "尿酸":
- url = "/pages_watch/healthMonitoring/uricAcid"
- break;
- case "压力":
- url = "/pages_watch/healthMonitoring/pressure"
- break;
- default:
- url = ""
- break;
- }
- if (url) {
- uni.navigateTo({
- url: url
- })
- } else {
- uni.showToast({
- title: '功能开发中...',
- icon: 'none',
- position: 'top',
- duration: 2000
- })
- }
- } else {
- this.$showLoginPage()
- }
- },
- async checkAppCamera() {
- let status = permision.isIOS ? await permision.requestIOS("camera") : await permision.requestAndroid("android.permission.CAMERA")
- if(status === null || status == 1) {
- status == 1
- } else if(status == 2) {
- uni.showModal({
- content: "相机权限已关闭",
- showCancel: false,
- success: () => {}
- })
- } else if(status.code) {
- uni.showModal({
- content: status.message
- })
- } else {
- uni.showModal({
- content: "为了使用相机功能,请点击设置开启相机权限",
- confirmText: "设置",
- success: (res) => {
- if(res.confirm) {
- permision.gotoAppSetting()
- }
- }
- })
- }
- return status
- },
- checkWXCamera() {
- const that = this
- uni.getSetting({
- success(res) {
- // 判断是否拥有此权限进行拉起授权 和 重新授权功能
- if (!res.authSetting['scope.camera']) {
- // 未授权此项权限 拉起授界面
- uni.authorize({
- scope: 'scope.camera',
- success() {
- // 授权成功后 就可以执行 需要权限的 操作函数了
- // 使用已授权的功能
- that.scanQRCode();
- },
- fail(err) {
- /*
- 第一次拒绝授权后必须在 uni.authorize的fail中使用
- uni.openSetting 才能进入设置界面打开授权按钮
- */
- uni.showToast({
- title: '您拒绝了授权',
- icon: 'none'
- });
- // 这里必须经过一个confirm 不然也会出现问题(啥问题我也不知道)
- uni.showModal({
- title: '是否重新授权相机功能',
- success(res) {
- if (res.confirm) {
- uni.openSetting({
- success() {
- console.log('开启权限成功');
- },
- fail() {
- console.log('开启权限失败');
- }
- });
- } else if (res.cancel) {
- console.log('拒绝开启开启权限');
- }
- }
- });
- }
- });
- } else {
- that.scanQRCode()
- }
- }
- });
- },
- /* 检查更新 在线更新 */
- checkUpdateApp:function(){
- // 获取manifest.json里的配置信息
- if(this.isForce){
- return;
- }
- let that=this;
- this.isForce=true;
- plus.runtime.getProperty(plus.runtime.appid, function(widgetinfo) {
- // console.log("App widgetinfo:"+JSON.stringify(widgetinfo));
- // 可以根据manifest.json里的应用名称来进行针对性的APP升级
- // if (widgetinfo.name == that.$qconfig.appName) { //APP名称
- // 获取manifest.json里的版本号
- let platform = uni.getSystemInfoSync().platform;
- let isAndroid=platform=="android";
- let type=isAndroid?1:2;
- getAppVersion(type).then(srcData => {
- this.isForce=false;
- if(srcData.code==200){
- let data = srcData.data;
- let version = widgetinfo.versionCode,//用户当前版本
- appVersion = data.versionCode,//升级包版本
- appName = widgetinfo.name, //app名称
- updata = data.isForce,//是否强制热更新
- appurl = data.url,//升级包地址
- intro = data.note;//升级包提示
- //如果用户版本号小于升级包版本号,先升级
- let afterVer=that.$qconfig.isAppStore?data.appStoreUpdate:true;
- // let afterVer= true;
- if(data && (version < appVersion) && afterVer){
- uni.showModal({
- title:"更新提示",
- confirmText:"立即升级",
- content:intro,
- cancelText:'确定',
- confirmText:'取消',
- success: (res) => {
- if (res.cancel) {
- openDownload(srcData.data);
- } else if (res.confirm) {
- if(updata==1){
- console.log('用户点击取消');
- uni.showToast({
- title:"请先升级APP版本",
- icon:"none",
- duration:2000
- })
- //退出app
- setTimeout(function(){
- plus.runtime.quit();
- },2000)
- }
- }
- },
- fail: () => {
- uni.hideLoading();
- }
- })
- }
- }
- },
- rej => {}
- ).catch(()=>{
- //联网失败, 结束加载
- // this.mescroll.endErr();
- });
-
- // }
- });
- },
-
- }
- }
- </script>
- <style lang="scss" scoped>
- @mixin u-flex($flexD, $alignI, $justifyC) {
- display: flex;
- flex-direction: $flexD;
- align-items: $alignI;
- justify-content: $justifyC;
- }
- .indexSubsection {
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .watch-con {
- padding-top: calc(var(--status-bar-height) + 44px + 88rpx);
- padding-bottom: var(--window-bottom);
- min-height: 100vh;
- box-sizing: border-box;
- background: linear-gradient(180deg, #FDF0DA 0%, #FDF4EB 75%, #F5F7FA 100%) no-repeat;
- background-size: 100% 504rpx;
- color: #222222;
- &-body {
- padding: 0 0 32rpx 0;
- }
- .userbox {
- width: 100%;
- overflow: hidden;
- position: fixed;
- z-index: 9999;
- left: 0;
- top: calc(var(--status-bar-height) + 44px);
- .home_top_bg {
- width: 100%;
- position: absolute !important;
- left: 0;
- top: -44px;
- z-index: 0;
- }
- }
- .tab-bar {
- width: 100%;
- flex-direction: row;
- white-space: nowrap;
- }
- .user {
- width: 100%;
- height: 88rpx;
- padding: 0 24rpx;
- box-sizing: border-box;
- @include u-flex(row, center, space-between);
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- color: #222222;
- overflow: hidden;
- position: relative;
- &-navbox {
- flex: 1;
- margin-right: 20rpx;
- overflow: hidden;
- @include u-flex(row, center, flex-start);
- font-size: 32rpx;
-
- &-line {
- display: inherit;
- margin-top: 16rpx;
-
- image {
- width: 40rpx;
- height: 12rpx;
- }
- }
- }
-
- &-navitem {
- min-width: 90rpx;
- padding: 0 20rpx;
- box-sizing: border-box;
- text-align: center;
- @include u-flex(column, center, center);
- display: inline-flex;
- flex-wrap: nowrap;
- &-active {
- font-size: 40rpx;
- color: #FF7700;
- }
- }
-
- &-family {
- flex-shrink: 0;
- font-weight: 400;
- font-size: 20rpx;
- text-align: center;
-
- image {
- width: 32rpx;
- height: 32rpx;
- }
- }
- }
-
- .banner {
- height: 312rpx;
- padding: 32rpx;
- margin: 24rpx 24rpx 0 24rpx;
- overflow: hidden;
- background: linear-gradient(180deg, #FBA457 0%, #FE7040 100%);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- font-family: PingFang SC, PingFang SC;
- color: #FFFFFF;
- box-sizing: border-box;
- position: relative;
-
- .banner_bg {
- width: 414rpx;
- height: 312rpx;
- position: absolute !important;
- right: 0;
- top: 0;
- }
- .banner_bg_watch {
- width: 264rpx;
- height: 307rpx;
- position: absolute !important;
- right: 0;
- top: 0;
- }
- .status_text {
- padding-left: 28rpx;
- line-height: 60rpx;
- font-weight: 600;
- font-size: 48rpx;
- position: relative;
-
- &::after {
- content: "";
- width: 8rpx;
- height: 40rpx;
- background: #FFFFFF;
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- }
- }
-
- .status_desc {
- width: 264rpx;
- padding-top: 20rpx;
- padding-bottom: 24rpx;
- font-weight: 400;
- font-size: 24rpx;
- line-height: 36rpx;
- }
-
- .status_btnbox{
- @include u-flex(row, center, flex-start);
- }
-
- .binding_btn {
- background: #FFFFFF;
- color: #FF7700;
- margin-right: 16rpx !important;
- }
- }
- .status_btn {
- width: 200rpx;
- height: 64rpx;
- line-height: 64rpx;
- border-radius: 36rpx 36rpx 36rpx 36rpx;
- @include u-flex(row, center, center);
- display: inline-flex;
- font-weight: 500;
- font-size: 26rpx;
- border: 2rpx solid #FFFFFF;
- box-sizing: border-box;
- margin: 0;
- &::after {
- border: none;
- }
- image {
- width: 32rpx;
- height: 32rpx;
- }
- }
- .demonstrate_btn {
- image {
- width: 48rpx !important;
- height: 48rpx !important;
- }
- }
- .swiper-item {
- padding: 0 12rpx;
- box-sizing: border-box;
- height: 350rpx;
- @include u-flex(row, center, flex-start);
- }
- .bindbox{
- &-banner{
- width: 100%;
- min-width: 624rpx;
- padding: 0 24rpx;
- box-sizing: border-box;
- @include u-flex(column, inherit, center);
- background: linear-gradient( 180deg, #FBA457 0%, #FE7040 100%);
- box-shadow: 0rpx 0rpx 14rpx 6rpx rgba(236,115,69,0.2);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- overflow: hidden;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #FFFFFF;
- }
- &-head {
- width: 100%;
- @include u-flex(row, center, flex-start);
- }
- &-img {
- flex-shrink: 0;
- width: 88rpx;
- height: 88rpx;
- padding: 8rpx;
- box-sizing: border-box;
- margin-right: 20rpx;
- background: #FEF2E0;
- border-radius: 50%;
- }
- &-headr {
- flex: 1;
- @include u-flex(row, center, space-between);
- overflow: hidden;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- }
- &-title {
- font-weight: 600;
- font-size: 36rpx;
- line-height: 60rpx;
- }
- &-info {
- width: 100%;
- margin-top: 46rpx;
- @include u-flex(row, center, space-between);
- .question_mark_icon {
- width: 24rpx;
- height: 24rpx;
- margin-left: 10rpx;
- }
- }
- &-info-l {
- flex: 1;
- @include u-flex(row, center, flex-start);
- }
- &-info-desc {
- margin-top: 18rpx;
- font-weight: 500;
- font-size: 28rpx;
- color: #FFFFFF;
- @include u-flex(row, center, center);
- }
- &-info-name {
- text-align: center;
- padding-right: 30rpx;
- border-right: 2rpx solid rgba(255,255,255,0.2);
- }
- &-info-status {
- padding-left: 30rpx;
- text-align: center;
- }
- &-info-r {
- width: 192rpx;
- height: 64rpx;
- background: #FFFFFF;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 26rpx;
- color: #FF7700;
- line-height: 64rpx;
- text-align: center;
- @include u-flex(row, center, center);
- image {
- height: 32rpx;
- width: 32rpx;
- }
- }
- }
-
- .add-device {
- width: 308rpx;
- height: 308rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 14rpx 8rpx rgba(236,115,69,0.1);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- @include u-flex(column, center, center);
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #757575;
- .add-device-icon {
- width: 144rpx;
- height: 144rpx;
- margin-bottom: 16rpx;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- border: 4rpx dashed #FF7700;
- @include u-flex(column, center, center);
- image {
- width: 56rpx;
- height: 56rpx;
- }
- }
- }
- .health-risks {
- margin-top: 20rpx;
- padding: 4rpx 16rpx 16rpx 16rpx;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- box-sizing: border-box;
- background: linear-gradient(180deg, #FFF1ED 0%, #FFFFFF 100%);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- border: 2rpx solid;
- border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)) 2 2;
-
- &-title {
- padding: 20rpx 12rpx;
- @include u-flex(row, center, space-between);
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- }
-
- &-titlel {
- font-weight: 600;
- font-size: 32rpx;
- color: #333333;
-
- text {
- color: #FF7700;
- }
- }
-
- &-titler {
- @include u-flex(row, center, flex-start);
-
- image {
- width: 32rpx;
- height: 32rpx;
- flex-shrink: 0;
- }
- }
-
- &-msgnum {
- min-width: 46rpx;
- height: 28rpx;
- padding: 0 12rpx;
- line-height: 28rpx;
- box-sizing: border-box;
- background: linear-gradient(136deg, #EE7D4E 0%, #E86235 100%);
- border-radius: 14rpx 14rpx 14rpx 14rpx;
- font-weight: 400;
- font-size: 20rpx;
- color: #FFFFFF;
- margin: 0 8rpx;
- flex-shrink: 0;
- text-align: center;
- }
-
- &-msg {
- padding: 20rpx 16rpx 0 16rpx;
- background: #FFFFFF;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- color: #333333;
- font-weight: 400;
- font-size: 26rpx;
- }
-
- &-msgitem {
- margin-bottom: 20rpx;
- @include u-flex(row, center, space-between);
- }
-
- &-msgtxt {
- line-height: 52rpx;
- padding-left: 26rpx;
- position: relative;
-
- &::before {
- content: "";
- width: 8rpx;
- height: 8rpx;
- background: rgba(255, 119, 0, 0.5);
- border-radius: 50%;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- }
- }
-
- &-msgbtn {
- min-width: 108rpx;
- height: 48rpx;
- padding: 0 24rpx;
- margin-left: 50rpx;
- box-sizing: border-box;
- line-height: 48rpx;
- background: #FCF0E7;
- border-radius: 26rpx 26rpx 26rpx 26rpx;
- flex-shrink: 0;
- font-weight: 500;
- font-size: 20rpx;
- color: #FF7700;
- }
- }
-
- .navbox {
- @include u-flex(row, center, flex-start);
- // gap: 16rpx;
- margin-top: 20rpx;
-
- .tongue-diagnosis {
- flex: 1;
- height: 160rpx;
- margin-right: 16rpx;
- background: linear-gradient(180deg, #FBE2B0 0%, #FFCA80 100%);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- font-weight: 400;
- font-size: 26rpx;
- color: #D36208;
- padding: 0 24rpx;
- @include u-flex(row, center, space-between);
-
- image {
- width: 97rpx;
- height: 96rpx;
- }
-
- &-title {
- font-weight: 600;
- font-size: 32rpx;
- margin-bottom: 10rpx;
- }
- }
-
- .health-report {
- flex: 1;
- height: 160rpx;
- padding: 0 24rpx;
- background: linear-gradient(180deg, #D6E3FF 0%, #95AFFF 100%);
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- font-weight: 400;
- font-size: 26rpx;
- color: #455FAD;
- @include u-flex(row, center, space-between);
-
- image {
- width: 99rpx;
- height: 105rpx;
- }
-
- &-title {
- font-weight: 600;
- font-size: 32rpx;
- margin-bottom: 10rpx;
- }
- }
- }
-
- .box-title {
- height: 80rpx;
- margin-top: 20rpx;
- line-height: 80rpx;
- font-weight: 500;
- font-size: 36rpx;
- color: #222222;
- @include u-flex(row, center, space-between);
-
- &-right {
- flex-shrink: 0;
- }
-
- .arrow_right_icon {
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- @include u-flex(row, center, flex-start);
-
- image {
- height: 48rpx;
- width: 48rpx;
- }
- }
-
- &-rightedit {
- min-width: 192rpx;
- height: 64rpx;
- padding: 0 32rpx;
- box-sizing: border-box;
- background: #FFFFFF;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- font-weight: 500;
- font-size: 24rpx;
- color: #757575;
- @include u-flex(row, center, center);
-
- image {
- width: 24rpx;
- height: 24rpx;
- margin-right: 4rpx;
- }
- }
- }
-
- .health-monitoring {
- @include u-flex(row, center, flex-start);
- flex-wrap: wrap;
- // gap: 16rpx;
- margin-bottom: -16rpx;
- margin-right: -16rpx;
- &-item {
- width: 343rpx;
- min-height: 264rpx;
- margin: 0 16rpx 16rpx 0;
- overflow: hidden;
- background: #FFFFFF;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- padding: 24rpx 34rpx 24rpx 24rpx;
- box-sizing: border-box;
- }
-
- &-maintitle {
- margin-bottom: 4rpx;
- font-weight: 500;
- font-size: 30rpx;
- color: #333333;
- }
-
- &-title {
- @include u-flex(row, center, space-between);
- font-weight: 400;
- font-size: 24rpx;
- color: #999999;
-
- image {
- width: 72rpx;
- height: 72rpx;
- flex-shrink: 0;
- }
- }
-
- .resnum {
- font-family: DIN, DIN;
- font-weight: 500;
- font-size: 64rpx;
- }
-
- &-res {
- height: 78rpx;
- margin: 20rpx 0 6rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 48rpx;
- color: #333333;
- }
-
- &-time {
- font-weight: 400;
- font-size: 22rpx;
- color: #999999;
- }
- }
- }
-
- </style>
|