fix: bug修复
This commit is contained in:
parent
87e9cde197
commit
42a187459e
@ -35,7 +35,8 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/login/login",
|
"path": "pages/login/login",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "柚健康"
|
"navigationBarTitleText": "柚健康",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -55,7 +55,12 @@ const customerArchive = ref(null);
|
|||||||
const verifyVisible = ref(false);
|
const verifyVisible = ref(false);
|
||||||
const visible = 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 }) {
|
function change({ title, value }) {
|
||||||
if (title) {
|
if (title) {
|
||||||
@ -72,6 +77,7 @@ function change({ title, value }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function confirm() {
|
function confirm() {
|
||||||
|
console.log(formData.value)
|
||||||
if (!tempRef.value.verify()) return;
|
if (!tempRef.value.verify()) return;
|
||||||
if (customerId.value) {
|
if (customerId.value) {
|
||||||
updateArchive();
|
updateArchive();
|
||||||
|
|||||||
@ -57,7 +57,7 @@ async function changeTeam({ teamId, corpId, corpName }) {
|
|||||||
|
|
||||||
async function getTeams() {
|
async function getTeams() {
|
||||||
loading.value = true;
|
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 : [];
|
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];
|
const validTeam = teams.value.find(item => team.value && item.teamId === team.value.teamId) || teams.value[0];
|
||||||
if (validTeam) {
|
if (validTeam) {
|
||||||
|
|||||||
@ -1,38 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="team" class="pt-lg px-15 flex flex-col items-center text-center">
|
<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" />
|
<group-avatar :avatarList="team.avatars" />
|
||||||
<view class="mt-15 text-base font-semibold text-dark">
|
|
||||||
{{ team.teamName }}
|
|
||||||
</view>
|
</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>
|
||||||
|
<!-- 登录按钮 -->
|
||||||
<view class="login-btn-wrap">
|
<view class="login-btn-wrap">
|
||||||
<button v-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
<button v-if="checked && account" class="login-btn" type="primary" @click="getPhoneNumber">
|
||||||
手机号快捷登录
|
手机号快捷登录
|
||||||
</button>
|
</button>
|
||||||
<!-- <button v-if="checked" class="login-btn" type="primary" @click="getPhoneNumber()">
|
<button v-else-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber"
|
||||||
|
@getphonenumber="getPhoneNumber">
|
||||||
手机号快捷登录
|
手机号快捷登录
|
||||||
</button> -->
|
</button>
|
||||||
<button v-else class="login-btn" type="primary" @click="remind()">
|
<button v-else class="login-btn" type="primary" @click="remind()">
|
||||||
手机号快捷登录
|
手机号快捷登录
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</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="agreement">
|
||||||
<view class="text-sm text-gray">我已阅读并同意</view>
|
<checkbox :checked="checked" @click="checked = !checked" />
|
||||||
<view class="text-sm text-primary">《用户协议》、</view>
|
<text>我已阅读并同意</text>
|
||||||
<view class="text-sm text-primary">《隐私政策》</view>
|
<text class="link" @click="openUserAgreement">《用户协议》</text>
|
||||||
|
<text>、</text>
|
||||||
|
<text class="link" @click="openPrivacyPolicy">《隐私政策》</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import useAccountStore from "@/store/account";
|
import useAccountStore from "@/store/account";
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
@ -41,10 +57,12 @@ import { toast } from "@/utils/widget";
|
|||||||
|
|
||||||
import groupAvatar from "@/components/group-avatar.vue";
|
import groupAvatar from "@/components/group-avatar.vue";
|
||||||
|
|
||||||
|
const env = __VITE_ENV__;
|
||||||
|
const appid = env.MP_WX_APP_ID;
|
||||||
const team = ref(null);
|
const team = ref(null);
|
||||||
const checked = ref(false);
|
const checked = ref(false);
|
||||||
const redirectUrl = ref("");
|
const redirectUrl = ref("");
|
||||||
|
const { account } = storeToRefs(useAccountStore());
|
||||||
const { login } = useAccountStore();
|
const { login } = useAccountStore();
|
||||||
|
|
||||||
function attempRedirect(url) {
|
function attempRedirect(url) {
|
||||||
@ -77,9 +95,13 @@ function toHome() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkTeamArchive(account) {
|
async function bindTeam() {
|
||||||
const res = await api('getWxAppCustomerCount', { miniAppId: account.openid, corpId: account.corpId, teamId: '1nYlVrNXGT173674701967643308' || team.value.teamId });
|
const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid });
|
||||||
if (res && res.data > 0) {
|
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();
|
toHome();
|
||||||
} else {
|
} else {
|
||||||
attempToPage(redirectUrl.value)
|
attempToPage(redirectUrl.value)
|
||||||
@ -88,11 +110,13 @@ async function checkTeamArchive(account) {
|
|||||||
|
|
||||||
async function getPhoneNumber(e) {
|
async function getPhoneNumber(e) {
|
||||||
const phoneCode = e && e.detail && e.detail.code;
|
const phoneCode = e && e.detail && e.detail.code;
|
||||||
// if (e && !phoneCode) return;
|
if (!account.value) {
|
||||||
const res = await login(phoneCode);
|
const res = await login(phoneCode);
|
||||||
if (res && team.value) {
|
if (!res) return;
|
||||||
checkTeamArchive(res)
|
}
|
||||||
} else if (res && redirectUrl.value) {
|
if (team.value) {
|
||||||
|
bindTeam(account.value)
|
||||||
|
} else if (redirectUrl.value) {
|
||||||
await attempToPage(redirectUrl.value);
|
await attempToPage(redirectUrl.value);
|
||||||
} else if (res) {
|
} else if (res) {
|
||||||
toHome();
|
toHome();
|
||||||
@ -121,11 +145,6 @@ onLoad((opts) => {
|
|||||||
padding-top: 20vh;
|
padding-top: 20vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
|
||||||
width: 160rpx;
|
|
||||||
height: 160rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-btn-wrap {
|
.login-btn-wrap {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -154,4 +173,161 @@ onLoad((opts) => {
|
|||||||
.login-btn:active {
|
.login-btn:active {
|
||||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
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>
|
</style>
|
||||||
|
|||||||
@ -5,13 +5,18 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import api from "@/utils/api";
|
import api from "@/utils/api";
|
||||||
import { set } from "@/utils/cache";
|
import { set } from "@/utils/cache";
|
||||||
import { toast } from "@/utils/widget";
|
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 loading = ref(false);
|
||||||
const team = ref(null);
|
const team = ref(null);
|
||||||
|
|
||||||
@ -22,6 +27,9 @@ async function changeTeam({ teamId, corpId }) {
|
|||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
team.value = res.data;
|
team.value = res.data;
|
||||||
team.value.corpName = res.data.corpName;
|
team.value.corpName = res.data.corpName;
|
||||||
|
if (account.value) {
|
||||||
|
bindTeam()
|
||||||
|
} else {
|
||||||
set("invite-team-info", {
|
set("invite-team-info", {
|
||||||
corpId: team.value.corpId,
|
corpId: team.value.corpId,
|
||||||
teamId: team.value.teamId,
|
teamId: team.value.teamId,
|
||||||
@ -35,11 +43,29 @@ async function changeTeam({ teamId, corpId }) {
|
|||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/login/login?source=teamInvite",
|
url: "/pages/login/login?source=teamInvite",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
toast(res?.message || "获取团队信息失败");
|
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) => {
|
onLoad((options) => {
|
||||||
const href =
|
const href =
|
||||||
typeof options.q === "string" ? decodeURIComponent(options.q) : "";
|
typeof options.q === "string" ? decodeURIComponent(options.q) : "";
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'pages/login/login',
|
path: 'pages/login/login',
|
||||||
meta: { title: '柚健康' },
|
meta: { title: '柚健康', navigationStyle: 'custom' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'pages/login/redirect-page',
|
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',
|
wxAppLogin: 'wxAppLogin',
|
||||||
getTeamHealthTemplate: 'getTeamHealthTemplate',
|
getTeamHealthTemplate: 'getTeamHealthTemplate',
|
||||||
getTeamHealthTemps: "getTeamHealthTemps",
|
getTeamHealthTemps: "getTeamHealthTemps",
|
||||||
getCorpMemberJob: "getCorpMemberJob"
|
getCorpMemberJob: "getCorpMemberJob",
|
||||||
|
bindWxappWithTeam: 'bindWxappWithTeam',
|
||||||
|
getWxappRelateTeams: 'getWxappRelateTeams',
|
||||||
},
|
},
|
||||||
|
|
||||||
knowledgeBase: {
|
knowledgeBase: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user