8.6(邀请二维码
This commit is contained in:
@@ -35,35 +35,35 @@
|
|||||||
<!-- 分享 -->
|
<!-- 分享 -->
|
||||||
<view class="share-type flex justify-around">
|
<view class="share-type flex justify-around">
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<view class="share-type-cont" style="position:relative;">
|
<view class="share-type-cont" style="position:relative;">
|
||||||
<image :src="`${config.aliyunOssUrl}/static/images/app/config/weixin.png`" mode=""></image>
|
<image :src="`${config.aliyunOssUrl}/static/images/app/config/weixin.png`" mode=""></image>
|
||||||
<view>微信好友</view>
|
<view>微信好友</view>
|
||||||
<button id="shareBtn" open-type="share" @click="shareBtnInfo(1)"></button>
|
<button id="shareBtn" open-type="share" @click="shareBtnInfo(1)"></button>
|
||||||
</view>
|
</view>
|
||||||
<!-- @click="shareBtnInfo" -->
|
<!-- @click="shareBtnInfo" -->
|
||||||
<view class="share-type-cont" style="position:relative;" @click="shareBtnInfo(2)">
|
<view class="share-type-cont" style="position:relative;" @click="shareBtnInfo(2)">
|
||||||
<image :src="`${config.aliyunOssUrl}/static/images/app/config/pengyouquan.png`" mode=""></image>
|
<image :src="`${config.aliyunOssUrl}/static/images/app/config/pengyouquan.png`" mode=""></image>
|
||||||
<view>朋友圈</view>
|
<view>朋友圈</view>
|
||||||
<!-- <button id="shareBtn" open-type="share" @click="shareBtnInfo(2)"></button> -->
|
<!-- <button id="shareBtn" open-type="share" @click="shareBtnInfo(2)"></button> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="share-type-cont" @click="savePoster">
|
<view class="share-type-cont" @click="savePoster">
|
||||||
<image :src="`${config.aliyunOssUrl}/static/images/app/config/save.png`" mode=""></image>
|
<image :src="`${config.aliyunOssUrl}/static/images/app/config/save.png`" mode=""></image>
|
||||||
<view>保存海报</view>
|
<view>保存海报</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifdef APP -->
|
<!-- #ifdef APP -->
|
||||||
<view class="share-type-cont" @click="shareFn('WXSceneSession')">
|
<view class="share-type-cont" @click="shareFn('WXSceneSession')">
|
||||||
<image src="@/static/images/app/config/weixin.png" mode=""></image>
|
<image src="@/static/images/app/config/weixin.png" mode=""></image>
|
||||||
<view>微信好友</view>
|
<view>微信好友</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="share-type-cont" @click="shareFn('WXSceneTimeline')">
|
<view class="share-type-cont" @click="shareFn('WXSceneTimeline')">
|
||||||
<image src="@/static/images/app/config/pengyouquan.png" mode=""></image>
|
<image src="@/static/images/app/config/pengyouquan.png" mode=""></image>
|
||||||
<view>朋友圈</view>
|
<view>朋友圈</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="share-type-cont" @click="savePoster">
|
<view class="share-type-cont" @click="savePoster">
|
||||||
<image src="@/static/images/app/config/save.png" mode=""></image>
|
<image src="@/static/images/app/config/save.png" mode=""></image>
|
||||||
<view>保存海报</view>
|
<view>保存海报</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<!-- 画布 -->
|
<!-- 画布 -->
|
||||||
@@ -72,6 +72,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
urlToBase64
|
||||||
|
} from "@/utils/index.js"
|
||||||
import {
|
import {
|
||||||
getInviteInfo
|
getInviteInfo
|
||||||
} from "@/api/welfare/welfare.js"
|
} from "@/api/welfare/welfare.js"
|
||||||
@@ -96,22 +99,22 @@
|
|||||||
// 来自页面内分享按钮
|
// 来自页面内分享按钮
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
title:'海报', //分享的名称
|
title: '海报', //分享的名称
|
||||||
path: '/pages/index/index',
|
path: '/pages/index/index',
|
||||||
imageUrl: this.imageBg,
|
imageUrl: this.imageBg,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShareTimeline(res){
|
onShareTimeline(res) {
|
||||||
return {
|
return {
|
||||||
title:'海报',
|
title: '海报',
|
||||||
path: '/pages/index/index',
|
path: '/pages/index/index',
|
||||||
imageUrl: this.imageBg,
|
imageUrl: this.imageBg,
|
||||||
// channel:''
|
// channel:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
shareBtnInfo(num){
|
shareBtnInfo(num) {
|
||||||
if(num==2){
|
if (num == 2) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请点击右上角胶囊中的三个点进行朋友圈分享',
|
title: '请点击右上角胶囊中的三个点进行朋友圈分享',
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
@@ -121,7 +124,7 @@
|
|||||||
},
|
},
|
||||||
//分享
|
//分享
|
||||||
shareFn(type) {
|
shareFn(type) {
|
||||||
this.drawPoster(this.imageBg, false,type)
|
this.drawPoster(this.imageBg, false, type)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 轮播图切换
|
// 轮播图切换
|
||||||
@@ -222,30 +225,37 @@
|
|||||||
// console.log(res, '海报');
|
// console.log(res, '海报');
|
||||||
this.userInfo = res.data
|
this.userInfo = res.data
|
||||||
this.imageBg = this.userInfo.posterList[0].image
|
this.imageBg = this.userInfo.posterList[0].image
|
||||||
let url =`https://cms.diyouzhijia.com/car_h5/#/pages/index?uId=${this.userInfo.id}`
|
let url = `https://cms.diyouzhijia.com/car_h5/#/pages/index?uId=${this.userInfo.id}`
|
||||||
// let base64Data = uni.arrayBufferToBase64([url])
|
|
||||||
this.verificationImage =
|
// const encodedUrl = encodeURIComponent(url);
|
||||||
`https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode?content=${url}`
|
// console.log(unescape(encodeURIComponent(url)));
|
||||||
|
// const base64 = uni.arrayBufferToBase64(encodedUrl);
|
||||||
|
|
||||||
// this.verificationImage =
|
// this.verificationImage =
|
||||||
// `https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode/base64?content=${base64Data}`
|
// `https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode/base64?content=${base64}`
|
||||||
// console.log(`https://wxapp.nianxiang-tech.com/prod-api/ums/login/qrcode?content=${url}`);
|
|
||||||
|
// 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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
#shareBtn {
|
#shareBtn {
|
||||||
// border: 1px solid ;
|
// border: 1px solid ;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
opacity:0;
|
opacity: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background: linear-gradient(180deg, #98C2E1 0%, rgba(255, 255, 255, 0) 100%);
|
background: linear-gradient(180deg, #98C2E1 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
}
|
}
|
||||||
@@ -297,6 +307,7 @@
|
|||||||
height: 1126rpx;
|
height: 1126rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -296,4 +296,26 @@ export const getTimeDifference = (time) => {
|
|||||||
} else if (diffInSeconds > 0) {
|
} else if (diffInSeconds > 0) {
|
||||||
return diffInSeconds + "秒前";
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const request = config => {
|
|||||||
}
|
}
|
||||||
const code = res.data.code || 200
|
const code = res.data.code || 200
|
||||||
const msg = errorCode[code] || res.data.message || res.data.msg || errorCode['default']
|
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 => {
|
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// store.dispatch('LogOut').then(res => {
|
// store.dispatch('LogOut').then(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user