diff --git a/src/components/contenteditable.vue b/src/components/contenteditable.vue index 743c430..27cc011 100644 --- a/src/components/contenteditable.vue +++ b/src/components/contenteditable.vue @@ -75,7 +75,7 @@ const functions = { document.execCommand('italic', false, null); }, - uploadImage: async() => { + uploadImage: async () => { // 保存当前光标位置 savedRange.value = saveSelection(); @@ -84,7 +84,7 @@ const functions = { fileInput.click(); - fileInput.onchange = async(e) => { + fileInput.onchange = async (e) => { const [file] = e.target.files; if (!file) return; if (file.size > 2 * 1024 * 1024) { @@ -96,12 +96,28 @@ const functions = { const img = document.createElement('img'); img.src = data.url; img.onload = () => { - const scale = img.naturalHeight / 50; - const width = (img.naturalWidth / scale).toFixed(0); - const height = 50; + // const scale = img.naturalHeight / 50; + // const width = (img.naturalWidth / scale).toFixed(0); + // const height = 50; + // const maxWidth = img.naturalWidth; + // const maxHeight = img.naturalHeight; + // eslint-disable-next-line standard/no-callback-literal + // const style = `style="width:${width}px; + // height:${height}px; + // max-width:${maxWidth}px; + // max-height:${maxHeight}px"`; + // 使用原始高度 + const height = img.naturalHeight; + // 根据宽高比计算宽度 + const width = (height * 3) / 4; const maxWidth = img.naturalWidth; const maxHeight = img.naturalHeight; - const style = `style="width:${width}px;height:${height}px;max-width:${maxWidth}px;max-height:${maxHeight}px"`; + // eslint-disable-next-line standard/no-callback-literal + const style = `style="width:${width}px; + height:${height}px; + max-width:${maxWidth}px; + max-height:${maxHeight}px"`; + // eslint-disable-next-line standard/no-callback-literal insertImageAtCaret(``); // 恢复光标位置 @@ -146,10 +162,10 @@ const isEmptyContent = (html) => { const trimmedHtml = html.trim(); // 检查是否为空字符串、仅包含
或仅包含


return ( - trimmedHtml === '' - || trimmedHtml === '
' - || trimmedHtml === '


' - || trimmedHtml === '

' + trimmedHtml === '' || + trimmedHtml === '
' || + trimmedHtml === '


' || + trimmedHtml === '

' ); }; diff --git a/src/utils/QuestionJsons/MartrixQuestion.js b/src/utils/QuestionJsons/MartrixQuestion.js index 583eccf..9024480 100644 --- a/src/utils/QuestionJsons/MartrixQuestion.js +++ b/src/utils/QuestionJsons/MartrixQuestion.js @@ -12,7 +12,7 @@ export default { is_fixed: 0, is_other: 0, is_remove_other: 0, - option: '

选项1

', + option: '

行标签1

', option_config: { image_url: [], title: '', @@ -22,26 +22,7 @@ export default { }, option_index: 1, parent_id: 0, - type: 0, - cascade: [], - config: [] - }, - { - id: '', - is_fixed: 0, - is_other: 0, - is_remove_other: 0, - option: '

选项2

', - option_config: { - image_url: [], - title: '', - instructions: [], - option_type: 0, - limit_right_content: '' - }, - option_index: 1, - parent_id: 0, - type: 0, + type: 1, cascade: [], config: [] } @@ -67,35 +48,7 @@ export default { gradient: '', image_url: [], option_type: 0, - type: 0, - limit_right_content: '', - child_area: null, - binding_goods_id: '' - }, - disable_option_update: null, - cascade: [] - }, - { - option: '

列标签2

', - id: '1049202', - type: 2, - is_other: 0, - is_fixed: 0, - is_remove_other: 0, - created_at: null, - created_user_id: null, - parent_id: null, - option_index: 4, - list_id: 74491, - option_code: '', - option_config: { - title: '', - instructions: [], - price: 0, - gradient: '', - image_url: [], - option_type: 0, - type: 0, + type: 2, limit_right_content: '', child_area: null, binding_goods_id: '' @@ -103,6 +56,34 @@ export default { disable_option_update: null, cascade: [] } + // { + // option: '

列标签2

', + // id: '1049202', + // type: 2, + // is_other: 0, + // is_fixed: 0, + // is_remove_other: 0, + // created_at: null, + // created_user_id: null, + // parent_id: null, + // option_index: 4, + // list_id: 74491, + // option_code: '', + // option_config: { + // title: '', + // instructions: [], + // price: 0, + // gradient: '', + // image_url: [], + // option_type: 0, + // type: 0, + // limit_right_content: '', + // child_area: null, + // binding_goods_id: '' + // }, + // disable_option_update: null, + // cascade: [] + // } ] ], last_option_index: 1, diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index 2f18c95..4c01d03 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -52,8 +52,8 @@ { +onMounted(async() => { if (appBridge.isInReactNative()) { const appToken = utils.getSessionStorage('xToken'); getUserInfo(appToken) diff --git a/src/views/Home/components/Market/components/MarketItem.vue b/src/views/Home/components/Market/components/MarketItem.vue index 28dbb52..83844bd 100644 --- a/src/views/Home/components/Market/components/MarketItem.vue +++ b/src/views/Home/components/Market/components/MarketItem.vue @@ -101,7 +101,7 @@ const deleteItem = (item) => { showCancelButton: true, confirmButtonColor: '#03B03C' }) - .then(async () => { + .then(async() => { const res = await deleteTemplate(item.sn); if (res.data.code === 0) { showSuccessToast('删除成功'); diff --git a/src/views/Survey/Index.vue b/src/views/Survey/Index.vue index 001ba8b..340439d 100644 --- a/src/views/Survey/Index.vue +++ b/src/views/Survey/Index.vue @@ -141,7 +141,7 @@ const onLoad = () => { fetchSurveys(); }, 500); }; -const fetchSurveys = async () => { +const fetchSurveys = async() => { const params = { page: form.value.page, per_page: form.value.pageSize, @@ -179,7 +179,7 @@ const deleteItem = (item) => { showCancelButton: true, confirmButtonColor: '#03B03C' }) - .then(async () => { + .then(async() => { const res = await deleteSurveys(item.sn); if (res.data.message) { showToast(res.data.message); @@ -203,7 +203,7 @@ const copyItem = (item) => { showCancelButton: true, confirmButtonColor: '#03B03C' }) - .then(async () => { + .then(async() => { const res = await copySurveys(item.sn); if (res.data.code === 200 || res.data.code === 201) { showSuccessToast('复制成功'); @@ -252,7 +252,7 @@ const editItem = (item) => { }); }; // 保存为模板 -const saveTemplate = async (item) => { +const saveTemplate = async(item) => { const data = JSON.parse(JSON.stringify(item)); const res = await saveTemplates(item.sn, data); if (res.data.code === 200 || res.data.code === 201) { diff --git a/src/views/Survey/views/Create/Index.vue b/src/views/Survey/views/Create/Index.vue index 0882854..81535e6 100644 --- a/src/views/Survey/views/Create/Index.vue +++ b/src/views/Survey/views/Create/Index.vue @@ -60,7 +60,7 @@ -
+
+ 添加题目 @@ -431,14 +431,14 @@ const questionEvent = (item) => { options: item.json.options.length > 0 ? item.json.options.map((item) => { - return item.map((it) => { - return { - ...it, - // 主键生成 - id: uuidv4() - }; - }); - }) + return item.map((it) => { + return { + ...it, + // 主键生成 + id: uuidv4() + }; + }); + }) : [] }) ); @@ -577,7 +577,7 @@ const previewQuestion = () => { router.push({ name: 'preview', query: { ...route.query } }); }; -onMounted(async () => { +onMounted(async() => { await getQuestionDetail(); }); @@ -750,6 +750,7 @@ onMounted(async () => { font-weight: bold; font-size: 16px; } + .ques_list { margin-bottom: 10px; }