From f813485bcd71b139857ef1301afc53ac7744e93f Mon Sep 17 00:00:00 2001 From: "liu.huiying@ebiz-digits.com" Date: Wed, 12 Mar 2025 18:26:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:app=E5=B5=8C=E5=A5=97h5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home/Index.vue | 16 +++---- src/views/Survey/views/Publish/Index.vue | 59 +++++++++++++----------- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue index 84093f1..4262091 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -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; } }); @@ -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({} 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; }