8.6(邀请二维码

This commit is contained in:
Hong
2024-08-06 14:47:21 +08:00
parent fcb47bc7b8
commit 8c9e7910d1
3 changed files with 83 additions and 50 deletions

View File

@@ -72,6 +72,9 @@
</template>
<script>
import {
urlToBase64
} from "@/utils/index.js"
import {
getInviteInfo
} from "@/api/welfare/welfare.js"
@@ -223,19 +226,26 @@
this.userInfo = res.data
this.imageBg = this.userInfo.posterList[0].image
let url = `https://cms.diyouzhijia.com/car_h5/#/pages/index?uId=${this.userInfo.id}`
// let base64Data = uni.arrayBufferToBase64([url])
this.verificationImage =
`https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode?content=${url}`
// const encodedUrl = encodeURIComponent(url);
// console.log(unescape(encodeURIComponent(url)));
// const base64 = uni.arrayBufferToBase64(encodedUrl);
// this.verificationImage =
// `https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode/base64?content=${base64Data}`
// console.log(`https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode?content=${url}`);
// `https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode/base64?content=${base64}`
// console.log(this.verificationImage);
let base64Data = urlToBase64(url)
this.verificationImage =
`https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode/base64?content=${base64Data}`
console.log('base', this.verificationImage); // 打印出Base64字符串
})
}
}
</script>
<style lang="scss">
#shareBtn {
// border: 1px solid ;
position: absolute;
@@ -297,6 +307,7 @@
height: 1126rpx;
background: #fff;
border-radius: 8rpx;
image {
width: 100%;
height: 100%;

View File

@@ -297,3 +297,25 @@ export const getTimeDifference = (time) => {
return diffInSeconds + "秒前";
}
}
//传入url 返回base64格式
export const urlToBase64 = (str) => {
let CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let out = '', i = 0, len = str.length, c1, c2, c3, enc1, enc2, enc3, enc4;
while (i < len) {
c1 = str.charCodeAt(i++);
c2 = str.charCodeAt(i++);
c3 = str.charCodeAt(i++);
enc1 = c1 >> 2;
enc2 = ((c1 & 3) << 4) | (c2 >> 4);
enc3 = ((c2 & 15) << 2) | (c3 >> 6);
enc4 = c3 & 63;
if (isNaN(c2)) {
enc3 = enc4 = 64;
} else if (isNaN(c3)) {
enc4 = 64;
}
out += CHARS.charAt(enc1) + CHARS.charAt(enc2) + CHARS.charAt(enc3) + CHARS.charAt(enc4);
}
return out;
}

View File

@@ -41,7 +41,7 @@ const request = config => {
}
const code = res.data.code || 200
const msg = errorCode[code] || res.data.message || res.data.msg || errorCode['default']
if (code === 401 || code === 402) {
if (code === 401 || code === 402|| code === 301) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
if (res.confirm) {
// store.dispatch('LogOut').then(res => {