Commit ae1170b8 by yuzhenWang

Merge branch 'dev' into 'uat'

Dev

See merge request !59
parents 33f6a949 3d081fa0
......@@ -3,6 +3,7 @@
import {interceptor} from "@/util/interceptor";
import {baseURL,apiURL,cffpURL,companyInfo} from "@/environments/environment";
import api from './api/api';
import {hshare} from '@/util/fiveshare';
export default {
data() {
return {
......@@ -12,6 +13,7 @@
onLaunch: function() {
console.log('App Launch');
if(!uni.getStorageSync('loginType')){
console.log('走进来了');
uni.clearStorageSync();
uni.setStorageSync('loginType','visitor');
}
......@@ -115,7 +117,8 @@
'/pages/courseDetail/courseDetail',
'/pages/orderDetail/orderDetail',
'/pages/orderStatus/orderStatus',
'/pages/index/index'
'/pages/index/index',
'/myPackageA/poster/poster',
] // 根据需要调整
if(!whiteList.includes(currentRoute)) {
uni.navigateTo({
......@@ -130,20 +133,38 @@
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
uni.setStorageSync('userinfodataForm', res.data);
}
} catch (err) {
console.error('检查用户状态失败:', err);
}
}
return
}else {
this.checkToken()
}
},
// 清除登录状态
clearLoginState() {
uni.clearStorageSync();
uni.setStorageSync('loginType', 'visitor');
this.checkToken()
// 可以在这里添加其他需要清除的状态
},
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
}
})
}
})
},
// 处理外部链接参数
handleExternalUrlParams() {
// #ifdef H5
......
......@@ -175,6 +175,7 @@
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
this.closebootpage()
......
/** 从 0x20 开始到 0x80 的字符宽度数据 */
export declare const CHAR_WIDTH_SCALE_MAP: number[];
import { ObjectFit, ObjectPosition, Size } from "../value";
/**
* 用于计算图片的宽高比例
* @see https://drafts.csswg.org/css-images-3/#sizing-terms
*
* ## 名词解释
* ### intrinsic dimensions
* 图片本身的尺寸
*
* ### specified size
* 用户指定的元素尺寸
*
* ### concrete object size
* 应用了 `objectFit` 之后图片的显示尺寸
*
* ### default object size
*/
export declare function calculateConcreteRect(style: {
/** @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-fit */
objectFit?: ObjectFit;
/** @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-position */
objectPosition?: ObjectPosition;
}, intrinsicSize: Size, specifiedSize: Size): {
sx: number;
sy: number;
sw: number;
sh: number;
dx: number;
dy: number;
dw: number;
dh: number;
};
<template>
<!-- 微信小程序专用 -->
<!-- #ifdef MP-WEIXIN -->
<painter
:palette="finalPalette"
@imgOK="onImgOK"
@imgErr="onImgErr"
:customStyle="customStyle"
/>
<!-- #endif -->
<!-- H5和APP端使用Canvas兼容 -->
<!-- #ifndef MP-WEIXIN -->
<view class="painter-container">
<canvas
id="posterCanvas"
canvas-id="posterCanvas"
:style="{
width: customStyle.width,
height: customStyle.height,
position: 'fixed',
left: '-9999px'
}"
></canvas>
<image v-if="posterUrl" :src="posterUrl" mode="widthFix" class="poster-image" />
<view v-if="generating" class="loading">海报生成中...</view>
</view>
<!-- #endif -->
</template>
<script>
// 小程序端直接使用原生组件
// #ifdef MP-WEIXIN
import Painter from './painter.js';
export default {
components: { Painter },
props: {
palette: Object,
customStyle: {
type: Object,
default: () => ({ width: '750rpx', height: '1334rpx' })
}
},
computed: {
finalPalette() {
return this.palette;
}
},
methods: {
onImgOK(e) {
this.$emit('imgOK', e);
},
onImgErr(err) {
this.$emit('imgErr', err);
}
}
};
// #endif
// H5和APP端兼容实现
// #ifndef MP-WEIXIN
import QRCode from 'qrcode';
export default {
props: {
palette: Object,
customStyle: Object
},
data() {
return {
posterUrl: '',
generating: false
};
},
mounted() {
this.generateH5Poster();
},
methods: {
async generateH5Poster() {
this.generating = true;
try {
console.log('开始生成海报');
// 1. 生成二维码
const qrCodeUrl = await this.generateQRCode();
console.log('二维码生成完成', qrCodeUrl ? '成功' : '失败');
// 2. 获取Canvas上下文
const ctx = uni.createCanvasContext('posterCanvas', this);
// 3. 绘制背景
ctx.setFillStyle('#ffffff');
ctx.fillRect(0, 0, 750, 1334);
// 4. 绘制背景图
const bg = this.palette.views.find(v => v.type === 'image');
if (bg) {
console.log('开始绘制背景图:', bg.url);
try {
await this.drawImage(ctx, bg.url, 0, 0, 750, 1334);
} catch (err) {
console.warn('背景图绘制失败:', err);
}
}
// 5. 绘制文字
const texts = this.palette.views.filter(v => v.type === 'text');
texts.forEach(text => {
ctx.setFontSize(parseInt(text.css.fontSize));
ctx.setFillStyle(text.css.color || '#000000');
ctx.setTextAlign(text.css.left === 'center' ? 'center' : 'left');
const x = text.css.left === 'center' ? 375 : parseInt(text.css.left);
const y = parseInt(text.css.top);
ctx.fillText(text.text, x, y);
});
// 6. 绘制二维码
const qrView = this.palette.views.find(v => v.type === 'qrcode');
if (qrView && qrCodeUrl) {
console.log('开始绘制二维码');
try {
await this.drawImage(ctx, qrCodeUrl,
parseInt(qrView.css.left),
parseInt(qrView.css.top),
parseInt(qrView.css.width),
parseInt(qrView.css.height)
);
} catch (err) {
console.warn('二维码绘制失败:', err);
}
}
// 7. 生成最终图片
console.log('开始生成最终图片');
await new Promise(resolve => {
ctx.draw(false, () => {
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'posterCanvas',
success: (res) => {
console.log('图片生成成功', res);
this.posterUrl = res.tempFilePath;
this.$emit('imgOK', { detail: { path: res.tempFilePath } });
resolve();
},
fail: (err) => {
console.error('图片生成失败:', err);
this.$emit('imgErr', err);
resolve();
}
}, this);
}, 300);
});
});
} catch (err) {
console.error('海报生成失败:', err);
this.$emit('imgErr', err);
} finally {
this.generating = false;
}
},
drawImage(ctx, url, x, y, width, height) {
return new Promise((resolve, reject) => {
// 如果是base64数据,直接绘制
if (url.startsWith('data:image')) {
console.log('绘制base64图片');
const img = new Image();
img.onload = () => {
ctx.drawImage(img, x, y, width, height);
resolve();
};
img.onerror = (err) => {
console.warn('base64图片加载失败', err);
reject(err);
};
img.src = url;
return;
}
console.log('加载网络图片:', url);
uni.getImageInfo({
src: url,
success: (res) => {
console.log('图片加载成功', res);
const img = new Image();
img.onload = () => {
ctx.drawImage(img, x, y, width, height);
resolve();
};
img.onerror = (err) => {
console.warn('图片绘制失败', err);
reject(err);
};
img.src = res.path;
},
fail: (err) => {
console.warn('图片加载失败:', err);
reject(err);
}
});
});
},
generateQRCode() {
return new Promise((resolve) => {
const qrView = this.palette.views.find(v => v.type === 'qrcode');
if (!qrView || !qrView.content) {
console.warn('未找到有效的二维码配置');
resolve(null);
return;
}
console.log('开始生成二维码,内容:', qrView.content);
// 创建临时Canvas用于生成二维码
const canvas = document.createElement('canvas');
canvas.width = 200;
canvas.height = 200;
// 使用Promise风格的API
QRCode.toCanvas(canvas, qrView.content, {
width: 200,
margin: 2,
color: {
dark: '#000000',
light: '#ffffff'
}
}, (error) => {
if (error) {
console.error('二维码生成失败:', error);
resolve(null);
} else {
console.log('二维码生成成功');
resolve(canvas.toDataURL('image/png'));
}
});
});
}
}
};
// #endif
</script>
<style scoped>
.painter-container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
canvas {
display: none;
}
.poster-image {
width: 100%;
max-width: 750rpx;
display: block;
margin: 0 auto;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20rpx 40rpx;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border-radius: 10rpx;
font-size: 28rpx;
}
</style>
\ No newline at end of file
import Painter from "./painter";
import { PainterContext } from "./painter-context/index";
interface ILineSpliterContextOption {
fontSize: number;
lineClamp: number;
width: number;
painter: Painter;
content: string;
}
export default class LineSpliterContext {
fontSize: number;
lineClamp: number;
width: number;
ctx: PainterContext;
painter: Painter;
content: string;
lines: string[];
currentLineText: string;
position: number;
endPostion: number;
isOverflow: boolean;
isDry: boolean;
isFull: boolean;
constructor(option: ILineSpliterContextOption);
split(): string[];
minCharNumberInWidth(width: number): number;
freeSpaceInCurrentLine(): number;
adjustCharNumberInCurrentLine(charNumber: number): void;
commitLine(): void;
handleOverflow(): void;
fillText(): void;
}
export {};
import Painter from "../painter";
import { BaseLine, FillStrokeStyle, TextAlign } from "../value";
import { PainterContext } from "./index";
declare const PainterH5Context_base: new (prototype: CanvasRenderingContext2D) => CanvasRenderingContext2D & {
context: CanvasRenderingContext2D;
};
export declare class PainterH5Context extends PainterH5Context_base implements PainterContext {
private painter;
constructor(painter: Painter, context: CanvasRenderingContext2D);
draw(reserve: boolean, callback: () => void): void;
setFillStyle(color: FillStrokeStyle): void;
setStrokeStyle(color: FillStrokeStyle): void;
drawImageWithSrc(imageResource: string, sx: number, sy: number, sWidth: number, sHeight: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): Promise<void>;
setTextAlign(align: TextAlign): void;
setTextBaseline(baseline: BaseLine): void;
setFontSize(fontSize: number): void;
measureTextWidth(text: string, fontSize: number): number;
}
export declare function normalizeImageResource(src: string): Promise<HTMLImageElement>;
export {};
import { PainterUniContext } from "./context-uni";
import { PainterContext } from "./index";
export declare class PainterUniMpAlipayContext extends PainterUniContext implements PainterContext {
measureTextWidth(text: string, fontSize: number): number;
}
import { PainterUniContext } from "./context-uni";
import { PainterContext } from "./index";
export declare class PainterUniMpBaiduContext extends PainterUniContext implements PainterContext {
measureTextWidth(text: string, fontSize: number): number;
drawImageWithSrc(imageResource: string, sx: number, sy: number, sWidth: number, sHeigt: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): Promise<void>;
}
import { PainterUniContext } from "./context-uni";
import { PainterContext } from "./index";
export declare class PainterUniMpWeixinContext extends PainterUniContext implements PainterContext {
/** 兼容地,根据控制点和半径绘制圆弧路径 */
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
measureTextWidth(text: string, fontSize: number): number;
}
/// <reference types="uni-app" />
import Painter from "../painter";
import { PainterContext } from "./index";
declare const CanvasContext: new (prototype: CanvasContext) => CanvasContext & {
context: CanvasContext;
};
export declare class PainterUniContext extends CanvasContext implements PainterContext {
private painter;
constructor(painter: Painter, context: CanvasContext);
drawImageWithSrc(imageResource: string, sx: number, sy: number, sWidth: number, sHeight: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): Promise<void>;
measureTextWidth(text: string, fontSize: number): number;
}
export {};
export declare function createClass<T extends object>(): new (prototype: T) => T & {
context: T;
};
/// <reference types="uni-app" />
import Painter from "../painter";
export declare type CompatableContext = CanvasContext | CanvasRenderingContext2D;
export declare type PainterContext = Pick<CanvasContext, "arcTo" | "clip" | "draw" | "fillStyle" | "font" | "lineTo" | "restore" | "save" | "setFillStyle" | "setFontSize" | "setStrokeStyle" | "setTextAlign" | "setTextBaseline" | "strokeStyle" | "beginPath" | "closePath" | "moveTo" | "createLinearGradient" | "stroke" | "fill" | "strokeRect" | "fillRect" | "lineWidth" | "setLineDash" | "fillText" | "setTransform" | "scale" | "rotate" | "translate"> & {
measureTextWidth(text: string, fontSize: number): number;
drawImageWithSrc(imageResource: string, sx: number, sy: number, sWidth: number, sHeigt: number): Promise<void>;
drawImageWithSrc(imageResource: string, sx: number, sy: number, sWidth: number, sHeigt: number, dx: number, dy: number, dWidth: number, dHeight: number): Promise<void>;
};
export declare function adaptContext(painter: Painter, ctx: CompatableContext): PainterContext;
import Painter from "../painter";
import { Size, Position } from "../value";
export interface PainterElementOption {
type: string;
/** 定位方式 */
position: Position;
left: number;
top: number;
}
export declare abstract class PainterElement {
parent?: PainterElement;
offsetTop: number;
offsetLeft: number;
left: number;
top: number;
contentHeight: number;
contentWidth: number;
position: Position;
painter: Painter;
constructor(painter: Painter, option: Partial<PainterElementOption>, parent?: PainterElement);
protected abstract _layout(): Promise<Size> | Size;
layout(): Promise<Size>;
abstract paint(): void;
get anchorX(): number;
get anchorY(): number;
get elementX(): number;
get elementY(): number;
get offsetHeight(): number;
get offsetWidth(): number;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { BuiltInPainterElementOption } from "./index";
import { BuiltInPainterPathOption } from "../painter-path/index";
import { PainterPath } from "../painter-path/base";
export interface PainterClipElementOption extends PainterElementOption {
type: "clip";
/** 裁剪使用的路径 */
path: BuiltInPainterPathOption;
/** 被裁剪的内容 */
content: BuiltInPainterElementOption;
}
export declare class PainterClipElement extends PainterElement {
contentElement: PainterElement;
clipPath: PainterPath;
constructor(painter: Painter, option: PainterClipElementOption, parent?: PainterElement);
_layout(): Promise<import("../value").Size>;
paint(): Promise<void>;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { OmitBaseOption } from "../value";
import { BuiltInPainterElementOption } from "./index";
export interface PainterContainerElementOption extends PainterElementOption {
type: "container";
/** 子元素的排列方式 */
direction: "vertical" | "horizontal";
width: number | "auto";
height: number | "auto";
/** 子元素 */
children: BuiltInPainterElementOption[];
}
export declare class PainterContainerElement extends PainterElement {
option: OmitBaseOption<PainterContainerElementOption>;
children: PainterElement[];
childOffsetTop: number;
childOffsetLeft: number;
constructor(painter: Painter, option: PainterContainerElementOption, parent?: PainterElement);
_layout(): Promise<{
width: number;
height: number;
}>;
private layoutChildren;
private layoutChild;
private calcContainerWidth;
private calcContainerHeight;
paint(): Promise<void>;
childrenMaxWidth(): number;
childrenMaxHeight(): number;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { ObjectFit, OmitBaseOption, ObjectPosition } from "../value";
export interface PainterImageElementOption extends PainterElementOption {
type: "image";
/**
* 图片地址
*
* 可以使用网络图片地址或下载后的临时图片地址
*/
src: string;
width: number;
height: number;
/**
* 图片的适应方式
* - fill 拉伸图片以铺满容器
* - contain 等比缩放,使图片刚好能完整显示出来
* - cover 等比缩放,使图片刚好能占满容器
*/
objectFit?: ObjectFit;
/**
* 图片的位置
* 默认为 `["center","center"]`
*/
objectPosition?: ObjectPosition;
}
export declare class PainterImageElement extends PainterElement {
option: OmitBaseOption<PainterImageElementOption>;
constructor(painter: Painter, option: PainterImageElementOption, parent?: PainterElement);
_layout(): {
width: number;
height: number;
};
paint(): Promise<void>;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { OmitBaseOption } from "../value";
import { BuiltInPainterFillStrokeOption } from "../painter-fill-stroke/index";
export interface PainterLineElementOption extends PainterElementOption {
type: "line";
/** 直线终点距离起点在水平方向上的距离 */
dx: number;
/** 直线终点距离起点在垂直方向上的距离 */
dy: number;
/** 直线的颜色 */
color: BuiltInPainterFillStrokeOption;
/** 直线的宽度 */
lineWidth: number;
/** 虚线样式,默认为实线 */
dashPattern: number[];
}
export declare class PainterLineElement extends PainterElement {
option: OmitBaseOption<PainterLineElementOption>;
constructor(painter: Painter, option: Partial<PainterLineElementOption>, parent?: PainterElement);
_layout(): {
width: number;
height: number;
};
paint(): void;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { OmitBaseOption, BorderRadius, BorderStyle, Color } from "../value";
import { BuiltInPainterFillStrokeOption } from "../painter-fill-stroke/index";
export interface PainterRectagleElementOption extends PainterElementOption {
type: "rect";
width: number;
height: number;
/**
* 圆角
*
* - `number` 一个数字,四个角的圆角都使用设置的值
* - `[number, number, number, number]` 四个数字的元组分别代表 **左上**、**右上**、**右下** 和 **左下** 的圆角值。
*/
borderRadius: BorderRadius;
/**
* 背景颜色
*/
background: BuiltInPainterFillStrokeOption;
borderWidth: number;
borderStyle: BorderStyle;
borderColor: Color;
}
export declare class PainterRectagleElement extends PainterElement {
option: OmitBaseOption<PainterRectagleElementOption>;
constructor(painter: Painter, option: PainterRectagleElementOption, parent?: PainterElement);
_layout(): {
width: number;
height: number;
};
paint(): void;
private get shouldFill();
private get shouldStroke();
private applyFillStyle;
private applyStrokeStyle;
private paintByRect;
private paintByPath;
}
import Painter from "../painter";
import { PainterTextElementOption } from "./element-text";
import { PainterElement } from "./base";
import { OmitBaseOption } from "../value";
export interface PainterTextBlockElementOption extends Omit<PainterTextElementOption, "type"> {
type: "text-block";
/** 行高 */
lineHeight: number;
/** 文本块的最大行数 */
lineClamp: number;
/** 文本块的宽度 */
width: number;
height: number | "auto";
}
export declare class PainterTextBlockElement extends PainterElement {
option: OmitBaseOption<Partial<PainterTextBlockElementOption> & Pick<PainterTextBlockElementOption, "fontSize" | "width" | "height" | "lineClamp" | "content" | "lineHeight" | "top" | "color">>;
lines: string[];
constructor(painter: Painter, option: PainterTextBlockElementOption, parent?: PainterElement);
_layout(): {
width: number;
height: number;
};
paint(): Promise<void>;
}
import Painter from "../painter";
import { FontWeight, BaseLine, TextAlign, OmitBaseOption, FontStyle, TextDecoration } from "../value";
import { PainterElementOption, PainterElement } from "./base";
import { BuiltInPainterFillStrokeOption } from "../painter-fill-stroke/index";
export interface PainterTextElementOption extends PainterElementOption {
type: "text";
/** 文字的颜色 */
color: BuiltInPainterFillStrokeOption;
/** 文字的字号 */
fontSize: number;
/** 文字的字重 */
fontWeight: FontWeight;
/** 文字的字型 */
fontStyle: FontStyle;
/** 文字的字体 */
fontFamily: string;
/** 锚点在垂直方向相对文字的位置 */
baseline: BaseLine;
/** 锚点在水平方向相对文字的位置 */
align: TextAlign;
/** 文本内容 */
content: string;
/** 文字的宽度,为空则根据文本内容及字号自动计算宽度 */
width?: number;
textDecoration: TextDecoration;
}
export declare class PainterTextElement extends PainterElement {
option: OmitBaseOption<PainterTextElementOption>;
constructor(painter: Painter, option: PainterTextElementOption, parent?: PainterElement);
_layout(): {
width: number;
height: number;
};
paint({ inTextBlock }?: {
inTextBlock?: boolean | undefined;
}): void;
private paintTextDecoration;
}
import Painter from "../painter";
import { PainterElementOption, PainterElement } from "./base";
import { BuiltInPainterElementOption } from "./index";
export interface PainterTransformElementOption extends PainterElementOption {
type: "transform";
/** 变换的内容 */
content: BuiltInPainterElementOption;
/** 变换的选项 */
transform: BuiltInPainterTransformOption[];
/** 变换的原点、默认为元素的中心 */
transformOrigin: PaitnerTransformOriginOption;
}
declare type BuiltInPainterTransformOption = PainterTransformTranslateOption | PainterTransformRotateOption | PainterTransformScaleOption | PainterTransformMatrixOption;
interface PainterTransformTranslateOption {
type: "translate";
x?: number;
y?: number;
}
interface PainterTransformRotateOption {
type: "rotate";
/** degree */
rotate: number;
}
interface PainterTransformScaleOption {
type: "scale";
scaleWidth?: number;
scaleHeight?: number;
}
interface PainterTransformMatrixOption {
type: "set-matrix";
translateX: number;
translateY: number;
scaleX: number;
scaleY: number;
skewX: number;
skewY: number;
}
declare type PaitnerTransformOriginOption = [
PaitnerTransformOriginHorizontalOption,
PaitnerTransformOriginVerticalOption
];
declare type PaitnerTransformOriginHorizontalOption = "left" | "center" | "right";
declare type PaitnerTransformOriginVerticalOption = "top" | "center" | "bottom";
/**
* - fixme: Cascade transform not supported yet.
* Cause when we set tansform origin in `withTransformOrigin`,
* We don't know the transform state of outer element.
*/
export declare class PainterTransformElement extends PainterElement {
transformOrigin: PaitnerTransformOriginOption;
transformOptions: BuiltInPainterTransformOption[];
contentElement: PainterElement;
constructor(painter: Painter, option: PainterTransformElementOption, parent?: PainterElement);
_layout(): Promise<import("../value").Size>;
paint(): Promise<void>;
private transform;
private singleTransform;
private withTransformOrigin;
}
export {};
import { PainterTextElementOption, PainterTextElement } from "./element-text";
import { PainterTextBlockElementOption, PainterTextBlockElement } from "./element-text-block";
import { PainterImageElementOption, PainterImageElement } from "./element-image";
import { PainterLineElementOption, PainterLineElement } from "./element-line";
import { PainterRectagleElementOption, PainterRectagleElement } from "./element-rect";
import { PainterContainerElementOption, PainterContainerElement } from "./element-container";
import { PainterClipElementOption, PainterClipElement } from "./element-clip";
import { PainterTransformElementOption, PainterTransformElement } from "./element-transform";
import Painter from "../painter";
import { PainterElement } from "./base";
export declare type BuiltInPainterElementOption = PainterTextElementOption | PainterTextBlockElementOption | PainterImageElementOption | PainterLineElementOption | PainterRectagleElementOption | PainterContainerElementOption | PainterClipElementOption | PainterTransformElementOption;
export declare function createElement(painter: Painter, option: BuiltInPainterElementOption, parent?: PainterElement): PainterTextElement | PainterTextBlockElement | PainterImageElement | PainterLineElement | PainterRectagleElement | PainterContainerElement | PainterClipElement | PainterTransformElement;
import { PainterLinearGradientOption } from "./linear-gradient";
import { PainterElement } from "../painter-element/base";
export interface PainterGradientPatternOption {
type: string;
}
export declare type BuiltInPainterGradientPatternOption = PainterLinearGradientOption;
export declare abstract class PainterGradientPatternStyle {
element: PainterElement;
constructor(element: PainterElement);
get painter(): import("../painter").default;
abstract get style(): CanvasGradient | CanvasPattern;
}
import { Color } from "../value";
import { PainterLinearGradientOption } from "./linear-gradient";
import { PainterElement } from "../painter-element/base";
export declare type BuiltInPainterFillStrokeOption = Color | PainterLinearGradientOption;
export declare function createFillStrokeStyle(element: PainterElement, option: BuiltInPainterFillStrokeOption): string | CanvasGradient;
import { ColorStop } from "../value";
import { PainterGradientPatternOption, PainterGradientPatternStyle } from "./base";
import { PainterElement } from "../painter-element/base";
export interface PainterLinearGradientOption extends PainterGradientPatternOption {
type: "linear-gradient";
colorStops: ColorStop[];
x1: number;
y1: number;
x2: number;
y2: number;
}
export declare class PainterLinearGradientStyle extends PainterGradientPatternStyle {
option: PainterLinearGradientOption;
constructor(element: PainterElement, option: PainterLinearGradientOption);
get style(): CanvasGradient;
}
import { PainterElement } from "../painter-element/base";
export interface PainterPathOption {
type: string;
left?: number;
top?: number;
}
export declare abstract class PainterPath {
element: PainterElement;
left: number;
top: number;
constructor(element: PainterElement, option: PainterPathOption);
get painter(): import("../painter").default;
get pathX(): number;
get pathY(): number;
abstract paint(): void;
}
import { PainterElement } from "../painter-element/base";
import { PainterRoundedRectanglePath, PainterRoundedRectanglePathOption } from "./path-rounded-rect";
export declare type BuiltInPainterPathOption = PainterRoundedRectanglePathOption;
export declare function createPath(element: PainterElement, option: BuiltInPainterPathOption): PainterRoundedRectanglePath;
import { PainterPath, PainterPathOption } from "./base";
import { BorderRadius } from "../value";
import { PainterElement } from "../painter-element/base";
export interface PainterRoundedRectanglePathOption extends PainterPathOption {
type: "rounded-rect";
/** 路径的宽度 */
width: number;
/** 路径的高度 */
height: number;
/** 路径的圆角 */
borderRadius: BorderRadius;
}
export declare class PainterRoundedRectanglePath extends PainterPath {
option: PainterRoundedRectanglePathOption;
constructor(element: PainterElement, option: PainterRoundedRectanglePathOption);
private assertBorderRadius;
paint(): void;
private get normalizedBorderRadius();
/**
* @see https://www.w3.org/TR/css-backgrounds-3/#corner-overlap
* Corner curves must not overlap: When the sum of any two adjacent border
* radii exceeds the size of the border box, UAs must proportionally reduce
* the used values of all border radii until none of them overlap.
*/
private reduceBorderRadius;
}
/// <reference types="uni-app" />
import { UniPlatforms } from "../utils/platform";
import { BuiltInPainterElementOption } from "./painter-element/index";
import { PainterContext } from "./painter-context/index";
interface IPanterOption {
platform?: UniPlatforms;
upx2px?: (upx: number) => number;
}
/** 单次绘制选项 */
interface IDrawOption {
}
export default class Painter {
ctx: PainterContext;
upx2px: NonNullable<IPanterOption["upx2px"]>;
platform: NonNullable<IPanterOption["platform"]>;
constructor(ctx: CanvasContext, { platform, upx2px }?: IPanterOption);
draw(elementOption: BuiltInPainterElementOption, drawOption?: IDrawOption): Promise<import("./value").Size>;
/** 创建元素对象 */
createElement(elementOption: BuiltInPainterElementOption): import("./painter-element/element-text").PainterTextElement | import("./painter-element/element-text-block").PainterTextBlockElement | import("./painter-element/element-image").PainterImageElement | import("./painter-element/element-line").PainterLineElement | import("./painter-element/element-rect").PainterRectagleElement | import("./painter-element/element-container").PainterContainerElement | import("./painter-element/element-clip").PainterClipElement | import("./painter-element/element-transform").PainterTransformElement;
/** 获取指定元素的内部尺寸, 结果不包含元素的 left 和 top */
layout(elementOption: BuiltInPainterElementOption): Promise<import("./value").Size>;
/** 兼容将 painter 实例保存在 uniapp this 上, 勿手动调用 */
toJSON(): string;
}
export {};
import { PainterElementOption } from "./painter-element/base";
export interface Size {
width: number;
height: number;
}
export interface Rect {
top: number;
left: number;
width: number;
height: number;
}
export declare type BaseLine = "top" | "middle" | "bottom" | "normal";
export declare type BorderRadius = number | BorderRadius4;
export declare type BorderRadius4 = [topLeft: number, topRight: number, bottomLeft: number, bottomRight: number];
export declare type BorderStyle = "solid" | "dashed";
/** @example "#rrggbb" | "#rgb" | "colorName" */
export declare type Color = string;
export interface ColorStop {
offset: number;
color: Color;
}
export declare type FillStrokeStyle = string | CanvasGradient | CanvasPattern;
export declare type FontWeight = "normal" | "bold";
export declare type FontStyle = "normal" | "italic";
export declare type ObjectFit = "fill" | "contain" | "cover";
export declare type ObjectPosition = ["left" | "center" | "right", "top" | "center" | "bottom"];
export declare type Position = "static" | "absolute";
export declare type TextAlign = "left" | "right" | "center";
export declare type TextDecoration = "none" | "line-through";
/** left-top right-top right-bottom left-bottom */
export declare type OmitBaseOption<T> = Omit<T, keyof PainterElementOption>;
export declare function cssBorderStyleToLinePattern(borderStyle: BorderStyle, borderWidth: number): [number, number];
......@@ -265,6 +265,7 @@
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
......
......@@ -6,6 +6,7 @@ const dev = {
cffp_url:'https://mdev.anjibao.cn/cffpApi/cffp',
share_url:'https://mdev.anjibao.cn/cffp',
sfp_url:'https://mdev.anjibao.cn/sfpApi',
img_url:'https://mdev.zuihuibi.cn'
}
const stage = {
base_url:'https://mstage.zuihuibi.cn',
......@@ -20,7 +21,8 @@ const prod = {
api_url:'https://app.ydhomeoffice.cn/appApi',
cffp_url:'https://app.ydhomeoffice.cn/appApi/cffp',
share_url:'https://app.ydhomeoffice.cn/appYdhomeoffice',
sfp_url:'https://hoservice.ydhomeoffice.cn/hoserviceApi'
sfp_url:'https://hoservice.ydhomeoffice.cn/hoserviceApi',
img_url:'https://app.ydhomeoffice.cn'
}
// companyType: '1', cffp
// companyType: '2', appYdhomeoffice
......@@ -51,6 +53,7 @@ let apiURL = config[env].api_url;
let cffpURL = config[env].cffp_url;
let shareURL = config[env].share_url;
let sfpUrl = config[env].sfp_url;
let imgUrl = config[env].img_url;
export{
baseURL,
......@@ -59,4 +62,6 @@ export{
companyInfo,
shareURL,
sfpUrl,
env,
imgUrl
}
\ No newline at end of file
......@@ -118,6 +118,7 @@
import * as environment from "@/environments/environment";
import common from '@/common/common';
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{
everyJoinPopup,
......@@ -177,8 +178,9 @@
if(uni.getStorageSync('cffp_userId')){
this.userId = uni.getStorageSync('cffp_userId')
}
if(!uni.getStorageSync('loginType')){
if(!uni.getStorageSync('loginType') || this.loginType == 'visitor'){
this.loginType = 'visitor'
this.checkToken()
}
// 非邀请状态
if(!this.inviteUserId&&this.loginType == 'codelogin'&&this.userInfo.mobile){
......@@ -189,9 +191,34 @@
if(!this.inviteUserId&&this.loginType == 'codelogin'&&!this.form.nickName){
this.queryInfo()
}
// 登录状态
if(this.loginType == 'codelogin'){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
},
methods: {
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
})
}
})
},
getqueryById(shareId){
api.queryById({id:shareId}).then(res =>{
this.form.nickName = res.data.data.name
......@@ -348,6 +375,7 @@
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
......
......@@ -60,6 +60,7 @@
import api from '../../api/api';
import common from '../../common/common';
import {companyInfo} from "@/environments/environment";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -350,6 +351,11 @@
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
})
}
......@@ -359,6 +365,7 @@
},
onShow() {
this.checkToken();
},
destroyed() {
uni.hideToast();
......
......@@ -81,11 +81,19 @@
</template>
<script>
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
}
},
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
}
</script>
......
......@@ -287,6 +287,7 @@
<script>
import {companyInfo} from "@/environments/environment";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return {
......@@ -300,10 +301,14 @@
this.type = options.type;
this.isBack = options.isBack
},
// onLoad(options){
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
// },
},
methods:{
callCustomerService() {
const phoneNumber = '400-921-9290';
......
......@@ -57,6 +57,7 @@
</template>
<script>
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return {
......@@ -64,8 +65,12 @@
}
},
components:{},
onLoad(){
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
......
......@@ -76,6 +76,7 @@
import everyJoinPopup from "@/components/commonPopup/everyJoinPopup.vue";
import eSignature from '@/components/eSignature/eSignature.vue';
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{eSignature,everyJoinPopup},
data() {
......@@ -100,6 +101,11 @@
},
onShow(){
this.lockScroll()
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
beforeDestroy() {
console.log('组件销毁');
......@@ -259,6 +265,7 @@
}
})
this.releaseScroll()
this.checkToken()
}
})
},
......@@ -267,6 +274,19 @@
delta: 1
});
},
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
uni.setStorageSync('loginType', 'visitor');
}
})
}
})
},
cancel(){
uni.navigateBack({delta:1})
},
......
......@@ -15,11 +15,18 @@
]
},
"dependencies": {
"@dcloudio/uni-ui": "^1.5.10",
"@uqrcode/js": "^4.0.7",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.13",
"echarts": "^5.4.1",
"html2canvas": "^1.4.1",
"js-sha256": "^0.11.1",
"nanoid": "^4.0.0"
"mp-painter": "^1.0.1",
"nanoid": "^4.0.0",
"qrcode": "^1.5.4",
"qrcodejs2": "^0.0.2",
"uqrcodejs": "^4.0.7"
},
"devDependencies": {
"less": "^4.3.0"
......
......@@ -539,6 +539,11 @@
"style": {
"navigationBarTitleText": "协议"
}
},{
"path": "poster/poster",
"style": {
"navigationBarTitleText": "分销海报"
}
}
]
},{
......
......@@ -78,6 +78,7 @@
import courseItem from "@/components/courseItem/courseItem.vue";
import api from "@/api/api";
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{courseItem},
data() {
......@@ -147,6 +148,13 @@
this.afterSalesFlag = option.afterSalesFlag;
this.userAfterSalesDtl()
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
}
......
......@@ -26,6 +26,7 @@
import dataHandling from "@/util/dataHandling";
import api from "@/api/api";
import courseItem from "@/components/courseItem/courseItem.vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{
courseItem
......@@ -70,7 +71,14 @@
},
onLoad() {
this.userAfterSales()
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
}
</script>
......
......@@ -86,6 +86,7 @@
import courseItem from "@/components/courseItem/courseItem.vue";
import commonSelect from '@/components/commonSelect/commonSelect.vue';
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{
courseItem,
......@@ -223,6 +224,11 @@
},
onShow() {
this.userRefundCourseDtl();
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
}
</script>
......
......@@ -14,6 +14,7 @@
<script>
// import myListItem from "@/components/my-list-item/my-list-item.vue";
import api from "@/api/api";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
// components:{
// myListItem
......@@ -76,6 +77,13 @@
this.readId = option.readId;
this.queryDate = option.queryDate;
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
if(this.type=='1'){
this.typeName = '分享';
......
......@@ -54,7 +54,8 @@
<view class="courseTitleContent">
<view class="courseTitle">
<view class="" style="width: 100%;">
<h4>{{courseInfo.fileTitle}}</h4>
<h4>{{courseInfo.fileSynopsis}}</h4>
<view>{{courseInfo.fileTitle}}</view>
</view>
</view>
......@@ -190,11 +191,11 @@
import VerifyPopup from "@/components/unipopup/verifyPopup.vue";
import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import dataHandling from "@/util/dataHandling";
import {hshare} from '@/util/fiveshare';
import {hshare,setWechatShare,initJssdkShare} from '@/util/fiveshare';
import {nanoid} from 'nanoid';
import common from '../../common/common';
import {baseURL,apiURL,cffpURL,companyInfo,shareURL} from "@/environments/environment";
export default {
components: {
UniShareWx,
......@@ -317,6 +318,7 @@
this.continueShare()
},
continueShare(){
this.userId = uni.getStorageSync('cffp_userId')
const shareCode = nanoid() + this.userId
const jumptime = Date.parse(new Date()) / 1000
//app分享
......@@ -626,7 +628,7 @@
//this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId'];
// this.lecturerQuery();
this.relatedCoursesList();
// this.relatedCoursesList();
if (uni.getStorageSync('h5_coursesharing')) {
this.coursesharing = uni.getStorageSync('h5_coursesharing')
this.getshareData()
......@@ -1028,7 +1030,12 @@
if(uni.getStorageSync('cffp_userInfo')){
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
this.userId = uni.getStorageSync('cffp_userId')
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
let _this = this;
......@@ -1076,6 +1083,11 @@
clearInterval(this.timer)
}
}
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
}
</script>
......
......@@ -26,6 +26,12 @@
</view>
<view class="productBox">
<view class="productList" :style="{marginTop}">
<view class="tabBox">
<!-- @click="courseClassify=4;courseList()" -->
<view :class="{'actived': courseClassify==4}" @click="transform('consult')"><text>咨询产品</text></view>
<!-- @click="courseClassify=3;courseList()" -->
<view :class="{'actived': courseClassify==3}" @click="transform('plan')"><text>规划产品</text></view>
</view>
<view class="productItem" v-for="item in localCourseInfos" :key="item.fileId" >
<view class="top" @click="goDetail(item)">
<view class="left">
......@@ -33,10 +39,10 @@
</view>
<view class="right">
<view class="one">
{{item.fileTitle}}
{{item.fileSynopsis}}
</view>
<view class="two">
{{item.fileSynopsis}}
{{item.fileTitle}}
</view>
<view class="three">
<text style="font-size: 28rpx;color: rgba(32, 39, 155, 1);">{{Number(item.coursePrice).toFixed(2)}}</text>
......@@ -102,6 +108,7 @@
</template>
<script>
import BootPage from "@/components/bootpage/bootpage.vue";
import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
import api from "../../api/api";
......@@ -111,7 +118,7 @@
import search from '@/components/search/search.vue';
import {baseURL,apiURL,cffpURL,companyInfo,shareURL} from "@/environments/environment";
import dataHandling from "@/util/dataHandling";
import {hshare} from '@/util/fiveshare';
import {hshare,setWechatShare,initJssdkShare} from '@/util/fiveshare';
import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import {nanoid} from 'nanoid';
export default{
......@@ -158,6 +165,7 @@
env:dataHandling.getRuntimeEnv2(),
shareItem:{},//分享的产品
sharelogin: false,
courseClassify:4,
}
},
......@@ -173,7 +181,12 @@
if(uni.getStorageSync('cffp_userInfo')){
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
this.userId = uni.getStorageSync('cffp_userId')
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
created(){
this.queryName = uni.getStorageSync('queryName') || '';
......@@ -195,6 +208,15 @@
}
},
methods:{
transform(value){
if(value == 'consult'){
this.courseClassify = 4
}else if(value == 'plan'){
this.courseClassify = 3
}
this.$emit('changeCourseClassify',this.courseClassify)
this.courseList()
},
gotoJoinPartner(){
dataHandling.pocessTracking(
'点击',
......@@ -255,7 +277,7 @@
this.continueShare()
},
continueShare(){
console.log('this.shareItem',this.shareItem);
this.userId = uni.getStorageSync('cffp_userId')
const shareCode = nanoid() + this.userId
const jumptime = Date.parse(new Date()) / 1000
//app分享
......@@ -310,7 +332,13 @@
url = window.sessionStorage.getItem('firstEntryUrl').split('#')[0];
}
}
hshare(data, url)
setTimeout(()=>{
initJssdkShare(() => {
setWechatShare(data);
}, url);
},500)
// hshare(data, url)
this.submitsuessc(shareCode,jumptime,item)
dataHandling.pocessTracking(
......@@ -339,6 +367,11 @@
}
api.userShare(UserShareRequestVO).then(res => {
if (res['success']) {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
// uni.showToast({
// title: '分享成功',
// duration: 2000
......@@ -397,7 +430,8 @@
},
courseList(){
const param = {
queryName:this.queryName
queryName:this.queryName,
courseClassify:this.courseClassify
}
api.courseList(param).then(res=>{
if(res['success']){
......@@ -416,7 +450,8 @@
const cffp_userInfo = {
name: res['data']['userReName'],
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType']
partnerType:res['data']['partnerType'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList');
......@@ -450,6 +485,26 @@
width: 100%;
height: auto;
box-sizing: border-box;
.tabBox{
display: flex;
align-items: center;
height: 88rpx;
margin-bottom: 20rpx;
background: #fafafa;
border-bottom: 1px solid #262088;
view{
color: #000;
width: 160rpx;
height: 100%;
text-align: center;
margin-right:30rpx ;
line-height: 88rpx;
&.actived{
background-color: #262088;
color: #fff;
}
}
}
.homeHeader{
box-sizing: border-box;
width: 100%;
......
......@@ -64,7 +64,11 @@
</view>
</view> -->
<view class="productList" v-if="cffpCourseInfos.length>0">
<courselist :showFlag="false" :cffpCourseInfos="cffpCourseInfos"></courselist>
<courselist
:showFlag="false"
:cffpCourseInfos="cffpCourseInfos"
@changeCourseClassify="changeCourseClassify"
></courselist>
<view class="productListBox">
<!-- <view class="productListItem" v-for="item in cffpCourseInfos" :key="item.fileId" @click="goDetail(item)"> -->
......@@ -196,9 +200,21 @@
</view>
</view>
</uni-popup>
<!-- 不是新锐合伙人提示 -->
<partner-tip-popup
ref="PartnerTipPopup"
content="您还未升级为新锐合伙人,团队成员销售成功您不能拿到收益。购买产品升级为新锐合伙人 "
joinText="暂不升级,继续邀请"
continueText="购买产品,立即升级"
btnType="vertical"
:tipIcon="true"
@join="jumpPage('2')"
@continue="jumpPage('1')"
/>
</template>
<script>
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling";
import courselist from '@/pages/courselist/courselist.vue';
import api from "../../api/api";
......@@ -206,11 +222,14 @@
import carousel from '@/components/carousel/carousel.vue';
import search from '@/components/search/search.vue';
import courseItem from "@/components/courseItem/courseItem.vue";
import {companyInfo} from "@/environments/environment";
import {companyInfo,baseURL,shareURL} from "@/environments/environment";
import JoinPopup from '@/components/commonPopup/JoinPopup.vue';
import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
import {hshare} from '@/util/fiveshare';
export default {
data() {
return {
productType: 4,
partnerStatistic:{}, //申请加盟统计
showSearch: true,
searchQuery: '',
......@@ -267,7 +286,8 @@
loginornot: true,
queryName: '',
loginType : uni.getStorageSync('loginType'),
userInfo:{} //用户信息
userInfo:{} ,//用户信息,
productItem:{}
}
},
components: {
......@@ -276,11 +296,11 @@
carousel,
search,
courseItem,
JoinPopup
JoinPopup,
PartnerTipPopup
},
onShow() {
console.log('11111');
this.loginType = uni.getStorageSync('loginType')
this.init();
this.showSearch = false;
......@@ -292,12 +312,21 @@
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
if(uni.getStorageSync('cffp_userId')){
this.userInfo = uni.getStorageSync('cffp_userId')
this.userId = uni.getStorageSync('cffp_userId')
}
},
onLoad(options) {
if(options.sharePoster){
dataHandling.pocessTracking(
'进入',
`用户通过分享海报进入系统,邀请码为${options.invitationCode},邀请人userId为${options.inviteUserId}`,
'进入',
2,
'首页',
'pages/index/index'
)
}
//如果用户在其他的地方快捷登录,没有返回到首页,执行此监听方法
uni.$on('loginUpdate',()=>{
this.queryAreaCenterInfo();
......@@ -314,6 +343,32 @@
uni.$off('loginUpdate', this.queryAreaCenterInfo);
},
methods: {
// 初始化首页分享 注意sdk时序问题。传递的url一定要是当前页面的url window.location.href.split('#')[0]
// 不是window.location.href.split('#')[0]很可能不成功
initShare() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href.split('#')[0]);
// #endif
},
jumpPage(type){
console.log('type',type);
if(type=='1'){
uni.navigateTo({
url:'/pages/inviteJoin/inviteJoin'
})
}else {
uni.navigateTo({
url: `/pages/courseDetail/courseDetail?fileId=${this.productItem.fileId}`
});
}
},
changeCourseClassify(val){
this.productType = val
},
queryInfo() {
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
......@@ -324,6 +379,7 @@
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
console.log('cffp_userInfo.partnerType',cffp_userInfo.partnerType);
......@@ -391,6 +447,9 @@
if(loginType == 'codelogin'){
this.querySystemMessage()
this.queryInfo()
this.courseList()
this.initShare();
this.getOneProduct()
}else {
this.featureLists =[
{
......@@ -419,7 +478,6 @@
},
]
console.log('this.featureLists',this.featureLists);
uni.removeTabBarBadge({ index: 3 });
}
if (uni.getStorageSync('isLogin')) {
......@@ -445,6 +503,8 @@
this.queryAreaCenterInfo();
this.announcementQuery();
this.courseList();
this.getOneProduct()
this.initShare();
} else {
uni.showToast({
title: res['message'],
......@@ -504,7 +564,8 @@
},
courseList() {
const param = {
queryName: this.queryName
queryName: this.queryName,
courseClassify: this.productType
}
api.courseList(param).then(res => {
if (res['success']) {
......@@ -512,6 +573,22 @@
if(this.cffpCourseInfos.length>0){
this.cffpCourseInfos.forEach(item=>{
item.coursePrice =Number(item.coursePrice).toFixed(2) || '0.00'
if(item.productCode&&item.productCode=='C09'){
this.productItem = item
uni.setStorageSync('productItem',this.productItem );
}
})
}
}
})
},
getOneProduct() {
api.courseList().then(res => {
if (res['success']) {
let result = res['data']['data'];
if(result.length>0){
result.forEach(item=>{
item.coursePrice =Number(item.coursePrice).toFixed(2) || '0.00'
})
}
}
......@@ -547,7 +624,19 @@
return
}
// 未登录状态,不允许未登录状态跳转的,直接去登录页
if(!this.loginType||this.loginType=='visitor'){
if (featureItem.key == '07') {
uni.switchTab({
url: featureItem.link
})
}else {
uni.navigateTo({
url:'/myPackageA/login/login'
})
}
return
}
if(featureItem.isApply&& this.userInfo.partnerType){
dataHandling.pocessTracking(
'点击',
......@@ -560,23 +649,12 @@
this.getPartnerStatistic()
return
}
if (this.loginornot == false && featureItem.name != "学习认证" && featureItem.name != "更多功能") {
dataHandling.pocessTracking(
'点击',
`用户在首页未登录时点击${featureItem.name}`,
'点击',
2,
'首页',
'pages/index/index'
)
uni.clearStorageSync();
uni.setStorageSync('loginType','visitor');
uni.redirectTo({
url: '/myPackageA/login/login?from=index'
})
return
//当为见习合伙人的时候,弹出框提示
if(featureItem.key == '04'&& this.userInfo.levelCode == 'P1'){
this.$refs.PartnerTipPopup.open()
return
}
if (featureItem.key == '02') {
if (this.cffpUserInfo.levelCode == 'C1' || this.cffpUserInfo.levelCode == 'C2' || this.cffpUserInfo
.levelCode == 'C3') {
......@@ -674,9 +752,23 @@
onChange: function(e) {
this.old.x = e.detail.x
this.old.y = e.detail.y
}
},
getOneProduct() {
api.courseList().then(res => {
if (res['success']) {
let result = res['data']['data'];
if(result.length>0){
result.forEach(item=>{
if(item.productCode&&item.productCode=='C09'){
this.productItem = item
uni.setStorageSync('productItem',this.productItem );
}
})
}
}
})
},
},
mounted() {}
}
</script>
......
......@@ -154,9 +154,8 @@
import dataHandling from "@/util/dataHandling";
import api from "@/api/api"
import common from '../../common/common';
import {hshare } from '@/util/fiveshare';
import {hshare ,setWechatShare,initJssdkShare} from '@/util/fiveshare';
import {baseURL,apiURL,cffpURL,companyInfo,shareURL} from "@/environments/environment";
export default {
data() {
return {
......@@ -207,6 +206,13 @@
this.queryInfo();
}
},
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
goBack() {
uni.navigateBack({
......@@ -346,6 +352,14 @@
'邀请加盟',
'pages/inviteJoin/inviteJoin'
)
// setTimeout(()=>{
// // #ifdef H5
// initJssdkShare(() => {
// setWechatShare();
// }, window.location.href);
// // #endif
// },500)
},
closeShare() {
this.$refs.share.close()
......
......@@ -95,6 +95,7 @@
import dataHandling from "@/util/dataHandling";
import CommonTimePicker from '@/components/commonTimePicker/commonTimePicker.vue';
import JoinPopup from '@/components/commonPopup/JoinPopup.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import {
fmdata
} from '@/util/currentDate.js'
......@@ -232,6 +233,13 @@
this.userShareCount();
this.userShareQuery();
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
}
......
......@@ -10,8 +10,8 @@
<!-- 课程详情 -->
<template v-if="courseInfoItem">
<view class="courseItemBox" >
<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle"
:summaryBox="courseInfoItem.fileSynopsis"
<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileSynopsis"
:summaryBox="courseInfoItem.fileTitle"
:dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}"
:fileLecturerId="courseInfoItem.fileLecturerId" :fileId="fileId"></course-item>
</view>
......@@ -177,6 +177,7 @@
import {apiURL,companyInfo} from "@/environments/environment";
import {nextTick} from "vue";
import common from '../../common/common';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components: {
courseItem
......@@ -531,7 +532,13 @@
this.courseDetailLoad(option);
}
},
mounted() {}
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
}
</script>
......
......@@ -42,6 +42,7 @@
import api from "@/api/api";
import common from "@/common/common";
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -232,6 +233,13 @@
this.Withdrawal = option.Withdrawal
this.commissionType = option.commissionType;
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
uni.showLoading({
title: '加载中...'
......
......@@ -56,6 +56,7 @@
import {apiURL} from "@/environments/environment";
import courseItem from "@/components/courseItem/courseItem.vue";
import tabBar from '../../components/tabBar/tabBar.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{tabBar,courseItem},
data() {
......@@ -71,6 +72,11 @@
};
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
// let loginType = uni.getStorageSync('loginType')
// if(loginType !== "visitor" ){
// this.querySystemMessage()
......
......@@ -37,6 +37,7 @@
<script>
import {companyInfo} from "@/environments/environment";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -65,6 +66,11 @@
}else if(this.companyType == '2'){
this.companyLogo='../../../static/logo2.png'
}
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
goBack() {
......
......@@ -52,6 +52,7 @@
<script>
import questionsData from "@/util/questions";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -65,6 +66,13 @@
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
computed:{
newQuestionData(){
let result = questionsData.filter(item=>item.id==this.currentTab)
......
......@@ -128,6 +128,7 @@
import CommonTimePicker from '@/components/commonTimePicker/commonTimePicker.vue';
import dataHandling from "@/util/dataHandling";
import api from "@/api/api";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components: {
CommonTimePicker
......@@ -263,6 +264,13 @@
this.getmyseatem()
this.getqueryTeamAchievement()
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
sortswitch(obj) {
this.currentFilterBtn = obj.id
......
......@@ -119,6 +119,7 @@
import CommonTimePicker from '@/components/commonTimePicker/commonTimePicker.vue';
import dataHandling from "@/util/dataHandling";
import api from "@/api/api";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components: {
CommonTimePicker
......@@ -229,6 +230,13 @@
this.getmyseatem()
this.getqueryTeamAchievement()
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
sortswitch(obj) {
this.currentFilterBtn = obj.id
......
......@@ -60,6 +60,11 @@
</view>
</view>
<view class="shareBtn" :class="{'shareBottom':shareBtnBottom}" @click="gotoPoster">
<view class="shareBox">
分享给好友
</view>
</view>
</view>
<!-- 使用封装后的弹窗组件 -->
<join-popup
......@@ -146,6 +151,17 @@
</view>
</view>
</uni-popup>
<!-- 不是新锐合伙人提示 -->
<partner-tip-popup
ref="PartnerTipPopup"
content="您还未升级为新锐合伙人,团队成员销售成功您不能拿到收益。购买产品升级为新锐合伙人 "
joinText="暂不升级,继续邀请"
continueText="购买产品,立即升级"
btnType="vertical"
:tipIcon="true"
@join="jumpPage('2')"
@continue="jumpPage('1')"
/>
</view>
</template>
......@@ -157,7 +173,8 @@
import {companyInfo} from "@/environments/environment";
import FloatingButton from '@/components/FloatingButton/FloatingButton.vue';
import JoinPopup from '@/components/commonPopup/JoinPopup.vue';
import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -186,7 +203,7 @@
{id:'01',categoryName:'团队',
children:[
{title:'申请加盟',icon:'icon-hezuo',link:'/myPackageA/applyFranchise/applyFranchise?',isOpen:true,isShow:true,isApply:true},
{title:'邀请加盟',icon:'icon-yaoqing',link:'/pages/inviteJoin/inviteJoin',isOpen:true,isShow:true,identity: true},
{key:'06',title:'邀请加盟',icon:'icon-yaoqing',link:'/pages/inviteJoin/inviteJoin',isOpen:true,isShow:true,identity: true},
{title:'我的团队',icon:'icon-tuandui',link:'/pages/personalCenter/myTeam',isOpen:true,isShow:true,identity: true},
{title:'育成团队',icon:'icon-yuchengguanxi',link:'/pages/personalCenter/myTeamIncubate',isOpen:true,isShow:true,identity: true},
],
......@@ -206,12 +223,16 @@
{title:'我的消息',icon:'message',link:'/pages/systemMsg/system_msg',isOpen:true,isShow:true,islogin:true},
{title:'系统设置',icon:'setting',link:'/pages/personalCenter/system/settings',isOpen:true,isShow:true}
],
partnerStatistic:{} //申请加盟统计
partnerStatistic:{}, //申请加盟统计
userInfo:{} ,//用户信息,
shareBtnBottom:false,
productItem:{}
}
},
components:{
tabBar,
JoinPopup
JoinPopup,
PartnerTipPopup
},
onShow() {
this.loginType = uni.getStorageSync('loginType')
......@@ -230,6 +251,7 @@
if(this.loginType == 'codelogin'){
this.querySystemMessage()
this.queryInfo();
this.courseList()
}else {
this.messageInfo = []
uni.removeTabBarBadge({ index: 3 });
......@@ -247,9 +269,61 @@
// 移除监听事件
uni.$off('handClick');
});
if(uni.getStorageSync('cffp_userInfo')){
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
// #ifdef H5
const systemInfo = uni.getSystemInfoSync();
this.shareBtnBottom = systemInfo.platform === 'ios'
console.log('this.shareBtnBottom',this.shareBtnBottom);
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
courseList() {
api.courseList().then(res => {
if (res['success']) {
let cffpCourseInfos = res['data']['data'];
if(cffpCourseInfos.length>0){
cffpCourseInfos.forEach(item=>{
if(item.productCode&&item.productCode=='C09'){
this.productItem = item
uni.setStorageSync('productItem',this.productItem );
}
})
}
}
})
},
gotoPoster(){
if(!uni.getStorageSync('loginType') || uni.getStorageSync('loginType')=='visitor'){
uni.setStorageSync('loginType','visitor')
uni.setStorageSync('islogin','1')
}
uni.navigateTo({
url:'/myPackageA/poster/poster?from=personalCenter'
})
},
jumpPage(type){
if(type=='1'){
uni.navigateTo({
url:'/pages/inviteJoin/inviteJoin'
})
}else {
let productItem = {}
if(uni.getStorageSync('productItem')){
productItem = JSON.parse(JSON.stringify(uni.getStorageSync('productItem')))
}
uni.navigateTo({
url: `/pages/courseDetail/courseDetail?fileId=${productItem.fileId}`
});
}
},
getPartnerStatistic(){
if(this.userId){
api.partnerStatisticsGrade({userId:uni.getStorageSync('cffp_userId')}).then((res)=>{
......@@ -340,6 +414,9 @@
},
// 菜单跳转页面
goDetail(item){
if(uni.getStorageSync('cffp_userInfo')){
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
if(item.isApply&&(!uni.getStorageSync('loginType')||uni.getStorageSync('loginType')=='visitor')){
dataHandling.pocessTracking(
'申请加盟',
......@@ -405,6 +482,11 @@
return
}
//当为见习合伙人的时候,弹出框提示
if(item.key == '06'&& this.userInfo.levelCode == 'P1' && uni.getStorageSync('loginType') == 'codelogin'){
this.$refs.PartnerTipPopup.open()
return
}
// 说明不需要登录就可以进
if(item.isLogin){
dataHandling.pocessTracking(
......@@ -702,6 +784,25 @@
.kuaiBox:last-child{
margin-bottom: 100rpx;
}
.shareBtn{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 50rpx 0rpx;
.shareBox{
background-color: #20269B;
color: #fff;
font-size: 30rpx;
border-radius: 60rpx;
width: 50%;
text-align: center;
padding: 20rpx 30rpx;
}
}
.shareBottom{
padding-bottom: 150rpx;
}
}
.joinContent{
width: 500rpx;
......@@ -814,5 +915,31 @@
}
}
}
/* 新增:iPad mini 和 iPad Air 竖屏的媒体查询 */
/* iPad mini 竖屏 */
@media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 1) {
.container {
.myContent .shareBtn{
padding-bottom: 120rpx;
}
}
}
/* iPad Air 竖屏 */
@media only screen
and (min-device-width: 820px)
and (max-device-width: 1180px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 1) {
.container {
.myContent .shareBtn{
padding-bottom: 120rpx !important;
}
}
}
</style>
......@@ -14,7 +14,7 @@
<script>
import MenuList from "@/components/menuList/menuList.vue"
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{
MenuList
......@@ -53,6 +53,13 @@
]
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
goBack() {
uni.navigateBack({
......
......@@ -19,6 +19,7 @@
</template>
<script>
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
props: {
menuList: {
......@@ -28,6 +29,13 @@
data() {
return {}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
console.log(this.minorMenuLists, 7412)
},
......
......@@ -21,6 +21,7 @@
import MenuList from "@/components/menuList/menuList.vue"
import {companyInfo} from "@/environments/environment";
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{ MenuList },
data() {
......@@ -53,6 +54,13 @@
]
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
destroyed() {
uni.hideToast();
},
......
......@@ -50,6 +50,7 @@
import common from '../../common/common';
import {companyInfo} from "@/environments/environment";
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -100,6 +101,13 @@
}
this.optionForm = JSON.parse(options.customerBasicInfo)
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
handleKeyDown(e) {
console.log('this.isComposing',this.isComposing);
......
......@@ -131,6 +131,7 @@
import api from '../../api/api';
import CustomDatePop from './customDatePop.vue';
import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
let nowTime = dataHandling.getMonthRange(dataHandling.getDateParts().year, dataHandling.getDateParts().month)
export default{
data(){
......@@ -182,7 +183,11 @@
this.queryByUserIdFortuneStatistic();
this.getCommissionType()
this.getDetail()
console.log(11111);
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
// 查看订单详情
......
......@@ -31,6 +31,7 @@
import dataHandling from "@/util/dataHandling";
import tabBar from '../../components/tabBar/tabBar.vue';
import courseItem from "@/components/courseItem/courseItem.vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -71,6 +72,13 @@
]
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
goDetail(item) {
if (item.isShow == true && item.isOpen == true) {
......
......@@ -115,6 +115,7 @@
import CommonTimePicker from '@/components/commonTimePicker/commonTimePicker.vue';
import dataHandling from "@/util/dataHandling";
import JoinPopup from '@/components/commonPopup/JoinPopup.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
components:{
courseItem,
......@@ -264,6 +265,11 @@
let app22 = getCurrentPages().length
this.userCourseCount()
this.userCourseList()
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
}
}
</script>
......
......@@ -38,6 +38,7 @@
<script>
import api from '../../api/api';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return{
......@@ -49,6 +50,11 @@
},
onShow(){
this.querySystemMessage();
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
querySystemMessage() {
......
......@@ -22,6 +22,7 @@
<script>
import api from "../../api/api";
import common from '../../common/common';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return{
......@@ -39,6 +40,13 @@
this.id = options.id;
this.getSystemMsgDetail();
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
getSystemMsgDetail(){
api.querySystemMessageDetail({systemMessageId:this.id}).then((res)=>{
......
......@@ -57,6 +57,7 @@
</template>
<script>
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return {
......@@ -64,8 +65,12 @@
}
},
components:{},
onLoad(){
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
......
......@@ -73,6 +73,7 @@
<script>
import api from '../../api/api';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
return {
......@@ -91,6 +92,13 @@
this.partnerTradeNo = options.partnerTradeNo;
this.goFortuneWithdrawal()
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
goBack() {
uni.navigateBack({
......
......@@ -172,7 +172,7 @@
import dataHandling from "../../util/dataHandling";
import { nanoid } from "nanoid";
import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -205,6 +205,13 @@
option:{}
}
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods: {
goBack(){
uni.navigateBack({
......
......@@ -86,6 +86,7 @@
<script>
import api from "../../api/api";
import {reactive,provide} from "vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -108,6 +109,13 @@
this.bindPickerChange({detail:{value:this.index}});
this.calcuteData = uni.getStorageSync('calcuteData') ? JSON.parse(uni.getStorageSync('calcuteData')) : null;
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
// 选择间隔
bindPickerChange(e){
......
......@@ -278,6 +278,7 @@
import { nanoid } from "nanoid";
// import Echarts from '../../components/echarts/echarts'
import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
data(){
......@@ -355,6 +356,13 @@
onLoad(){
this.provCityQry();
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
methods:{
goBack(){
uni.navigateBack({
......
......@@ -53,6 +53,7 @@
<script>
import { ref,toRefs,reactive } from "vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
props: ['isReadonly','loanType','a','b'],
emits:['getData'],
......@@ -92,6 +93,13 @@
components:{
},
onShow() {
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
setup(props,content) {
const a = reactive({value:props.a});
const b = reactive({value:props.b});
......
......@@ -37,6 +37,7 @@
import {toRefs} from "vue";
import api from '../../api/api';
import common from '../../common/common'
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default{
props:['cityInfo','planningParams'],
emits:['getData'],
......@@ -60,7 +61,12 @@
components:{
},
onLoad(){
onShow(){
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
setup(props,content){
const cityInfo = props.cityInfo ? props.cityInfo : null;
......
......@@ -205,7 +205,7 @@
import foot from '../footer/footer.vue';
import { toRefs, ref } from 'vue';
import commonHead from '../header/header.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
export default {
data() {
return {
......@@ -638,6 +638,11 @@
this.calcuteMethod = '2';
this.resultShowFlag = true;
}
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
mounted() {
//this.checkToken();
......
......@@ -364,4 +364,33 @@ export default{
}
})
},
/**
* 检测是否是iOS刘海屏设备
* @returns {boolean} true-是刘海屏, false-不是刘海屏
*/
isNotchIOS() {
// 1. 先判断是否是iOS设备
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) ||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
if (!isIOS) return false;
// 2. 通过CSS环境变量检测
// 创建一个测试元素
const div = document.createElement('div');
div.style.position = 'fixed';
div.style.top = '0';
div.style.left = '0';
div.style.width = '1px';
div.style.height = 'constant(safe-area-inset-top)'; // 兼容旧版iOS
div.style.height = 'env(safe-area-inset-top)'; // 新版iOS
document.body.appendChild(div);
// 获取计算的高度值
const computedHeight = parseInt(window.getComputedStyle(div).height, 10);
document.body.removeChild(div);
// 3. 刘海屏设备safe-area-inset-top通常大于20(非刘海屏为0)
return computedHeight > 20;
}
}
\ No newline at end of file
......@@ -3,48 +3,123 @@
// import wx from 'weixin-js-sdk'
import api from "../api/api";
import {companyInfo,baseURL,shareURL} from "@/environments/environment";
let userInfo = {name:''}
if(uni.getStorageSync('cffp_userInfo')){
userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
//初始化
export function initJssdkShare(callback, url) {
var url = url
// export function initJssdkShare(callback, url) {
// console.log('签名',url);
// var url = url
//这一步需要调用后台接口,返回需要的签名 签名时间戳 随机串 和公众号appid
//注意url:window.location.href.split('#')[0] //
// request.post("", {
// url // url是当前页面的url
// },
let WxConfigRequestVO = {
url:url,
systemType:uni.getStorageSync('addSystemType')?uni.getStorageSync('addSystemType'):'1'
}
// @ts-ignore
api.Wxshare(WxConfigRequestVO).then(res => {
jWeixin.config({
debug: false,//调试的时候需要 在app上回弹出errmg:config ok 的时候就证明没问题了 这时候就可以改为false
appId: res.data.appId,//appid
timestamp: res.data.timestamp,//时间戳
nonceStr: res.data.nonceStr,//随机串
signature: res.data.signature,//签名
jsApiList: res.data.jsApiList//必填 是下面需要用到的方法集合
})
if(callback){
callback()
}
})
}
// //这一步需要调用后台接口,返回需要的签名 签名时间戳 随机串 和公众号appid
// //注意url:window.location.href.split('#')[0] //
// // request.post("", {
// // url // url是当前页面的url
// // },
// let WxConfigRequestVO = {
// url:url,
// systemType:uni.getStorageSync('addSystemType')?uni.getStorageSync('addSystemType'):'1'
// }
// // @ts-ignore
// api.Wxshare(WxConfigRequestVO).then(res => {
// jWeixin.config({
// debug: false,//调试的时候需要 在app上回弹出errmg:config ok 的时候就证明没问题了 这时候就可以改为false
// appId: res.data.appId,//appid
// timestamp: res.data.timestamp,//时间戳
// nonceStr: res.data.nonceStr,//随机串
// signature: res.data.signature,//签名
// jsApiList: res.data.jsApiList//必填 是下面需要用到的方法集合
// })
// if(callback){
// callback()
// }
// })
// }
// 初始化SDK
export function initJssdkShare(callback, url) {
const WxConfigRequestVO = {
url: url,
systemType: uni.getStorageSync('addSystemType') || '1'
};
api.Wxshare(WxConfigRequestVO).then(res => {
jWeixin.config({
debug: false, // 生产环境关闭调试
appId: res.data.appId,
timestamp: res.data.timestamp,
nonceStr: res.data.nonceStr,
signature: res.data.signature,
jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage']
});
jWeixin.ready(() => {
console.log('微信SDK初始化完成');
if (callback) callback();
});
jWeixin.error(err => {
console.error('微信SDK初始化失败', err);
});
});
}
// 设置微信分享内容(不自动覆盖,需手动调用)
export function setWechatShare(data) {
if (!jWeixin) {
console.error('微信SDK未初始化');
return;
}
if(!data){
const currentUrl = `${shareURL}/pages/index/index`;
data = {
title: '成为银盾合伙人,分享商品赚不停',
// desc: `${userInfo.name || ''}邀您加入【家庭财策师联盟】,资源+伙伴,共赢未来!`,
desc: `资源+伙伴,共赢未来!`,
link: currentUrl,
imgUrl: `${shareURL}/static/images/shareBg.png`
};
}
jWeixin.ready(() => {
// 新API(推荐)
jWeixin.updateAppMessageShareData({
title: data.title,
desc: data.desc,
link: data.link,
imgUrl: data.imgUrl,
success: () => console.log('好友分享设置成功')
});
jWeixin.updateTimelineShareData({
title: data.title,
link: data.link,
imgUrl: data.imgUrl,
success: () => console.log('朋友圈分享设置成功')
});
// 旧API(兼容)
jWeixin.onMenuShareAppMessage({
title: data.title,
desc: data.desc,
link: data.link,
imgUrl: data.imgUrl,
success: () => console.log('旧版分享设置成功')
});
});
}
// data是穿的参数 url是当前页面的链接
export function hshare(data,url){
console.log('data,url',data,url);
// 确保分享的链接不包含时间戳
const cleanLink = data.link.split('&t_reload=')[0];
// initJssdkShare(data, url)
initJssdkShare(function(){
jWeixin.ready(function(){
var sharedata={
title: data.title, //标题
desc: data.desc, //描述
link: cleanLink ,//分享链接
link: data.link ,//分享链接
imgUrl:data.imgUrl, //图片
success:(res=>{
})
......@@ -54,4 +129,5 @@ export function initJssdkShare(callback, url) {
jWeixin.onMenuShareAppMessage(sharedata);//获取“分享给朋友”按钮点击状态及自定义分享内容接口(即将废弃)
})
},url)
}
\ No newline at end of file
}
\ No newline at end of file
import html2canvas from 'html2canvas';
/**
* 将DOM元素转换为图片
* @param {HTMLElement} element DOM元素
* @param {Object} options html2canvas配置选项
* @returns {Promise<string>} 返回图片的base64数据
*/
export const elementToImage = async (element, options = {}) => {
try {
// 默认配置
const defaultOptions = {
backgroundColor: null, // 透明背景
scale: 2, // 提高缩放以获得更清晰的图片
useCORS: true, // 允许跨域图片
allowTaint: true, // 允许污染图片
logging: false // 关闭日志
};
const canvas = await html2canvas(element, { ...defaultOptions, ...options });
return canvas.toDataURL('image/png');
} catch (error) {
console.error('生成图片失败:', error);
throw error;
}
};
\ No newline at end of file
import api from "@/api/api";
import dataHandling from './dataHandling'
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
//只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页
// 页面白名单,不受拦截
const whiteList = [
......@@ -12,7 +13,8 @@ const whiteList = [
'/pages/courseDetail/courseDetail',
'/pages/courselist/courselist',
'/pages/personalCenter/helpCenter',
'/pages/index/index'
'/pages/index/index',
'/myPackageA/poster/poster',
]
export default function initApp(){
let date = Date.now()
......@@ -21,10 +23,10 @@ export default function initApp(){
uni.addInterceptor('navigateTo', {
// 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转
invoke (e) {
console.log(e);
let pages = getCurrentPages()
let pagesLength = pages.length
if(whiteList.indexOf(e.url)==-1&&!uni.getStorageSync('loginType')){
uni.clearStorageSync();
uni.setStorageSync('loginType','visitor')
......@@ -50,6 +52,7 @@ export default function initApp(){
mobile: res['data']['mobile'],
partnerType:res['data']['partnerType'],
nickName:res['data']['nickName'],
levelCode:res['data']['levelCode'],
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
}
......@@ -66,6 +69,7 @@ export default function initApp(){
};
const fromParam = getQueryParam(e.url, 'from');
console.log('2222',!hasPermission(e.url));
if(!hasPermission(e.url)){
// 如果 from 参数在 whiteArr 中,说明是tabbar页带着tabbar的标志参数跳转到登录页,以便未登录状态下回到对应的tabbar页
if (fromParam && whiteArr.includes(fromParam)) {
......@@ -73,6 +77,7 @@ export default function initApp(){
url: `/myPackageA/login/login?from=${fromParam}`
})
}else {
console.log('zoujinlaile');
uni.redirectTo({
url: '/myPackageA/login/login'
})
......@@ -103,8 +108,10 @@ export default function initApp(){
success (e) {}
})
uni.addInterceptor('switchTab', {
// tabbar页面跳转前进行拦截
invoke(e) {
if (date) {
//如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking(
......@@ -122,6 +129,7 @@ export default function initApp(){
uni.addInterceptor('reLaunch', {
//页面跳转前拦截
invoke(e) {
if (date) {
//如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment