This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1 @@
.ant-guide-tour-button{width:100%;position:absolute;left:0;bottom:calc(100 * .5px + env(safe-area-inset-bottom));z-index:10001;display:flex;justify-content:center}.ant-guide-tour-button .ant-button:nth-of-type(1){color:#fff;background-color:transparent;box-shadow:inset 0 0 0 1px #eee}.ant-guide-tour-button .ant-button:nth-of-type(2){color:#333;background-color:#fff;box-shadow:none}.ant-guide-tour-button .ant-button{margin:0 6px;width:76px}.ant-guide-tour-indicator{width:100%;position:absolute;bottom:calc(calc(100 * .5px + env(safe-area-inset-bottom)) + 40 * .5px + 26px);left:50%;transform:translateX(-50%);z-index:10000;display:flex;justify-content:center}.ant-guide-tour-indicator-dot{margin:0 1.5px;background-color:#999;width:3px;height:3px;border-radius:1px}.ant-guide-tour-indicator-dot-active{width:13px;background-color:#fff}.ant-guide-tour-clear{position:fixed;top:40px;right:20px;z-index:10001;font-size:28px;color:#999}.ant-guide-tour-item{z-index:10000;position:fixed;top:0;left:0}.ant-guide-tour-swiper{z-index:10000;position:fixed;top:0;left:0}

View File

@ -0,0 +1,126 @@
<import-sjs
from="./index.sjs"
name="utils"
></import-sjs>
<view
a:if="{{visible}}"
class="ant-guide-tour {{className || ''}}"
style="{{style || ''}}"
>
<mask
show
className="{{maskClassName}}"
style="z-index:9999;{{maskStyle || ''}}"
></mask>
<ant-icon
type="CloseOutline"
className="ant-guide-tour-clear"
onTap="onCancel"
></ant-icon>
<view class="ant-guide-tour-button">
<ant-button
a:if="{{utils.checkShowJump(mixin.value, items)}}"
inline
size="small"
onTap="onCancel"
>
{{jumpText}}
</ant-button>
<ant-button
a:if="{{utils.checkShowPrev(mixin.value, items)}}"
inline
size="small"
onTap="onPrev"
data-currentValue="{{mixin.value}}"
>
{{prevStepText}}
</ant-button>
<ant-button
a:if="{{utils.checkShowNext(mixin.value, items)}}"
inline
size="small"
onTap="onNext"
data-currentValue="{{mixin.value}}"
>
{{nextStepText}}
</ant-button>
<ant-button
a:if="{{utils.checkShowKnow(mixin.value, items)}}"
inline
size="small"
onTap="onCancel"
>
{{gotItText}}
</ant-button>
</view>
<block a:if="{{swiperable}}">
<view class="ant-guide-tour-indicator">
<block
a:for="{{items}}"
a:for-index="index"
a:for-item="item"
>
<view class="ant-guide-tour-indicator-dot {{index === mixin.value ? 'ant-guide-tour-indicator-dot-active' : ''}}"></view>
</block>
</view>
<swiper
class="ant-guide-tour-swiper"
current="{{mixin.value}}"
adjustHeight="none"
style="height: 100vh"
onChange="onSwiperChange"
>
<block
a:for="{{items}}"
a:for-index="index"
a:for-item="item"
>
<swiper-item>
<view
class="ant-guide-tour-item {{item.className || ''}}"
style="top:{{item.top}}px; left:{{item.left}}px"
>
<slot
name="step"
index="{{mixin.current}}"
>
<image
a:if="{{item.imageUrl}}"
class="ant-guide-tour-item-img"
src="{{item.imageUrl}}"
style="{{item.imageStyle}}"
mode="{{item.imageMode}}"
></image>
</slot>
</view>
</swiper-item>
</block>
</swiper>
</block>
<block a:else>
<block
a:for="{{items}}"
a:for-index="index"
a:for-item="item"
>
<view
a:if="{{mixin.value === index}}"
class="ant-guide-tour-item {{item.className || ''}}"
style="top:{{item.top}}px; left:{{item.left}}px"
>
<slot
name="step"
index="{{index}}"
>
<image
a:if="{{item.imageUrl}}"
class="ant-guide-tour-item-img"
src="{{item.imageUrl}}"
style="{{item.imageStyle}}"
mode="{{item.imageMode}}"
></image>
</slot>
</view>
</block>
</block>
</view>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,55 @@
import { __awaiter, __generator } from "tslib";
import { Component, triggerEvent, triggerEventOnly } from '../_util/simply';
import { GuideTourDefaultProps } from './props';
import mixinValue from '../mixins/value';
Component(GuideTourDefaultProps, {
onNext: function () {
return __awaiter(this, void 0, void 0, function () {
var currentValue, newCurrent;
return __generator(this, function (_a) {
currentValue = this.getValue();
newCurrent = currentValue + 1;
if (!this.isControlled()) {
this.update(newCurrent);
}
triggerEvent(this, 'change', newCurrent);
return [2 /*return*/];
});
});
},
onPrev: function () {
return __awaiter(this, void 0, void 0, function () {
var currentValue, newCurrent;
return __generator(this, function (_a) {
currentValue = this.getValue();
newCurrent = currentValue - 1;
if (!this.isControlled()) {
this.update(newCurrent);
}
triggerEvent(this, 'change', newCurrent);
return [2 /*return*/];
});
});
},
onCancel: function () {
triggerEventOnly(this, 'cancel');
},
onSwiperChange: function (e) {
return __awaiter(this, void 0, void 0, function () {
var current;
return __generator(this, function (_a) {
current = e.detail.current;
if (!this.isControlled()) {
this.update(current);
}
triggerEvent(this, 'change', current);
return [2 /*return*/];
});
});
},
}, undefined, [
mixinValue({
valueKey: 'current',
defaultValueKey: 'defaultCurrent',
}),
]);

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"mask": "../Mask/index",
"ant-button": "../Button/index",
"ant-icon": "../Icon/index"
}
}

View File

@ -0,0 +1,18 @@
function checkShowNext(current, items) {
return current < items.length - 1;
}
function checkShowPrev(current, items) {
return current > 0;
}
function checkShowJump(current, items) {
return current === 0 && items.length > 1;
}
function checkShowKnow(current, items) {
return current === items.length - 1;
}
export default {
checkShowNext: checkShowNext,
checkShowPrev: checkShowPrev,
checkShowJump: checkShowJump,
checkShowKnow: checkShowKnow
};

View File

@ -0,0 +1,88 @@
import { IBaseProps } from '../_util/base';
interface IStep {
/**
* @description 图片地址
*/
imageUrl: string;
/**
* @description 图片模式
*/
imageMode: string;
/**
* @description 图片内联样式
*/
imageStyle: string;
/**
* @description 距离顶部
*/
top: string;
/**
* @description 距离左边
*/
left: string;
/**
* @description className
*/
className?: string;
}
export interface IGuideTour extends IBaseProps {
/**
* @description 蒙层样式
*/
maskStyle: string;
/**
* @description 蒙层 className
*/
maskClassName?: string;
/**
* @description 步骤详情
*/
items: IStep[];
/**
* @description 当前步骤
*/
current: number;
/**
* @description 初始step
*/
defaultCurrent: number;
/**
* @description 是否开启滑动模式
*/
swiperable: boolean;
/**
* @description 引导是否可见, 受控
* @default true
*/
visible: boolean;
/**
* @description 关闭回调
*/
onCancel: () => void;
/**
* @description 步骤改变回调
*/
onChange: (index: number) => boolean;
/**
* @description 上一步按钮文案
* @default "上一步"
*/
prevStepText?: string;
/**
* @description 下一步按钮文案
* @default "下一步"
*/
nextStepText?: string;
/**
* @description 知道了按钮文案
* @default "知道了"
*/
gotItText?: string;
/**
* @description 跳过按钮文案
* @default "跳过"
*/
jumpText?: string;
}
export declare const GuideTourDefaultProps: Partial<IGuideTour>;
export {};

View File

@ -0,0 +1,13 @@
export var GuideTourDefaultProps = {
visible: false,
swiperable: false,
items: [],
current: null,
defaultCurrent: 0,
gotItText: '知道了',
nextStepText: '下一步',
prevStepText: '上一步',
jumpText: '跳过',
maskStyle: '',
maskClassName: '',
};