feat:app嵌套h5
This commit is contained in:
@@ -3,34 +3,34 @@
|
||||
import LastSurvey from './components/LastSurvey/Index.vue';
|
||||
import Market from './components/Market/Index.vue';
|
||||
import CreateSurvey from './components/CreateSurvey/Index.vue';
|
||||
import { onMounted,ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import utils from '@/assets/js/common';
|
||||
import { getUserInfo } from '@/api/common/index.js';
|
||||
import { showFailToast } from 'vant';
|
||||
let contentShow = ref(false);
|
||||
const contentShow = ref(false);
|
||||
onMounted(async() => {
|
||||
if (utils.getParameter('digitalYiliToken')) {
|
||||
const appToken = utils.getParameter('digitalYiliToken');
|
||||
getUserInfo(appToken).then((res) => {
|
||||
if (res.data) {
|
||||
contentShow = true;
|
||||
contentShow.value = true;
|
||||
utils.setSessionStorage('userInfo', res.data.data);
|
||||
} else {
|
||||
contentShow = false;
|
||||
contentShow.value = false;
|
||||
showFailToast(error.response.data?.message || error.data?.message || error.message || '服务器错误');
|
||||
}
|
||||
}).catch((error) => {
|
||||
contentShow = false;
|
||||
contentShow.value = false;
|
||||
showFailToast(error.response.data?.message || error.message || '服务器错误');
|
||||
});
|
||||
}else{
|
||||
contentShow = true
|
||||
} else {
|
||||
contentShow.value = true;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container" v-if="contentShow">
|
||||
<div v-if="contentShow" class="container">
|
||||
<create-survey />
|
||||
|
||||
<!-- 最新问卷 -->
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
|
||||
<van-cell-group inset style="margin-top: 20px; padding: 30px">
|
||||
<div>
|
||||
<img width="100%"
|
||||
<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="" />
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="qrcode">
|
||||
<img :src="publishInfo.img_url" alt="" width="100px" height="100px" />
|
||||
@@ -18,14 +20,17 @@
|
||||
<div>移动端仅做数据回收,问卷数据分析请前往PC端浏览</div>
|
||||
<div class="operation">
|
||||
<span v-for="(item, index) in operateList" :key="index" @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" />
|
||||
<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>
|
||||
<!-- 底部功能性按钮 -->
|
||||
<div style="
|
||||
<div
|
||||
style="
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
@@ -35,7 +40,8 @@
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
background-color: white;
|
||||
">
|
||||
"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -48,22 +54,21 @@ import utils from '@/assets/js/common';
|
||||
import appBridge from '@/assets/js/appBridge';
|
||||
import { getQrcode } from '@/api/survey';
|
||||
|
||||
|
||||
const route = useRoute();
|
||||
const surveyTitle = route.meta.title as string;
|
||||
appBridge.setTitle(surveyTitle)
|
||||
appBridge.setTitle(surveyTitle);
|
||||
const operateList = reactive([
|
||||
{
|
||||
title: '复制链接',
|
||||
type: 'copyLink',
|
||||
type: 'copyLink'
|
||||
},
|
||||
{
|
||||
title: '转发到微信',
|
||||
type: 'shareLink',
|
||||
type: 'shareLink'
|
||||
},
|
||||
{
|
||||
title: '下载二维码',
|
||||
type: 'qrCode',
|
||||
type: 'qrCode'
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -79,7 +84,7 @@ interface PublishInfo {
|
||||
const publishInfo = ref<PublishInfo>({} as PublishInfo);
|
||||
|
||||
type OperateItem = typeof operateList[0];
|
||||
onMounted(async () => {
|
||||
onMounted(async() => {
|
||||
getQrcode('Xxgdr5EN').then((res) => {
|
||||
if (res.data) {
|
||||
publishInfo.value = res.data.data || {};
|
||||
@@ -90,21 +95,21 @@ onMounted(async () => {
|
||||
});
|
||||
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);
|
||||
@@ -114,7 +119,7 @@ function copyLink () {
|
||||
showSuccessToast('复制成功');
|
||||
}
|
||||
// 分享链接
|
||||
function shareLink () {
|
||||
function shareLink() {
|
||||
const params = {
|
||||
type: 'shareToWx',
|
||||
title: publishInfo.value.download_url.title,
|
||||
@@ -129,7 +134,7 @@ function shareLink () {
|
||||
}
|
||||
|
||||
// 下载二维码
|
||||
function downLoadImg () {
|
||||
function downLoadImg() {
|
||||
const { title, url } = publishInfo.value.download_url;
|
||||
if (utils.getCookie('xToken')) {
|
||||
appBridge.save2Album(url, (result: any) => {
|
||||
@@ -170,6 +175,7 @@ function downLoadImg () {
|
||||
.qrcode {
|
||||
display: flex;
|
||||
margin: 10px 0;
|
||||
|
||||
.tit{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -190,6 +196,7 @@ function downLoadImg () {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
img{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user