feat:app嵌套h5

This commit is contained in:
liu.huiying@ebiz-digits.com
2025-03-12 11:38:39 +08:00
parent 03698d975a
commit 4f047b8b59
17 changed files with 698 additions and 108 deletions

3
.env
View File

@@ -8,3 +8,6 @@ VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/
VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync
VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken
VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com
# VITE_APP_BASE_APPURL=https://ycsb-gw-uat.dcin-test.digitalyili.com
# VITE_APP_APPKEY=62f495a0f7854e4e46ebbf40
# VITE_APP_APPID=m5c66hlce3

View File

@@ -8,3 +8,6 @@ VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/
VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync
VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken
VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com
# VITE_APP_BASE_APPURL=https://ycsb-gw-uat.dcin-test.digitalyili.com
# VITE_APP_APPKEY=62f495a0f7854e4e46ebbf40
# VITE_APP_APPID=m5c66hlce3

View File

@@ -1,5 +1,17 @@
<script setup lang="ts">
import { RouterView } from 'vue-router';
import { onMounted } from 'vue';
import appBridge from '@/assets/js/appBridge';
import utils from '@/assets/js/common';
onMounted(async() => {
if (utils.getParameter('digitalYiliToken')) {
// 隐藏/显示 header
appBridge.setHeaderShown(false);
// 设置系统状态栏明暗主题
appBridge.setStatusBarStyle('light');
}
});
</script>
<template>

10
src/api/common/index.js Normal file
View File

@@ -0,0 +1,10 @@
import request from '@/utils/request.js';
// 校验token返回用户信息
export function getUserInfo(params) {
return request({
url: '/thirdPartyInterfaceInfoEx/test',
method: 'get',
params
});
}

34
src/api/survey/index.js Normal file
View File

@@ -0,0 +1,34 @@
import request from '@/utils/request';
// 投放问卷
export function publishSurvey(data) {
return request({
url: `/console/survey_publishes`,
method: 'post',
data
});
}
// 问卷详情
export function getSurveyInfo(sn) {
return request({
url: `/console/surveys/${sn}`,
method: 'get'
});
}
// 查看二维码
export function getQrcode(sn) {
return request({
url: `/console/survey_publishes/${sn}/qrcode`,
method: 'get'
});
}
// 获取问卷测试是否弹层
export function getCheckSurvey(sn) {
return request({
url: `/console/check_survey_test/${sn}`,
method: 'get'
});
}

View File

@@ -3,16 +3,6 @@
@import 'vant';
@import '../../fonts/moblie/iconfont.css';
$theme-color: #70b936;
::v-deep .theme-color {
color: $theme-color;
}
::v-deep .theme-back-color {
background-color: $theme-color;
}
a,
.green {
padding: 3px;

289
src/assets/js/appBridge.js Normal file
View File

@@ -0,0 +1,289 @@
export default {
/** ****************** ReactNative通信 ********************/
/**
* 生成唯一ID
* @returns {string} 唯一ID
*/
generateUniqueId() {
return `cb_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
},
/**
* @desc 检查是否在ReactNative环境中
* @returns {Boolean} 是否在ReactNative WebView中
*/
isInReactNative() {
return typeof window !== 'undefined' && !!window.ReactNativeWebView;
},
/**
* @desc 发送消息到ReactNative
* @param {Object} message 消息对象
* @returns {Boolean} 发送是否成功
*/
postMessageToRN(data) {
if (!this.isInReactNative()) {
return false;
}
try {
window.ReactNativeWebView.postMessage(JSON.stringify(data));
return true;
} catch (error) {
return false;
}
},
/**
* @desc 控制头部导航栏显示/隐藏
* @param {Boolean} visible 是否显示导航栏
* @returns {Boolean} 操作是否成功
*/
setHeaderShown(visible = false) {
return this.postMessageToRN({
type: 'headerShown',
visible
});
},
/**
* @desc 关闭当前页面,触发返回操作
* @returns {Boolean} 操作是否成功
*/
navigateBack() {
return this.postMessageToRN({
type: 'back'
});
},
/**
* @desc 设置头部导航栏标题
* @param {String} title 标题文本
* @returns {Boolean} 操作是否成功
*/
setTitle(title) {
if (title) {
return this.postMessageToRN({
type: 'title',
title
});
}
},
/**
* @desc 设置系统状态栏明暗主题
* @param {String} style 主题风格,'light'为浅色,'dark'为深色
* @returns {Boolean} 操作是否成功
*/
setStatusBarStyle(style = 'light') {
return this.postMessageToRN({
type: 'statusBar',
style
});
},
/**
* @desc 跳转到APP页面
* @param {String} url APP内页面路由
* @returns {Boolean} 操作是否成功
*/
navigateToAppPage(url) {
return this.postMessageToRN({
type: 'navigate',
url
});
},
// /**
// * @desc 跳转到H5页面
// * @param {String} h5Url 目标H5链接
// * @param {String} name 导航头中的标题文案
// * @param {Boolean} fullscreen 是否全屏显示(隐藏导航头)
// * @returns {Boolean} 操作是否成功
// */
// navigateToH5(h5Url, name, fullscreen = false) {
// if (fullscreen) {
// h5Url = this.appendQueryParam(h5Url, 'fullscreen', 'true');
// }
// return this.postMessageToRN({
// type: 'navigate',
// url: `authH5?url=${encodeURIComponent(h5Url)}&name=${name}`
// });
// },
// /**
// * @desc 给URL添加查询参数
// * @param {String} url 原始URL
// * @param {String} key 参数名
// * @param {String} value 参数值
// * @returns {String} 添加参数后的URL
// * @private
// */
// appendQueryParam(url, key, value) {
// const separator = url.includes('?') ? '&' : '?';
// return `${url}${separator}${key}=${value}`;
// },
/**
* @desc 禁用原生返回Android
* @returns {Boolean} 操作是否成功
*/
takeOverAndroidBack() {
return this.postMessageToRN({
type: 'takeOverAndroidBack'
});
},
/**
* @desc 跳转到手机浏览器中打开页面
* @param {String} url 要打开的URL
* @returns {Boolean} 操作是否成功
*/
openInBrowser(url) {
return this.postMessageToRN({
type: 'openLink',
url
});
},
/**
* @desc 使用原生扫码工具
* @param {Function} callback 扫码结果回调函数
* @returns {Boolean} 操作是否成功
*/
scanCode(callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'scanCode',
cbId
});
},
/**
* @desc 分享链接到微信
* @param {Object} options 分享选项
* @param {String} options.title 分享标题
* @param {String} options.description 分享副标题
* @param {String} options.thumbImageUrl 缩略图URL
* @param {String} options.webpageUrl 网页链接
* @param {Number} options.scene 分享场景0为微信好友1为朋友圈
* @param {Function} callback 分享结果回调函数
* @returns {Boolean} 操作是否成功
*/
shareToWeChat(options, callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'shareToWx',
title: options.title,
description: options.description,
thumbImageUrl: options.thumbImageUrl,
webpageUrl: options.webpageUrl,
scene: options.scene || 0,
cbId
});
},
/**
* @desc 分享视频到抖音
* @param {Object} options 分享选项
* @param {String} options.title 分享标题
* @param {String} options.shortTitle 抖音短标题
* @param {Array<String>} options.videos 视频地址数组
* @param {Boolean} options.isPublish 是否直接跳转到发布页
* @param {Boolean} options.tip 是否显示APP自带的提示与loading
* @param {Function} callback 分享结果回调函数
* @returns {Boolean} 操作是否成功
*/
shareVideoToDouyin(options, callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'shareVideoToDouyin',
title: options.title,
shortTitle: options.shortTitle,
videos: options.videos,
isPublish: options.isPublish !== false,
tip: options.tip !== false,
cbId
});
},
/**
* @desc 唤起抖音
* @param {Function} callback 操作结果回调函数
* @returns {Boolean} 操作是否成功
*/
openDouyin(callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'openDouyin',
cbId
});
},
/**
* @desc 分享文本到微博
* @param {String} content 要分享的文本内容
* @param {Function} callback 分享结果回调函数
* @returns {Boolean} 操作是否成功
*/
shareTextToWeibo(content, callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'shareTextToWeibo',
content,
cbId
});
},
/**
* @desc 保存到相册
* @param {String} src 媒体资源URL图片或视频
* @param {Function} callback 保存结果回调函数
* @returns {Boolean} 操作是否成功
*/
save2Album(src, callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'save2Album',
src,
cbId
});
},
/**
* @desc 请求安卓权限
* @param {String} permission 权限名称,如'android.permission.CAMERA'
* @param {Function} callback 请求结果回调函数
* @returns {Boolean} 操作是否成功
*/
requestAndroidPermission(permission, callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'androidPermission',
permission,
cbId
});
},
/**
* @desc 获取新的认证令牌
* @param {Function} callback 获取结果回调函数,参数格式为:
* {status: 0|1, msg: string, data: string}
* status: 0成功1失败
* msg: 错误信息
* data: 新token
* @returns {Boolean} 操作是否成功
*/
getNewAuthToken(callback) {
const cbId = this.generateUniqueId();
window[cbId] = callback;
return this.postMessageToRN({
type: 'newAuthToken',
cbId
});
}
};

164
src/assets/js/common.js Normal file
View File

@@ -0,0 +1,164 @@
export default {
/** ****************** 数据转换工具 ********************/
/**
* @desc json转string
* @param {*} value 值
* @return {*} value 值
*/
_json2string(value) {
return JSON.stringify(value);
},
/**
* @desc string转json
* @param {*} value 值
* @return {*} value 值
*/
_string2json(value) {
try {
value = JSON.parse(value);
} catch (e) {}
return value;
},
/**
* @desc 对象解除关联(深拷贝)
* @param {*} obj
*/
convertObj(obj) {
return JSON.parse(JSON.stringify(obj));
},
/** ****************** Cookie操作 ********************/
/**
* @desc 获取cookie
* @param {String} name 名称
* @return {*} 值
*/
getCookie(name) {
let rs = '';
const nameStr = `${name}=`;
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(nameStr) !== -1) {
rs = this._string2json(c.substring(nameStr.length, c.length));
}
}
return rs;
},
/**
* @desc 设置cookie
* @param {String} name 名称
* @param {*} value 值
* @param {Number} hours 过期时间(小时)
*/
setCookie(name, value, hours) {
let str = `${name}=${this._json2string(value)}`;
if (hours && hours > 0) {
const date = new Date();
date.setTime(date.getTime() + hours * 3600 * 1000);
str += `; expires=${date.toUTCString()}`;
}
document.cookie = str;
},
/**
* @desc 删除cookie
* @param {String} name 名称
* @param {Object} options 选项
* @param {Boolean} options.usePath 是否指定路径
*/
delCookie(name, options = {}) {
const date = new Date();
date.setTime(date.getTime() - 10000);
let cookieStr = `${name}=a; expires=${date.toGMTString()}`;
if (options.usePath) {
cookieStr += ';path=/micro;';
}
document.cookie = cookieStr;
},
/**
* @desc 删除cookie带路径
* @param {String} name 名称
*/
clearCookie(name) {
this.delCookie(name, { usePath: true });
},
/** ****************** 本地存储操作 ********************/
/**
* @desc 获取localStorage中指定的变量
* @param {String} name 名称
* @return {*} 值
*/
getStorage(name) {
return this._string2json(window.localStorage[name]);
},
/**
* @desc 设置localStorage中指定的变量
* @param {String} name 名称
* @param {*} value 值
*/
setStorage(name, value) {
window.localStorage[name] = this._json2string(value);
},
/**
* @desc 删除localStorage中指定的变量
* @param {String} name 名称
*/
delStorage(name) {
window.localStorage.removeItem(name);
},
/**
* @desc 获取sessionStorage中指定的变量
* @param {String} name 名称
* @return {*} 值
*/
getSessionStorage(name) {
return this._string2json(window.sessionStorage.getItem(name));
},
/**
* @desc 设置sessionStorage中指定的变量
* @param {String} name 名称
* @param {*} value 值
*/
setSessionStorage(name, value) {
window.sessionStorage.setItem(name, this._json2string(value));
},
/**
* @desc 删除sessionStorage中指定的变量
* @param {String} name 名称
*/
delSessionStorage(name) {
window.sessionStorage.removeItem(name);
},
/** ****************** URL工具 ********************/
/**
* @desc 获取URL中的参数
* @param {String} name 参数名
* @return {String} 参数值
*/
getParameter(name) {
const reg = new RegExp(`${name}=.*`, 'g');
const str = window.location.href.match(reg);
if (str) {
return str[0].split('&')[0].split('=')[1];
} else {
return '';
}
}
};

View File

@@ -134,7 +134,6 @@ onMounted(() => {
bottom: 0;
left: 0;
z-index: 2008;
display: flex;
width: 100%;
height: 40px;
padding: 0 10px;

View File

@@ -9,4 +9,6 @@ export default {
jsonpUrl: import.meta.env.VITE_APP_JSONPURL,
jqrUrl: import.meta.env.VITE_APP_YQRURL,
currentMode: import.meta.env.VITE_APP_CURRENTMODE
// appKey: import.meta.env.VITE_APP_APPKEY,
// appId: import.meta.env.VITE_APP_APPID
};

View File

@@ -1,4 +1,4 @@
import '@/assets/css/main.scss';
import './assets/css/main.scss';
import 'amfe-flexible';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
@@ -6,6 +6,15 @@ import App from './App.vue';
import router from './router';
// 2. 引入组件样式
import 'vant/lib/index.css';
// // 调整路由守卫的设置位置
// router.beforeEach((to, from, next) => {
// if (to.query.digitalYiliToken) {
// utils.delCookie('xToken');
// utils.clearCookie('xToken');
// utils.setCookie('xToken', to.query.xToken, 7);
// }
// next();
// });
const app = createApp(App);
app.use(createPinia());
app.use(router);

View File

@@ -15,7 +15,6 @@
:index="index"
:chooseQuestionId="chooseQuestionId"
@get-choose-question-id="getChooseQuestionId"
@move="emitFun.move"
>
<!-- 选择题 -->
<Choice
@@ -104,8 +103,6 @@
</div>
</template>
</choose-question>
<!-- 增加控制按钮-->
<slot name="button" :item="element"></slot>
<!-- {{ element.question_type }}-->
<!-- {{questionInfo.survey.pages.length}}-->
@@ -298,14 +295,6 @@ const actionFun = {
}
};
// emit 事件
const emitFun = {
move: (ev) => {
console.log(ev);
}
};
onMounted(() => {
questionInfo.value = store.questionsInfo.value;
});

View File

@@ -158,8 +158,6 @@ const deleteQuestion = () => {
});
};
// emit
const emit = defineEmits(['move', 'copy']);
// 打开题目弹窗
const openQuestionActionModel = () => {
show.value = true;
@@ -168,7 +166,6 @@ const openQuestionActionModel = () => {
const openQuestionSettingModel = () => {
questionShow.value = true;
};
// 题目上下移动
const questionMove = (action) => {
if (action.action === 'down') {
@@ -178,8 +175,6 @@ const questionMove = (action) => {
const temp = questions.value[props.questionIndex];
questions.value.splice(props.questionIndex, 1);
questions.value.splice(props.questionIndex + 1, 0, temp);
emit('move', 'down');
} else if (action.action === 'up') {
if (props.questionIndex === 0) {
return;
@@ -187,7 +182,6 @@ const questionMove = (action) => {
const temp = questions.value[props.questionIndex];
questions.value.splice(props.questionIndex, 1);
questions.value.splice(props.questionIndex - 1, 0, temp);
emit('move', 'up');
} else {
// 复制 题目 生成新的id 更新最新的 last index
const temp = questions.value[props.questionIndex];
@@ -197,7 +191,6 @@ const questionMove = (action) => {
question_index: questionsInfo.value.survey.last_question_index + 1
});
questionsInfo.value.survey.last_question_index += 1;
emit('copy', 'down');
}
};

View File

@@ -17,10 +17,20 @@
v-model:data="element"
:questions="questions"
:questionIndex="index"
@move="emit('move', $event)"
@copy="emit('copy', $event)"
></question-action>
</template>
<!-- <div-->
<!-- v-for="item in questionAction"-->
<!-- :key="item.key"-->
<!-- class=""-->
<!-- :class="item.class ? item.class : ''"-->
<!-- @click="itemAction(item)"-->
<!-- >-->
<!-- <i class="icon iconfont choose-question-active-container-icon" v-html="item.icon"></i>-->
<!-- <div class="choose-question-active-container-name">-->
<!-- {{ item.name }}-->
<!-- </div>-->
<!-- </div>-->
</van-cell>
</div>
</div>
@@ -49,14 +59,70 @@ const props = defineProps({
}
});
const element = ref(props.element);
// 选中题目后出现的操作
const emit = defineEmits(['getChooseQuestionId', 'move', 'copy']);
// const questionAction = ref([
// {
// icon: '&#xe630;',
// name: '编辑',
// key: 'edit',
// class: ''
// },
// {
// icon: '&#xe632;',
// name: '复制',
// key: 'copy',
// class: ''
// },
// {
// icon: '&#xe6a0;',
// name: '移动',
// key: 'moveUp',
// class: 'moverQues'
// },
// // {
// // icon:'',
// // name:'下移',
// // key:'moveDown',
// // class:''
// // },
// {
// icon: '&#xe63f;',
// name: '删除',
// key: 'delete',
// class: ''
// }
// ]);
const emit = defineEmits(['getChooseQuestionId']);
// 选中题目
const chooseItem = () => {
// 使用从 defineProps 接收的 element 对象
emit('getChooseQuestionId', props.element);
};
// const itemAction = (item) => {
// switch (item.key) {
// case 'edit':
// // vue router跳转到/edit
//
// router.push({
// path: '/design/edit',
// query: {
// id: props.element.id
// }
// });
// break;
// case 'copy':
// break;
// case 'moveUp':
// break;
// case 'moveDown':
// break;
// case 'delete':
// break;
// }
// };
</script>
<style scoped lang="scss">
.choose-question-container {

View File

@@ -3,6 +3,36 @@
import LastSurvey from './components/LastSurvey/Index.vue';
import Market from './components/Market/Index.vue';
import CreateSurvey from './components/CreateSurvey/Index.vue';
import { onMounted } from 'vue';
import utils from '@/assets/js/common';
import { getUserInfo } from '@/api/common/index.js';
import { showFailToast } from 'vant';
onMounted(async() => {
if (utils.getParameter('digitalYiliToken')) {
const query = {
xToken: utils.getParameter('digitalYiliToken')
};
getUserInfo(query).then((res) => {
// res = {
// code: 200,
// message: null,
// data: {
// deptName: '总部数字科技中心',
// userName: '黄静',
// userCode: '10046899',
// deptCode: '10001892',
// buName: '总部'
// }
// };
if (res.data) {
utils.setSessionStorage('userInfo', res.data);
} else {
showFailToast(error.data?.message || error.message || '服务器错误');
}
});
}
});
</script>
<template>

View File

@@ -25,23 +25,17 @@
></contenteditable>
</div>
<van-button v-if="questionInfo.questions.length === 0" size="small" @click="show = true">
添加题目
</van-button>
<button v-if="questionInfo.questions.length === 0" @click="show = true">添加题目</button>
</div>
</van-cell-group>
<div class="ques">
<!-- 题目-->
<Design :active-id="activeId" class="design" @get-active-question="getActiveQuestion">
<template #button="{ item }">
<div class="design-button">
<van-button v-if="activeId === item.id" size="small" @click="show = true">
添加题目
</van-button>
</div>
</template>
</Design>
<Design
:active-id="activeId"
class="desgin"
@get-active-question="getActiveQuestion"
></Design>
<!-- <van-button @click="show = true">添加题目</van-button>-->
<!-- 弹出的新增题目弹窗-->
<van-popup
@@ -80,9 +74,9 @@
<span>投放设置</span>
</div>
<div class="survey-action_btn">
<van-button size="small" @click="previewQuestion">预览</van-button>
<van-button size="small" @click="saveAs">保存</van-button>
<van-button size="small" @click="publishQuestion">投放</van-button>
<van-button size="small">预览</van-button>
<van-button size="small">保存</van-button>
<van-button size="small" @click="$router.push({ name: 'publish' })">投放</van-button>
</div>
</div>
</div>
@@ -102,7 +96,6 @@
size="0.5rem"
:active-value="1"
:inactive-value="0"
@change="saveIsOnePage"
></van-switch>
</template>
</van-cell>
@@ -309,9 +302,8 @@ import {
signQuestion,
nps
} from '@/utils/importJsons';
import { useRoute, useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import YLPicker from '@/components/YLPicker.vue';
import { getPages } from '@/utils/public';
// 获取 Store 实例
const counterStore = useCounterStore();
@@ -322,7 +314,6 @@ const activeQuestionIndex = ref(-1);
const currentDate = ref();
const currentType = ref();
const route = useRoute();
const router = useRouter();
const surveyTitle = route.meta.title as string;
const show = ref(false);
// const textModel = ref(false);
@@ -353,7 +344,6 @@ const onConfirmDate = (e) => {
// 获取选中的题目
const getActiveQuestion = (activeQues) => {
chooseQuestionId.value = activeQues.id;
activeId.value = activeQues.id;
// 在questions 里 查找index 给 activeQuestionIndex
questionInfo.value.questions.forEach((item, index) => {
if (item.id === activeQues.id) {
@@ -492,10 +482,9 @@ const saveQuestionItem = (questionJson) => {
questions: [questionJson],
survey: {
local_pages: [],
pages: getPages(
questionInfo.value.questions,
questionInfo.value.survey.is_one_page_one_question
),
pages: questionInfo.value.questions.map((item) => {
return [item.question_index];
}),
version: Base64.encode(`${new Date().getTime()}`)
}
}
@@ -531,13 +520,6 @@ const saveSetting = (parentKey, childKeys) => {
});
};
// 保存是否每页一题
const saveIsOnePage = () => {
questionDetails({
sn: route.query.sn,
is_one_page_one_question: questionInfo.value.survey.is_one_page_one_question
});
};
const init = () => {
// event.detail 为当前输入的值
show.value = true;
@@ -583,21 +565,7 @@ watch(
},
{ deep: true }
);
// 保存 目前没有任何逻辑可以执行所有保存
const saveAs = () => {
// 保存所有
};
// 投放
const publishQuestion = () => {
router.push({ name: 'publish', query: { ...route.query } });
};
// 预览
const previewQuestion = () => {
router.push({ name: 'preview', query: { ...route.query } });
};
onMounted(async () => {
onMounted(async() => {
await getQuestionDetail(); // 等待接口返回数据
});
</script>
@@ -630,10 +598,8 @@ onMounted(async () => {
& > button {
margin: 20px;
//border-radius: 10px;
background-color: #70b936;
color: #fff;
border-radius: 10px;
background-color: lightgreen;
}
}
}
@@ -658,21 +624,8 @@ onMounted(async () => {
font-size: 16px;
}
& .design {
padding-bottom: 60px;
& .design-button {
width: 100%;
text-align: center;
::v-deep .van-button {
background-color: #70b936;
//width: 140px;
color: #fff;
font-size: 12px;
}
}
& .desgin {
padding-bottom: 50px;
}
.ques_list {

View File

@@ -19,13 +19,13 @@
</div>
<div>移动端仅做数据回收问卷数据分析请前往PC端浏览</div>
<div class="operation">
<span v-for="item in 2" :key="item">
<span v-for="item in operateList" :key="item" @click="operateBtn(item)">
<img
width="30px"
src="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"
/>
复制链接
{{ item.title }}
</span>
</div>
</van-cell-group>
@@ -49,9 +49,53 @@
<script setup lang="ts">
import { useRoute } from 'vue-router';
import { onMounted } from 'vue';
import appBridge from '@/assets/js/appBridge';
import { getQrcode } from '@/api/survey';
const route = useRoute();
const surveyTitle = route.meta.title as string;
const operateList = [
{
title: '复制链接',
img: 'copyLink'
},
{
title: '转发到微信',
type: 'shareLink',
img: ''
},
{
title: '下载二维码',
type: 'qrCode',
img: ''
}
];
onMounted(async() => {
const { data: linkData } = await getQrcode('Xxgdr5EN');
console.log('linkData', linkData);
});
// 分享链接
const shareLink = () => {
const url = window.location.href;
const params = {
type: 'shareToWx',
title: '分享标题',
description: '分享副标题',
thumbImageUrl: 'https://logo.png',
webpageUrl: 'https://example.com',
scene: 0 // 朋友圈1 微信好友0
};
appBridge.shareToWeChat(params);
};
const operateBtn = (item) => {
console.log(item);
switch (item.type) {
case 'shareLink':
shareLink();
break;
}
};
</script>
<style scoped lang="scss">