添加新文件
This commit is contained in:
+296
@@ -0,0 +1,296 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "LuckyWheel",
|
||||
props: {
|
||||
prizes: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
default: 600
|
||||
},
|
||||
customStyle: {
|
||||
type: String
|
||||
},
|
||||
styleOpt: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
prizeBgColors: ["#fff0a3", "#fffce6", "#fdba64"],
|
||||
borderColor: "#ffd752"
|
||||
})
|
||||
},
|
||||
innerStyle: {
|
||||
type: String,
|
||||
default: `width: 85%;height:85%`
|
||||
},
|
||||
turns: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 5e3
|
||||
},
|
||||
lightNormalSpeed: {
|
||||
type: Number,
|
||||
default: 1e3
|
||||
},
|
||||
lighFastSpeed: {
|
||||
type: Number,
|
||||
default: 50
|
||||
},
|
||||
lightSize: {
|
||||
type: String,
|
||||
default: `26rpx`
|
||||
},
|
||||
lightColors: {
|
||||
type: Array,
|
||||
default: () => ["#FF0000", "#FFFF00"]
|
||||
},
|
||||
lightImgs: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
prizeBgImages: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rotating: false,
|
||||
// 是否正在旋转
|
||||
rotationAngle: 0,
|
||||
// 当前旋转角度
|
||||
// 设置指针默认指向的位置,现在是默认指向2个扇形之间的边线上
|
||||
rotateAngle: 0,
|
||||
rotateTransition: "",
|
||||
animationInterval: null,
|
||||
lights: [],
|
||||
// 用于存储闪光灯信息
|
||||
currentAnimationStep: 0,
|
||||
lightConfig: {
|
||||
animationSpeed: 1e3,
|
||||
// 初始动画速度,单位毫秒
|
||||
totalLights: 0
|
||||
// 总灯数,将在 mounted 中设置
|
||||
},
|
||||
lotteryIndex: null
|
||||
// 中奖下标
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 计算轮盘样式
|
||||
containerStyle() {
|
||||
let {
|
||||
size,
|
||||
customStyle
|
||||
} = this;
|
||||
size = /\d$/.test(size) ? size + "rpx" : size;
|
||||
return `width: ${size}; height: ${size}; ${customStyle}`;
|
||||
},
|
||||
wheelStyle() {
|
||||
return `
|
||||
padding: ${this.styleOpt.padding};
|
||||
transform: ${this.rotateAngle};
|
||||
transition: ${this.rotateTransition};
|
||||
${this.innerStyle}
|
||||
`;
|
||||
},
|
||||
getCorrectAngle() {
|
||||
return (index) => {
|
||||
const style = {
|
||||
transform: `skewY(${90 - 360 / this.prizes.length}deg) skewX(0deg) rotate(${180 / this.prizes.length}deg)`
|
||||
};
|
||||
if (this.prizes.length == 2) {
|
||||
if (index == 0) {
|
||||
style["transform"] = `rotate(90deg)`;
|
||||
style["bottom"] = 0;
|
||||
} else {
|
||||
style["transform"] = `rotate(0deg)`;
|
||||
style["left"] = 0;
|
||||
style["bottom"] = "-50%";
|
||||
}
|
||||
}
|
||||
return style;
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 计算每个奖项扇形的样式
|
||||
getPrizeItemStyle(index) {
|
||||
const style = {
|
||||
transform: `rotate(${360 / this.prizes.length * index}deg) skewX(0deg) skewY(${360 / this.prizes.length - 90}deg)`
|
||||
};
|
||||
if (this.prizes.length == 2) {
|
||||
style["transform"] = index == 0 ? 0 : `rotate(270deg)`;
|
||||
style["top"] = 0;
|
||||
}
|
||||
if (!this.getPrizeBgImage(index)) {
|
||||
style.backgroundColor = `${this.styleOpt.prizeBgColors[index % this.styleOpt.prizeBgColors.length]}`;
|
||||
}
|
||||
return style;
|
||||
},
|
||||
// 开始旋转
|
||||
startRotation(index) {
|
||||
if (this.rotating)
|
||||
return;
|
||||
const duration = this.duration;
|
||||
const length = this.prizes.length;
|
||||
const rotateAngle = this.rotationAngle + this.turns * 360 + 360 - (180 / length + 360 / length * index) - this.rotationAngle % 360;
|
||||
common_vendor.index.__f__("log", "at uni_modules/dengbo-lotteryWheel/components/dengbo-lotteryWheel/dengbo-lotteryWheel.vue:205", "rotateAngle", rotateAngle);
|
||||
this.rotationAngle = rotateAngle;
|
||||
this.rotateAngle = `rotate(${rotateAngle}deg)`;
|
||||
this.rotateTransition = `transform ${duration}ms cubic-bezier(0.250, 0.460, 0.455, 0.995)`;
|
||||
this.rotating = true;
|
||||
this.accelerateLightAnimation();
|
||||
setTimeout(() => {
|
||||
this.$emit("done");
|
||||
this.rotating = false;
|
||||
this.stopSpinningAnimation();
|
||||
this.resetLightAnimation();
|
||||
}, duration + 500);
|
||||
},
|
||||
accelerateLightAnimation() {
|
||||
this.stopLightAnimation();
|
||||
this.lightConfig.animationSpeed = this.lighFastSpeed;
|
||||
this.startLightAnimation();
|
||||
},
|
||||
resetLightAnimation() {
|
||||
this.stopLightAnimation();
|
||||
this.lightConfig.animationSpeed = this.lightNormalSpeed;
|
||||
this.startLightAnimation();
|
||||
},
|
||||
stopSpinningAnimation() {
|
||||
clearInterval(this.animationInterval);
|
||||
},
|
||||
// 对外暴露的启动方法
|
||||
// run(index) {
|
||||
// this.startRotation(index);
|
||||
// },
|
||||
run(index) {
|
||||
this.startRotation(index);
|
||||
},
|
||||
// 设置次数
|
||||
setCount(count) {
|
||||
common_vendor.index.__f__("log", "at uni_modules/dengbo-lotteryWheel/components/dengbo-lotteryWheel/dengbo-lotteryWheel.vue:249", "count", count);
|
||||
this.lotteryIndex = count;
|
||||
},
|
||||
// 初始化闪光灯
|
||||
initLights() {
|
||||
this.lightConfig.totalLights = this.prizes.length * 2;
|
||||
this.lights = Array(this.lightConfig.totalLights).fill().map(() => ({}));
|
||||
},
|
||||
// 获取闪光灯样式
|
||||
getLightStyle(index) {
|
||||
const angle = 360 / this.lights.length * index - 90;
|
||||
const radius = 44.5;
|
||||
const radian = angle * (Math.PI / 180);
|
||||
const x = 50 + radius * Math.cos(radian);
|
||||
const y = 50 + radius * Math.sin(radian);
|
||||
const style = {
|
||||
left: `${x}%`,
|
||||
top: `${y}%`,
|
||||
transform: "translate(-50%, -50%)",
|
||||
width: this.lightSize,
|
||||
height: this.lightSize
|
||||
};
|
||||
if (this.lightImgs.length === 0) {
|
||||
style.backgroundColor = this.getCurrentColor(index);
|
||||
style.boxShadow = `0 0 5px ${this.getCurrentColor(index)}`;
|
||||
}
|
||||
return style;
|
||||
},
|
||||
getCurrentColor(colorIndex) {
|
||||
if (this.lightImgs.length > 0)
|
||||
return "";
|
||||
const totalSteps = this.lightColors.length;
|
||||
const currentStep = this.currentAnimationStep % totalSteps;
|
||||
const currentColorIndex = (colorIndex + currentStep) % totalSteps;
|
||||
return this.lightColors[currentColorIndex];
|
||||
},
|
||||
getCurrentImage(colorIndex) {
|
||||
if (this.lightImgs.length === 0)
|
||||
return "";
|
||||
const totalSteps = this.lightImgs.length;
|
||||
const currentStep = this.currentAnimationStep % totalSteps;
|
||||
const currentImageIndex = (colorIndex + currentStep) % totalSteps;
|
||||
return this.lightImgs[currentImageIndex];
|
||||
},
|
||||
startLightAnimation() {
|
||||
this.animationInterval = setInterval(() => {
|
||||
this.currentAnimationStep++;
|
||||
this.$forceUpdate();
|
||||
}, this.lightConfig.animationSpeed);
|
||||
},
|
||||
stopLightAnimation() {
|
||||
if (this.animationInterval) {
|
||||
clearInterval(this.animationInterval);
|
||||
this.animationInterval = null;
|
||||
}
|
||||
},
|
||||
// 新增:获取扇形背景图
|
||||
getPrizeBgImage(index) {
|
||||
if (this.prizeBgImages.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return this.prizeBgImages[index % this.prizeBgImages.length];
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLights();
|
||||
this.startLightAnimation();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.stopSpinningAnimation();
|
||||
this.stopLightAnimation();
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.$slots && _ctx.$slots.bg
|
||||
}, _ctx.$slots && _ctx.$slots.bg ? {} : {}, {
|
||||
b: common_vendor.f($props.prizes, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: $options.getPrizeBgImage(index)
|
||||
}, $options.getPrizeBgImage(index) ? {
|
||||
b: $options.getPrizeBgImage(index)
|
||||
} : {}, {
|
||||
c: common_vendor.t(item.name),
|
||||
d: item.iconUrl,
|
||||
e: "d-" + i0,
|
||||
f: common_vendor.r("d", {
|
||||
item,
|
||||
index
|
||||
}, i0),
|
||||
g: common_vendor.s($options.getCorrectAngle(index)),
|
||||
h: index,
|
||||
i: common_vendor.s($options.getPrizeItemStyle(index))
|
||||
});
|
||||
}),
|
||||
c: common_vendor.s($options.wheelStyle),
|
||||
d: _ctx.$slots && _ctx.$slots.pointer
|
||||
}, _ctx.$slots && _ctx.$slots.pointer ? {
|
||||
e: common_vendor.r("pointer", {
|
||||
class: "pointer-heart"
|
||||
})
|
||||
} : {
|
||||
f: common_vendor.o(($event) => _ctx.$emit("run"))
|
||||
}, {
|
||||
g: common_vendor.f($data.lights, (light, index, i0) => {
|
||||
return common_vendor.e($props.lightImgs.length > 0 ? {
|
||||
a: $options.getCurrentImage(index)
|
||||
} : {}, {
|
||||
b: index,
|
||||
c: common_vendor.s($options.getLightStyle(index))
|
||||
});
|
||||
}),
|
||||
h: $props.lightImgs.length > 0,
|
||||
i: common_vendor.s($options.containerStyle)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a25e7602"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/dengbo-lotteryWheel/components/dengbo-lotteryWheel/dengbo-lotteryWheel.js.map
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="lucky-wheel-container data-v-a25e7602" style="{{i}}"><view class="lucky-wheel-bg data-v-a25e7602"><slot wx:if="{{a}}" name="bg"/></view><view class="lucky-wheel data-v-a25e7602" style="{{c}}"><view class="lucky-wheel-wrap data-v-a25e7602"><view wx:for="{{b}}" wx:for-item="item" wx:key="h" class="prize-item data-v-a25e7602" style="{{item.i}}"><view class="prize-content data-v-a25e7602" style="{{item.g}}"><view class="prize-content-bg data-v-a25e7602"><image wx:if="{{item.a}}" class="data-v-a25e7602" src="{{item.b}}" style="width:100%;height:100%"/></view><block wx:if="{{$slots.d}}"><slot name="{{item.e}}"></slot></block><block wx:else><text class="prize-name data-v-a25e7602">{{item.c}}</text><view class="prize-pro data-v-a25e7602"><image class="data-v-a25e7602" src="{{item.d}}" style="width:98rpx;height:70rpx"></image></view></block></view></view></view></view><view class="pointer data-v-a25e7602"><view wx:if="{{d}}" class="pointer-heart data-v-a25e7602"><slot name="pointer"/></view><view wx:else class="pointer-triangle pointer-heart data-v-a25e7602" bindtap="{{f}}"></view></view><view class="lights-container data-v-a25e7602"><view wx:for="{{g}}" wx:for-item="light" wx:key="b" class="light data-v-a25e7602" style="{{light.c}}"><image wx:if="{{h}}" class="data-v-a25e7602" src="{{light.a}}" style="width:100%;height:100%;position:absolute;left:0;right:0"/></view></view></view>
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 轮盘容器样式 */
|
||||
.lucky-wheel-container.data-v-a25e7602 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
.lucky-wheel-bg.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
.lucky-wheel-d.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 0;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.wheel-image.data-v-a25e7602 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.wheel-image-1.data-v-a25e7602 {
|
||||
animation: blink-1-a25e7602 1000ms infinite linear;
|
||||
}
|
||||
.wheel-image-2.data-v-a25e7602 {
|
||||
animation: blink-2-a25e7602 1000ms infinite linear;
|
||||
}
|
||||
@keyframes blink-1-a25e7602 {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes blink-2-a25e7602 {
|
||||
0%, 100% {
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
/* 轮盘主体样式 */
|
||||
.lucky-wheel.data-v-a25e7602 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
transition-property: transform;
|
||||
transition-timing-function: cubic-bezier(0.25, 0.46, 0.455, 0.995);
|
||||
}
|
||||
.lucky-wheel-wrap.data-v-a25e7602 {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 奖项扇形样式 */
|
||||
.prize-item.data-v-a25e7602 {
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transform-origin: 0 100%;
|
||||
}
|
||||
|
||||
/* 奖项内容样式 */
|
||||
.prize-content.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
padding-top: 16rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: -50%;
|
||||
bottom: -50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.prize-content-bg.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
/* 奖项图片样式 */
|
||||
.prize-image.data-v-a25e7602 {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* 奖项名称样式 */
|
||||
.prize-name.data-v-a25e7602 {
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 9;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #DA402B;
|
||||
}
|
||||
.prize-pro.data-v-a25e7602 {
|
||||
position: relative;
|
||||
}
|
||||
.prize-pro-txt.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-weight: 400;
|
||||
font-size: 14rpx;
|
||||
color: #E26241;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 指针样式 */
|
||||
.pointer.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
top: 47%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pointer-triangle.data-v-a25e7602 {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 20px solid transparent;
|
||||
border-right: 20px solid transparent;
|
||||
border-bottom: 40px solid #ff0000;
|
||||
/* 红色三角形 */
|
||||
/* 删除 transform: rotate(180deg); 这一行 */
|
||||
}
|
||||
.pointer-heart.data-v-a25e7602 {
|
||||
animation: heart-a25e7602 1s infinite;
|
||||
}
|
||||
@keyframes heart-a25e7602 {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
25% {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
to {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.lights-container.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
}
|
||||
.light.data-v-a25e7602 {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 是否显示圆点
|
||||
isDot: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.isDot
|
||||
},
|
||||
// 显示的内容
|
||||
value: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.value
|
||||
},
|
||||
// 显示的内容
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.modelValue
|
||||
},
|
||||
// 是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.show
|
||||
},
|
||||
// 最大值,超过最大值会显示 '{max}+'
|
||||
max: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.max
|
||||
},
|
||||
// 主题类型,error|warning|success|primary
|
||||
type: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.type
|
||||
},
|
||||
// 当数值为 0 时,是否展示 Badge
|
||||
showZero: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.showZero
|
||||
},
|
||||
// 背景颜色,优先级比type高,如设置,type参数会失效
|
||||
bgColor: {
|
||||
type: [String, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.bgColor
|
||||
},
|
||||
// 字体颜色
|
||||
color: {
|
||||
type: [String, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.color
|
||||
},
|
||||
// 徽标形状,circle-四角均为圆角,horn-左下角为直角
|
||||
shape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.shape
|
||||
},
|
||||
// 设置数字的显示方式,overflow|ellipsis|limit
|
||||
// overflow会根据max字段判断,超出显示`${max}+`
|
||||
// ellipsis会根据max判断,超出显示`${max}...`
|
||||
// limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数
|
||||
numberType: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.numberType
|
||||
},
|
||||
// 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效
|
||||
offset: {
|
||||
type: Array,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.offset
|
||||
},
|
||||
// 是否反转背景和字体颜色
|
||||
inverted: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.inverted
|
||||
},
|
||||
// 是否绝对定位
|
||||
absolute: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.absolute
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-badge/props.js.map
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uBadge_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-badge",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_components_uBadge_props.props, uni_modules_uviewPlus_libs_mixin_mixin.mixin],
|
||||
computed: {
|
||||
// 是否将badge中心与父组件右上角重合
|
||||
boxStyle() {
|
||||
let style = {};
|
||||
return style;
|
||||
},
|
||||
// 整个组件的样式
|
||||
badgeStyle() {
|
||||
const style = {};
|
||||
if (this.color) {
|
||||
style.color = this.color;
|
||||
}
|
||||
if (this.bgColor && !this.inverted) {
|
||||
style.backgroundColor = this.bgColor;
|
||||
}
|
||||
if (this.absolute) {
|
||||
style.position = "absolute";
|
||||
if (this.offset.length) {
|
||||
const top = this.offset[0];
|
||||
const right = this.offset[1] || top;
|
||||
style.top = uni_modules_uviewPlus_libs_function_index.addUnit(top);
|
||||
style.right = uni_modules_uviewPlus_libs_function_index.addUnit(right);
|
||||
}
|
||||
}
|
||||
return style;
|
||||
},
|
||||
showValue() {
|
||||
switch (this.numberType) {
|
||||
case "overflow":
|
||||
return Number(this.value) > Number(this.max) ? this.max + "+" : this.value;
|
||||
case "ellipsis":
|
||||
return Number(this.value) > Number(this.max) ? "..." : this.value;
|
||||
case "limit":
|
||||
return Number(this.value) > 999 ? Number(this.value) >= 9999 ? Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value / 1e3 * 100) / 100 + "k" : this.value;
|
||||
default:
|
||||
return Number(this.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot)
|
||||
}, _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot) ? {
|
||||
b: common_vendor.t(_ctx.isDot ? "" : $options.showValue),
|
||||
c: common_vendor.n(_ctx.isDot ? "u-badge--dot" : "u-badge--not-dot"),
|
||||
d: common_vendor.n(_ctx.inverted && "u-badge--inverted"),
|
||||
e: common_vendor.n(_ctx.shape === "horn" && "u-badge--horn"),
|
||||
f: common_vendor.n(`u-badge--${_ctx.type}${_ctx.inverted ? "--inverted" : ""}`),
|
||||
g: common_vendor.s($options.addStyle(_ctx.customStyle)),
|
||||
h: common_vendor.s($options.badgeStyle)
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-06cca9b7"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-badge/u-badge.js.map
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<text wx:if="{{a}}" class="{{[c, d, e, f, 'u-badge', 'data-v-06cca9b7']}}" style="{{g + ';' + h}}">{{b}}</text>
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-06cca9b7,
|
||||
.u-empty__wrap.data-v-06cca9b7,
|
||||
.u-tabs.data-v-06cca9b7,
|
||||
.u-tabs__wrapper.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__scroll-view.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__nav.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__nav__line.data-v-06cca9b7,
|
||||
.up-empty.data-v-06cca9b7,
|
||||
.up-empty__wrap.data-v-06cca9b7,
|
||||
.up-tabs.data-v-06cca9b7,
|
||||
.up-tabs__wrapper.data-v-06cca9b7,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-06cca9b7,
|
||||
.up-tabs__wrapper__scroll-view.data-v-06cca9b7,
|
||||
.up-tabs__wrapper__nav.data-v-06cca9b7,
|
||||
.up-tabs__wrapper__nav__line.data-v-06cca9b7 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-badge.data-v-06cca9b7 {
|
||||
border-top-right-radius: 100px;
|
||||
border-top-left-radius: 100px;
|
||||
border-bottom-left-radius: 100px;
|
||||
border-bottom-right-radius: 100px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
line-height: 11px;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.u-badge--dot.data-v-06cca9b7 {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
.u-badge--inverted.data-v-06cca9b7 {
|
||||
font-size: 13px;
|
||||
}
|
||||
.u-badge--not-dot.data-v-06cca9b7 {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
.u-badge--horn.data-v-06cca9b7 {
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
.u-badge--primary.data-v-06cca9b7 {
|
||||
background-color: #3c9cff;
|
||||
}
|
||||
.u-badge--primary--inverted.data-v-06cca9b7 {
|
||||
color: #3c9cff;
|
||||
}
|
||||
.u-badge--error.data-v-06cca9b7 {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
.u-badge--error--inverted.data-v-06cca9b7 {
|
||||
color: #f56c6c;
|
||||
}
|
||||
.u-badge--success.data-v-06cca9b7 {
|
||||
background-color: #5ac725;
|
||||
}
|
||||
.u-badge--success--inverted.data-v-06cca9b7 {
|
||||
color: #5ac725;
|
||||
}
|
||||
.u-badge--info.data-v-06cca9b7 {
|
||||
background-color: #909399;
|
||||
}
|
||||
.u-badge--info--inverted.data-v-06cca9b7 {
|
||||
color: #909399;
|
||||
}
|
||||
.u-badge--warning.data-v-06cca9b7 {
|
||||
background-color: #f9ae3d;
|
||||
}
|
||||
.u-badge--warning--inverted.data-v-06cca9b7 {
|
||||
color: #f9ae3d;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 激活部分的颜色
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.lineProgress.activeColor
|
||||
},
|
||||
inactiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.lineProgress.color
|
||||
},
|
||||
// 进度百分比,数值
|
||||
percentage: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.lineProgress.inactiveColor
|
||||
},
|
||||
// 是否在进度条内部显示百分比的值
|
||||
showText: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.lineProgress.showText
|
||||
},
|
||||
// 进度条的高度,单位px
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.lineProgress.height
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-line-progress/props.js.map
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uLineProgress_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-line-progress",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uLineProgress_props.props],
|
||||
data() {
|
||||
return {
|
||||
lineWidth: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
percentage(n) {
|
||||
this.resizeProgressWidth();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
progressStyle() {
|
||||
let style = {};
|
||||
style.width = this.lineWidth;
|
||||
style.backgroundColor = this.activeColor;
|
||||
style.height = uni_modules_uviewPlus_libs_function_index.addUnit(this.height);
|
||||
return style;
|
||||
},
|
||||
innserPercentage() {
|
||||
return uni_modules_uviewPlus_libs_function_index.range(0, 100, this.percentage);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
init() {
|
||||
uni_modules_uviewPlus_libs_function_index.sleep(20).then(() => {
|
||||
this.resizeProgressWidth();
|
||||
});
|
||||
},
|
||||
getProgressWidth() {
|
||||
return this.$uGetRect(".u-line-progress__background");
|
||||
},
|
||||
resizeProgressWidth() {
|
||||
this.getProgressWidth().then((size) => {
|
||||
const {
|
||||
width
|
||||
} = size;
|
||||
this.lineWidth = width * this.innserPercentage / 100 + "px";
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.s({
|
||||
backgroundColor: _ctx.inactiveColor,
|
||||
height: $options.addUnit(_ctx.height)
|
||||
}),
|
||||
b: _ctx.showText && _ctx.percentage >= 10
|
||||
}, _ctx.showText && _ctx.percentage >= 10 ? {
|
||||
c: common_vendor.t($options.innserPercentage + "%")
|
||||
} : {}, {
|
||||
d: common_vendor.s($options.progressStyle),
|
||||
e: common_vendor.s($options.addStyle(_ctx.customStyle))
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-eeee7090"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-line-progress/u-line-progress.js.map
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<view class="u-line-progress data-v-eeee7090" style="{{e}}"><view class="u-line-progress__background data-v-eeee7090" ref="u-line-progress__background" style="{{a}}"></view><view class="u-line-progress__line data-v-eeee7090" style="{{d}}"><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><text wx:if="{{b}}" class="u-line-progress__text data-v-eeee7090">{{c}}</text></block></view></view>
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-eeee7090,
|
||||
.u-empty__wrap.data-v-eeee7090,
|
||||
.u-tabs.data-v-eeee7090,
|
||||
.u-tabs__wrapper.data-v-eeee7090,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-eeee7090,
|
||||
.u-tabs__wrapper__scroll-view.data-v-eeee7090,
|
||||
.u-tabs__wrapper__nav.data-v-eeee7090,
|
||||
.u-tabs__wrapper__nav__line.data-v-eeee7090,
|
||||
.up-empty.data-v-eeee7090,
|
||||
.up-empty__wrap.data-v-eeee7090,
|
||||
.up-tabs.data-v-eeee7090,
|
||||
.up-tabs__wrapper.data-v-eeee7090,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-eeee7090,
|
||||
.up-tabs__wrapper__scroll-view.data-v-eeee7090,
|
||||
.up-tabs__wrapper__nav.data-v-eeee7090,
|
||||
.up-tabs__wrapper__nav__line.data-v-eeee7090 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-line-progress.data-v-eeee7090 {
|
||||
align-items: stretch;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
border-radius: 100px;
|
||||
}
|
||||
.u-line-progress__background.data-v-eeee7090 {
|
||||
background-color: #ececec;
|
||||
border-radius: 100px;
|
||||
flex: 1;
|
||||
}
|
||||
.u-line-progress__line.data-v-eeee7090 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
color: #ffffff;
|
||||
border-radius: 100px;
|
||||
transition: width 0.5s ease;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.u-line-progress__text.data-v-eeee7090 {
|
||||
font-size: 10px;
|
||||
align-items: center;
|
||||
text-align: right;
|
||||
color: #FFFFFF;
|
||||
margin-right: 5px;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 提示内容
|
||||
loadingText: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.loadingText
|
||||
},
|
||||
// 文字上方用于替换loading动画的图片
|
||||
image: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.image
|
||||
},
|
||||
// 加载动画的模式,circle-圆形,spinner-花朵形,semicircle-半圆形
|
||||
loadingMode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.loadingMode
|
||||
},
|
||||
// 是否加载中
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.loading
|
||||
},
|
||||
// 背景色
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.bgColor
|
||||
},
|
||||
// 文字颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.color
|
||||
},
|
||||
// 文字大小
|
||||
fontSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.fontSize
|
||||
},
|
||||
// 图标大小
|
||||
iconSize: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.fontSize
|
||||
},
|
||||
// 加载中图标的颜色,只能rgb或者十六进制颜色值
|
||||
loadingColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.loadingColor
|
||||
},
|
||||
// 层级
|
||||
zIndex: {
|
||||
type: [Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.loadingPage.zIndex
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-loading-page/props.js.map
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uLoadingPage_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-loading-page",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uLoadingPage_props.props],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
|
||||
const _easycom_u_transition2 = common_vendor.resolveComponent("u-transition");
|
||||
(_easycom_u_loading_icon2 + _easycom_u_transition2)();
|
||||
}
|
||||
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
|
||||
const _easycom_u_transition = () => "../u-transition/u-transition.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_loading_icon + _easycom_u_transition)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.image
|
||||
}, _ctx.image ? {
|
||||
b: _ctx.image,
|
||||
c: $options.addUnit(_ctx.iconSize),
|
||||
d: $options.addUnit(_ctx.iconSize)
|
||||
} : {
|
||||
e: common_vendor.p({
|
||||
mode: _ctx.loadingMode,
|
||||
size: $options.addUnit(_ctx.iconSize),
|
||||
color: _ctx.loadingColor
|
||||
})
|
||||
}, {
|
||||
f: common_vendor.t(_ctx.loadingText),
|
||||
g: $options.addUnit(_ctx.fontSize),
|
||||
h: _ctx.color,
|
||||
i: common_vendor.p({
|
||||
show: _ctx.loading,
|
||||
["custom-style"]: {
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
backgroundColor: _ctx.bgColor,
|
||||
display: "flex",
|
||||
zIndex: _ctx.zIndex,
|
||||
..._ctx.customStyle
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9c9e88a3"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-loading-page/u-loading-page.js.map
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-loading-icon": "../u-loading-icon/u-loading-icon",
|
||||
"u-transition": "../u-transition/u-transition"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<u-transition wx:if="{{i}}" class="data-v-9c9e88a3" u-s="{{['d']}}" u-i="9c9e88a3-0" bind:__l="__l" u-p="{{i}}"><view class="u-loading-page data-v-9c9e88a3"><view class="u-loading-page__warpper data-v-9c9e88a3"><view class="u-loading-page__warpper__loading-icon data-v-9c9e88a3"><image wx:if="{{a}}" src="{{b}}" class="u-loading-page__warpper__loading-icon__img data-v-9c9e88a3" mode="widthFit" style="{{'width:' + c + ';' + ('height:' + d)}}"></image><u-loading-icon wx:else class="data-v-9c9e88a3" u-i="9c9e88a3-1,9c9e88a3-0" bind:__l="__l" u-p="{{e||''}}"></u-loading-icon></view><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><text class="u-loading-page__warpper__text data-v-9c9e88a3" style="{{'font-size:' + g + ';' + ('color:' + h)}}">{{f}}</text></block></view></view></u-transition>
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-9c9e88a3,
|
||||
.u-empty__wrap.data-v-9c9e88a3,
|
||||
.u-tabs.data-v-9c9e88a3,
|
||||
.u-tabs__wrapper.data-v-9c9e88a3,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-9c9e88a3,
|
||||
.u-tabs__wrapper__scroll-view.data-v-9c9e88a3,
|
||||
.u-tabs__wrapper__nav.data-v-9c9e88a3,
|
||||
.u-tabs__wrapper__nav__line.data-v-9c9e88a3,
|
||||
.up-empty.data-v-9c9e88a3,
|
||||
.up-empty__wrap.data-v-9c9e88a3,
|
||||
.up-tabs.data-v-9c9e88a3,
|
||||
.up-tabs__wrapper.data-v-9c9e88a3,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-9c9e88a3,
|
||||
.up-tabs__wrapper__scroll-view.data-v-9c9e88a3,
|
||||
.up-tabs__wrapper__nav.data-v-9c9e88a3,
|
||||
.up-tabs__wrapper__nav__line.data-v-9c9e88a3 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-loading-page.data-v-9c9e88a3 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.u-loading-page__warpper.data-v-9c9e88a3 {
|
||||
margin-top: -150px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #c8c8c8;
|
||||
font-size: 19px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.u-loading-page__warpper__loading-icon.data-v-9c9e88a3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.u-loading-page__warpper__loading-icon__img.data-v-9c9e88a3 {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
.u-loading-page__warpper__text.data-v-9c9e88a3 {
|
||||
font-size: 19px;
|
||||
color: #c8c8c8;
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 是否展示modal
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.show
|
||||
},
|
||||
// 标题
|
||||
title: {
|
||||
type: [String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.title
|
||||
},
|
||||
// 弹窗内容
|
||||
content: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.content
|
||||
},
|
||||
// 确认文案
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.confirmText
|
||||
},
|
||||
// 取消文案
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.cancelText
|
||||
},
|
||||
// 是否显示确认按钮
|
||||
showConfirmButton: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.showConfirmButton
|
||||
},
|
||||
// 是否显示取消按钮
|
||||
showCancelButton: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.showCancelButton
|
||||
},
|
||||
// 确认按钮颜色
|
||||
confirmColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.confirmColor
|
||||
},
|
||||
// 取消文字颜色
|
||||
cancelColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.cancelColor
|
||||
},
|
||||
// 对调确认和取消的位置
|
||||
buttonReverse: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.buttonReverse
|
||||
},
|
||||
// 是否开启缩放效果
|
||||
zoom: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.zoom
|
||||
},
|
||||
// 是否异步关闭,只对确定按钮有效
|
||||
asyncClose: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.asyncClose
|
||||
},
|
||||
// 是否允许点击遮罩关闭modal
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.closeOnClickOverlay
|
||||
},
|
||||
// 给一个负的margin-top,往上偏移,避免和键盘重合的情况
|
||||
negativeTop: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.negativeTop
|
||||
},
|
||||
// modal宽度,不支持百分比,可以数值,px,rpx单位
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.width
|
||||
},
|
||||
// 确认按钮的样式,circle-圆形,square-方形,如设置,将不会显示取消按钮
|
||||
confirmButtonShape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.confirmButtonShape
|
||||
},
|
||||
// 文案对齐方式
|
||||
contentTextAlign: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.modal.contentTextAlign
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-modal/props.js.map
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uModal_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-modal",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uModal_props.props],
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(n) {
|
||||
if (n && this.loading)
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
emits: ["confirm", "cancel", "close", "update:show"],
|
||||
methods: {
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
// 点击确定按钮
|
||||
confirmHandler() {
|
||||
if (this.asyncClose) {
|
||||
this.loading = true;
|
||||
} else {
|
||||
this.$emit("update:show", false);
|
||||
}
|
||||
this.$emit("confirm");
|
||||
},
|
||||
// 点击取消按钮
|
||||
cancelHandler() {
|
||||
this.$emit("update:show", false);
|
||||
this.$emit("cancel");
|
||||
},
|
||||
// 点击遮罩
|
||||
// 从原理上来说,modal的遮罩点击,并不是真的点击到了遮罩
|
||||
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽有然遮罩,但是为了让弹窗内容能flex居中
|
||||
// 多了一个透明的遮罩,此透明的遮罩会覆盖在灰色的遮罩上,所以实际上是点击不到灰色遮罩的,popup内部在
|
||||
// 透明遮罩的子元素做了.stop处理,所以点击内容区,也不会导致误触发
|
||||
clickHandler() {
|
||||
if (this.closeOnClickOverlay) {
|
||||
this.$emit("update:show", false);
|
||||
this.$emit("close");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_line2 = common_vendor.resolveComponent("u-line");
|
||||
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_u_line2 + _easycom_u_loading_icon2 + _easycom_u_popup2)();
|
||||
}
|
||||
const _easycom_u_line = () => "../u-line/u-line.js";
|
||||
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
|
||||
const _easycom_u_popup = () => "../u-popup/u-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_line + _easycom_u_loading_icon + _easycom_u_popup)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.title
|
||||
}, _ctx.title ? {
|
||||
b: common_vendor.t(_ctx.title)
|
||||
} : {}, {
|
||||
c: common_vendor.t(_ctx.content),
|
||||
d: _ctx.contentTextAlign,
|
||||
e: `${_ctx.title ? 12 : 25}px`,
|
||||
f: _ctx.$slots.confirmButton
|
||||
}, _ctx.$slots.confirmButton ? {} : common_vendor.e({
|
||||
g: _ctx.showCancelButton
|
||||
}, _ctx.showCancelButton ? {
|
||||
h: common_vendor.t(_ctx.cancelText),
|
||||
i: _ctx.cancelColor,
|
||||
j: common_vendor.n(_ctx.showCancelButton && !_ctx.showConfirmButton && "u-modal__button-group__wrapper--only-cancel"),
|
||||
k: common_vendor.o((...args) => $options.cancelHandler && $options.cancelHandler(...args))
|
||||
} : {}, {
|
||||
l: _ctx.showConfirmButton && _ctx.showCancelButton
|
||||
}, _ctx.showConfirmButton && _ctx.showCancelButton ? {
|
||||
m: common_vendor.p({
|
||||
direction: "column"
|
||||
})
|
||||
} : {}, {
|
||||
n: _ctx.showConfirmButton
|
||||
}, _ctx.showConfirmButton ? common_vendor.e({
|
||||
o: $data.loading
|
||||
}, $data.loading ? {} : {
|
||||
p: common_vendor.t(_ctx.confirmText),
|
||||
q: _ctx.confirmColor
|
||||
}, {
|
||||
r: common_vendor.n(!_ctx.showCancelButton && _ctx.showConfirmButton && "u-modal__button-group__wrapper--only-confirm"),
|
||||
s: common_vendor.o((...args) => $options.confirmHandler && $options.confirmHandler(...args))
|
||||
}) : {}, {
|
||||
t: _ctx.buttonReverse ? "row-reverse" : "row"
|
||||
}), {
|
||||
v: $options.addUnit(_ctx.width),
|
||||
w: common_vendor.n(_ctx.customClass),
|
||||
x: common_vendor.o($options.clickHandler),
|
||||
y: common_vendor.p({
|
||||
mode: "center",
|
||||
zoom: _ctx.zoom,
|
||||
show: _ctx.show,
|
||||
customStyle: {
|
||||
borderRadius: "6px",
|
||||
overflow: "hidden",
|
||||
marginTop: `-${$options.addUnit(_ctx.negativeTop)}`
|
||||
},
|
||||
closeOnClickOverlay: _ctx.closeOnClickOverlay,
|
||||
safeAreaInsetBottom: false,
|
||||
duration: 400
|
||||
})
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f667648f"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-modal/u-modal.js.map
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-line": "../u-line/u-line",
|
||||
"u-loading-icon": "../u-loading-icon/u-loading-icon",
|
||||
"u-popup": "../u-popup/u-popup"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<u-popup wx:if="{{y}}" u-s="{{['d']}}" class="{{['data-v-f667648f', w]}}" bindclick="{{x}}" u-i="f667648f-0" bind:__l="__l" u-p="{{y}}"><view class="u-modal data-v-f667648f" style="{{'width:' + v}}"><view wx:if="{{a}}" class="u-modal__title data-v-f667648f">{{b}}</view><view class="u-modal__content data-v-f667648f" style="{{'padding-top:' + e}}"><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><text class="u-modal__content__text data-v-f667648f" style="{{'text-align:' + d}}">{{c}}</text></block></view><view wx:if="{{f}}" class="u-modal__button-group--confirm-button data-v-f667648f"><slot name="confirmButton"></slot></view><block wx:else><u-line class="data-v-f667648f" u-i="f667648f-1,f667648f-0" bind:__l="__l"></u-line><view class="u-modal__button-group data-v-f667648f" style="{{'flex-direction:' + t}}"><view wx:if="{{g}}" hover-stay-time="{{150}}" hover-class="u-modal__button-group__wrapper--hover" class="{{['u-modal__button-group__wrapper', 'u-modal__button-group__wrapper--cancel', 'data-v-f667648f', j]}}" bindtap="{{k}}"><text class="u-modal__button-group__wrapper__text data-v-f667648f" style="{{'color:' + i}}">{{h}}</text></view><u-line wx:if="{{l}}" class="data-v-f667648f" u-i="f667648f-2,f667648f-0" bind:__l="__l" u-p="{{m}}"></u-line><view wx:if="{{n}}" hover-stay-time="{{150}}" hover-class="u-modal__button-group__wrapper--hover" class="{{['u-modal__button-group__wrapper', 'u-modal__button-group__wrapper--confirm', 'data-v-f667648f', r]}}" bindtap="{{s}}"><u-loading-icon wx:if="{{o}}" class="data-v-f667648f" u-i="f667648f-3,f667648f-0" bind:__l="__l"></u-loading-icon><text wx:else class="u-modal__button-group__wrapper__text data-v-f667648f" style="{{'color:' + q}}">{{p}}</text></view></view></block></view></u-popup>
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-f667648f,
|
||||
.u-empty__wrap.data-v-f667648f,
|
||||
.u-tabs.data-v-f667648f,
|
||||
.u-tabs__wrapper.data-v-f667648f,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-f667648f,
|
||||
.u-tabs__wrapper__scroll-view.data-v-f667648f,
|
||||
.u-tabs__wrapper__nav.data-v-f667648f,
|
||||
.u-tabs__wrapper__nav__line.data-v-f667648f,
|
||||
.up-empty.data-v-f667648f,
|
||||
.up-empty__wrap.data-v-f667648f,
|
||||
.up-tabs.data-v-f667648f,
|
||||
.up-tabs__wrapper.data-v-f667648f,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-f667648f,
|
||||
.up-tabs__wrapper__scroll-view.data-v-f667648f,
|
||||
.up-tabs__wrapper__nav.data-v-f667648f,
|
||||
.up-tabs__wrapper__nav__line.data-v-f667648f {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-modal.data-v-f667648f {
|
||||
width: 650rpx;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.u-modal__title.data-v-f667648f {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #606266;
|
||||
text-align: center;
|
||||
padding-top: 25px;
|
||||
}
|
||||
.u-modal__content.data-v-f667648f {
|
||||
padding: 12px 25px 25px 25px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
}
|
||||
.u-modal__content__text.data-v-f667648f {
|
||||
font-size: 15px;
|
||||
color: #606266;
|
||||
flex: 1;
|
||||
}
|
||||
.u-modal__button-group.data-v-f667648f {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.u-modal__button-group--confirm-button.data-v-f667648f {
|
||||
flex-direction: column;
|
||||
padding: 0px 25px 15px 25px;
|
||||
}
|
||||
.u-modal__button-group__wrapper.data-v-f667648f {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
}
|
||||
.u-modal__button-group__wrapper--confirm.data-v-f667648f, .u-modal__button-group__wrapper--only-cancel.data-v-f667648f {
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
.u-modal__button-group__wrapper--cancel.data-v-f667648f, .u-modal__button-group__wrapper--only-confirm.data-v-f667648f {
|
||||
border-bottom-left-radius: 6px;
|
||||
}
|
||||
.u-modal__button-group__wrapper--hover.data-v-f667648f {
|
||||
background-color: #f3f4f6;
|
||||
}
|
||||
.u-modal__button-group__wrapper__text.data-v-f667648f {
|
||||
color: #606266;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_vue = require("../../libs/vue.js");
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = uni_modules_uviewPlus_libs_vue.defineMixin({
|
||||
props: {
|
||||
// 用于v-model双向绑定选中的星星数量
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.value
|
||||
},
|
||||
// 要显示的星星数量
|
||||
count: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.count
|
||||
},
|
||||
// 是否不可选中
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.disabled
|
||||
},
|
||||
// 是否只读
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.readonly
|
||||
},
|
||||
// 星星的大小,单位px
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.size
|
||||
},
|
||||
// 未选中时的颜色
|
||||
inactiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.inactiveColor
|
||||
},
|
||||
// 选中的颜色
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.activeColor
|
||||
},
|
||||
// 星星之间的间距,单位px
|
||||
gutter: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.gutter
|
||||
},
|
||||
// 最少能选择的星星个数
|
||||
minCount: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.minCount
|
||||
},
|
||||
// 是否允许半星
|
||||
allowHalf: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.allowHalf
|
||||
},
|
||||
// 选中时的图标(星星)
|
||||
activeIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.activeIcon
|
||||
},
|
||||
// 未选中时的图标(星星)
|
||||
inactiveIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.inactiveIcon
|
||||
},
|
||||
// 是否可以通过滑动手势选择评分
|
||||
touchable: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.rate.touchable
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-rate/props.js.map
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uRate_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-rate",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uRate_props.props],
|
||||
data() {
|
||||
return {
|
||||
// 生成一个唯一id,否则一个页面多个评分组件,会造成冲突
|
||||
elId: uni_modules_uviewPlus_libs_function_index.guid(),
|
||||
elClass: uni_modules_uviewPlus_libs_function_index.guid(),
|
||||
rateBoxLeft: 0,
|
||||
// 评分盒子左边到屏幕左边的距离,用于滑动选择时计算距离
|
||||
activeIndex: this.modelValue,
|
||||
rateWidth: 0,
|
||||
// 每个星星的宽度
|
||||
// 标识是否正在滑动,由于iOS事件上touch比click先触发,导致快速滑动结束后,接着触发click,导致事件混乱而出错
|
||||
moving: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
modelValue(val) {
|
||||
this.activeIndex = val;
|
||||
},
|
||||
activeIndex: "emitEvent"
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
init() {
|
||||
uni_modules_uviewPlus_libs_function_index.sleep().then(() => {
|
||||
this.getRateItemRect();
|
||||
this.getRateIconWrapRect();
|
||||
});
|
||||
},
|
||||
// 获取评分组件盒子的布局信息
|
||||
async getRateItemRect() {
|
||||
await uni_modules_uviewPlus_libs_function_index.sleep();
|
||||
this.$uGetRect("#" + this.elId).then((res) => {
|
||||
this.rateBoxLeft = res.left;
|
||||
});
|
||||
},
|
||||
// 获取单个星星的尺寸
|
||||
getRateIconWrapRect() {
|
||||
this.$uGetRect("." + this.elClass).then((res) => {
|
||||
this.rateWidth = res.width;
|
||||
});
|
||||
},
|
||||
// 手指滑动
|
||||
touchMove(e) {
|
||||
if (!this.touchable) {
|
||||
return;
|
||||
}
|
||||
this.preventEvent(e);
|
||||
const x = e.changedTouches[0].pageX;
|
||||
this.getActiveIndex(x);
|
||||
},
|
||||
// 停止滑动
|
||||
touchEnd(e) {
|
||||
if (!this.touchable) {
|
||||
return;
|
||||
}
|
||||
this.preventEvent(e);
|
||||
const x = e.changedTouches[0].pageX;
|
||||
this.getActiveIndex(x);
|
||||
},
|
||||
// 通过点击,直接选中
|
||||
clickHandler(e, index) {
|
||||
if (uni_modules_uviewPlus_libs_function_index.os() === "ios" && this.moving) {
|
||||
return;
|
||||
}
|
||||
this.preventEvent(e);
|
||||
let x = 0;
|
||||
x = e.changedTouches[0].pageX;
|
||||
this.getActiveIndex(x, true);
|
||||
},
|
||||
// 发出事件
|
||||
emitEvent() {
|
||||
this.$emit("change", this.activeIndex);
|
||||
this.$emit("update:modelValue", this.activeIndex);
|
||||
},
|
||||
// 获取当前激活的评分图标
|
||||
getActiveIndex(x, isClick = false) {
|
||||
if (this.disabled || this.readonly) {
|
||||
return;
|
||||
}
|
||||
const allRateWidth = this.rateWidth * this.count + this.rateBoxLeft;
|
||||
x = uni_modules_uviewPlus_libs_function_index.range(this.rateBoxLeft, allRateWidth, x) - this.rateBoxLeft;
|
||||
const distance = x;
|
||||
let index;
|
||||
if (this.allowHalf) {
|
||||
index = Math.floor(distance / this.rateWidth);
|
||||
const decimal = distance % this.rateWidth;
|
||||
if (decimal <= this.rateWidth / 2 && decimal > 0) {
|
||||
index += 0.5;
|
||||
} else if (decimal > this.rateWidth / 2) {
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
index = Math.floor(distance / this.rateWidth);
|
||||
const decimal = distance % this.rateWidth;
|
||||
if (isClick) {
|
||||
if (decimal > 0)
|
||||
index++;
|
||||
} else {
|
||||
if (decimal > this.rateWidth / 2)
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.activeIndex = Math.min(index, this.count);
|
||||
if (this.activeIndex < this.minCount) {
|
||||
this.activeIndex = this.minCount;
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.moving = true;
|
||||
}, 10);
|
||||
setTimeout(() => {
|
||||
this.moving = false;
|
||||
}, 10);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
_easycom_u_icon2();
|
||||
}
|
||||
const _easycom_u_icon = () => "../u-icon/u-icon.js";
|
||||
if (!Math) {
|
||||
_easycom_u_icon();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.f(Number(_ctx.count), (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: "69a384ee-0-" + i0,
|
||||
b: common_vendor.p({
|
||||
name: Math.floor($data.activeIndex) > index ? _ctx.activeIcon : _ctx.inactiveIcon,
|
||||
color: _ctx.disabled ? "#c8c9cc" : Math.floor($data.activeIndex) > index ? _ctx.activeColor : _ctx.inactiveColor,
|
||||
["custom-style"]: {
|
||||
padding: `0 ${$options.addUnit(_ctx.gutter / 2)}`
|
||||
},
|
||||
size: _ctx.size
|
||||
}),
|
||||
c: common_vendor.o(($event) => $options.clickHandler($event, index + 1), index)
|
||||
}, _ctx.allowHalf ? {
|
||||
d: "69a384ee-1-" + i0,
|
||||
e: common_vendor.p({
|
||||
name: Math.ceil($data.activeIndex) > index ? _ctx.activeIcon : _ctx.inactiveIcon,
|
||||
color: _ctx.disabled ? "#c8c9cc" : Math.ceil($data.activeIndex) > index ? _ctx.activeColor : _ctx.inactiveColor,
|
||||
["custom-style"]: {
|
||||
padding: `0 ${$options.addUnit(_ctx.gutter / 2)}`
|
||||
},
|
||||
size: _ctx.size
|
||||
}),
|
||||
f: common_vendor.o(($event) => $options.clickHandler($event, index + 1), index),
|
||||
g: common_vendor.s({
|
||||
width: $options.addUnit($data.rateWidth / 2)
|
||||
})
|
||||
} : {}, {
|
||||
h: index
|
||||
});
|
||||
}),
|
||||
b: _ctx.allowHalf,
|
||||
c: common_vendor.n($data.elClass),
|
||||
d: common_vendor.o((...args) => $options.touchMove && $options.touchMove(...args)),
|
||||
e: common_vendor.o((...args) => $options.touchEnd && $options.touchEnd(...args)),
|
||||
f: $data.elId,
|
||||
g: common_vendor.s($options.addStyle(_ctx.customStyle))
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-69a384ee"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-plus/components/u-rate/u-rate.js.map
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<view class="u-rate data-v-69a384ee" id="{{f}}" ref="u-rate" style="{{g}}"><view class="u-rate__content data-v-69a384ee" catchtouchmove="{{d}}" catchtouchend="{{e}}"><view wx:for="{{a}}" wx:for-item="item" wx:key="h" class="{{['u-rate__content__item', 'cursor-pointer', 'data-v-69a384ee', c]}}"><view class="u-rate__content__item__icon-wrap data-v-69a384ee" ref="u-rate__content__item__icon-wrap" catchtap="{{item.c}}"><u-icon wx:if="{{item.b}}" class="data-v-69a384ee" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></u-icon></view><view wx:if="{{b}}" catchtap="{{item.f}}" class="u-rate__content__item__icon-wrap u-rate__content__item__icon-wrap--half data-v-69a384ee" style="{{item.g}}" ref="u-rate__content__item__icon-wrap"><u-icon wx:if="{{item.e}}" class="data-v-69a384ee" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e}}"></u-icon></view></view></view></view>
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.u-empty.data-v-69a384ee,
|
||||
.u-empty__wrap.data-v-69a384ee,
|
||||
.u-tabs.data-v-69a384ee,
|
||||
.u-tabs__wrapper.data-v-69a384ee,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-69a384ee,
|
||||
.u-tabs__wrapper__scroll-view.data-v-69a384ee,
|
||||
.u-tabs__wrapper__nav.data-v-69a384ee,
|
||||
.u-tabs__wrapper__nav__line.data-v-69a384ee,
|
||||
.up-empty.data-v-69a384ee,
|
||||
.up-empty__wrap.data-v-69a384ee,
|
||||
.up-tabs.data-v-69a384ee,
|
||||
.up-tabs__wrapper.data-v-69a384ee,
|
||||
.up-tabs__wrapper__scroll-view-wrapper.data-v-69a384ee,
|
||||
.up-tabs__wrapper__scroll-view.data-v-69a384ee,
|
||||
.up-tabs__wrapper__nav.data-v-69a384ee,
|
||||
.up-tabs__wrapper__nav__line.data-v-69a384ee {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-rate.data-v-69a384ee {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
touch-action: none;
|
||||
}
|
||||
.u-rate__content.data-v-69a384ee {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.u-rate__content__item.data-v-69a384ee {
|
||||
position: relative;
|
||||
}
|
||||
.u-rate__content__item__icon-wrap--half.data-v-69a384ee {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.u-icon.data-v-69a384ee {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
Reference in New Issue
Block a user