feat(api): 新增通用上传文件方法
- 添加 uploadFileWidthSn 和 uploadFileWidthSnForAnswer 方法用于上传文件 - 实现 getOssInfo 方法获取 OSS 信息 - 添加 cosUpload3D 和 cosUpload 方法上传文件到 COS- 实现 docuHousecosUpload 方法上传文件到阿里云和文档库 - 优化文件命名和错误处理
This commit is contained in:
@@ -33,7 +33,9 @@ function showModal(options) {
|
||||
.then(() => {
|
||||
// confirm();
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
// catch();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,13 +43,13 @@ function showModal(options) {
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const canPlanetPublishPSM = function (data) {
|
||||
const canPlanetPublishPSM = function(data) {
|
||||
let isFb = true;
|
||||
let message = '';
|
||||
let title = '题目设置未完成';
|
||||
const incompleteQuestionList = [];
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
if (s.question_type === 101 && s.config.price_gradient.length <= 0) {
|
||||
isFb = false;
|
||||
message = 'psm题目未完成设置,请设置价格区间后投放';
|
||||
@@ -72,15 +74,15 @@ const canPlanetPublishPSM = function (data) {
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const canPlanetPublishMxdAndHotArea = function (data) {
|
||||
const canPlanetPublishMxdAndHotArea = function(data) {
|
||||
let isFb = true;
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
const incompleteQuestionList = [];
|
||||
let type = 0;
|
||||
let title = '题目设置未完成';
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
if (s.question_type === 105 && s.config.design_version <= 0) {
|
||||
isFb = false;
|
||||
message = 'maxdiff题目未完成设置,请生成设计后投放';
|
||||
@@ -119,21 +121,23 @@ const canPlanetPublishMxdAndHotArea = function (data) {
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const canPlanetPublish3D = function (data) {
|
||||
const canPlanetPublish3D = function(data) {
|
||||
{
|
||||
let canFB = true;
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||
try {
|
||||
if (s.config.is_three_dimensions && !s.config.scene) {
|
||||
canFB = false;
|
||||
qSteams.push(`(${s.title})`);
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-eval
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -154,15 +158,15 @@ const canPlanetPublish3D = function (data) {
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
if (QUESTION_TYPE.contains(s.question_type)) {
|
||||
try {
|
||||
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
||||
const wares = [];
|
||||
const _sceneInformation = s.config.scene_information;
|
||||
const sceneInformation =
|
||||
typeof _sceneInformation === 'string'
|
||||
const sceneInformation
|
||||
= typeof _sceneInformation === 'string'
|
||||
? JSON.parse(_sceneInformation)
|
||||
: _sceneInformation;
|
||||
sceneInformation.shelves.forEach((shelf) => {
|
||||
@@ -174,7 +178,10 @@ const canPlanetPublish3D = function (data) {
|
||||
|
||||
const options = s.options.flat();
|
||||
s.associate.forEach((ass) => {
|
||||
const question = data.questions.find((q) => q.question_index == ass.question_index);
|
||||
// eslint-disable-next-line no-eval
|
||||
const question = data.questions.find(
|
||||
(q) => q.question_index === ass.question_index
|
||||
);
|
||||
if (!question) return;
|
||||
options.push(...question.options.flat());
|
||||
});
|
||||
@@ -184,7 +191,9 @@ const canPlanetPublish3D = function (data) {
|
||||
qSteams.push(`(${s.title})`);
|
||||
}
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
// error
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -207,14 +216,14 @@ const canPlanetPublish3D = function (data) {
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const canPlanetPublishImage = function (data) {
|
||||
const canPlanetPublishImage = function(data) {
|
||||
{
|
||||
let canFB = true;
|
||||
let message = '';
|
||||
const qSteams = [];
|
||||
let title = '';
|
||||
data.questions &&
|
||||
data.questions.forEach((s) => {
|
||||
data.questions
|
||||
&& data.questions.forEach((s) => {
|
||||
if (s.question_type === 13) {
|
||||
try {
|
||||
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
||||
@@ -284,9 +293,10 @@ function canPublishRandom(data, publishType) {
|
||||
const publishStr = ['', '预览', '投放'][publishType] || '投放';
|
||||
|
||||
const errors = [];
|
||||
// eslint-disable-next-line no-eval
|
||||
const randomList = data?.survey?.group_pages || [];
|
||||
|
||||
randomList.forEach((random, randomIndex) => {
|
||||
randomList.forEach((random) => {
|
||||
const list = random.list || [];
|
||||
|
||||
// 每一个随机,至少要有两个随机题组
|
||||
@@ -308,8 +318,8 @@ function canPublishRandom(data, publishType) {
|
||||
if (!isValidated) {
|
||||
errors.push({
|
||||
message:
|
||||
field.message ||
|
||||
`请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
||||
field.message
|
||||
|| `请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"`
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -369,11 +379,11 @@ function isLoopingLogicValid(data, publishType) {
|
||||
if (
|
||||
(data?.cycle_pages || []).every((i) => {
|
||||
return (
|
||||
i.question_index &&
|
||||
i.relation_type !== undefined &&
|
||||
i.relation_type !== null &&
|
||||
i.first_page &&
|
||||
i.last_page
|
||||
i.question_index
|
||||
&& i.relation_type !== undefined
|
||||
&& i.relation_type !== null
|
||||
&& i.first_page
|
||||
&& i.last_page
|
||||
);
|
||||
})
|
||||
) {
|
||||
@@ -397,7 +407,7 @@ function isLoopingLogicValid(data, publishType) {
|
||||
* @param sn
|
||||
* @param publishType undefined投放;null投放;0投放;1预览;2投放;3测试
|
||||
*/
|
||||
export const canPlanetPublish = async function (sn, publishType) {
|
||||
export const canPlanetPublish = async function(sn, publishType) {
|
||||
const parsedPublishType = !publishType ? 2 : publishType;
|
||||
const num = window.location.href.indexOf('code=');
|
||||
let code;
|
||||
|
||||
Reference in New Issue
Block a user