feat: 页面提交
This commit is contained in:
parent
5f1f83f6c7
commit
f4f29469b3
@ -4,3 +4,4 @@ MP_CACHE_PREFIX=development
|
||||
MP_WX_APP_ID=wx93af55767423938e
|
||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||
MP_TIM_SDK_APP_ID=1600123876
|
||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||
|
||||
8
.env.ip
Normal file
8
.env.ip
Normal file
@ -0,0 +1,8 @@
|
||||
MP_API_BASE_URL=http://192.168.60.2:8080
|
||||
MP_IMAGE_URL=https://patient.youcan365.com
|
||||
MP_CACHE_PREFIX=development
|
||||
MP_WX_APP_ID=wx93af55767423938e
|
||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||
MP_TIM_SDK_APP_ID=1600123876
|
||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||
|
||||
@ -4,3 +4,4 @@ MP_CACHE_PREFIX=development
|
||||
MP_WX_APP_ID=wx93af55767423938e
|
||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||
MP_TIM_SDK_APP_ID=1600123876
|
||||
MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate
|
||||
|
||||
68
package.json
68
package.json
@ -1,34 +1,40 @@
|
||||
{
|
||||
"name": "ykt-wxapp",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"name": "ykt-wxapp",
|
||||
"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": {}
|
||||
"title": "本地",
|
||||
"env": {
|
||||
"UNI_PLATFORM": "mp-weixin"
|
||||
}
|
||||
},
|
||||
"ip": {
|
||||
"title": "本机ip",
|
||||
"env": {
|
||||
"UNI_PLATFORM": "mp-weixin"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
@ -4,43 +4,66 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useGuard from "@/hooks/useGuard.js";
|
||||
import useAccountStore from "@/store/account.js";
|
||||
import api from '@/utils/api';
|
||||
import { set } from "@/utils/cache";
|
||||
import { toast } from '@/utils/widget';
|
||||
|
||||
const teamId = ref('');
|
||||
const corpId = ref('');
|
||||
const loading = ref(false);
|
||||
const team = ref(null)
|
||||
const { useLoad } = useGuard()
|
||||
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
||||
|
||||
async function changeTeam({ teamId, corpId, corpName }) {
|
||||
loading.value = true;
|
||||
const res = await api('getTeamData', { teamId, corpId, withCorpName: true });
|
||||
loading.value = false;
|
||||
if (res && res.data) {
|
||||
team.value = res.data;
|
||||
team.value.corpName = 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'
|
||||
})
|
||||
async function getTeam(teamId) {
|
||||
if (teamId) {
|
||||
const res = await api('getTeamData', { teamId, corpId: account.value.corpId });
|
||||
if (res && res.data) {
|
||||
return toJoinTeam(teamId)
|
||||
} else {
|
||||
await toast(res?.message || '获取团队信息失败')
|
||||
}
|
||||
} else {
|
||||
toast(res?.message || '获取团队信息失败')
|
||||
await toast('获取团队信息失败')
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
teamId.value = options.teamId || '';
|
||||
corpId.value = options.corpId || '';
|
||||
changeTeam({ teamId: teamId.value, corpId: corpId.value });
|
||||
async function toJoinTeam(teamId) {
|
||||
// 已注册
|
||||
if (doctorInfo.value && doctorInfo.value.userid) {
|
||||
const data = {
|
||||
teamId,
|
||||
corpId: account.value.corpId,
|
||||
id: doctorInfo.value._id,
|
||||
userId: doctorInfo.value.userid
|
||||
}
|
||||
const res = await api('joinTheInvitedTeam', data);
|
||||
if (res && res.success) {
|
||||
await toast('加入团队成功');
|
||||
return uni.switchTab({
|
||||
url: '/pages/work/work'
|
||||
})
|
||||
} else {
|
||||
await toast(res?.message || '加入团队失败')
|
||||
}
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: `/pages/work/profile?type=joinTeam&teamId=${teamId}`
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
useLoad(options => {
|
||||
const href = typeof options.q === 'string' ? decodeURIComponent(options.q) : '';
|
||||
const [, url = ''] = href.split('?');
|
||||
const data = url.split('&').reduce((acc, cur) => {
|
||||
const [key, value] = cur.split('=');
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {})
|
||||
if (data.type === 'inviteTeam') {
|
||||
getTeam(data.teamId)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
|
||||
@ -72,7 +72,9 @@ const { getDoctorInfo } = useAccountStore();
|
||||
const job = { assistant: '医生助理', doctor: '医生' };
|
||||
|
||||
const form = ref({});
|
||||
const inviteTeamId = ref('')
|
||||
const type = ref('');
|
||||
|
||||
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value, mobile: account.value?.mobile }));
|
||||
const cancelText = computed(() => doctorInfo.value ? '取消' : '暂不填写');
|
||||
const confirmText = computed(() => type.value === 'cert' ? '下一步' : '保存');
|
||||
@ -189,6 +191,9 @@ async function save() {
|
||||
if (doctorInfo.value) {
|
||||
data.id = doctorInfo.value._id;
|
||||
}
|
||||
if (inviteTeamId.value) {
|
||||
data.inviteTeamId = inviteTeamId.value;
|
||||
}
|
||||
const res = await api(apiName, data);
|
||||
if (res && res.success) {
|
||||
await getDoctorInfo()
|
||||
@ -206,6 +211,9 @@ async function save() {
|
||||
|
||||
useLoad(opts => {
|
||||
type.value = opts?.type;
|
||||
if (type.value === 'joinTeam' && opts.teamId) {
|
||||
inviteTeamId.value = opts.teamId
|
||||
}
|
||||
})
|
||||
|
||||
useShow(() => {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
成员邀请码
|
||||
</view>
|
||||
<view class="flex justify-center overflow-hidden">
|
||||
<uqrcode canvas-id="qrcode" value="https://uqrcode.cn/doc" :options="options"></uqrcode>
|
||||
<uqrcode canvas-id="qrcode" :value="qrcode" :options="options"></uqrcode>
|
||||
</view>
|
||||
<view class="mt-10 px-15 text-base text-dark leading-normal text-center">
|
||||
微信扫一扫上面的二维码
|
||||
@ -20,19 +20,24 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useGuard from "@/hooks/useGuard.js";
|
||||
import useAccountStore from "@/store/account.js";
|
||||
import api from '@/utils/api';
|
||||
import { toast } from "@/utils/widget";
|
||||
|
||||
const env = __VITE_ENV__;
|
||||
const inviteQrcode = env.MP_INVITE_TEAMMATE_QRCODE;
|
||||
|
||||
const options = { margin: 10 };
|
||||
const team = ref(null);
|
||||
const teamId = ref('');
|
||||
const { useLoad, useShow } = useGuard();
|
||||
const { account } = storeToRefs(useAccountStore());
|
||||
|
||||
const qrcode = computed(() => `${inviteQrcode}?type=inviteTeam&teamId=${teamId.value}`)
|
||||
|
||||
async function getTeam() {
|
||||
const res = await api('getTeamData', { teamId: teamId.value, corpId: account.value.corpId });
|
||||
if (res && res.data) {
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-shrink-0 flex flex-col items-center justify-center" @click.stop="invitePatient(i)">
|
||||
<view class="flex-shrink-0 flex flex-col items-center justify-center" @click.stop="invite(i)">
|
||||
<image class="mb-5 qrcode" src="/static/work/qrcode.svg" />
|
||||
<view class="w-full text-sm text-dark text-center">邀请患者</view>
|
||||
<view class="w-full text-sm text-dark text-center">邀请成员</view>
|
||||
</view>
|
||||
</view>
|
||||
<template #footer>
|
||||
@ -47,8 +47,9 @@ const { useShow } = useGuard();
|
||||
const { doctorInfo, account } = storeToRefs(useAccountStore());
|
||||
const list = ref([]);
|
||||
|
||||
function invitePatient(team) {
|
||||
uni.navigateTo({ url: `/pages/work/team/invite/invite-patient?teamId=${team.teamId || ''}` })
|
||||
function invite(team) {
|
||||
uni.navigateTo({ url: `/pages/work/team/invite/invite-teammate?teamId=${team.teamId || ''}` })
|
||||
// uni.navigateTo({ url: `/pages/work/team/invite/invite-patient?teamId=${team.teamId || ''}` })
|
||||
}
|
||||
|
||||
function toCreate() {
|
||||
|
||||
@ -3,6 +3,10 @@ export default [
|
||||
path: 'pages/login/login',
|
||||
meta: { title: '登录', login: false },
|
||||
},
|
||||
{
|
||||
path: 'pages/login/redirect-page',
|
||||
meta: { title: '登录', login: true },
|
||||
},
|
||||
{
|
||||
path: 'pages/login/redirect-page',
|
||||
meta: { title: '登录', login: false },
|
||||
|
||||
@ -21,7 +21,8 @@ const urlsConfig = {
|
||||
updateTeamInfo: "updateTeamInfo",
|
||||
createOwnTeam: 'createOwnTeam',
|
||||
removeTeammate: "removeTeammate",
|
||||
toggleTeamLeaderRole: "toggleTeamLeaderRole"
|
||||
toggleTeamLeaderRole: "toggleTeamLeaderRole",
|
||||
joinTheInvitedTeam: 'joinTheInvitedTeam'
|
||||
},
|
||||
|
||||
knowledgeBase: {
|
||||
|
||||
@ -21,6 +21,9 @@ export default (command, mode) => {
|
||||
case "localhost":
|
||||
mode = "localhost";
|
||||
break;
|
||||
case "ip":
|
||||
mode = "ip";
|
||||
break;
|
||||
default:
|
||||
mode = "production";
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user