feat: 将Markdown渲染改为HTML渲染
- CMS相关字段由Markdown改为WYSIWYG,前端做出对应更改 - AssetUrl重写:将CMS地址重写为本地API
This commit is contained in:
@ -3,5 +3,13 @@ import { companyProfileService } from '~~/server/services/cms/companyProfileServ
|
||||
export default defineEventHandler(async (event) => {
|
||||
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||
|
||||
return companyProfileService.getCompanyProfile(locale);
|
||||
const companyProfile = await companyProfileService.getCompanyProfile(locale);
|
||||
|
||||
companyProfile.content = rewriteAssetUrls(
|
||||
companyProfile.content,
|
||||
useRuntimeConfig().public.directus.url,
|
||||
'/api/assets'
|
||||
);
|
||||
|
||||
return companyProfile;
|
||||
});
|
||||
|
||||
@ -3,5 +3,13 @@ import { contactInfoService } from '~~/server/services/cms/contactInfoService';
|
||||
export default defineEventHandler(async (event) => {
|
||||
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||
|
||||
return contactInfoService.getContactInfo(locale);
|
||||
const contactInfo = await contactInfoService.getContactInfo(locale);
|
||||
|
||||
contactInfo.content = rewriteAssetUrls(
|
||||
contactInfo.content,
|
||||
useRuntimeConfig().public.directus.url,
|
||||
'/api/assets'
|
||||
);
|
||||
|
||||
return contactInfo;
|
||||
});
|
||||
|
||||
@ -9,5 +9,13 @@ export default defineEventHandler(async (event) => {
|
||||
});
|
||||
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||
|
||||
return productService.getProductById(id, locale);
|
||||
const product = await productService.getProductById(id, locale);
|
||||
|
||||
product.description = rewriteAssetUrls(
|
||||
product.description,
|
||||
useRuntimeConfig().public.directus.url,
|
||||
'/api/assets'
|
||||
);
|
||||
|
||||
return product;
|
||||
});
|
||||
|
||||
@ -2,5 +2,15 @@ import { questionService } from '~~/server/services/cms/questionService';
|
||||
export default defineEventHandler(async (event) => {
|
||||
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||
|
||||
return questionService.getQuestionList(locale);
|
||||
const questions = await questionService.getQuestionList(locale);
|
||||
|
||||
questions.forEach((question) => {
|
||||
question.content = rewriteAssetUrls(
|
||||
question.content,
|
||||
useRuntimeConfig().public.directus.url,
|
||||
'/api/assets'
|
||||
);
|
||||
});
|
||||
|
||||
return questions;
|
||||
});
|
||||
|
||||
@ -10,5 +10,13 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
const locale = getHeader(event, 'x-locale') || 'zh-CN';
|
||||
|
||||
return solutionService.getSolutionById(id, locale);
|
||||
const solution = await solutionService.getSolutionById(id, locale);
|
||||
|
||||
solution.content = rewriteAssetUrls(
|
||||
solution.content,
|
||||
useRuntimeConfig().public.directus.url,
|
||||
'/api/assets'
|
||||
);
|
||||
|
||||
return solution;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user