海报:完善小程序码(添加前缀 data:image/png;base64,)
parent
f46bfc6ee1
commit
2dfe61503f
|
@ -1,6 +1,6 @@
|
||||||
<!-- 分销中心 -->
|
<!-- 分销中心 -->
|
||||||
<template>
|
<template>
|
||||||
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" onShareAppMessage>
|
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" :onShareAppMessage="shareInfo">
|
||||||
<!-- 分销商信息 -->
|
<!-- 分销商信息 -->
|
||||||
<commission-info />
|
<commission-info />
|
||||||
<!-- 账户信息 -->
|
<!-- 账户信息 -->
|
||||||
|
@ -16,14 +16,23 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { computed } from 'vue';
|
||||||
import commissionInfo from './components/commission-info.vue';
|
import commissionInfo from './components/commission-info.vue';
|
||||||
import accountInfo from './components/account-info.vue';
|
import accountInfo from './components/account-info.vue';
|
||||||
import commissionLog from './components/commission-log.vue';
|
import commissionLog from './components/commission-log.vue';
|
||||||
import commissionMenu from './components/commission-menu.vue';
|
import commissionMenu from './components/commission-menu.vue';
|
||||||
import commissionAuth from './components/commission-auth.vue';
|
import commissionAuth from './components/commission-auth.vue';
|
||||||
|
import sheep from '@/sheep';
|
||||||
|
|
||||||
const state = reactive({});
|
const shareInfo = computed(() => {
|
||||||
|
return sheep.$platform.share.getShareInfo({
|
||||||
|
params: {
|
||||||
|
page: '6',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
type: 'user',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const bgStyle = {
|
const bgStyle = {
|
||||||
color: '#F7D598',
|
color: '#F7D598',
|
||||||
|
@ -34,4 +43,4 @@
|
||||||
:deep(.page-main) {
|
:deep(.page-main) {
|
||||||
background-size: 100% 100% !important;
|
background-size: 100% 100% !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
import request from '@/sheep/request';
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
const BrokerageApi = {
|
const BrokerageApi = {
|
||||||
|
// 绑定推广员
|
||||||
|
bindBrokerageUser: (data)=>{
|
||||||
|
return request({
|
||||||
|
url: '/trade/brokerage-user/bind',
|
||||||
|
method: 'PUT',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获得个人分销信息
|
// 获得个人分销信息
|
||||||
getBrokerageUser: () => {
|
getBrokerageUser: () => {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { formatImageUrlProtocol } from './index';
|
||||||
const goods = async (poster) => {
|
const goods = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
|
@ -5,7 +5,7 @@ import third from '@/sheep/api/migration/third';
|
||||||
const groupon = async (poster) => {
|
const groupon = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
|
@ -30,30 +30,3 @@ export function formatImageUrlProtocol(url) {
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getBase64Src(base64data, appType) {
|
|
||||||
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
|
|
||||||
switch (appType) {
|
|
||||||
case 'wechat':
|
|
||||||
const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`;
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const fileManager = uni.getFileSystemManager();
|
|
||||||
fileManager.writeFile({
|
|
||||||
filePath: filePath,
|
|
||||||
data: bodyData, // base64 数据
|
|
||||||
encoding: 'base64', // 字符编码
|
|
||||||
success: () => {
|
|
||||||
resolve(filePath);
|
|
||||||
},
|
|
||||||
file: (err) => {
|
|
||||||
console.log('base64 保存失败', err);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
default:
|
|
||||||
console.warn('获得 base64 图片地址只做了微信小程序端的转换,其它端请自行实现!!!');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import third from '@/sheep/api/migration/third';
|
||||||
const user = async (poster) => {
|
const user = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
const wxa_qrcode = 'data:image/png;base64,' + (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
showAuthModal();
|
showAuthModal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(props.shareInfo);
|
||||||
unref(SharePosterRef).getPoster();
|
unref(SharePosterRef).getPoster();
|
||||||
state.showPosterModal = true;
|
state.showPosterModal = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 登录
|
// 登录
|
||||||
// import third from '@/sheep/api/third';
|
import third from '@/sheep/api/migration/third';
|
||||||
import SocialApi from '@/sheep/api/member/social';
|
import SocialApi from '@/sheep/api/member/social';
|
||||||
|
|
||||||
// TODO 芋艿:等后面搞 App 再弄
|
// TODO 芋艿:等后面搞 App 再弄
|
||||||
|
|
|
@ -73,7 +73,7 @@ const buildSpmQuery = (params) => {
|
||||||
shareId = user.userInfo.id;
|
shareId = user.userInfo.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let page = '1'; // 页面类型: 1=首页(默认),2=商品,3=拼团商品,4=秒杀商品,5=邀请参团...按需扩展
|
let page = '1'; // 页面类型: 1=首页(默认),2=商品,3=拼团商品,4=秒杀商品,5=邀请参团,6=分销邀请...按需扩展
|
||||||
if (typeof params.page !== 'undefined') {
|
if (typeof params.page !== 'undefined') {
|
||||||
page = params.page;
|
page = params.page;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,8 @@ const decryptSpm = (spm) => {
|
||||||
id: shareParamsArray[2],
|
id: shareParamsArray[2],
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case '6': // 分销
|
||||||
|
// TODO puhui999: 如果用户未登录想想怎么搞
|
||||||
}
|
}
|
||||||
shareParams.platform = platformMap[shareParamsArray[3] - 1];
|
shareParams.platform = platformMap[shareParamsArray[3] - 1];
|
||||||
shareParams.from = fromMap[shareParamsArray[4] - 1];
|
shareParams.from = fromMap[shareParamsArray[4] - 1];
|
||||||
|
|
Loading…
Reference in New Issue