Merge branch 'dev-wdb' of http://175.27.226.205:3000/huxuejian/ykt-wxapp into dev-wdb
This commit is contained in:
commit
21a59da3d2
@ -1,7 +1,7 @@
|
|||||||
MP_API_BASE_URL=https://patient.youcan365.com
|
MP_API_BASE_URL=https://patient.youcan365.com
|
||||||
MP_IMAGE_URL=https://patient.youcan365.com
|
MP_IMAGE_URL=https://patient.youcan365.com
|
||||||
MP_CACHE_PREFIX=development
|
MP_CACHE_PREFIX=development
|
||||||
MP_WX_APP_ID=wx6ee11733526b4f04
|
MP_WX_APP_ID=wx1d8337a40c11d66c
|
||||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||||
MP_TIM_SDK_APP_ID=1600123876
|
MP_TIM_SDK_APP_ID=1600123876
|
||||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||||
|
|||||||
2
.env.ip
2
.env.ip
@ -1,7 +1,7 @@
|
|||||||
MP_API_BASE_URL=http://192.168.60.2:8080
|
MP_API_BASE_URL=http://192.168.60.2:8080
|
||||||
MP_IMAGE_URL=https://patient.youcan365.com
|
MP_IMAGE_URL=https://patient.youcan365.com
|
||||||
MP_CACHE_PREFIX=development
|
MP_CACHE_PREFIX=development
|
||||||
MP_WX_APP_ID=wx6ee11733526b4f04
|
MP_WX_APP_ID=wx1d8337a40c11d66c
|
||||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||||
MP_TIM_SDK_APP_ID=1600123876
|
MP_TIM_SDK_APP_ID=1600123876
|
||||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
MP_API_BASE_URL=http://localhost:8080
|
MP_API_BASE_URL=http://localhost:8080
|
||||||
MP_IMAGE_URL=https://patient.youcan365.com
|
MP_IMAGE_URL=https://patient.youcan365.com
|
||||||
MP_CACHE_PREFIX=development
|
MP_CACHE_PREFIX=development
|
||||||
MP_WX_APP_ID=wx6ee11733526b4f04
|
MP_WX_APP_ID=wx1d8337a40c11d66c
|
||||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||||
MP_TIM_SDK_APP_ID=1600123876
|
MP_TIM_SDK_APP_ID=1600123876
|
||||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||||
|
|||||||
19
App.vue
19
App.vue
@ -5,18 +5,21 @@ import { globalTimChatManager } from "@/utils/tim-chat.js";
|
|||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
// 需在 pinia 安装后再获取 store,避免 getActivePinia 报错
|
// 需在 pinia 安装后再获取 store,避免 getActivePinia 报错
|
||||||
const { account, login, initIMAfterLogin } = useAccountStore();
|
const { account, login, initIMAfterLogin, getDoctorInfo } =
|
||||||
|
useAccountStore();
|
||||||
|
|
||||||
// 如果已有缓存的账户信息,尝试初始化 IM,否则重新登录
|
// 如果已有缓存的账户信息,尝试初始化 IM,否则重新登录
|
||||||
|
debugger;
|
||||||
if (account && account.openid) {
|
if (account && account.openid) {
|
||||||
console.log("App Launch: 已有登录信息,初始化 IM");
|
console.log("App Launch: 已有登录信息,初始化 IM");
|
||||||
initIMAfterLogin().catch(err => {
|
initIMAfterLogin().catch((err) => {
|
||||||
console.error('IM初始化失败:', err);
|
console.error("IM初始化失败:", err);
|
||||||
});
|
});
|
||||||
|
getDoctorInfo();
|
||||||
} else {
|
} else {
|
||||||
console.log("App Launch: 无登录信息,开始登录");
|
console.log("App Launch: 无登录信息,开始登录");
|
||||||
login().catch(err => {
|
login().catch((err) => {
|
||||||
console.error('自动登录失败:', err);
|
console.error("自动登录失败:", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -40,7 +43,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
$primary-color: #0877F1;
|
$primary-color: #0877f1;
|
||||||
|
|
||||||
page {
|
page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -82,7 +85,7 @@ uni-button[type="primary"]:not([disabled]):active {
|
|||||||
.relative {
|
.relative {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.absolute{
|
.absolute {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +162,7 @@ uni-button[type="primary"]:not([disabled]):active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bg-light-text-color::after {
|
.bg-light-text-color::after {
|
||||||
content: '';
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
@ -123,8 +123,24 @@ const pageParams = ref({
|
|||||||
groupId: "",
|
groupId: "",
|
||||||
patientId: "",
|
patientId: "",
|
||||||
corpId: "",
|
corpId: "",
|
||||||
|
teamId: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ensureTeamId = async () => {
|
||||||
|
if (pageParams.value.teamId) return pageParams.value.teamId;
|
||||||
|
if (!pageParams.value.groupId) return "";
|
||||||
|
try {
|
||||||
|
const res = await api("getGroupListByGroupId", { groupId: pageParams.value.groupId }, false);
|
||||||
|
const team = res?.data?.team || {};
|
||||||
|
const resolved = res?.data?.teamId || team.teamId || team._id || "";
|
||||||
|
if (resolved) pageParams.value.teamId = resolved;
|
||||||
|
return pageParams.value.teamId;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("ensureTeamId failed:", err);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const isSelectMode = ref(false);
|
const isSelectMode = ref(false);
|
||||||
const selectEventName = ref("");
|
const selectEventName = ref("");
|
||||||
|
|
||||||
@ -334,6 +350,7 @@ const sendArticle = async (article) => {
|
|||||||
try {
|
try {
|
||||||
const { doctorInfo } = useAccountStore();
|
const { doctorInfo } = useAccountStore();
|
||||||
|
|
||||||
|
await ensureTeamId();
|
||||||
// 使用统一的消息发送助手
|
// 使用统一的消息发送助手
|
||||||
const success = await sendArticleMessage(
|
const success = await sendArticleMessage(
|
||||||
{
|
{
|
||||||
@ -348,6 +365,7 @@ const sendArticle = async (article) => {
|
|||||||
userId: doctorInfo?.userid,
|
userId: doctorInfo?.userid,
|
||||||
customerId: pageParams.value.patientId,
|
customerId: pageParams.value.patientId,
|
||||||
corpId: corpId,
|
corpId: corpId,
|
||||||
|
teamId: pageParams.value.teamId,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -383,6 +401,10 @@ onLoad((options) => {
|
|||||||
if (options.corpId) {
|
if (options.corpId) {
|
||||||
pageParams.value.corpId = options.corpId;
|
pageParams.value.corpId = options.corpId;
|
||||||
}
|
}
|
||||||
|
if (options.teamId) {
|
||||||
|
pageParams.value.teamId = options.teamId;
|
||||||
|
}
|
||||||
|
ensureTeamId();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -76,6 +76,7 @@ const props = defineProps({
|
|||||||
formatTime: { type: Function, required: true },
|
formatTime: { type: Function, required: true },
|
||||||
groupId: { type: String, default: "" },
|
groupId: { type: String, default: "" },
|
||||||
userId: { type: String, default: "" },
|
userId: { type: String, default: "" },
|
||||||
|
teamId: { type: String, default: "" },
|
||||||
patientId: { type: String, default: "" },
|
patientId: { type: String, default: "" },
|
||||||
corpId: { type: String, default: "" },
|
corpId: { type: String, default: "" },
|
||||||
orderStatus: { type: String, default: "" },
|
orderStatus: { type: String, default: "" },
|
||||||
@ -381,14 +382,14 @@ const showFollowUpTasks = () => {
|
|||||||
// 跳转到宣教文章页面
|
// 跳转到宣教文章页面
|
||||||
const goToArticleList = () => {
|
const goToArticleList = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/message/article-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}`,
|
url: `/pages/message/article-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&teamId=${props.teamId}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 跳转到问卷列表页面
|
// 跳转到问卷列表页面
|
||||||
const goToSurveyList = () => {
|
const goToSurveyList = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/message/survey-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&customerName=${props.patientInfo.name}`,
|
url: `/pages/message/survey-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&teamId=${props.teamId}&customerName=${props.patientInfo.name}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -160,6 +160,7 @@
|
|||||||
: ''
|
: ''
|
||||||
"
|
"
|
||||||
:userId="openid"
|
:userId="openid"
|
||||||
|
:teamId="teamId"
|
||||||
:patientId="patientId"
|
:patientId="patientId"
|
||||||
:corpId="corpId"
|
:corpId="corpId"
|
||||||
:patientInfo="patientInfo"
|
:patientInfo="patientInfo"
|
||||||
@ -249,6 +250,7 @@ const patientInfo = ref({
|
|||||||
|
|
||||||
// 患者ID
|
// 患者ID
|
||||||
const patientId = ref("");
|
const patientId = ref("");
|
||||||
|
const teamId = ref("");
|
||||||
|
|
||||||
// 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件
|
// 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件
|
||||||
const showConsultAccept = computed(() => orderStatus.value === "pending");
|
const showConsultAccept = computed(() => orderStatus.value === "pending");
|
||||||
@ -314,6 +316,8 @@ const fetchGroupOrderStatus = async () => {
|
|||||||
const teamName = result.data.team?.name || "群聊";
|
const teamName = result.data.team?.name || "群聊";
|
||||||
updateNavigationTitle(teamName);
|
updateNavigationTitle(teamName);
|
||||||
|
|
||||||
|
teamId.value = result.data.teamId || result.data.team?.teamId || result.data.team?._id || "";
|
||||||
|
|
||||||
// 更新患者信息
|
// 更新患者信息
|
||||||
if (result.data.patient) {
|
if (result.data.patient) {
|
||||||
patientInfo.value = {
|
patientInfo.value = {
|
||||||
|
|||||||
@ -102,6 +102,23 @@ const timChatManager = globalTimChatManager;
|
|||||||
// 从上一页传递的客户信息
|
// 从上一页传递的客户信息
|
||||||
const customerId = ref("");
|
const customerId = ref("");
|
||||||
const customerName = ref("");
|
const customerName = ref("");
|
||||||
|
const teamId = ref("");
|
||||||
|
const groupId = ref("");
|
||||||
|
|
||||||
|
const ensureTeamId = async () => {
|
||||||
|
if (teamId.value) return teamId.value;
|
||||||
|
if (!groupId.value) return "";
|
||||||
|
try {
|
||||||
|
const res = await api("getGroupListByGroupId", { groupId: groupId.value }, false);
|
||||||
|
const team = res?.data?.team || {};
|
||||||
|
const resolved = res?.data?.teamId || team.teamId || team._id || "";
|
||||||
|
if (resolved) teamId.value = resolved;
|
||||||
|
return teamId.value;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("ensureTeamId failed:", err);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 搜索关键词
|
// 搜索关键词
|
||||||
const searchName = ref("");
|
const searchName = ref("");
|
||||||
@ -126,8 +143,11 @@ const selectEventName = ref("");
|
|||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
isSelectMode.value = String(options?.select || '') === '1';
|
isSelectMode.value = String(options?.select || '') === '1';
|
||||||
selectEventName.value = String(options?.eventName || '');
|
selectEventName.value = String(options?.eventName || '');
|
||||||
|
groupId.value = options?.groupId || "";
|
||||||
customerId.value = options?.patientId || "";
|
customerId.value = options?.patientId || "";
|
||||||
customerName.value = options?.customerName || "";
|
customerName.value = options?.customerName || "";
|
||||||
|
teamId.value = options?.teamId || "";
|
||||||
|
ensureTeamId();
|
||||||
getCategoryList();
|
getCategoryList();
|
||||||
loadSurveyList();
|
loadSurveyList();
|
||||||
});
|
});
|
||||||
@ -335,6 +355,7 @@ const sendSurvey = async (survey) => {
|
|||||||
const doctorInfo = accountStore.doctorInfo;
|
const doctorInfo = accountStore.doctorInfo;
|
||||||
userId.value = doctorInfo?.userid;
|
userId.value = doctorInfo?.userid;
|
||||||
|
|
||||||
|
await ensureTeamId();
|
||||||
// 使用统一的消息发送助手
|
// 使用统一的消息发送助手
|
||||||
const success = await sendSurveyMessage(
|
const success = await sendSurveyMessage(
|
||||||
{
|
{
|
||||||
@ -348,6 +369,7 @@ const sendSurvey = async (survey) => {
|
|||||||
customerId: customerId.value,
|
customerId: customerId.value,
|
||||||
customerName: customerName.value,
|
customerName: customerName.value,
|
||||||
corpId: corpId,
|
corpId: corpId,
|
||||||
|
teamId: teamId.value,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ export default defineStore("accountStore", () => {
|
|||||||
|
|
||||||
async function loginByCode(phoneCode = '') {
|
async function loginByCode(phoneCode = '') {
|
||||||
try {
|
try {
|
||||||
|
debugger
|
||||||
const { code } = await uni.login({
|
const { code } = await uni.login({
|
||||||
appid,
|
appid,
|
||||||
provider: "weixin",
|
provider: "weixin",
|
||||||
@ -82,13 +83,16 @@ export default defineStore("accountStore", () => {
|
|||||||
|
|
||||||
async function getDoctorInfo(data = {}) {
|
async function getDoctorInfo(data = {}) {
|
||||||
try {
|
try {
|
||||||
|
debugger
|
||||||
const res = await api('getCorpMemberData', {
|
const res = await api('getCorpMemberData', {
|
||||||
...data,
|
...data,
|
||||||
weChatOpenId: account.value.openid,
|
weChatOpenId: account.value.openid,
|
||||||
});
|
});
|
||||||
doctorInfo.value = res?.data || null;
|
doctorInfo.value = res?.data || null;
|
||||||
|
if (doctorInfo.value.accountState && doctorInfo.value.accountState == "disable") {
|
||||||
// 持久化医生信息
|
uni.redirectTo({ url: "/pages/login/login" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
cache.set(CACHE_KEYS.DOCTOR_INFO, res.data);
|
cache.set(CACHE_KEYS.DOCTOR_INFO, res.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,12 +109,16 @@ export async function sendArticleMessage(article, options = {}) {
|
|||||||
if (result?.success) {
|
if (result?.success) {
|
||||||
// 记录文章发送记录(异步,不阻塞)
|
// 记录文章发送记录(异步,不阻塞)
|
||||||
if (options.articleId && options.userId && options.customerId && options.corpId) {
|
if (options.articleId && options.userId && options.customerId && options.corpId) {
|
||||||
api('addArticleSendRecord', {
|
const params = {
|
||||||
articleId: options.articleId,
|
articleId: options.articleId,
|
||||||
userId: options.userId,
|
userId: options.userId,
|
||||||
customerId: options.customerId,
|
customerId: options.customerId,
|
||||||
corpId: options.corpId,
|
corpId: options.corpId,
|
||||||
}).catch((err) => {
|
};
|
||||||
|
if (options.teamId) {
|
||||||
|
params.teamId = options.teamId;
|
||||||
|
}
|
||||||
|
api('addArticleSendRecord', params).catch((err) => {
|
||||||
console.error('记录文章发送失败:', err);
|
console.error('记录文章发送失败:', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -151,15 +155,20 @@ export async function sendSurveyMessage(survey, options = {}) {
|
|||||||
// 生成发送ID
|
// 生成发送ID
|
||||||
const sendSurveyId = generateRandomString(10);
|
const sendSurveyId = generateRandomString(10);
|
||||||
|
|
||||||
// 创建问卷记录
|
const recordParams = {
|
||||||
const createRecordRes = await api('createSurveyRecord', {
|
|
||||||
corpId: options.corpId,
|
corpId: options.corpId,
|
||||||
userId: options.userId,
|
userId: options.userId,
|
||||||
surveryId: survey._id,
|
surveryId: survey._id,
|
||||||
memberId: options.customerId,
|
memberId: options.customerId,
|
||||||
customer: options.customerName,
|
customer: options.customerName,
|
||||||
sendSurveyId: sendSurveyId,
|
sendSurveyId: sendSurveyId,
|
||||||
});
|
};
|
||||||
|
if (options.teamId) {
|
||||||
|
recordParams.teamId = options.teamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建问卷记录
|
||||||
|
const createRecordRes = await api('createSurveyRecord', recordParams);
|
||||||
|
|
||||||
if (!createRecordRes?.success) {
|
if (!createRecordRes?.success) {
|
||||||
toast(createRecordRes?.message || '创建问卷记录失败');
|
toast(createRecordRes?.message || '创建问卷记录失败');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user