Merge branch 'feature/feature-20250331-h5' into uat

This commit is contained in:
liu.huiying@ebiz-digits.com
2025-03-17 13:40:53 +08:00
16 changed files with 201 additions and 124 deletions

11
components.d.ts vendored
View File

@@ -8,9 +8,15 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
Contenteditable: typeof import('./src/components/contenteditable.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElText: typeof import('element-plus/es')['ElText']
RichText: typeof import('./src/components/RichText.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
@@ -23,6 +29,8 @@ 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']
@@ -30,9 +38,12 @@ declare module 'vue' {
VanRadio: typeof import('vant/es')['Radio']
VanRadioGroup: typeof import('vant/es')['RadioGroup']
VanRow: typeof import('vant/es')['Row']
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']

View File

@@ -8,6 +8,14 @@ export function getQuestionList(params) {
});
}
export function consoleSurveys(params) {
return request({
url: '/console/surveys',
method: 'post',
data: params
});
}
export function getSurveysPage(params) {
return request({
url: '/console/surveys',
method: 'get',
@@ -29,3 +37,11 @@ export function getSurveyTemplates(params) {
params
});
}
export function useTemplate(sn, params) {
return request({
url: `console/templates/${sn}`,
method: 'post',
data: params
});
}

View File

@@ -1,6 +1,6 @@
.van-nav-bar {
padding-top: calc(var(--status-bar-height) + 15px) !important;
z-index:999;
padding-top: calc(var(--status-bar-height) + 15px) !important;
}
.van-cell {

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@@ -19,7 +19,7 @@ import appBridge from '@/assets/js/appBridge';
const route = useRoute();
const router = useRouter();
function goBack () {
function goBack() {
if (window.history.length > 1 && route.meta.title !== '伊调研') {
router.go(-1);
} else {

View File

@@ -21,7 +21,7 @@ service.interceptors.request.use(
config.headers.Accept = 'application/json';
}
config.headers.Authorization = `${localStorage.getItem('plantToken')}`;
config.headers.Source = 1
config.headers.Source = 1;
// if (!config.headers.remoteIp) {
// config.baseURL += '/api';
// }

View File

@@ -25,7 +25,7 @@ service.interceptors.request.use(
config.headers.Accept = 'application/json';
}
config.headers.Authorization = `${localStorage.getItem('plantToken')}`;
config.headers.Source = 1
config.headers.Source = 1;
// if (!config.headers.remoteIp) {
// config.baseURL += '/api';
// }

View File

@@ -1,6 +1,8 @@
<template>
<van-field v-model="element.stem" :label="element.stem" :required="element.config.is_required === 1" label-align="top"
class="contenteditable-question-title base-select">
<van-field
v-model="element.stem" :label="element.stem" :required="element.config.is_required === 1" label-align="top"
class="contenteditable-question-title base-select"
>
<template #left-icon>
{{ index + 1 }}
</template>
@@ -11,11 +13,15 @@
<template #input>
<template v-for="(item, optionIndex) in element.options" :key="item.id">
<van-radio-group v-if="element.question_type === 1" v-model="choiceValue">
<option-action :data="isPreview ? item.options : item" :active="active" :question="element"
handle=".moverQues">
<option-action
:data="isPreview ? item.options : item" :active="active" :question="element"
handle=".moverQues"
>
<template #item="{ element: it, index: itIndex }">
<van-radio :key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem">
<van-radio
:key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem"
>
<!-- 自定义文本 -->
<template #default>
<div class="flex align-center van-cell">
@@ -37,11 +43,15 @@
</van-radio-group>
<van-checkbox-group v-if="element.question_type === 2" v-model="value" shape="square">
<option-action v-model:data="element.options[optionIndex]" handle=".moverQues" :active="active"
:question="element">
<option-action
v-model:data="element.options[optionIndex]" handle=".moverQues" :active="active"
:question="element"
>
<template #item="{ element: it, index: itIndex }">
<van-checkbox :key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem">
<van-checkbox
:key="itIndex" :name="it.option_index" :label="it.label" :disabled="it.disabled"
icon-size="0.45rem"
>
<template #default>
<div class="flex align-center van-cell">
<contenteditable v-model="it.option" className="contenteditable-input" :active="active">
@@ -106,7 +116,6 @@ const emitValue = () => {
}
.base-select {
& .van-checkbox-group,
.van-radio-group {
width: 100%;

View File

@@ -12,20 +12,24 @@ const show = ref(false);
onMounted(async() => {
if (utils.getSessionStorage('xToken')) {
const appToken = utils.getSessionStorage('xToken');
getUserInfo(appToken).then((res) => {
if (res.data) {
contentShow.value = true;
let token = res.data.data.token;
localStorage.setItem('plantToken',token)
utils.setSessionStorage('userInfo', res.data.data);
} else {
getUserInfo(appToken)
.then((res) => {
if (res.data) {
contentShow.value = true;
const token = res.data.data.token;
localStorage.setItem('plantToken', token);
utils.setSessionStorage('userInfo', res.data.data);
} else {
contentShow.value = false;
showFailToast(
error.response.data?.message || error.data?.message || error.message || '服务器错误'
);
}
})
.catch((error) => {
contentShow.value = false;
showFailToast(error.response.data?.message || error.data?.message || error.message || '服务器错误');
}
}).catch((error) => {
contentShow.value = false;
showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
});
showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
});
} else {
contentShow.value = true;
}
@@ -37,7 +41,7 @@ function create() {
<template>
<div v-if="contentShow" class="container">
<create-survey />
<create-survey :createdNewPage="false" />
<!-- 最新问卷 -->
<last-survey />
<!-- 模板市场 -->
@@ -49,7 +53,7 @@ function create() {
</div>
</div>
<van-popup v-model:show="show" round closeable position="bottom">
<CreateSurvey></CreateSurvey>
<CreateSurvey :createdNewPage="true"></CreateSurvey>
</van-popup>
</template>

View File

@@ -1,6 +1,6 @@
<script setup>
import { ref, onMounted } from 'vue';
import { consoleSurveys, getQuestionList } from '@/api/home/index.js';
import { consoleSurveys, getQuestionList, useTemplate } from '@/api/home/index.js';
import { snQuestions, saveQuestions } from '@/api/design/index.js';
import { useRouter } from 'vue-router';
import { useCounterStore } from '@/stores/counter';
@@ -12,35 +12,70 @@ const store = storeToRefs(counterStore);
const router = useRouter();
const surveys = ref([]);
const createdNewPage = defineModel('createdNewPage', {
type: Boolean,
default: false
});
const createdQuestion = (item) => {
const query = {
group_id: 0,
project_name: `${item.title}问卷 `,
remarks: '',
scene_code: item.scene_code,
scene_code_info: item.scene_code_info,
scene_code: item.parentCode,
scene_code_info: item.code,
// 很迷茫 模板新增 tag 空数组 非模板 就是k
tags: ''
};
consoleSurveys(query).then((res) => {
if (res.data) {
snQuestions({ sn: res.data.data.sn }).then((ques) => {
if (ques.data) {
ques.data.data.survey.introduction = `<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!(此提示语为默认提示语,您可选择自行输入本问卷的提示语)</p>`;
store.questionsInfo.value = ques.data.data;
saveQuestions({
sn: res.data.data.sn,
introduction: ques.data.data.survey.introduction,
title: ques.data.data.survey.title
}).then(() => {
router.push({
path: '/create',
query: {
sn: res.data.data.sn
}
});
});
if (createdNewPage.value) {
query.scene_code = item.parentCode;
query.tags = '';
} else {
if (item.sn) {
query.scene_code = null;
query.tags = [];
}
}
// 如果放在了底部 当作新增组件
if (createdNewPage.value) {
consoleSurveys(query).then((res) => {
if (res.data) {
createdApx(res);
}
});
} else {
if (item.sn) {
useTemplate(item.sn, query).then((temp) => {
if (temp.data) {
createdApx(temp);
}
});
} else {
consoleSurveys(query).then((res) => {
if (res.data) {
createdApx(res);
}
});
}
}
};
const createdApx = (res) => {
snQuestions({ sn: res.data.data.sn }).then((ques) => {
if (ques.data) {
ques.data.data.survey.introduction = `<p>为优化活动服务品质,烦请完成问卷,感谢配合!您的反馈至关重要!(此提示语为默认提示语,您可选择自行输入本问卷的提示语)</p>`;
store.questionsInfo.value = ques.data.data;
saveQuestions({
sn: res.data.data.sn,
introduction: ques.data.data.survey.introduction,
title: ques.data.data.survey.title
}).then(() => {
router.push({
path: '/create',
query: {
sn: res.data.data.sn
}
});
});
}
});
};

View File

@@ -41,18 +41,18 @@
<script setup>
import { ref, onMounted } from 'vue';
import { consoleSurveys } from '@/api/home/index.js';
import { getSurveysPage } from '@/api/home/index.js';
const survey = ref({
project_name: ''
});
const fetchSurveys = async() => {
const fetchSurveys = async () => {
const params = {
page: 1,
per_page: 10,
group_id: 0
};
const res = await consoleSurveys(params);
const res = await getSurveysPage(params);
if (res.data.code === 0) {
survey.value = res.data.data[0];
} else {

View File

@@ -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) => {
@@ -28,23 +28,24 @@ const getTableList = async() => {
marketList.value.push(item);
}
});
getMarketInfo(marketList.value[0]);
}
};
const getMarketInfo = async(item) => {
const code = marketList.value.filter((market, index) => item === index)[0].code;
const params = {
page: 1,
per_page: 10,
group_id: 0,
is_public: 1,
scene_code_info: code,
sort: 'quote_nums, desc'
};
const res = await getSurveyTemplates(params);
if (res.data.code === 0) {
marketInfo.value = res.data.data;
const getMarketInfo = async (item) => {
const data = marketList.value.filter((market, index) => item === index)[0];
if (data) {
const params = {
page: 1,
per_page: 10,
group_id: 0,
is_public: 1,
scene_code_info: data.code,
sort: 'quote_nums, desc'
};
const res = await getSurveyTemplates(params);
if (res.data.code === 0) {
marketInfo.value = res.data.data;
}
}
};

View File

@@ -2,36 +2,30 @@
<div class="container">
<layout />
<div class="content">
<van-cell-group v-if="status === 1" inset style="padding-top: 15px">
<div v-if="status === 1" inset>
<div>
<img
width="100%"
src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333"
alt=""
/>
<img width="100%" :src="bg" alt="" />
</div>
<div class="qrcode">
<img :src="publishInfo?.img_url" alt="" width="100px" height="100px" />
<div class="tit">
<div>{{ publishInfo?.download_url?.title || '' }}</div>
<div>扫码填写问卷</div>
<div style="font-size: 14px;font-weight: 600;">扫码填写问卷</div>
</div>
</div>
<div style="color: #7f7f7f">移动端仅做数据回收问卷数据分析请前往PC端浏览</div>
<div class="tip">移动端仅做数据回收问卷数据分析请前往PC端浏览</div>
<div class="operation">
<span v-for="(item, index) in operateList" :key="index" @click="operateBtn(item)">
<img width="30px" :src="item.icon" />
<img width="30px" :src="item.icon" alt="" />
{{ item.title }}
</span>
</div>
</van-cell-group>
</div>
<div v-if="status === 0 || status === 2" class="pulish-container">
<img class="not-publish-icon" src="@/assets/img/publish/not_pulish.png" alt="" />
<div class="text">点击"启用"按钮后问卷才可以开始回收数据</div>
<van-button
type="primary" style="margin-top: 20px" class="publish-btn" color="#70b936"
@click="openPublishModal"
>
<van-button type="primary" style="margin-top: 20px" class="publish-btn" color="#70b936"
@click="openPublishModal">
<template #icon>
<i class="mobilefont icon-fabu3" style="margin-right: 6px"></i>
</template>
@@ -52,6 +46,7 @@ import appBridge from '@/assets/js/appBridge';
import { getQrcode, getSurveyInfo, publishSurvey } from '@/api/survey';
import { canPlanetPublish } from '@/layouts/utils.js';
// import configUrl from '../../../../config';
import bg from '@/assets/img/publish/bg.png';
import copyIcon from '@/assets/img/publish/copy_icon.png';
import shareIcon from '@/assets/img/publish/share_icon.png';
import downloadIcon from '@/assets/img/publish/download_icon.png';
@@ -60,15 +55,13 @@ const route = useRoute();
const surveyTitle = route.meta.title as string;
appBridge.setTitle(surveyTitle);
const sn = route.query.sn;
// `0`: 编辑中 `1`: 投放中 `2`: 已结束
const status = ref<number>(0);
const status = ref<number>(0); // `0`: 编辑中 `1`: 投放中 `2`: 已结束
const publishType = ref(0);
const operateList = reactive([
{
title: '复制链接',
type: 'copyLink',
icon: copyIcon
// icon: 'https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u21.png?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333'
},
{
title: '转发到微信',
@@ -97,21 +90,21 @@ type OperateItem = (typeof operateList)[0];
const operateBtn = (item: OperateItem) => {
switch (item.type) {
case 'shareLink':
shareLink();
break;
case 'copyLink':
copyLink();
break;
case 'qrCode':
downLoadImg();
break;
default:
break;
case 'shareLink':
shareLink();
break;
case 'copyLink':
copyLink();
break;
case 'qrCode':
downLoadImg();
break;
default:
break;
}
};
// 复制链接
function copyLink() {
function copyLink () {
const input = document.createElement('input');
input.value = publishInfo.value.url;
document.body.appendChild(input);
@@ -121,22 +114,22 @@ function copyLink() {
showToast('复制成功');
}
// 分享链接
function shareLink() {
function shareLink () {
const params = {
type: 'shareToWx',
title: publishInfo.value.download_url.title,
description: publishInfo.value.desc || '',
thumbImageUrl: publishInfo.value.img_url,
webpageUrl: publishInfo.value.url,
// 朋友圈1 微信好友0
scene: 0
scene: 0 // 朋友圈1 微信好友0
};
// console.log('shareUrl', publishInfo.value.url);
appBridge.shareToWeChat(params);
console.log('shareUrl', publishInfo.value.url);
appBridge.shareToWeChat(params, () => {
});
}
// 下载二维码
function downLoadImg() {
function downLoadImg () {
const { title, url } = publishInfo.value.download_url;
if (utils.getSessionStorage('xToken')) {
appBridge.save2Album(url, () => {
@@ -151,7 +144,7 @@ function downLoadImg() {
document.body.removeChild(link);
}
}
async function openPublishModal() {
async function openPublishModal () {
const res = await canPlanetPublish(route.query.sn as string, publishType.value);
if (res) {
await publishSurvey({
@@ -167,7 +160,7 @@ async function openPublishModal() {
}
}
function getCode() {
function getCode () {
getQrcode(sn)
.then((res) => {
if (res.data) {
@@ -178,7 +171,7 @@ function getCode() {
showFailToast(error.data?.message || error.message || '服务器错误');
});
}
function fetchInfo() {
function fetchInfo () {
getSurveyInfo(sn)
.then((res) => {
status.value = Number(res.data.data.status);
@@ -192,8 +185,8 @@ watch(status, (val) => {
getCode();
}
});
onMounted(async() => {
// status.value = 0;
onMounted(async () => {
// status.value = 1;
// publishInfo.value.img_url
// = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
// publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`;
@@ -208,41 +201,49 @@ onMounted(async() => {
<style scoped lang="scss">
.container {
height: 100vh;
background-color: #f5f5f5;
background: linear-gradient(to bottom, #70B937 5.33333rem, #F2F2F2 8rem);
button {
padding: 3px 20px;
border: none;
background-color: #f2f2f2;
/* background-color: #f2f2f2; */
}
}
.content {
margin: 10px 15px;
margin: 10px;
padding-bottom: 30px;
border-radius: 3px;
border-radius: 8px;
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
}
.qrcode {
display: flex;
margin: 10px 0;
.tit {
.qrcode {
display: flex;
flex-direction: column;
justify-content: center;
margin: 0 10px;
line-height: 20px;
margin: 10px 24px;
.tit {
display: flex;
flex-direction: column;
justify-content: center;
margin: 0 10px;
line-height: 20px;
}
}
.tip {
margin: 18px 24px;
font-size: 12px;
color: #7f7f7f;
}
}
.operation {
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 25px 10px 0 0;
margin: 0 24px;
span {
display: flex;