更新
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class='guide-box'>
|
||||
<!-- <button @click="setCallingBell">setCallingBell</button> -->
|
||||
<!-- <button @click="enableMuteMode">enableMuteMode</button> -->
|
||||
<view class="single-box" v-for="(item, index) in entryInfos" :key="index" :id="index" @click='handleEntry'>
|
||||
<image class="icon" mode="aspectFit" :src="item.icon" role="img"></image>
|
||||
<view class="single-content">
|
||||
<view class="label">{{ item.title }}</view>
|
||||
<view class="desc">{{ item.desc }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// import { TUICallKitAPI } from "../../TUICallKit/src/index";
|
||||
// import { ref } from "vue";
|
||||
const template = '1v1';
|
||||
const entryInfos = [
|
||||
{
|
||||
icon: 'https://web.sdk.qcloud.com/component/miniApp/resources/audio-card.png',
|
||||
title: '语音通话',
|
||||
desc: '丢包率70%仍可正常语音通话',
|
||||
navigateTo: '../calling/call?type=1',
|
||||
},
|
||||
{
|
||||
icon: 'https://web.sdk.qcloud.com/component/miniApp/resources/video-card.png',
|
||||
title: '视频通话',
|
||||
desc: '丢包率50%仍可正常视频通话',
|
||||
navigateTo: '../calling/call?type=2',
|
||||
},
|
||||
{
|
||||
icon: 'https://web.sdk.qcloud.com/component/miniApp/resources/audio-card.png',
|
||||
title: '多人语音通话',
|
||||
desc: '丢包率70%仍可正常语音通话',
|
||||
navigateTo: '../calling/groupCall?type=1',
|
||||
},
|
||||
{
|
||||
icon: 'https://web.sdk.qcloud.com/component/miniApp/resources/video-card.png',
|
||||
title: '多人视频通话',
|
||||
desc: '丢包率50%仍可正常视频通话',
|
||||
navigateTo: '../calling/groupCall?type=2',
|
||||
},
|
||||
];
|
||||
// --------铃声相关接口测试-----------------
|
||||
// let isMute = ref(false);
|
||||
// const enableMuteMode = async () => {
|
||||
// isMute.value = !isMute.value;
|
||||
// await TUICallKitAPI.enableMuteMode(isMute.value);
|
||||
// }
|
||||
// const setCallingBell = async () => {
|
||||
// await TUICallKitAPI.setCallingBell('mp2.mp3');
|
||||
// }
|
||||
const handleEntry = (e) => {
|
||||
const url = entryInfos[e.currentTarget.id].navigateTo;
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
/* background-image: url(https://mc.qcloudimg.com/static/img/7da57e0050d308e2e1b1e31afbc42929/bg.png); */
|
||||
background: #F4F5F9;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.container .title {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
letter-spacing: 0;
|
||||
text-align: center;
|
||||
line-height: 28px;
|
||||
font-weight: 600;
|
||||
background: #FFFFFF;
|
||||
margin-top: 3.8vh;
|
||||
padding: 1.2vh 0;
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.guide-box {
|
||||
width: 100vw;
|
||||
box-sizing: border-box;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.single-box {
|
||||
flex: 1;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
width: 180px;
|
||||
height: 144px;
|
||||
}
|
||||
|
||||
.single-content {
|
||||
padding: 36px 30px 36px 20px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
color: #333333;
|
||||
letter-spacing: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.desc {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
letter-spacing: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.logo-box {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
bottom: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 160rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
|
||||
<view class="counter-warp">
|
||||
<view class="header-content">
|
||||
<image :src="avatarUrl" class="icon-box" v-if="avatarUrl"/>
|
||||
<view class="text-header">用户登录</view>
|
||||
</view>
|
||||
<view class="box">
|
||||
<view class="list-item">
|
||||
<label class="list-item-label">用户ID</label>
|
||||
<input
|
||||
class="input-box"
|
||||
type="text"
|
||||
v-model="userID"
|
||||
placeholder="请输入用户ID"
|
||||
placeholder-style="color:#BBBBBB;"
|
||||
/>
|
||||
</view>
|
||||
<view class="login"
|
||||
><button class="loginBtn" @click="loginHandler">登录</button></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted,getCurrentInstance } from "vue";
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
const { proxy } = getCurrentInstance()
|
||||
import * as GenerateTestUserSig from "../../debug/GenerateTestUserSig-es.js";
|
||||
import { CallManager } from "../../TUICallKit/src/TUICallService/serve/callManager";
|
||||
let userID = ref("4");
|
||||
let avatarUrl = ref(""); // 声明为响应式变量
|
||||
uni.CallManager = new CallManager();
|
||||
|
||||
onMounted(() => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function (loginRes) {
|
||||
console.log('xx');
|
||||
console.log(loginRes.code);
|
||||
wxcode(loginRes.code)
|
||||
// 获取用户信息
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
withCredentials:true,
|
||||
success: function (infoRes) {
|
||||
avatarUrl.value = infoRes.userInfo.avatarUrl; // 使用 .value 赋值
|
||||
console.log('头像URL:', avatarUrl.value);
|
||||
console.log(infoRes.userInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log('---------进入onMounted')
|
||||
})
|
||||
const wxcode = async (code) => {
|
||||
|
||||
try {
|
||||
// 通过 proxy 调用全局的 apiUrl
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/login/mnpLogin',
|
||||
method: 'POST',
|
||||
data: {
|
||||
code: code
|
||||
},
|
||||
}, false) // 不显示加载中
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '请求失败', icon: 'none' })
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
}
|
||||
const loginHandler = async () => {
|
||||
// 从后端获取签名
|
||||
const signatureData = await getSignatureFromServer(patientId.value);
|
||||
|
||||
console.log('获取签名成功:', signatureData);
|
||||
|
||||
const {userId } = signatureData;
|
||||
|
||||
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
||||
userID: userId.value,
|
||||
});
|
||||
console.warn('--- ', SDKAppID);
|
||||
|
||||
getApp().globalData.userID = userId.value;
|
||||
getApp().globalData.userSig = userSig;
|
||||
getApp().globalData.SDKAppID = SDKAppID;
|
||||
|
||||
await uni.CallManager.init({
|
||||
sdkAppID: SDKAppID, // 替换为用户自己的 sdkAppID
|
||||
userID: userId.value, // 替换为用户自己的 userID
|
||||
userSig: userSig, // 替换为用户自己的 userSig
|
||||
globalCallPagePath: "TUICallKit/src/Components/TUICallKit", // 替换为步骤一里注册的全局监听页面
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: "./index",
|
||||
});
|
||||
};
|
||||
// 从后端获取签名
|
||||
const getSignatureFromServer = async (patientId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: 'https://api.zzzhengyangtang.cn/api/tcm/getPatientSignature', // 后端接口地址 // 替换为你的后端地址
|
||||
method: 'GET',
|
||||
data: {
|
||||
patient_id: patientId
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 1) {
|
||||
resolve(res.data.data);
|
||||
} else {
|
||||
reject(new Error(res.data.msg || '获取签名失败'));
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #f4f5f9;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.counter-warp {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.background-image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
padding: 50px 20px 10px;
|
||||
box-sizing: border-box;
|
||||
top: 100rpx;
|
||||
background-color: #000;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.icon-box {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.text-header {
|
||||
height: 72rpx;
|
||||
font-size: 48rpx;
|
||||
line-height: 72rpx;
|
||||
color: #ffffff;
|
||||
margin: 40px auto;
|
||||
}
|
||||
|
||||
.text-content {
|
||||
height: 36rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.box {
|
||||
width: 80%;
|
||||
height: 50vh;
|
||||
position: relative;
|
||||
background: #ffffff;
|
||||
border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: left;
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 14px;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.login {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
margin-top: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login button {
|
||||
background: rgba(0, 110, 255, 1);
|
||||
border-radius: 30px;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
letter-spacing: 0;
|
||||
/* text-align: center; */
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.loginBtn {
|
||||
margin-top: 64px;
|
||||
background-color: white;
|
||||
border-radius: 24px;
|
||||
border-radius: 24px;
|
||||
/* display: flex;
|
||||
justify-content: center; */
|
||||
width: 100% !important;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-family: PingFangSC-Medium;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
border-bottom: 1px solid #eef0f3;
|
||||
}
|
||||
|
||||
.input-container {
|
||||
width: 90%;
|
||||
margin: 50px auto 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-family: PingFangSC-Medium;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
border-bottom: 1px solid #eef0f3;
|
||||
}
|
||||
|
||||
/* .input-box {
|
||||
height: 20px;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
border: 1px solid #999999;;
|
||||
} */
|
||||
.list-item .list-item-label {
|
||||
font-weight: 500;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.guide-box {
|
||||
width: 100vw;
|
||||
box-sizing: border-box;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.single-box {
|
||||
flex: 1;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
width: 180px;
|
||||
height: 144px;
|
||||
}
|
||||
|
||||
.single-content {
|
||||
padding: 36px 30px 36px 20px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
color: #333333;
|
||||
letter-spacing: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.desc {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
letter-spacing: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.logo-box {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
bottom: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,639 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="form-wrapper">
|
||||
<!-- 基本信息 -->
|
||||
<view class="section">
|
||||
<view class="section-title">基本信息</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">患者姓名</text>
|
||||
<text class="value">{{ formData.patient_name || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">身份证号</text>
|
||||
<text class="value">{{ formData.id_card || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">手机号</text>
|
||||
<text class="value">{{ formData.phone || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">性别</text>
|
||||
<text class="value">{{ formData.gender === 1 ? '男' : '女' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">年龄</text>
|
||||
<text class="value">{{ formData.age || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">诊断日期</text>
|
||||
<text class="value">{{ formData.diagnosis_date || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">诊断类型</text>
|
||||
<text class="value">{{ getDiagnosisTypeName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">证型</text>
|
||||
<text class="value">{{ getSyndromeTypeName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">糖尿病期数</text>
|
||||
<text class="value">{{ getDiabetesTypeName() || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 现病史 -->
|
||||
<view class="section">
|
||||
<view class="section-title">现病史</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">口腔感觉</text>
|
||||
<text class="value">{{ getAppetiteName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">每日饮水量</text>
|
||||
<text class="value">{{ getWaterIntakeName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">体重变化</text>
|
||||
<text class="value">{{ getWeightChangeName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">脂肪肝程度</text>
|
||||
<text class="value">{{ getFattyLiverDegreeName() || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">饮食情况</text>
|
||||
<view class="tag-list">
|
||||
<text v-for="item in getDietConditionNames()" :key="item" class="tag">{{ item }}</text>
|
||||
<text v-if="getDietConditionNames().length === 0" class="value">-</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">肢体感觉</text>
|
||||
<view class="tag-list">
|
||||
<text v-for="item in getBodyFeelingNames()" :key="item" class="tag">{{ item }}</text>
|
||||
<text v-if="getBodyFeelingNames().length === 0" class="value">-</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">睡眠情况</text>
|
||||
<view class="tag-list">
|
||||
<text v-for="item in getSleepConditionNames()" :key="item" class="tag">{{ item }}</text>
|
||||
<text v-if="getSleepConditionNames().length === 0" class="value">-</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 既往史 -->
|
||||
<view class="section">
|
||||
<view class="section-title">既往史</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">既往史</text>
|
||||
<view class="tag-list">
|
||||
<text v-for="item in getPastHistoryNames()" :key="item" class="tag">{{ item }}</text>
|
||||
<text v-if="getPastHistoryNames().length === 0" class="value">-</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 其他病史 -->
|
||||
<view class="section">
|
||||
<view class="section-title">其他病史</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">外伤史</text>
|
||||
<text class="value">{{ formData.trauma_history === 1 ? '有' : '无' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">手术史</text>
|
||||
<text class="value">{{ formData.surgery_history === 1 ? '有' : '无' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">过敏史</text>
|
||||
<text class="value">{{ formData.allergy_history === 1 ? '有' : '无' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 诊断信息 -->
|
||||
<view class="section">
|
||||
<view class="section-title">诊断信息</view>
|
||||
|
||||
<view class="info-item" v-if="formData.tongue_images && formData.tongue_images.length > 0">
|
||||
<text class="label">舌苔照片</text>
|
||||
<view class="image-list">
|
||||
<image
|
||||
v-for="(img, index) in formData.tongue_images"
|
||||
:key="index"
|
||||
:src="img"
|
||||
class="tongue-image"
|
||||
mode="aspectFill"
|
||||
@click="previewImage(img)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">症状</text>
|
||||
<text class="value multi-line">{{ formData.symptoms || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">舌苔</text>
|
||||
<text class="value">{{ formData.tongue_coating || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">脉象</text>
|
||||
<text class="value">{{ formData.pulse || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">治则</text>
|
||||
<text class="value multi-line">{{ formData.treatment_principle || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">处方</text>
|
||||
<text class="value multi-line">{{ formData.prescription || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">医嘱</text>
|
||||
<text class="value multi-line">{{ formData.doctor_advice || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 底部浮动按钮 -->
|
||||
<view class="fixed-bottom">
|
||||
<button class="confirm-btn" @click="handleConfirm">确认诊单</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted,getCurrentInstance } from "vue";
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
const { proxy } = getCurrentInstance()
|
||||
const formData = ref({
|
||||
patient_name: '',
|
||||
id_card: '',
|
||||
phone: '',
|
||||
gender: 1,
|
||||
age: '',
|
||||
diagnosis_date: '',
|
||||
diagnosis_type: '',
|
||||
syndrome_type: '',
|
||||
diabetes_type: '',
|
||||
appetite: '',
|
||||
water_intake: '',
|
||||
diet_condition: [],
|
||||
weight_change: '',
|
||||
body_feeling: [],
|
||||
sleep_condition: [],
|
||||
fatty_liver_degree: '',
|
||||
past_history: [],
|
||||
trauma_history: 0,
|
||||
surgery_history: 0,
|
||||
allergy_history: 0,
|
||||
tongue_images: [],
|
||||
symptoms: '',
|
||||
tongue_coating: '',
|
||||
pulse: '',
|
||||
treatment_principle: '',
|
||||
prescription: '',
|
||||
doctor_advice: ''
|
||||
});
|
||||
|
||||
// 字典选项
|
||||
const diagnosisTypeOptions = ref([]);
|
||||
const syndromeTypeOptions = ref([]);
|
||||
const diabetesTypeOptions = ref([]);
|
||||
const pastHistoryOptions = ref([]);
|
||||
const appetiteOptions = ref([]);
|
||||
const waterIntakeOptions = ref([]);
|
||||
const dietConditionOptions = ref([]);
|
||||
const weightChangeOptions = ref([]);
|
||||
const bodyFeelingOptions = ref([]);
|
||||
const sleepConditionOptions = ref([]);
|
||||
const fattyLiverDegreeOptions = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
getDictOptions();
|
||||
loadDiagnosisDetail();
|
||||
});
|
||||
|
||||
// 获取字典数据
|
||||
const getDictOptions = async () => {
|
||||
try {
|
||||
const [
|
||||
diagnosisType,
|
||||
syndromeType,
|
||||
diabetesType,
|
||||
pastHistory,
|
||||
appetite,
|
||||
waterIntake,
|
||||
dietCondition,
|
||||
weightChange,
|
||||
bodyFeeling,
|
||||
sleepCondition,
|
||||
fattyLiverDegree
|
||||
] = await Promise.all([
|
||||
getDictData('diagnosis_type'),
|
||||
getDictData('syndrome_type'),
|
||||
getDictData('diabetes_type'),
|
||||
getDictData('past_history'),
|
||||
getDictData('appetite'),
|
||||
getDictData('water_intake'),
|
||||
getDictData('diet_condition'),
|
||||
getDictData('weight_change'),
|
||||
getDictData('body_feeling'),
|
||||
getDictData('sleep_condition'),
|
||||
getDictData('fatty_liver_degree')
|
||||
]);
|
||||
|
||||
diagnosisTypeOptions.value = diagnosisType?.diagnosis_type || [];
|
||||
syndromeTypeOptions.value = syndromeType?.syndrome_type || [];
|
||||
diabetesTypeOptions.value = diabetesType?.diabetes_type || [];
|
||||
pastHistoryOptions.value = pastHistory?.past_history || [];
|
||||
appetiteOptions.value = appetite?.appetite || [];
|
||||
waterIntakeOptions.value = waterIntake?.water_intake || [];
|
||||
dietConditionOptions.value = dietCondition?.diet_condition || [];
|
||||
weightChangeOptions.value = weightChange?.weight_change || [];
|
||||
bodyFeelingOptions.value = bodyFeeling?.body_feeling || [];
|
||||
sleepConditionOptions.value = sleepCondition?.sleep_condition || [];
|
||||
fattyLiverDegreeOptions.value = fattyLiverDegree?.fatty_liver_degree || [];
|
||||
} catch (error) {
|
||||
console.error('获取字典数据失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 获取单个字典数据
|
||||
const getDictData = async (type) => {
|
||||
try {
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/getDict',
|
||||
method: 'GET',
|
||||
data: { type }
|
||||
}, false);
|
||||
|
||||
if (res.code === 1) {
|
||||
return res.data;
|
||||
}
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error(`获取字典${type}失败:`, error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// 加载诊单详情
|
||||
const loadDiagnosisDetail = async () => {
|
||||
// 从页面参数获取诊单ID
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 假设你的对象是 ai
|
||||
const scene = currentPage.options.scene;
|
||||
|
||||
// 1. 先对 scene 进行 URL 解码
|
||||
const decodedScene = decodeURIComponent(scene) ||currentPage.options;
|
||||
// 得到 "id=4&share_user=1"
|
||||
|
||||
// 2. 解析成键值对对象
|
||||
const params = {};
|
||||
decodedScene.split('&').forEach(item => {
|
||||
const [key, value] = item.split('=');
|
||||
params[key] = value;
|
||||
});
|
||||
|
||||
const diagnosisId = currentPage.options.id ||params.id|| 4;
|
||||
console.log('nihhhhhh',pages,params,diagnosisId)
|
||||
if (!diagnosisId) {
|
||||
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '加载中...' });
|
||||
|
||||
try {
|
||||
// 通过 proxy 调用全局的 apiUrl
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/diagnosisDetail',
|
||||
method: 'GET',
|
||||
data: {
|
||||
id: diagnosisId
|
||||
},
|
||||
}, false); // 不显示加载中
|
||||
|
||||
if (res.code === 1) {
|
||||
formData.value = res.data;
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '加载失败', icon: 'none' });
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '请求失败', icon: 'none' });
|
||||
console.error(err);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
// 获取选中项名称
|
||||
const getDiagnosisTypeName = () => {
|
||||
const item = diagnosisTypeOptions.value.find(i => i.value === formData.value.diagnosis_type);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getSyndromeTypeName = () => {
|
||||
const item = syndromeTypeOptions.value.find(i => i.value === formData.value.syndrome_type);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getDiabetesTypeName = () => {
|
||||
const item = diabetesTypeOptions.value.find(i => i.value === formData.value.diabetes_type);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getAppetiteName = () => {
|
||||
const item = appetiteOptions.value.find(i => i.value === formData.value.appetite);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getWaterIntakeName = () => {
|
||||
const item = waterIntakeOptions.value.find(i => i.value === formData.value.water_intake);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getWeightChangeName = () => {
|
||||
const item = weightChangeOptions.value.find(i => i.value === formData.value.weight_change);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getFattyLiverDegreeName = () => {
|
||||
const item = fattyLiverDegreeOptions.value.find(i => i.value === formData.value.fatty_liver_degree);
|
||||
return item ? item.name : '';
|
||||
};
|
||||
|
||||
const getDietConditionNames = () => {
|
||||
if (!formData.value.diet_condition || formData.value.diet_condition.length === 0) return [];
|
||||
// 处理字符串类型(逗号分隔)或数组类型
|
||||
const values = Array.isArray(formData.value.diet_condition)
|
||||
? formData.value.diet_condition
|
||||
: formData.value.diet_condition.split(',');
|
||||
|
||||
return values.map(val => {
|
||||
const item = dietConditionOptions.value.find(i => i.value === val);
|
||||
return item ? item.name : val;
|
||||
}).filter(Boolean);
|
||||
};
|
||||
|
||||
const getBodyFeelingNames = () => {
|
||||
if (!formData.value.body_feeling || formData.value.body_feeling.length === 0) return [];
|
||||
// 处理字符串类型(逗号分隔)或数组类型
|
||||
const values = Array.isArray(formData.value.body_feeling)
|
||||
? formData.value.body_feeling
|
||||
: formData.value.body_feeling.split(',');
|
||||
|
||||
return values.map(val => {
|
||||
const item = bodyFeelingOptions.value.find(i => i.value === val);
|
||||
return item ? item.name : val;
|
||||
}).filter(Boolean);
|
||||
};
|
||||
|
||||
const getSleepConditionNames = () => {
|
||||
if (!formData.value.sleep_condition || formData.value.sleep_condition.length === 0) return [];
|
||||
// 处理字符串类型(逗号分隔)或数组类型
|
||||
const values = Array.isArray(formData.value.sleep_condition)
|
||||
? formData.value.sleep_condition
|
||||
: formData.value.sleep_condition.split(',');
|
||||
|
||||
return values.map(val => {
|
||||
const item = sleepConditionOptions.value.find(i => i.value === val);
|
||||
return item ? item.name : val;
|
||||
}).filter(Boolean);
|
||||
};
|
||||
|
||||
const getPastHistoryNames = () => {
|
||||
if (!formData.value.past_history || formData.value.past_history.length === 0) return [];
|
||||
// 处理字符串类型(逗号分隔)或数组类型
|
||||
const values = Array.isArray(formData.value.past_history)
|
||||
? formData.value.past_history
|
||||
: formData.value.past_history.split(',');
|
||||
|
||||
return values.map(val => {
|
||||
const item = pastHistoryOptions.value.find(i => i.value === val);
|
||||
return item ? item.name : val;
|
||||
}).filter(Boolean);
|
||||
};
|
||||
|
||||
// 预览图片
|
||||
const previewImage = (current) => {
|
||||
uni.previewImage({
|
||||
current,
|
||||
urls: formData.value.tongue_images
|
||||
});
|
||||
};
|
||||
|
||||
// 确认诊单
|
||||
const handleConfirm = () => {
|
||||
uni.showModal({
|
||||
title: '确认诊单',
|
||||
content: '确认后将无法修改,是否确认?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
confirmDiagnosis();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 提交确认诊单
|
||||
const confirmDiagnosis = async () => {
|
||||
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 假设你的对象是 ai
|
||||
const scene = currentPage.options.scene;
|
||||
|
||||
// 1. 先对 scene 进行 URL 解码
|
||||
const decodedScene = decodeURIComponent(scene);
|
||||
// 得到 "id=4&share_user=1"
|
||||
|
||||
// 2. 解析成键值对对象
|
||||
const params = {};
|
||||
decodedScene.split('&').forEach(item => {
|
||||
const [key, value] = item.split('=');
|
||||
params[key] = value;
|
||||
});
|
||||
|
||||
const diagnosisId = currentPage.options.id ||params.id|| 4;
|
||||
console.log('nihhhhhh',pages,params,diagnosisId)
|
||||
if (!params.id) {
|
||||
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uni.showLoading({ title: '提交中...' });
|
||||
|
||||
try {
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/confirmDiagnosis',
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: params.id,
|
||||
share_user: params.share_user
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (res.code === 1) {
|
||||
uni.showToast({
|
||||
title: '确认成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '确认失败', icon: 'none' });
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({ title: '请求失败', icon: 'none' });
|
||||
console.error(err);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
padding: 20rpx;
|
||||
padding-bottom: 140rpx; /* 为底部按钮留出空间 */
|
||||
}
|
||||
|
||||
.section {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 30rpx;
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
margin-bottom: 24rpx;
|
||||
line-height: 1.6;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.label {
|
||||
flex-shrink: 0;
|
||||
width: 180rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
|
||||
&.multi-line {
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.8;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: 8rpx 20rpx;
|
||||
background-color: #f0f5ff;
|
||||
color: #1890ff;
|
||||
font-size: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.image-list {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.tongue-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.fixed-bottom {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx 30rpx;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
background: linear-gradient(to top, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 80%, rgba(255, 255, 255, 0) 100%);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
border: none;
|
||||
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user