diff --git a/components/full-page.vue b/components/full-page.vue index 59465cb..a4d4135 100644 --- a/components/full-page.vue +++ b/components/full-page.vue @@ -1,9 +1,9 @@ + diff --git a/pages/archive/edit-archive.vue b/pages/archive/edit-archive.vue index 7d1bbf5..159734c 100644 --- a/pages/archive/edit-archive.vue +++ b/pages/archive/edit-archive.vue @@ -11,7 +11,7 @@ ({ ...customer.value, ...form.value })); -function back() { - const pages = getCurrentPages(); - if (pages.length > 1) { - uni.navigateBack(); - } else { - uni.redirectTo({ url: `/pages/home/home?corpId=${corpId.value}&teamId=${teamId.value}` }) - } -} - function change({ title, value }) { if (title) { form.value[title] = value; @@ -80,7 +72,7 @@ function change({ title, value }) { } function confirm() { - if (!tempRef.value.verify() || Object.keys(form.value).length === 0) return; + if (!tempRef.value.verify()) return; if (customerId.value) { updateArchive(); } else { @@ -97,12 +89,15 @@ async function addArchive() { teamId: teamId.value, corpId: corpId.value, mobile: account.value.mobile, - miniAppId: account.value.openid + miniAppId: account.value.openid, + externalUserId: externalUserId.value, } loading.value = false; const res = await api('addCustomer', { params }); if (res && res.success) { - back() + uni.redirectTo({ + url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}` + }) } else { toast(res?.message || '新增档案失败'); } @@ -122,12 +117,15 @@ async function bindArchive(customerId) { async function init() { if (customerId.value) { - await getCustomer() + await getCustomer(); } else { const res = await getArchives(); if (res.length > 0) { visible.value = true; } + if (!externalUserId.value) { + getExternalUserId(); + } } await getBaseForm(); } @@ -166,6 +164,32 @@ async function getCustomer() { } } +async function updateArchive() { + if (Object.keys(form.value).length > 0) { + const res = await api('updateCustomer', { id: customerId.value, ...form.value }); + if (res && res.success) { + await toast('修改成功'); + uni.navigateBack(); + } else { + toast(res?.message || '修改失败'); + } + } else { + uni.navigateBack(); + } +} + +// async updateCustomer() { +// if (Object.keys(this.form).length === 0) return this.editMemberId; +// const { success, message } = await updateCustomer( +// this.editMemberId, +// this.form +// ); +// if (success) return this.editMemberId; +// this.widget.hideLoading(); +// this.widget.toast(message); +// return Promise.reject(); +// }, + onLoad(options => { customerId.value = options.id || ''; uni.setNavigationBarTitle({ title: customerId.value ? '编辑档案' : '新增档案' }) diff --git a/pages/article/article-detail.vue b/pages/article/article-detail.vue index 5d8927f..9ef3aaf 100644 --- a/pages/article/article-detail.vue +++ b/pages/article/article-detail.vue @@ -28,8 +28,11 @@ import { onLoad } from "@dcloudio/uni-app"; 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(""); const articleData = ref({ @@ -40,6 +43,16 @@ const articleData = ref({ let articleId = ""; +const markArticleRead = async () => { + const unionid = account.value?.unionid; + if (!unionid || !articleId) return; + try { + await api("addArticleReadRecord", { corpId, articleId, unionid }, false); + } catch (err) { + console.warn("markArticleRead failed:", err?.message || err); + } +}; + // 处理富文本内容,使图片自适应 const processRichTextContent = (html) => { if (!html) return ""; @@ -107,6 +120,7 @@ const loadArticle = async () => { onLoad((options) => { if (options.id) { articleId = options.id; + markArticleRead(); loadArticle(); } else { error.value = "文章信息不完整"; diff --git a/pages/article/article-list.vue b/pages/article/article-list.vue index 6cf29d1..ed0c095 100644 --- a/pages/article/article-list.vue +++ b/pages/article/article-list.vue @@ -11,16 +11,25 @@ ? 'bg-orange-100 text-orange-500 border-orange-500' : 'bg-white text-gray-600 border-gray-200' ]" - @click="activeTab = tab.value" + @click="selectTab(tab.value)" > {{ tab.name }} - + + + 加载中... + + + + + + + - {{ item.type }} + 宣教文章 @@ -44,86 +53,168 @@ class="text-sm mr-2" :class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'" > - {{ item.status === 'UNREAD' ? '未阅读' : '查看' }} + {{ item.status === 'UNREAD' ? '未阅读' : '已阅读' }} - - - 人员: - {{ item.person }} + + 人员: + {{ item.person || '-' }} - - - 团队: - {{ item.team }} + + + 团队: + {{ item.team || '-' }} - 发送时间: {{ item.time }} + 发送时间: {{ item.time || '-' }} + + + + 加载中... + + + + 没有更多了 + diff --git a/pages/home/article-list.vue b/pages/home/article-list.vue index 79e85d7..8ee522a 100644 --- a/pages/home/article-list.vue +++ b/pages/home/article-list.vue @@ -68,6 +68,8 @@ watch(articleIds, n => { margin: 0 30rpx; margin-top: 24rpx; padding-bottom: 40rpx; + width: calc(100% - 60rpx); + box-sizing: border-box; } .arrow-icon { @@ -91,6 +93,8 @@ watch(articleIds, n => { min-height: 188rpx; padding: 20rpx; align-items: flex-start; + width: 100%; + box-sizing: border-box; } .article-card:active { diff --git a/pages/home/customer-archive.vue b/pages/home/customer-archive.vue index 6323910..ce1696b 100644 --- a/pages/home/customer-archive.vue +++ b/pages/home/customer-archive.vue @@ -24,20 +24,10 @@ {{ i.relationship }} - {{ i.name }} - - - - {{ i.age > 0 ? i.age + '岁' : '' }} - - @@ -203,7 +193,7 @@ watch(() => props.corpId, n => { .customer-card { width: 160rpx; - height: 160rpx; + height: 110rpx; display: flex; align-items: center; justify-content: center; @@ -219,9 +209,6 @@ watch(() => props.corpId, n => { border: 2rpx solid #065BD6; } -.customer-name { - margin-top: 12rpx; -} .relationship-tag { position: absolute; @@ -307,10 +294,6 @@ watch(() => props.corpId, n => { margin-bottom: 12rpx; } -.sex-icon { - width: 32rpx; - height: 32rpx; -} .info-card-new { position: relative; diff --git a/pages/home/team-head.vue b/pages/home/team-head.vue index 4495e61..d028a1b 100644 --- a/pages/home/team-head.vue +++ b/pages/home/team-head.vue @@ -259,7 +259,7 @@ onMounted(() => { .mask { position: fixed; - z-index: 2; + z-index: 99; left: 0; top: 0; right: 0; @@ -268,7 +268,7 @@ onMounted(() => { } .z-3 { - z-index: 3; + z-index: 101; } .team-dropdown { @@ -276,7 +276,7 @@ onMounted(() => { left: 0; right: 0; top: 0; - z-index: 3; + z-index: 100; border-bottom-left-radius: 16rpx; border-bottom-right-radius: 16rpx; } diff --git a/pages/login/login.vue b/pages/login/login.vue index b99e2ad..00897cf 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -17,8 +17,8 @@ 手机号快捷登录 + 手机号快捷登录 + --> @@ -35,6 +35,7 @@ import { ref } from "vue"; import { onLoad } from "@dcloudio/uni-app"; import useAccountStore from "@/store/account"; +import api from '@/utils/api'; import { get } from "@/utils/cache"; import { toast } from "@/utils/widget"; @@ -71,16 +72,27 @@ function remind() { } function toHome() { - uni.navigateTo({ + uni.switchTab({ url: "/pages/home/home", }); } +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) { + toHome(); + } else { + attempToPage(redirectUrl.value) + } +} + async function getPhoneNumber(e) { const phoneCode = e && e.detail && e.detail.code; - if (e && !phoneCode) return; + // if (e && !phoneCode) return; const res = await login(phoneCode); - if (res && redirectUrl.value) { + if (res && team.value) { + checkTeamArchive(res) + } else if (res && redirectUrl.value) { await attempToPage(redirectUrl.value); } else if (res) { toHome(); @@ -99,7 +111,6 @@ onLoad((opts) => { if (opts.source === "teamInvite") { team.value = get("invite-team-info"); redirectUrl.value = `/pages/archive/edit-archive?teamId=${team.value.teamId}&corpId=${team.value.corpId}`; - console.log("redirectUrl", redirectUrl.value); return; } redirectUrl.value = opts.redirectUrl || ""; diff --git a/pages/login/redirect-page.vue b/pages/login/redirect-page.vue index 98d2a73..8e74c0d 100644 --- a/pages/login/redirect-page.vue +++ b/pages/login/redirect-page.vue @@ -15,13 +15,13 @@ const corpId = ref(""); const loading = ref(false); const team = ref(null); -async function changeTeam({ teamId, corpId, corpName }) { +async function changeTeam({ teamId, corpId }) { 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; + team.value.corpName = res.data.corpName; set("invite-team-info", { corpId: team.value.corpId, teamId: team.value.teamId, @@ -45,9 +45,7 @@ onLoad((options) => { typeof options.q === "string" ? decodeURIComponent(options.q) : ""; const [, url = ""] = href.split("?"); const data = url.split("&").reduce((acc, cur) => { - console.log(cur); const [key, value] = cur.split("="); - console.log(key, "=====", value); acc[key] = value; return acc; }, {}); diff --git a/pages/survey/survey-list.vue b/pages/survey/survey-list.vue index e213a83..1613e69 100644 --- a/pages/survey/survey-list.vue +++ b/pages/survey/survey-list.vue @@ -11,16 +11,25 @@ ? 'bg-orange-100 text-orange-500 border-orange-500' : 'bg-white text-gray-600 border-gray-200' ]" - @click="activeTab = tab.value" + @click="selectTab(tab.value)" > {{ tab.name }} - + + + 加载中... + + + + + + + - {{ item.type }} + 问卷调查 @@ -38,93 +47,166 @@ - + - - {{ item.status === 'UNFILLED' ? '未填写' : '查看' }} - - + 查看 + - - - 人员: - {{ item.person }} + + 人员: + {{ item.person || '-' }} - - - 团队: - {{ item.team }} + + + 团队: + {{ item.team || '-' }} - 发送时间: {{ item.time }} + 发送时间: {{ item.time || '-' }} + + + + 加载中... + + + + 没有更多了 + \ No newline at end of file + +.field-label { + flex-shrink: 0; + white-space: nowrap; +} + +.loading-container, +.empty-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 100rpx 0; +} + +.loading-text { + margin-top: 20rpx; + font-size: 28rpx; + color: #999; +} + +.loading-more, +.no-more { + display: flex; + align-items: center; + justify-content: center; + padding: 30rpx 0; + font-size: 24rpx; + color: #999; + gap: 10rpx; +} + diff --git a/pages/team/friend.vue b/pages/team/friend.vue index d2ca011..c9551da 100644 --- a/pages/team/friend.vue +++ b/pages/team/friend.vue @@ -14,13 +14,18 @@ + + 点击识别下方二维码,加我为好友 +