chenyc
2025-08-26 7b2f328b9eed45e57afa037e1eea5c06fe636fc2
src/views/home/index.vue
@@ -2,13 +2,14 @@
    <div class="page">
        <div class="box_1">
            <div class="userinfo">
                <div class="name">张三丰</div>
                <div class="userCode">卡号:202324224242 </div>
                <div class="name" v-if="patientInfo.patientInfo.patientName !== undefined">{{patientInfo.patientInfo.patientName}}</div>
                <div class="userCode">透析号:{{patientInfo.patientInfo.patientHemoCode}} </div>
                <div class="userQRcode">
                    <img
                        @click="showerwima = true"
                        style=" width: 60px;height: 60px;margin-left: 8%; margin-top: 20px;"
                        referrerpolicy="no-referrer"
                        src="@/views/home/assets/img/SketchPng011ef35b32ef075413b756766208370cde43357dffc3333d2acf29b70793c15d.png"
                        :src="patientInfo.patientInfo.patientQrcodeUrl"
                    />
                </div>
            </div>
@@ -17,7 +18,7 @@
                    round
                    width="78px"
                    height="78px"
                    src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
                    :src="patientInfo.patientInfo.patientAvatarIcon"
                />
            </div>
            <div class="meuns">
@@ -64,21 +65,25 @@
        <div class="viewInfo">
            <div class="box">
                <div class="crainfo">
                    <div class="tizhong">86</div>
                    <div class="tizhong">{{最近体重血压.体重}}</div>
                </div>
                <div class="hanzhi">体重(kg)</div>
                <div class="yinyu">Patient weight data</div>
                <div class="yinyu">最近透析治疗签到的透前体重</div>
            </div>
            <div class="box">
                <div class="crainfo">
                    <div class="xueya">138/88</div>
                    <div class="xueya">
                        <div v-if="最近体重血压.血压">{{最近体重血压.血压.split('/')[0]}}</div>
                        <div style="height: 1px;background-color: #909399;"></div>
                        <div v-if="最近体重血压.血压">{{最近体重血压.血压.split('/')[1]}}</div>
                    </div>
                </div>
                <div class="hanzhi">血压(mmHg)</div>
                <div class="yinyu">Patient blood pressure data</div>
                <div class="yinyu">最近透析治疗签到的透前血压</div>
            </div>
        </div>
        <div class="listInfos">
            <div class="listrow">
            <div class="listrow" @click="Toast('此功能正在开发中,敬请期待')">
                <div class="rowioc">
                    <van-image
                        width="24px"
@@ -87,7 +92,7 @@
                    />
                </div>
                <div class="rowtext">
                    <div class="rowb">健康趋势</div>
                    <div class="rowc">健康趋势</div>
                    <div class="rowc">Health trends</div>
                </div>
                <div class="rowiocback">
@@ -96,7 +101,7 @@
                    />
                </div>
            </div>
            <div class="listrow">
            <div class="listrow" @click="Toast('此功能正在开发中,敬请期待')">
                <div class="rowioc">
                    <van-image
                        width="24px"
@@ -105,7 +110,7 @@
                    />
                </div>
                <div class="rowtext">
                    <div class="rowb">健康趋势</div>
                    <div class="rowc">健康宣教</div>
                    <div class="rowc">Health trends</div>
                </div>
                <div class="rowiocback">
@@ -117,66 +122,74 @@
        </div>
        <van-tabbar v-model="active" @change="tabChang">
            <van-tabbar-item name="home" icon="like">首页</van-tabbar-item>
            <van-tabbar-item name="xuanjiao" icon="smile-o">宣教</van-tabbar-item>
            <van-tabbar-item name="my" icon="manager">我的</van-tabbar-item>
        </van-tabbar>
        <van-popup v-model:show="showerwima">
            <div class="imgcla">
                <img
                    preview="1"
                    style=" width: 350px;height: 350px;"
                    referrerpolicy="no-referrer"
                    :src="patientInfo.patientInfo.patientQrcodeUrl"
                />
            </div>
        </van-popup>
    </div>
</template>
  <script lang="ts" setup>
    import { onMounted,computed,ref } from 'vue'
    import { ajaxGet } from '@/utils/axios'
    // import { useCounterStore } from '@/stores/counter'
    import { Image as VanImage,Tabbar as VanTabbar , TabbarItem as VanTabbarItem} from 'vant'
    import {useRoute,useRouter} from 'vue-router'
    import { onMounted,ref,computed,watch } from 'vue'
    import { userInfoStore } from '@/stores/userInfo'
    import { Image as VanImage,Tabbar as VanTabbar , TabbarItem as VanTabbarItem, Toast } from 'vant'
    import {useRouter} from 'vue-router'
    import meun1 from './assets/meun1.png'
    import meun2 from './assets/meun2.png'
    import meun3 from './assets/meun3.png'
    import meun4 from './assets/meun4.png'
    import List1 from './assets/row1.png'
    import Black from './assets/Black.png'
    const route = useRoute()
    const router=useRouter()
    // const counter = useCounterStore()
    const userInfo = userInfoStore()
    const active=ref('home')
    const showerwima=ref(false)
    const tabChang=(index:any)=>{
        if (index==='home'){
            router.push('/')
        } else {
        } else if (index==='xuanjiao') {
            router.push('xuanjiao')
        } else if (index==='my') {
            router.push('my')
        }
    }
    const topath=(url:string)=>{
        console.log('sss')
        router.push(url)
    }
    const isWechat = () => {
        return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === 'micromessenger'
    }
    onMounted(() => {
        if (isWechat()){
            console.log('初始化',route)
            const queryInfo=route.query
            const {code}=queryInfo
            console.log(code)
            if (code){
                ajaxGet('wechat/code',{code}).then((re:any)=>{
                    console.log(re)
                })
            }
            else {
                const appid = 'wx790bd67db6206070' // 微信APPid
                const local = window.location.href
                window.location.href =
                    'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
                    appid +
                    '&redirect_uri=' +
                    encodeURIComponent(local) +
                    '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
            }
        if (url==='/report222'){
            Toast('此功能暂未开通')
        } else {
            console.log('不是微信浏览器')
            router.push(url)
        }
    }
    const patientInfo=computed(() => {
        return userInfo.patient
    })
    const 最近体重血压=computed(() => {
        return userInfo.最近体重血压
    })
    // const Info=computed(() => {
    // return userInfo.info
    // })
    watch(
        ()=>patientInfo,
        ()=>{
            console.log('患者变化了')
        }
    )
    onMounted(() => {
        // if (userInfo.info.openid===''){
        //     router.push('login')
        // }
        console.log(userInfo.patient,'患者信息')
        console.log(userInfo.info,'微信账号信息')
    })
  </script>
  <style scoped lang="css" src="./assets/index.scss" />