Compare commits

...

5 Commits

7 changed files with 72 additions and 62 deletions

View File

@ -2,4 +2,3 @@ MP_API_BASE_URL=https://patient.youcan365.com
MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx6ee11733526b4f04
MP_TIM_SDK_APP_ID=1600123876
MP_CORP_ID=wwe3fb2faa52cf9dfb

View File

@ -2,4 +2,3 @@ MP_API_BASE_URL=http://localhost:8080
MP_CACHE_PREFIX=development
MP_WX_APP_ID=wx6ee11733526b4f04
MP_TIM_SDK_APP_ID=1600123876
MP_CORP_ID=wwe3fb2faa52cf9dfb

4
.env.production Normal file
View File

@ -0,0 +1,4 @@
MP_API_BASE_URL=https://ykt.youcan365.com
MP_CACHE_PREFIX=production
MP_WX_APP_ID=production
MP_TIM_SDK_APP_ID=1600123876

View File

@ -1,20 +1,20 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>

View File

@ -1,34 +1,40 @@
{
"name": "医客通患者端",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"prebuild": "node scripts/pre-build.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"dayjs": "^1.11.10",
"tim-upload-plugin": "^1.4.2",
"tim-wx-sdk": "^2.27.6"
},
"uni-app": {
"scripts": {
"dev": {
"title": "测试",
"env": {
"UNI_PLATFORM": "mp-weixin"
}
},
"localhost": {
"title": "本地",
"env": {
"UNI_PLATFORM": "mp-weixin"
}
}
}
},
"devDependencies": {}
"name": "医客通患者端",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"prebuild": "node scripts/pre-build.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"dayjs": "^1.11.10",
"tim-upload-plugin": "^1.4.2",
"tim-wx-sdk": "^2.27.6"
},
"uni-app": {
"scripts": {
"dev": {
"title": "测试",
"env": {
"UNI_PLATFORM": "mp-weixin"
}
},
"localhost": {
"title": "本地",
"env": {
"UNI_PLATFORM": "mp-weixin"
}
},
"pro": {
"title": "线上",
"env": {
"UNI_PLATFORM": "mp-weixin"
}
}
}
},
"devDependencies": {}
}

View File

@ -30,8 +30,6 @@ import api from "@/utils/api.js";
import { ref } from "vue";
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
const env = __VITE_ENV__;
const corpId = env.MP_CORP_ID;
const { account } = storeToRefs(useAccountStore());
const loading = ref(true);
const error = ref("");
@ -47,7 +45,11 @@ const markArticleRead = async () => {
const unionid = account.value?.unionid;
if (!unionid || !articleId) return;
try {
await api("addArticleReadRecord", { corpId, articleId, unionid }, false);
await api(
"addArticleReadRecord",
{ corpId: account.value?.corpId, articleId, unionid },
false
);
} catch (err) {
console.warn("markArticleRead failed:", err?.message || err);
}

View File

@ -7,7 +7,6 @@ const env = __VITE_ENV__;
export default defineStore("accountStore", () => {
const appid = env.MP_WX_APP_ID;
const corpId = env.MP_CORP_ID;
const account = ref(null);
const loading = ref(false)
const isIMInitialized = ref(false);
@ -27,8 +26,7 @@ export default defineStore("accountStore", () => {
const res = await api('wxAppLogin', {
appId: appid,
phoneCode,
code,
corpId
code
});
loading.value = false
if (res.success && res.data && res.data.mobile) {
@ -111,6 +109,8 @@ export default defineStore("accountStore", () => {
const corpId = account.value?.corpId;
const unionid = account.value?.unionid;
const openid = account.value?.openid;
console.clear()
console.log('corpId', corpId, ',unionid', unionid, ',openid', openid)
if (!(corpId && unionid && openid) || externalUserId.value) return;
const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId }, false);
if (res && res.success && typeof res.data === 'string' && res.data.trim()) {