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() { 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) { if (res && res.success && res.data) {
customer.value = res.data; customer.value = res.data;
setDisabledTitles(res.data) setDisabledTitles(res.data)

View File

@ -30,10 +30,13 @@
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import FullPage from "@/components/full-page.vue"; import FullPage from "@/components/full-page.vue";
import api from "@/utils/api.js"; import api from "@/utils/api.js";
import { set } from "@/utils/cache";
import { toast } from "@/utils/widget.js";
import { ref } from "vue"; import { ref } from "vue";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
const { account } = storeToRefs(useAccountStore()); const { account } = storeToRefs(useAccountStore());
const { login } = useAccountStore()
const loading = ref(true); const loading = ref(true);
const error = ref(""); const error = ref("");
const articleData = ref({ const articleData = ref({
@ -102,6 +105,7 @@ const loadArticle = async () => {
if (res.success && res.data) { if (res.success && res.data) {
// //
let date = ""; let date = "";
if (res.data.createTime) { if (res.data.createTime) {
const d = new Date(res.data.createTime); const d = new Date(res.data.createTime);
const year = d.getFullYear(); const year = d.getFullYear();
@ -115,6 +119,34 @@ const loadArticle = async () => {
content: processRichTextContent(res.data.content || ""), content: processRichTextContent(res.data.content || ""),
date: date, 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 { } else {
error.value = res.message || "加载文章失败"; 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) => { onLoad((options) => {
corpId.value = options.corpId; corpId.value = options.corpId;
if (options.id) { if (options.id) {
articleId = options.id; articleId = options.id;
markArticleRead(options.sendId || ''); if (options.sendId) {
handleSend(options.sendId)
}
loadArticle(); loadArticle();
} else { } else {
error.value = "文章信息不完整"; error.value = "文章信息不完整";

View File

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