diff --git a/components.d.ts b/components.d.ts index 8649f3a..407e547 100644 --- a/components.d.ts +++ b/components.d.ts @@ -2,12 +2,13 @@ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 -export {}; +export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { Contenteditable: typeof import('./src/components/contenteditable.vue')['default'] + ElInput: typeof import('element-plus/es')['ElInput'] ElOption: typeof import('element-plus/es')['ElOption'] ElSelect: typeof import('element-plus/es')['ElSelect'] RichText: typeof import('./src/components/RichText.vue')['default'] @@ -22,7 +23,10 @@ declare module 'vue' { VanCol: typeof import('vant/es')['Col'] VanDivider: typeof import('vant/es')['Divider'] VanField: typeof import('vant/es')['Field'] + VanGrid: typeof import('vant/es')['Grid'] + VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] + VanNavBar: typeof import('vant/es')['NavBar'] VanPicker: typeof import('vant/es')['Picker'] VanPopup: typeof import('vant/es')['Popup'] VanRadio: typeof import('vant/es')['Radio'] @@ -31,11 +35,10 @@ declare module 'vue' { VanSearch: typeof import('vant/es')['Search'] VanStepper: typeof import('vant/es')['Stepper'] VanSwitch: typeof import('vant/es')['Switch'] - VanTab: typeof import('vant/es')['Tab'] VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbarItem: typeof import('vant/es')['TabbarItem'] - VanTabs: typeof import('vant/es')['Tabs'] YLCascader: typeof import('./src/components/YLCascader.vue')['default'] + YLInput: typeof import('./src/components/YLInput.vue')['default'] YLPicker: typeof import('./src/components/YLPicker.vue')['default'] YLSelect: typeof import('./src/components/YLSelect.vue')['default'] } diff --git a/package.json b/package.json index 69c3662..3587663 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "vconsole": "^3.15.1", "vite-plugin-vue": "^0.0.1", "vue": "^3.4.29", + "vue-icons-plus": "^0.1.8", "vue-router": "^4.3.3", "vuex": "^4.1.0" }, diff --git a/src/App.vue b/src/App.vue index ed3e316..96f5004 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,7 +7,7 @@ import utils from '@/assets/js/common'; onMounted(async() => { if (utils.getSessionStorage('xToken')) { // 隐藏/显示 header - appBridge.setHeaderShown(true); + appBridge.setHeaderShown(false); // 设置系统状态栏明暗主题 appBridge.setStatusBarStyle('light'); } diff --git a/src/assets/css/base.scss b/src/assets/css/base.scss index 24f77c9..9994ee6 100644 --- a/src/assets/css/base.scss +++ b/src/assets/css/base.scss @@ -1,5 +1,6 @@ /* color palette from */ :root { + --primary-color : rgb(111,185, 55); --vt-c-white: #fff; --vt-c-white-soft: #f8f8f8; --vt-c-white-mute: #f2f2f2; diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 97365b9..8554b1f 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -12,11 +12,21 @@ a, transition: 0.4s; } +.theme-color { + color: $theme-color; +} + +.theme-background { + background: $theme-color; +} + .ml10 { margin-left: 10px; } .container { + // 容器的高度 , 减少底部之后的高度 + //height: calc(100vh - 100px); //width: 100%; // 绿色 #70B937 白色过渡渐变 竖向 上一半部分 渐变到白色就可以 background: linear-gradient(to bottom, $theme-color 200px, #f2f2f2 300px); diff --git a/src/components/YLInput.vue b/src/components/YLInput.vue new file mode 100644 index 0000000..4d0cfe7 --- /dev/null +++ b/src/components/YLInput.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/components/YLPicker.vue b/src/components/YLPicker.vue index 7e5cf8f..c5108d0 100644 --- a/src/components/YLPicker.vue +++ b/src/components/YLPicker.vue @@ -170,8 +170,8 @@ const getMaxDateLimit = computed(() => { props.format ); const tempStr = '0000-12-31 23:59:59'; - const result = - props.maxDate.length !== 0 && thisMax.length > props.maxDate.length + const result + = props.maxDate.length !== 0 && thisMax.length > props.maxDate.length ? thisMax.slice(0, props.maxDate.length) + tempStr.slice(props.maxDate.length) : thisMax; return result.slice(0, props.format.length); @@ -194,8 +194,8 @@ function onChange({ selectedValues, columnIndex }) { renderMinuteColumns, renderSecondColumns ]; - updateColumns[columnIndex] && - updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false); + updateColumns[columnIndex] + && updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false); } // 渲染全部列 diff --git a/src/components/YLSelect.vue b/src/components/YLSelect.vue index f89fb02..d15c9a9 100644 --- a/src/components/YLSelect.vue +++ b/src/components/YLSelect.vue @@ -18,6 +18,8 @@
+ + @@ -84,6 +86,7 @@ export default defineComponent({ display: inline-block; font-size: 16px; /* 增加字体大小 */ line-height: 1.5; /* 增加行高 */ + //margin-botton: 10px; } .yl-select-label { @@ -97,6 +100,6 @@ export default defineComponent({ diff --git a/src/fonts/demo.css b/src/fonts/demo.css index 0e97475..7df7d71 100644 --- a/src/fonts/demo.css +++ b/src/fonts/demo.css @@ -4,11 +4,11 @@ src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') - format('embedded-opentype'), + format('embedded-opentype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') - format('svg'); + format('svg'); src: url('//at.alicdn.com/t/c/font_4841764_vat2jbvw3q.woff2?t=1741575060989') format('woff2'), url('//at.alicdn.com/t/c/font_4841764_vat2jbvw3q.woff?t=1741575060989') format('woff'), diff --git a/src/fonts/moblie/demo.css b/src/fonts/moblie/demo.css index 18e8077..12ec742 100644 --- a/src/fonts/moblie/demo.css +++ b/src/fonts/moblie/demo.css @@ -4,11 +4,11 @@ src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') - format('embedded-opentype'), + format('embedded-opentype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') - format('svg'); + format('svg'); } .logo { diff --git a/src/layouts/index.vue b/src/layouts/index.vue index bac7f76..82fd6d1 100644 --- a/src/layouts/index.vue +++ b/src/layouts/index.vue @@ -2,8 +2,18 @@
-
{{ $route.meta.title }}
- + +
@@ -59,32 +69,29 @@ const table = [ } ]; function tabPath(path) { - router.push({ - path - }); - // if (utils.getParameter('digitalYiliToken')) { - // const appToken = utils.getParameter('digitalYiliToken'); - // getUserInfo(appToken) - // .then((res) => { - // if (res.data) { - // utils.setSessionStorage('userInfo', res.data.data); - // router.push({ - // path - // }); - // } else { - // showFailToast( - // error.response.data?.message || error.data?.message || error.message || '服务器错误' - // ); - // } - // }) - // .catch((error) => { - // showFailToast(error?.response?.data?.message || error?.message || '服务器错误'); - // }); - // } else { - // router.push({ - // path - // }); - // } + if (utils.getParameter('digitalYiliToken')) { + const appToken = utils.getParameter('digitalYiliToken'); + getUserInfo(appToken) + .then((res) => { + if (res.data) { + utils.setSessionStorage('userInfo', res.data.data); + router.push({ + path + }); + } else { + showFailToast( + error.response.data?.message || error.data?.message || error.message || '服务器错误' + ); + } + }) + .catch((error) => { + showFailToast(error?.response?.data?.message || error?.message || '服务器错误'); + }); + } else { + router.push({ + path + }); + } } @@ -96,10 +103,16 @@ function tabPath(path) { } .header { - position: sticky; - top: 0; - z-index: 1000; - background-color: #a5d380; + .header-nav { + background: var(--primary-color) !important; + } + + .header-search { + padding: 13px; + + //.input-class { + //} + } .title { display: flex; diff --git a/src/layouts/utils.js b/src/layouts/utils.js index f84cd22..7b11928 100644 --- a/src/layouts/utils.js +++ b/src/layouts/utils.js @@ -46,13 +46,13 @@ function showModal(options) { * @param {*} data * @returns */ -const canPlanetPublishPSM = function (data) { +const canPlanetPublishPSM = function(data) { let isFb = true; let content = ''; 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; content = 'psm题目未完成设置,请设置价格区间后投放'; @@ -77,15 +77,15 @@ const canPlanetPublishPSM = function (data) { * @param {*} data * @returns */ -const canPlanetPublishMxdAndHotArea = function (data) { +const canPlanetPublishMxdAndHotArea = function(data) { let isFb = true; let content = ''; 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; content = 'maxdiff题目未完成设置,请生成设计后投放'; @@ -124,14 +124,14 @@ const canPlanetPublishMxdAndHotArea = function (data) { * @param {*} data * @returns */ -const canPlanetPublish3D = function (data) { +const canPlanetPublish3D = function(data) { { let canFB = true; let content = ''; 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) { @@ -161,15 +161,15 @@ const canPlanetPublish3D = function (data) { let content = ''; 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) => { @@ -221,14 +221,14 @@ const canPlanetPublish3D = function (data) { * @param {*} data * @returns */ -const canPlanetPublishImage = function (data) { +const canPlanetPublishImage = function(data) { { let canFB = true; let content = ''; 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)) { @@ -323,8 +323,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}”` }); } }); @@ -378,7 +378,7 @@ function canPublishRandom(data, publishType) { // return false; // } -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='); diff --git a/src/main.ts b/src/main.ts index a9ab12b..d42604f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,8 +3,6 @@ import 'amfe-flexible'; import { createApp } from 'vue'; import { createPinia } from 'pinia'; import App from './App.vue'; -import 'vant/lib/index.css'; - import router from './router'; import utils from '@/assets/js/common'; // 2. 引入组件样式 @@ -12,9 +10,15 @@ import 'vant/lib/index.css'; import '@/style/utils.scss'; import appBridge from '@/assets/js/appBridge'; import VConsole from 'vconsole'; -let vconsole; +const app = createApp(App); + +// import VConsole from 'vconsole'; +// let vconsole; if (import.meta.env.VITE_APP_ENV !== 'production') { - vconsole = new VConsole(); + const vconsole = new VConsole(); + app.use(vconsole); + // eslint-disable-next-line no-unused-vars + // vconsole = new VConsole(); } // 添加 TypeScript 类型声明,在文件顶部添加 @@ -29,7 +33,7 @@ router.beforeEach((to, from, next) => { if (to.query.digitalYiliToken) { utils.setSessionStorage('xToken', to.query.digitalYiliToken); } - appBridge.setTitle(to.meta.title as string); + // appBridge.setTitle(to.meta.title as string); // 设置禁止原生返回 appBridge.takeOverAndroidBack(); // 定义路由是否可以返回的判断 @@ -45,16 +49,13 @@ router.beforeEach((to, from, next) => { // 添加 Android 返回按钮监听方法 window.onAndroidBack = () => { if (routerCanGoBack()) { - console.log('h5返回') - router.back(); + router.back(); } else { - console.log('app返回') - callAppGoBack(); // 调用 APP 的返回方法 + callAppGoBack(); } }; next(); }); -const app = createApp(App); app.use(createPinia()); app.use(router); app.mount('#app'); diff --git a/src/request/api/modules/survey.ts b/src/request/api/modules/survey.ts index c665a46..24a3eba 100644 --- a/src/request/api/modules/survey.ts +++ b/src/request/api/modules/survey.ts @@ -1,2 +1,2 @@ -export const surveyQuestion = - 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions'; +export const surveyQuestion + = 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions'; diff --git a/src/request/axios/index.ts b/src/request/axios/index.ts index 5cce295..8d7e34c 100644 --- a/src/request/axios/index.ts +++ b/src/request/axios/index.ts @@ -38,10 +38,10 @@ service.interceptors.request.use( service.interceptors.response.use( (response) => { if ( - response.status === 200 || - response.status === 201 || - response.status === 202 || - response.status === 204 + response.status === 200 + || response.status === 201 + || response.status === 202 + || response.status === 204 ) { if (response.config.method === 'put') { // message.success('保存中...'); diff --git a/src/utils/questionSteeingList.js b/src/utils/questionSteeingList.js new file mode 100644 index 0000000..3af67ce --- /dev/null +++ b/src/utils/questionSteeingList.js @@ -0,0 +1,86 @@ +const groupOptions = [ + { + label: '选项', + value: 0 + } + // { + // label: '分组', + // value: 1 + // // disabled: true + // } +]; +const settingIfOptions = [ + { label: 'IF', value: 'if' }, + { label: 'Always', value: 'always' } +]; +const settingAndOptions = [ + { label: 'AND', value: 'and' }, + { label: 'OR', value: 'or' } +]; +const answerOptions = [ + { label: '为空', value: 0 }, + { label: '不为空', value: 1 } +]; +const chooseOptions = [ + { label: '被选中', value: 1 }, + { label: '未被选中', value: 0 } +]; + +const symbolOptions = [ + { + label: '=', + value: '=' + }, + { + label: '≠', + value: '≠' + }, + { + label: '>', + value: '>' + }, + { + label: '≥', + value: '>' + }, + { + label: '<', + value: '<' + }, + { + label: '≤', + value: '≤' + } +]; + +// 包含 +// 不包含 +// +// 不是 +const completionOptions = [ + { + label: '包含', + value: '包含' + }, + { + label: '不包含', + value: '不包含' + }, + { + label: '是', + value: '是' + }, + { + label: '不是', + value: '不是' + } +]; +export { + groupOptions, + settingIfOptions, + settingAndOptions, + answerOptions, + symbolOptions, + chooseOptions, + completionOptions +}; diff --git a/src/utils/request.js b/src/utils/request.js index ef6eac0..36538c8 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -43,10 +43,10 @@ service.interceptors.request.use( service.interceptors.response.use( (response) => { if ( - response.status === 200 || - response.status === 201 || - response.status === 202 || - response.status === 204 + response.status === 200 + || response.status === 201 + || response.status === 202 + || response.status === 204 ) { if (response.config.method === 'put') { // message.success('保存中...'); diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index 05f73ed..e0dedef 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -14,6 +14,7 @@ :questions="questionInfo.questions" :index="index" :chooseQuestionId="chooseQuestionId" + :questionsInfo="questionInfo" @get-choose-question-id="getChooseQuestionId" @move="emitFun.move" @copy="emitFun.copy" @@ -239,10 +240,10 @@ const chooseQuestionIndex = ref(-1); const questionInfo = computed(() => store.questionsInfo.value); // 自动更新 题型 watch( - () => questionInfo.value.questions[chooseQuestionIndex.value], + () => questionInfo.value.questions, (newVal) => { if (newVal) { - // saveQueItem(questionInfo.value.logics, [newVal]); + saveQueItem(questionInfo.value.logics, newVal); // 确保保存最新的数据 } }, { deep: true } @@ -417,6 +418,8 @@ const emitFun = { saveQueItem(null, [item]); }, logics: (item) => { + // console.log(questionInfo.value.logics[); + // return false; saveQueItem(questionInfo.value.logics, [item]); } }; diff --git a/src/views/Design/components/ActionCompoents/QuestionAction.vue b/src/views/Design/components/ActionCompoents/QuestionAction.vue index dc5bc16..a8ac18e 100644 --- a/src/views/Design/components/ActionCompoents/QuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/QuestionAction.vue @@ -124,7 +124,12 @@
- + {{ questionsInfo.logics[2].logic }} +
@@ -132,19 +137,13 @@ + diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeCompletion.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeCompletion.vue new file mode 100644 index 0000000..26b11f4 --- /dev/null +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeCompletion.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeRadio.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeRadio.vue new file mode 100644 index 0000000..c9c8e36 --- /dev/null +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/BeforComponent/BeforeRadio.vue @@ -0,0 +1,99 @@ + + + diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/QuestionBefore.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/QuestionBefore.vue index e5bd59f..d15ec75 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/QuestionBefore.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/QuestionBefore.vue @@ -5,78 +5,84 @@ >
@@ -92,14 +98,14 @@
- - 删除 - + + + + + + + + @@ -112,14 +118,12 @@ @@ -356,19 +287,21 @@ const logicIf = (value, index) => { } .question-before { + width: 100%; + & .if { flex: none; - width: 90px; + width: 100%; } & .question { - flex: none; - width: 210px; + //flex: none; + //width: 210px; } & .group { - flex: none; - width: 75px; + //flex: none; + //width: 75px; } & .answer { diff --git a/src/views/Design/components/ChooseQuestion.vue b/src/views/Design/components/ChooseQuestion.vue index d59344c..dee0e04 100644 --- a/src/views/Design/components/ChooseQuestion.vue +++ b/src/views/Design/components/ChooseQuestion.vue @@ -21,6 +21,7 @@ diff --git a/src/views/Home/components/LastSurvey/Index.vue b/src/views/Home/components/LastSurvey/Index.vue index ec1c27a..b367a46 100644 --- a/src/views/Home/components/LastSurvey/Index.vue +++ b/src/views/Home/components/LastSurvey/Index.vue @@ -46,7 +46,7 @@ import { consoleSurveys } from '@/api/home/index.js'; const survey = ref({ project_name: '' }); -const fetchSurveys = async () => { +const fetchSurveys = async() => { const params = { page: 1, per_page: 10, diff --git a/src/views/Home/components/Market/Index.vue b/src/views/Home/components/Market/Index.vue index 1a5ffa5..ae0ed30 100644 --- a/src/views/Home/components/Market/Index.vue +++ b/src/views/Home/components/Market/Index.vue @@ -20,7 +20,7 @@ const marketList = ref([]); const active = ref(null); const marketInfo = ref([]); -const getTableList = async () => { +const getTableList = async() => { const res = await getListScene(); if (res.data.code === 0) { res.data.data.forEach((item) => { @@ -32,7 +32,7 @@ const getTableList = async () => { getMarketInfo(marketList.value[0]); } }; -const getMarketInfo = async (item) => { +const getMarketInfo = async(item) => { console.log(item); const code = marketList.value.filter((market, index) => item === index)[0].code; console.log(code); diff --git a/src/views/Home/components/Market/components/MarketItem.vue b/src/views/Home/components/Market/components/MarketItem.vue index c240547..a0d0c9b 100644 --- a/src/views/Home/components/Market/components/MarketItem.vue +++ b/src/views/Home/components/Market/components/MarketItem.vue @@ -6,60 +6,10 @@
- - - - +

{{ item.title }}

- - - - - - +
@@ -78,6 +28,8 @@
+