fix:问题修复

This commit is contained in:
huxuejian 2026-02-09 17:31:16 +08:00
parent c9483c48c1
commit ab64e7c9c9
8 changed files with 472 additions and 184 deletions

View File

@ -68,6 +68,7 @@ const { useLoad } = useGuard();
const { account } = storeToRefs(useAccount());
const { memberJob, memberList: list } = useJob();
const qrcode = ref('');
const corpId = ref('')
const friends = computed(() => {
const memberList = Array.isArray(team.value?.memberList) ? team.value.memberList : [];
@ -84,11 +85,11 @@ function previewImage() {
}
function toFriend(userid) {
uni.navigateTo({ url: `/pages/team/friend?corpId=${account.value?.corpId}&userid=${userid}` })
uni.navigateTo({ url: `/pages/team/friend?corpId=${corpId.value}&userid=${userid}` })
}
async function getQrcode(userid) {
const res = await api('addContactWay', { corpUserId: userid, corpId: account.value?.corpId, unionid: account.value?.openid });
const res = await api('addContactWay', { corpUserId: userid, corpId: corpId.value, unionid: account.value?.openid });
if (res && res.data) {
qrcode.value = res.data;
}
@ -104,6 +105,7 @@ async function getTeam(corpId, teamId) {
}
useLoad(options => {
corpId.value = options.corpId;
if (options.teamId && options.corpId) {
getTeam(options.corpId, options.teamId);
}

View File

@ -168,9 +168,7 @@ async function init() {
if (res.length > 0) {
visible.value = true;
}
if (!externalUserId.value) {
getExternalUserId();
}
getExternalUserId(corpId.value);
}
await getBaseForm();
if (!customerId.value) {

View File

@ -56,9 +56,6 @@ import dayjs from "dayjs";
import api from "@/utils/api.js";
import EmptyData from "@/components/empty-data.vue";
const env = __VITE_ENV__;
const defaultCorpId = env.MP_CORP_ID;
const corpId = ref("");
const enabledIds = ref([]);
const tabs = ref([{ name: "全部", value: "" }]);
@ -261,7 +258,7 @@ function goToDetail(item) {
}
onLoad(async (options) => {
corpId.value = options?.corpId || defaultCorpId || "";
corpId.value = options?.corpId || "";
enabledIds.value = parseIdsParam(options?.ids);
activeCateId.value = "";
await loadEnabledArticles();

View File

@ -40,6 +40,7 @@ const articleData = ref({
});
let articleId = "";
const corpId = ref('')
const markArticleRead = async () => {
const unionid = account.value?.unionid;
@ -47,7 +48,7 @@ const markArticleRead = async () => {
try {
await api(
"addArticleReadRecord",
{ corpId: account.value?.corpId, articleId, unionid },
{ corpId: corpId.value, articleId, unionid },
false
);
} catch (err) {
@ -90,7 +91,7 @@ const loadArticle = async () => {
loading.value = true;
error.value = "";
try {
const res = await api("getArticle", { id: articleId, corpId });
const res = await api("getArticle", { id: articleId, corpId: corpId.value });
if (res.success && res.data) {
//
@ -120,6 +121,7 @@ const loadArticle = async () => {
};
onLoad((options) => {
corpId.value = options.corpId;
if (options.id) {
articleId = options.id;
markArticleRead();

View File

@ -1,18 +1,14 @@
<template>
<view class="bg-gray-100 min-h-screen">
<!-- Filter Tabs -->
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full" :show-scrollbar="false">
<view
v-for="(tab, index) in tabs"
:key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors"
:class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors" :class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200'
]"
@click="selectTab(tab.value)"
>
]" @click="selectTab(tab.value)">
{{ tab.name }}
</view>
</scroll-view>
@ -28,16 +24,12 @@
</view>
<view v-else class="p-15">
<view
v-for="item in articles"
:key="item._id"
class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)"
>
<view v-for="item in articles" :key="item._id" class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)">
<!-- Header -->
<view class="flex items-start justify-between mb-10">
<view class="flex items-start flex-1 mr-10 relative">
<!-- Tag -->
<!-- Tag -->
<view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box">
宣教文章
</view>
@ -46,16 +38,13 @@
{{ item.title }}
</view>
</view>
<!-- Status -->
<view class="flex items-center flex-shrink-0 ml-2">
<text
class="text-sm mr-2"
:class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'"
>
{{ item.status === 'UNREAD' ? '未阅读' : '查看' }}
</text>
<uni-icons type="right" size="14" :color="item.status === 'UNREAD' ? '#ef4444' : '#9ca3af'"></uni-icons>
<text class="text-sm mr-2" :class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'">
{{ item.status === 'UNREAD' ? '未阅读' : '查看' }}
</text>
<uni-icons type="right" size="14" :color="item.status === 'UNREAD' ? '#ef4444' : '#9ca3af'"></uni-icons>
</view>
</view>
@ -69,7 +58,7 @@
<text class="text-gray-400 mr-2 field-label">团队:</text>
<text>{{ item.team || '-' }}</text>
</view>
<!-- Footer -->
<view class="text-sm text-gray-400">
发送时间: {{ item.time || '-' }}
@ -90,15 +79,13 @@
<script setup>
import { ref } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import EmptyData from "@/components/empty-data.vue";
const env = __VITE_ENV__;
const corpId = env.MP_CORP_ID;
const { account, openid } = storeToRefs(useAccountStore());
const tabs = ref([{ name: "全部", value: "" }]);
@ -110,6 +97,7 @@ const page = ref(1);
const pageSize = 20;
const loading = ref(false);
const inited = ref(false);
const corpId = ref('');
const selectTab = async (customerId) => {
if (activeTab.value === customerId) return;
@ -121,7 +109,7 @@ const loadCustomers = async () => {
const miniAppId = openid.value || uni.getStorageSync("openid");
if (!miniAppId) return;
try {
const res = await api("getMiniAppCustomers", { miniAppId, corpId });
const res = await api("getMiniAppCustomers", { miniAppId, corpId: corpId.value });
if (res && res.success) {
const list = Array.isArray(res.data) ? res.data : [];
tabs.value = [
@ -168,7 +156,7 @@ const loadArticleList = async (reset = false) => {
loading.value = true;
try {
const params = {
corpId,
corpId: corpId.value,
unionid,
miniAppId,
page: page.value,
@ -196,8 +184,11 @@ const loadArticleList = async (reset = false) => {
function goToDetail(item) {
if (!item?.articleId) return;
uni.navigateTo({ url: `/pages/article/article-detail?id=${item.articleId}` });
uni.navigateTo({ url: `/pages/article/article-detail?id=${item.articleId}&corpId=${corpId.value}` });
}
onLoad(opts => {
corpId.value = opts.corpId;
})
onShow(async () => {
if (!inited.value) {
@ -219,70 +210,224 @@ onReachBottom(() => {
<style scoped>
/* Utility helpers similar to Windi/Tailwind */
.min-h-screen { min-height: 100vh; }
.bg-gray-100 { background-color: #f7f8fa; }
.bg-white { background-color: #ffffff; }
.min-h-screen {
min-height: 100vh;
}
.p-15 { padding: 30rpx; }
.px-15 { padding-left: 30rpx; padding-right: 30rpx; }
.py-10 { padding-top: 20rpx; padding-bottom: 20rpx; }
.py-5 { padding-top: 10rpx; padding-bottom: 10rpx; }
.px-5 { padding-left: 10rpx; padding-right: 10rpx; }
.bg-gray-100 {
background-color: #f7f8fa;
}
.mr-10 { margin-right: 20rpx; }
.mr-5 { margin-right: 10rpx; }
.ml-2 { margin-left: 10rpx; }
.mr-2 { margin-right: 10rpx; }
.mb-15 { margin-bottom: 30rpx; }
.mb-10 { margin-bottom: 20rpx; }
.mb-5 { margin-bottom: 10rpx; }
.mt-1 { margin-top: 6rpx; }
.pb-10 { padding-bottom: 20rpx; }
.bg-white {
background-color: #ffffff;
}
.flex { display: flex; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.relative { position: relative; }
.p-15 {
padding: 30rpx;
}
.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.rounded-full { border-radius: 9999px; }
.rounded { border-radius: 8rpx; }
.rounded-lg { border-radius: 12rpx; }
.px-15 {
padding-left: 30rpx;
padding-right: 30rpx;
}
.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.py-10 {
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.text-xs { font-size: 22rpx; }
.text-sm { font-size: 28rpx; }
.text-base { font-size: 32rpx; }
.font-bold { font-weight: 600; }
.leading-normal { line-height: 1.4; }
.py-5 {
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.px-5 {
padding-left: 10rpx;
padding-right: 10rpx;
}
.mr-10 {
margin-right: 20rpx;
}
.mr-5 {
margin-right: 10rpx;
}
.ml-2 {
margin-left: 10rpx;
}
.mr-2 {
margin-right: 10rpx;
}
.mb-15 {
margin-bottom: 30rpx;
}
.mb-10 {
margin-bottom: 20rpx;
}
.mb-5 {
margin-bottom: 10rpx;
}
.mt-1 {
margin-top: 6rpx;
}
.pb-10 {
padding-bottom: 20rpx;
}
.flex {
display: flex;
}
.items-start {
align-items: flex-start;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.flex-1 {
flex: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.relative {
position: relative;
}
.border {
border-width: 1px;
border-style: solid;
}
.border-b {
border-bottom-width: 1px;
border-bottom-style: solid;
}
.rounded-full {
border-radius: 9999px;
}
.rounded {
border-radius: 8rpx;
}
.rounded-lg {
border-radius: 12rpx;
}
.shadow-sm {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.text-xs {
font-size: 22rpx;
}
.text-sm {
font-size: 28rpx;
}
.text-base {
font-size: 32rpx;
}
.font-bold {
font-weight: 600;
}
.leading-normal {
line-height: 1.4;
}
/* Colors - Adjusting to match image roughly */
.text-orange-500 { color: #f29e38; }
.bg-orange-100 { background-color: #fff8eb; }
.border-orange-500 { border-color: #f29e38; }
.text-orange-500 {
color: #f29e38;
}
.text-gray-600 { color: #333333; }
.text-gray-500 { color: #999999; }
.text-gray-400 { color: #999999; }
.text-gray-800 { color: #1a1a1a; }
.border-gray-200 { border-color: #e5e5e5; }
.border-gray-100 { border-color: #f5f5f5; }
.bg-orange-100 {
background-color: #fff8eb;
}
.text-green-600 { color: #4b8d5f; }
.border-green-600 { border-color: #4b8d5f; }
.text-red-500 { color: #e04a4a; }
.border-orange-500 {
border-color: #f29e38;
}
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.w-full { width: 100%; }
.whitespace-nowrap { white-space: nowrap; }
.inline-block { display: inline-block; }
.text-gray-600 {
color: #333333;
}
.text-gray-500 {
color: #999999;
}
.text-gray-400 {
color: #999999;
}
.text-gray-800 {
color: #1a1a1a;
}
.border-gray-200 {
border-color: #e5e5e5;
}
.border-gray-100 {
border-color: #f5f5f5;
}
.text-green-600 {
color: #4b8d5f;
}
.border-green-600 {
border-color: #4b8d5f;
}
.text-red-500 {
color: #e04a4a;
}
.sticky {
position: sticky;
}
.top-0 {
top: 0;
}
.z-10 {
z-index: 10;
}
.w-full {
width: 100%;
}
.whitespace-nowrap {
white-space: nowrap;
}
.inline-block {
display: inline-block;
}
.tag-box {
border-radius: 4rpx;

View File

@ -102,7 +102,7 @@ function handleItemClick(item) {
}
uni.navigateTo({
url: item.path,
url: `${item.path}?teamId=${props.teamId}&corpId=${props.corpId}`,
fail: () => {
toast("页面跳转失败");
},

View File

@ -1,18 +1,14 @@
<template>
<view class="bg-gray-100 min-h-screen">
<!-- Filter Tabs -->
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full" :show-scrollbar="false">
<view
v-for="(tab, index) in tabs"
:key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors"
:class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors" :class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200'
]"
@click="selectTab(tab.value)"
>
]" @click="selectTab(tab.value)">
{{ tab.name }}
</view>
</scroll-view>
@ -28,16 +24,12 @@
</view>
<view v-else class="p-15">
<view
v-for="item in surveys"
:key="item._id"
class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)"
>
<view v-for="item in surveys" :key="item._id" class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)">
<!-- Header -->
<view class="flex items-start justify-between mb-10">
<view class="flex items-start flex-1 mr-10 relative">
<!-- Tag -->
<!-- Tag -->
<view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box">
问卷调查
</view>
@ -46,7 +38,7 @@
{{ item.title }}
</view>
</view>
<!-- Status (暂不展示未填写/已填写) -->
<view class="flex items-center flex-shrink-0 ml-2">
<text class="text-sm mr-2 text-gray-400">查看</text>
@ -64,7 +56,7 @@
<text class="text-gray-400 mr-2 field-label">团队:</text>
<text>{{ item.team || '-' }}</text>
</view>
<!-- Footer -->
<view class="text-sm text-gray-400">
发送时间: {{ item.time || '-' }}
@ -85,19 +77,19 @@
<script setup>
import { ref } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import EmptyData from "@/components/empty-data.vue";
const env = __VITE_ENV__;
const corpId = env.MP_CORP_ID;
const { openid } = storeToRefs(useAccountStore());
const tabs = ref([{ name: "全部", value: "" }]);
const activeTab = ref("");
const corpId = ref('')
const surveys = ref([]);
const total = ref(0);
@ -116,7 +108,7 @@ const loadCustomers = async () => {
const miniAppId = openid.value || uni.getStorageSync("openid");
if (!miniAppId) return;
try {
const res = await api("getMiniAppCustomers", { miniAppId, corpId });
const res = await api("getMiniAppCustomers", { miniAppId, corpId: corpId.value });
if (res && res.success) {
const list = Array.isArray(res.data) ? res.data : [];
tabs.value = [
@ -162,7 +154,7 @@ const loadSurveyList = async (reset = false) => {
loading.value = true;
try {
const params = {
corpId,
corpId: corpId.value,
miniAppId,
page: page.value,
pageSize,
@ -191,6 +183,11 @@ function goToDetail() {
uni.showToast({ title: "详情暂未接入", icon: "none" });
}
onLoad(opts => {
corpId.value = opts.corpId
})
onShow(async () => {
if (!inited.value) {
await loadCustomers();
@ -211,70 +208,224 @@ onReachBottom(() => {
<style scoped>
/* Utility helpers similar to Windi/Tailwind */
.min-h-screen { min-height: 100vh; }
.bg-gray-100 { background-color: #f7f8fa; }
.bg-white { background-color: #ffffff; }
.min-h-screen {
min-height: 100vh;
}
.p-15 { padding: 30rpx; }
.px-15 { padding-left: 30rpx; padding-right: 30rpx; }
.py-10 { padding-top: 20rpx; padding-bottom: 20rpx; }
.py-5 { padding-top: 10rpx; padding-bottom: 10rpx; }
.px-5 { padding-left: 10rpx; padding-right: 10rpx; }
.bg-gray-100 {
background-color: #f7f8fa;
}
.mr-10 { margin-right: 20rpx; }
.mr-5 { margin-right: 10rpx; }
.ml-2 { margin-left: 10rpx; }
.mr-2 { margin-right: 10rpx; }
.mb-15 { margin-bottom: 30rpx; }
.mb-10 { margin-bottom: 20rpx; }
.mb-5 { margin-bottom: 10rpx; }
.mt-1 { margin-top: 6rpx; }
.pb-10 { padding-bottom: 20rpx; }
.bg-white {
background-color: #ffffff;
}
.flex { display: flex; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.relative { position: relative; }
.p-15 {
padding: 30rpx;
}
.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.rounded-full { border-radius: 9999px; }
.rounded { border-radius: 8rpx; }
.rounded-lg { border-radius: 12rpx; }
.px-15 {
padding-left: 30rpx;
padding-right: 30rpx;
}
.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.py-10 {
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.text-xs { font-size: 22rpx; }
.text-sm { font-size: 28rpx; }
.text-base { font-size: 32rpx; }
.font-bold { font-weight: 600; }
.leading-normal { line-height: 1.4; }
.py-5 {
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.px-5 {
padding-left: 10rpx;
padding-right: 10rpx;
}
.mr-10 {
margin-right: 20rpx;
}
.mr-5 {
margin-right: 10rpx;
}
.ml-2 {
margin-left: 10rpx;
}
.mr-2 {
margin-right: 10rpx;
}
.mb-15 {
margin-bottom: 30rpx;
}
.mb-10 {
margin-bottom: 20rpx;
}
.mb-5 {
margin-bottom: 10rpx;
}
.mt-1 {
margin-top: 6rpx;
}
.pb-10 {
padding-bottom: 20rpx;
}
.flex {
display: flex;
}
.items-start {
align-items: flex-start;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.flex-1 {
flex: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.relative {
position: relative;
}
.border {
border-width: 1px;
border-style: solid;
}
.border-b {
border-bottom-width: 1px;
border-bottom-style: solid;
}
.rounded-full {
border-radius: 9999px;
}
.rounded {
border-radius: 8rpx;
}
.rounded-lg {
border-radius: 12rpx;
}
.shadow-sm {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.text-xs {
font-size: 22rpx;
}
.text-sm {
font-size: 28rpx;
}
.text-base {
font-size: 32rpx;
}
.font-bold {
font-weight: 600;
}
.leading-normal {
line-height: 1.4;
}
/* Colors - Adjusting to match image roughly */
.text-orange-500 { color: #f29e38; }
.bg-orange-100 { background-color: #fff8eb; }
.border-orange-500 { border-color: #f29e38; }
.text-orange-500 {
color: #f29e38;
}
.text-gray-600 { color: #333333; }
.text-gray-500 { color: #999999; }
.text-gray-400 { color: #999999; }
.text-gray-800 { color: #1a1a1a; }
.border-gray-200 { border-color: #e5e5e5; }
.border-gray-100 { border-color: #f5f5f5; }
.bg-orange-100 {
background-color: #fff8eb;
}
.text-green-600 { color: #4b8d5f; }
.border-green-600 { border-color: #4b8d5f; }
.text-red-500 { color: #e04a4a; }
.border-orange-500 {
border-color: #f29e38;
}
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.w-full { width: 100%; }
.whitespace-nowrap { white-space: nowrap; }
.inline-block { display: inline-block; }
.text-gray-600 {
color: #333333;
}
.text-gray-500 {
color: #999999;
}
.text-gray-400 {
color: #999999;
}
.text-gray-800 {
color: #1a1a1a;
}
.border-gray-200 {
border-color: #e5e5e5;
}
.border-gray-100 {
border-color: #f5f5f5;
}
.text-green-600 {
color: #4b8d5f;
}
.border-green-600 {
border-color: #4b8d5f;
}
.text-red-500 {
color: #e04a4a;
}
.sticky {
position: sticky;
}
.top-0 {
top: 0;
}
.z-10 {
z-index: 10;
}
.w-full {
width: 100%;
}
.whitespace-nowrap {
white-space: nowrap;
}
.inline-block {
display: inline-block;
}
.tag-box {
border-radius: 4rpx;

View File

@ -105,12 +105,9 @@ export default defineStore("accountStore", () => {
uni.removeStorageSync('openid');
}
async function getExternalUserId() {
const corpId = account.value?.corpId;
async function getExternalUserId(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()) {
@ -118,9 +115,5 @@ export default defineStore("accountStore", () => {
}
}
watch(account, n => {
getExternalUserId()
}, { immediate: true })
return { account, login, initIMAfterLogin, logout, openid, isIMInitialized, externalUserId, getExternalUserId }
})