| | |
| | | const appStore = useAppStore(); |
| | | const { latestRoute } = storeToRefs(appStore); |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | const system = useSystemStore(); |
| | | |
| | | const router = Taro.useRouter(); |
| | | |
| | |
| | | console.log('router: params', router, blLifeRecharge.accountModel.channlesNum); |
| | | |
| | | Taro.useTabItemTap((item) => { |
| | | system.setTabIndex(item.index as any); |
| | | Taro.reLaunch({ |
| | | url: pathAddExtraParam(item.pagePath, { channelId: blLifeRecharge.accountModel.channlesNum }), |
| | | success() { |
| | |
| | | import { Image } from '@tarojs/components'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { useLifeRechargeContext } from '@life-payment/core-vue'; |
| | | import { useUser } from '@/hooks'; |
| | | import { isH5, isInWeChat } from '@/utils/env'; |
| | | |
| | | defineOptions({ |
| | | name: 'AgentRecruitment', |
| | |
| | | const router = Taro.useRouter(); |
| | | |
| | | const promoterIdNumber = router.params?.promoterIdNumber ?? ''; |
| | | //微信网页授权code 需要重定向获取 会导致多次触发onMounted |
| | | const code = router.params.code ?? ''; |
| | | |
| | | onMounted(() => { |
| | | if (promoterIdNumber) { |
| | | if (isH5 && isInWeChat) { |
| | | if (!code) setClickCount(); |
| | | } else { |
| | | setClickCount(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | function submit() { |
| | |
| | | import { CSSProperties, useTemplateRef } from 'vue'; |
| | | import { OssAssets } from '@/constants'; |
| | | import { createQrCodeImg } from '@/components/Qrcode/utils/qrcode'; |
| | | import { downloadBase64File, Message } from '@/utils'; |
| | | import { isInAlipay } from '@/utils/env'; |
| | | |
| | | defineOptions({ |
| | | name: 'InnerPage', |
| | |
| | | ); |
| | | |
| | | function downloadQrcode() { |
| | | Taro.saveImageToPhotosAlbum({ |
| | | filePath: link.value, |
| | | }); |
| | | // Taro.saveImageToPhotosAlbum({ |
| | | // filePath: link.value, |
| | | // }); |
| | | if (isInAlipay) { |
| | | Message.warning('可在浏览器打开此网页下载文件。'); |
| | | } else { |
| | | // TODO 还需要做小程序下载的兼容 |
| | | downloadBase64File(link.value, '推广二维码'); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | |
| | | return fileName; |
| | | }); |
| | | } |
| | | |
| | | export function downloadBase64File(base64Data: string, filename: string) { |
| | | // 将base64数据分割,获取mime-type |
| | | const [, mime, b64data] = base64Data.match(/^data:([^;]+);base64,(.+)$/); |
| | | |
| | | // 解码base64数据 |
| | | const byteString = atob(b64data); |
| | | const arrayBuffer = new ArrayBuffer(byteString.length); |
| | | const intArray = new Uint8Array(arrayBuffer); |
| | | |
| | | for (let i = 0; i < byteString.length; i++) { |
| | | intArray[i] = byteString.charCodeAt(i); |
| | | } |
| | | |
| | | // 创建Blob对象 |
| | | const blob = new Blob([intArray], { type: mime }); |
| | | |
| | | //@ts-ignore |
| | | if (typeof navigator !== 'undefined' && navigator.msSaveOrOpenBlob) { |
| | | //@ts-ignore 兼容IE |
| | | navigator.msSaveOrOpenBlob(blob, filename); |
| | | } else { |
| | | // 创建一个临时的a标签用于触发下载 |
| | | const a = document.createElement('a'); |
| | | const url = window.URL.createObjectURL(blob); |
| | | a.href = url; |
| | | a.download = filename; // 设置下载后的文件名 |
| | | document.body.appendChild(a); |
| | | a.click(); // 触发下载 |
| | | document.body.removeChild(a); |
| | | setTimeout(() => { |
| | | window.URL.revokeObjectURL(url); // 清除创建的对象URL |
| | | }, 0); |
| | | } |
| | | } |
| | |
| | | import { useSystemStoreWithOut } from '@/stores/modules/system'; |
| | | import { query2object, object2query } from '@life-payment/utils'; |
| | | import { blLifeRecharge } from './blLifeRecharge'; |
| | | import { isInAlipay } from '@/utils/env'; |
| | | |
| | | export function goBack(delta = 1) { |
| | | const pages = Taro.getCurrentPages(); |
| | | |
| | | const systemStore = useSystemStoreWithOut(); |
| | | |
| | | if (pages.length > 1) { |