Pre Merge pull request !176 from steven/feat-自定义海报代码补充开发
commit
3163f03469
|
|
@ -96,6 +96,8 @@
|
|||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
sheep.$store('app').init();
|
||||
// 获取业务配置入口,目前只有海报设置,可以自定义后续扩展
|
||||
sheep.$store('app').initBusinessConfig();
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 800);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ const goods = async (poster) => {
|
|||
const width = poster.width;
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||
const goods_bg_config = sheep.$store('app').brokeragePosterUrls[1] || '';
|
||||
return [
|
||||
{
|
||||
type: 'image',
|
||||
src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg)),
|
||||
src: goods_bg_config || formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg)),
|
||||
css: {
|
||||
width,
|
||||
position: 'fixed',
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ import sheep from '@/sheep';
|
|||
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
||||
|
||||
const groupon = async (poster) => {
|
||||
debugger;
|
||||
const width = poster.width;
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||
const groupon_bg_config = sheep.$store('app').brokeragePosterUrls[2] || '';
|
||||
return [
|
||||
{
|
||||
type: 'image',
|
||||
src: formatImageUrlProtocol(
|
||||
src: groupon_bg_config || formatImageUrlProtocol(
|
||||
sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg),
|
||||
),
|
||||
css: {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ const user = async (poster) => {
|
|||
const userInfo = sheep.$store('user').userInfo;
|
||||
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||
const widthNickName = measureTextWidth(userInfo.nickname, 14); // 使用新方法
|
||||
const user_bg_config = sheep.$store('app').brokeragePosterUrls[0] || '';
|
||||
return [
|
||||
{
|
||||
type: 'image',
|
||||
src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg)),
|
||||
src: user_bg_config || formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg)),
|
||||
css: {
|
||||
width,
|
||||
position: 'fixed',
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ const sheep = {
|
|||
export async function ShoproInit() {
|
||||
// 应用初始化
|
||||
await $store('app').init();
|
||||
// 获取业务配置 这里不用await,考虑的是业务配置不是初始化的必要条件,可以异步加载,提高加载速度,如果是前置的配置注意不能放到这里
|
||||
sheep.$store('app').initBusinessConfig();
|
||||
|
||||
// 平台初始化加载(各平台provider提供不同的加载流程)
|
||||
$platform.load();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import $router from '@/sheep/router';
|
|||
import user from './user';
|
||||
import sys from './sys';
|
||||
import { baseUrl, h5Url } from '@/sheep/config';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
|
||||
const app = defineStore({
|
||||
id: 'app',
|
||||
|
|
@ -32,6 +33,7 @@ const app = defineStore({
|
|||
},
|
||||
bind_mobile: 0, // 登陆后绑定手机号提醒 (弱提醒,可手动关闭)
|
||||
},
|
||||
brokeragePosterUrls: [], // 分销海报背景图列表,从第一张到第三张分别是个人、商品、拼团海报背景图
|
||||
template: {
|
||||
// 店铺装修模板
|
||||
basic: {}, // 基本信息
|
||||
|
|
@ -114,13 +116,22 @@ const app = defineStore({
|
|||
$router.error('InitError', res.msg || '加载失败');
|
||||
}
|
||||
},
|
||||
// 设置 paramsForTabbar
|
||||
async initBusinessConfig() {
|
||||
let { code, data } = await TradeConfigApi.getTradeConfig();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
if (data) {
|
||||
this.brokeragePosterUrls = data.brokeragePosterUrls || [];
|
||||
}
|
||||
},
|
||||
// 设置paramsForTabbar
|
||||
setParamsForTabbar(params = {}) {
|
||||
this.paramsForTabbar = params;
|
||||
},
|
||||
clearParamsForTabbar() {
|
||||
this.paramsForTabbar = {};
|
||||
},
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
enabled: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue