fix: 修复问题
This commit is contained in:
parent
384b6a08a7
commit
2bd1cd2349
@ -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)
|
||||
|
||||
@ -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 = "文章信息不完整";
|
||||
|
||||
@ -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}` });
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ const urlsConfig = {
|
||||
searchRateList: 'searchRateList',
|
||||
submitRateRecord: 'submitRateRecord',
|
||||
getRateRecord: 'getRateRecord',
|
||||
relateWechatAccountWithTeam: 'relateWechatAccountWithTeam'
|
||||
},
|
||||
member: {
|
||||
addCustomer: 'add',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user