fix: bug修复
This commit is contained in:
parent
87e9cde197
commit
42a187459e
@ -35,7 +35,8 @@
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "柚健康"
|
||||
"navigationBarTitleText": "柚健康",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -55,7 +55,12 @@ const customerArchive = ref(null);
|
||||
const verifyVisible = ref(false);
|
||||
const visible = ref(false);
|
||||
|
||||
const formData = computed(() => ({ ...customer.value, ...form.value }));
|
||||
const formData = computed(() => {
|
||||
if (customerId.value) {
|
||||
return { ...customer.value, ...form.value }
|
||||
}
|
||||
return { ...customer.value, ...form.value, mobile: account.value?.mobile }
|
||||
});
|
||||
|
||||
function change({ title, value }) {
|
||||
if (title) {
|
||||
@ -72,6 +77,7 @@ function change({ title, value }) {
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
console.log(formData.value)
|
||||
if (!tempRef.value.verify()) return;
|
||||
if (customerId.value) {
|
||||
updateArchive();
|
||||
|
||||
@ -57,7 +57,7 @@ async function changeTeam({ teamId, corpId, corpName }) {
|
||||
|
||||
async function getTeams() {
|
||||
loading.value = true;
|
||||
const res = await api('queryWxJoinedTeams', { openid: account.value.openid });
|
||||
const res = await api('getWxappRelateTeams', { openid: account.value.openid });
|
||||
teams.value = res && Array.isArray(res.data) ? res.data : [];
|
||||
const validTeam = teams.value.find(item => team.value && item.teamId === team.value.teamId) || teams.value[0];
|
||||
if (validTeam) {
|
||||
|
||||
@ -1,38 +1,54 @@
|
||||
<template>
|
||||
<view v-if="team" class="pt-lg px-15 flex flex-col items-center text-center">
|
||||
<group-avatar :avatarList="team.avatars" />
|
||||
<view class="mt-15 text-base font-semibold text-dark">
|
||||
{{ team.teamName }}
|
||||
<view class="login-bg">
|
||||
<image class="bg-image" src="/static/background.png" mode="aspectFill" />
|
||||
<!-- 医生卡片及头像 -->
|
||||
<view class="doctor-card-wrap">
|
||||
<view v-if="team" class="doctor-card">
|
||||
<view class="doctor-info">
|
||||
<view class="doctor-name">{{ team.teamName }}</view>
|
||||
<view class="doctor-hospital">{{ team.corpName }}</view>
|
||||
<view class="login-tip">为您提供团队个性化专属服务</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="doctor-card doctor-card-empty">
|
||||
<view class="doctor-info">
|
||||
<image class="logo" src="/static/logo-plain.png" mode="aspectFill" />
|
||||
<view class="doctor-name">柚健康</view>
|
||||
<view class="login-tip">生命全周期健康管理伙伴</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="team" class="doctor-avatar">
|
||||
<group-avatar :avatarList="team.avatars" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 登录按钮 -->
|
||||
<view class="login-btn-wrap">
|
||||
<button v-if="checked && account" class="login-btn" type="primary" @click="getPhoneNumber">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
<button v-else-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
<button v-else class="login-btn" type="primary" @click="remind()">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
</view>
|
||||
<!-- 协议 -->
|
||||
<view class="agreement">
|
||||
<checkbox :checked="checked" @click="checked = !checked" />
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="link" @click="openUserAgreement">《用户协议》</text>
|
||||
<text>、</text>
|
||||
<text class="link" @click="openPrivacyPolicy">《隐私政策》</text>
|
||||
</view>
|
||||
<view class="mt-12 text-sm text-gray">{{ team.corpName }}</view>
|
||||
<view class="mt-15 text-lg text-dark font-semibold">为您提供团队个性化专属服务</view>
|
||||
</view>
|
||||
<view v-else class="pt-lg px-15 flex flex-col items-center text-center">
|
||||
<image src="/static/logo-plain.png" class="logo"></image>
|
||||
<view class="mt-15 text-xl font-semibold text-dark">柚健康</view>
|
||||
<view class="mt-12 text-base text-dark">生命全周期健康管理伙伴</view>
|
||||
</view>
|
||||
<view class="login-btn-wrap">
|
||||
<button v-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
<!-- <button v-if="checked" class="login-btn" type="primary" @click="getPhoneNumber()">
|
||||
手机号快捷登录
|
||||
</button> -->
|
||||
<button v-else class="login-btn" type="primary" @click="remind()">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
</view>
|
||||
<view class="flex items-center justify-center mt-12 px-15" @click="checked = !checked">
|
||||
<checkbox :checked="checked" style="transform: scale(0.7)" />
|
||||
<view class="text-sm text-gray">我已阅读并同意</view>
|
||||
<view class="text-sm text-primary">《用户协议》、</view>
|
||||
<view class="text-sm text-primary">《隐私政策》</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import useAccountStore from "@/store/account";
|
||||
import api from '@/utils/api';
|
||||
@ -41,10 +57,12 @@ import { toast } from "@/utils/widget";
|
||||
|
||||
import groupAvatar from "@/components/group-avatar.vue";
|
||||
|
||||
|
||||
const env = __VITE_ENV__;
|
||||
const appid = env.MP_WX_APP_ID;
|
||||
const team = ref(null);
|
||||
const checked = ref(false);
|
||||
const redirectUrl = ref("");
|
||||
const { account } = storeToRefs(useAccountStore());
|
||||
const { login } = useAccountStore();
|
||||
|
||||
function attempRedirect(url) {
|
||||
@ -77,9 +95,13 @@ function toHome() {
|
||||
});
|
||||
}
|
||||
|
||||
async function checkTeamArchive(account) {
|
||||
const res = await api('getWxAppCustomerCount', { miniAppId: account.openid, corpId: account.corpId, teamId: '1nYlVrNXGT173674701967643308' || team.value.teamId });
|
||||
if (res && res.data > 0) {
|
||||
async function bindTeam() {
|
||||
const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid });
|
||||
if (!res || !res.success) {
|
||||
return toast("关联团队失败");
|
||||
}
|
||||
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: account.value.corpId, teamId: team.value.teamId });
|
||||
if (res1 && res1.data > 0) {
|
||||
toHome();
|
||||
} else {
|
||||
attempToPage(redirectUrl.value)
|
||||
@ -88,11 +110,13 @@ async function checkTeamArchive(account) {
|
||||
|
||||
async function getPhoneNumber(e) {
|
||||
const phoneCode = e && e.detail && e.detail.code;
|
||||
// if (e && !phoneCode) return;
|
||||
const res = await login(phoneCode);
|
||||
if (res && team.value) {
|
||||
checkTeamArchive(res)
|
||||
} else if (res && redirectUrl.value) {
|
||||
if (!account.value) {
|
||||
const res = await login(phoneCode);
|
||||
if (!res) return;
|
||||
}
|
||||
if (team.value) {
|
||||
bindTeam(account.value)
|
||||
} else if (redirectUrl.value) {
|
||||
await attempToPage(redirectUrl.value);
|
||||
} else if (res) {
|
||||
toHome();
|
||||
@ -121,11 +145,6 @@ onLoad((opts) => {
|
||||
padding-top: 20vh;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.login-btn-wrap {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
@ -154,4 +173,161 @@ onLoad((opts) => {
|
||||
.login-btn:active {
|
||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
||||
}
|
||||
|
||||
.login-bg {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.bg-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 500rpx;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.login-gradient {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 340rpx;
|
||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.doctor-card-wrap {
|
||||
width: calc(100vw - 48rpx);
|
||||
max-width: 600rpx;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
margin-top: 320rpx;
|
||||
}
|
||||
|
||||
.doctor-card {
|
||||
height: 398rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
background: linear-gradient(180deg, #dbe8ff 0%, #fff 50.25%);
|
||||
box-shadow: 0 8rpx 32rpx rgba(59, 124, 255, 0.08);
|
||||
padding: 100rpx 24rpx 0rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.doctor-avatar {
|
||||
border-radius: 16rpx;
|
||||
background: #f2f2f2;
|
||||
box-shadow: 0 2rpx 8rpx rgba(59, 124, 255, 0.08);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 6rpx solid #fff;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.doctor-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.doctor-name {
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
color: #1d2129;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.doctor-hospital {
|
||||
font-size: 28rpx;
|
||||
color: #78808f;
|
||||
font-weight: 400;
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.doctor-dept {
|
||||
display: inline-block;
|
||||
color: #213e80;
|
||||
border-radius: 4rpx;
|
||||
border: 1rpx solid #1a3e8433;
|
||||
padding: 0 8rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.login-btn-wrap {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 136rpx;
|
||||
}
|
||||
|
||||
.login-btn-wrap-loading {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: calc(100vw - 112rpx);
|
||||
max-width: 600rpx;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border-radius: 48rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4rpx 16rpx rgba(59, 124, 255, 0.08);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.login-btn:active {
|
||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
||||
}
|
||||
|
||||
.agreement {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #b2b7c2;
|
||||
font-size: 22rpx;
|
||||
margin-top: 40rpx;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: #3b7cff;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.agreement checkbox {
|
||||
transform: scale(0.7);
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -5,13 +5,18 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import api from "@/utils/api";
|
||||
import { set } from "@/utils/cache";
|
||||
import { toast } from "@/utils/widget";
|
||||
import useAccountStore from "@/store/account";
|
||||
|
||||
const env = __VITE_ENV__;
|
||||
const appid = env.MP_WX_APP_ID;
|
||||
const { account } = storeToRefs(useAccountStore());
|
||||
|
||||
|
||||
const teamId = ref("");
|
||||
const corpId = ref("");
|
||||
const loading = ref(false);
|
||||
const team = ref(null);
|
||||
|
||||
@ -22,24 +27,45 @@ async function changeTeam({ teamId, corpId }) {
|
||||
if (res && res.data) {
|
||||
team.value = res.data;
|
||||
team.value.corpName = res.data.corpName;
|
||||
set("invite-team-info", {
|
||||
corpId: team.value.corpId,
|
||||
teamId: team.value.teamId,
|
||||
corpName: team.value.corpName,
|
||||
teamName: team.value.name,
|
||||
avatars:
|
||||
team.value && Array.isArray(team.value.memberList)
|
||||
? team.value.memberList.map((item) => item.avatar || "")
|
||||
: [],
|
||||
});
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?source=teamInvite",
|
||||
});
|
||||
if (account.value) {
|
||||
bindTeam()
|
||||
} else {
|
||||
set("invite-team-info", {
|
||||
corpId: team.value.corpId,
|
||||
teamId: team.value.teamId,
|
||||
corpName: team.value.corpName,
|
||||
teamName: team.value.name,
|
||||
avatars:
|
||||
team.value && Array.isArray(team.value.memberList)
|
||||
? team.value.memberList.map((item) => item.avatar || "")
|
||||
: [],
|
||||
});
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?source=teamInvite",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toast(res?.message || "获取团队信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
async function bindTeam() {
|
||||
const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid });
|
||||
if (!res || !res.success) {
|
||||
return toast("关联团队失败");
|
||||
}
|
||||
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: account.value.corpId, teamId: team.value.teamId });
|
||||
if (res1 && res1.data > 0) {
|
||||
uni.switchTab({
|
||||
url: "/pages/home/home",
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: `/pages/archive/edit-archive?teamId=${team.value.teamId}&corpId=${team.value.corpId}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
const href =
|
||||
typeof options.q === "string" ? decodeURIComponent(options.q) : "";
|
||||
|
||||
@ -6,7 +6,7 @@ export default [
|
||||
},
|
||||
{
|
||||
path: 'pages/login/login',
|
||||
meta: { title: '柚健康' },
|
||||
meta: { title: '柚健康', navigationStyle: 'custom' },
|
||||
},
|
||||
{
|
||||
path: 'pages/login/redirect-page',
|
||||
|
||||
BIN
static/background.png
Normal file
BIN
static/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@ -9,7 +9,9 @@ const urlsConfig = {
|
||||
wxAppLogin: 'wxAppLogin',
|
||||
getTeamHealthTemplate: 'getTeamHealthTemplate',
|
||||
getTeamHealthTemps: "getTeamHealthTemps",
|
||||
getCorpMemberJob: "getCorpMemberJob"
|
||||
getCorpMemberJob: "getCorpMemberJob",
|
||||
bindWxappWithTeam: 'bindWxappWithTeam',
|
||||
getWxappRelateTeams: 'getWxappRelateTeams',
|
||||
},
|
||||
|
||||
knowledgeBase: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user