fix: 修复问题

This commit is contained in:
huxuejian 2026-05-15 17:51:38 +08:00
parent 384b6a08a7
commit 2bd1cd2349
4 changed files with 82 additions and 19 deletions

View File

@ -237,7 +237,7 @@ async function getBaseForm() {
}
async function getCustomer() {
const res = await api('getRefrencePeople', { customerId: customerId.value });
const res = await api('getCustomerByCustomerId', { customerId: customerId.value });
if (res && res.success && res.data) {
customer.value = res.data;
setDisabledTitles(res.data)

View File

@ -30,10 +30,13 @@
import { onLoad } from "@dcloudio/uni-app";
import FullPage from "@/components/full-page.vue";
import api from "@/utils/api.js";
import { set } from "@/utils/cache";
import { toast } from "@/utils/widget.js";
import { ref } from "vue";
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
const { account } = storeToRefs(useAccountStore());
const { login } = useAccountStore()
const loading = ref(true);
const error = ref("");
const articleData = ref({
@ -102,6 +105,7 @@ const loadArticle = async () => {
if (res.success && res.data) {
//
let date = "";
if (res.data.createTime) {
const d = new Date(res.data.createTime);
const year = d.getFullYear();
@ -115,6 +119,34 @@ const loadArticle = async () => {
content: processRichTextContent(res.data.content || ""),
date: date,
};
if (isWechatChannels(res.data)) {
uni.openChannelsActivity({
finderUserName: res.data.wechatChannels.finderUserName,
feedId: res.data.wechatChannels.feedId,
fail: err => {
const errMsg = err.errMsg || '';
if (/cancel/i.test(errMsg)) {
return
}
toast(`打开视频号失败:${errMsg}`)
}
})
return
}
// if (res.data.link) {
// uni.openOfficialAccountArticle({
// url: res.data.link,
// fail: err => {
// const errMsg = err.errMsg || '';
// console.error(errMsg)
// console.log(errMsg)
// if (/cancel/i.test(errMsg)) {
// return
// }
// toast(`:${errMsg}`)
// }
// })
// }
} else {
error.value = res.message || "加载文章失败";
}
@ -126,11 +158,41 @@ const loadArticle = async () => {
}
};
function isWechatChannels(item) {
return item?.wechatChannels?.finderUserName && item?.wechatChannels?.feedId;
}
async function handleSend(sendId) {
try {
await login();
markArticleRead(sendId);
authToTeam(sendId)
} catch (e) {
console.log(e)
}
}
//
async function authToTeam(sendId) {
const res = await api("relateWechatAccountWithTeam", {
sendId,
openid: account.value?.openid,
unionid: account.value?.unionid,
appid: account.value?.appId,
})
if (res.success) {
set('home-invite-team-info', { teamId: res.data })
}
}
onLoad((options) => {
corpId.value = options.corpId;
if (options.id) {
articleId = options.id;
markArticleRead(options.sendId || '');
if (options.sendId) {
handleSend(options.sendId)
}
loadArticle();
} else {
error.value = "文章信息不完整";

View File

@ -198,23 +198,23 @@ const loadArticleList = async (reset = false) => {
function goToDetail(item) {
if (!item?.articleId) return;
if (isWechatChannels(item.articleInfo)) {
uni.openChannelsActivity({
finderUserName: item.articleInfo.wechatChannels.finderUserName,
feedId: item.articleInfo.wechatChannels.feedId,
success: () => {
markArticleRead(item._id, item.articleId);
},
fail: err => {
const errMsg = err.errMsg || '';
if (/cancel/i.test(errMsg)) {
return
}
toast(`打开视频号失败:${errMsg}`)
}
})
return
}
// if (isWechatChannels(item.articleInfo)) {
// uni.openChannelsActivity({
// finderUserName: item.articleInfo.wechatChannels.finderUserName,
// feedId: item.articleInfo.wechatChannels.feedId,
// success: () => {
// markArticleRead(item._id, item.articleId);
// },
// fail: err => {
// const errMsg = err.errMsg || '';
// if (/cancel/i.test(errMsg)) {
// return
// }
// toast(`:${errMsg}`)
// }
// })
// return
// }
uni.navigateTo({ url: `/pages/article/article-detail?sendId=${item._id}&id=${item.articleId}&corpId=${corpId.value}` });
}

View File

@ -42,6 +42,7 @@ const urlsConfig = {
searchRateList: 'searchRateList',
submitRateRecord: 'submitRateRecord',
getRateRecord: 'getRateRecord',
relateWechatAccountWithTeam: 'relateWechatAccountWithTeam'
},
member: {
addCustomer: 'add',