2025/2/8第一次更新

This commit is contained in:
爱吃咸鱼小猫咪
2025-02-08 18:50:38 +08:00
commit d7af560866
26519 changed files with 5046029 additions and 0 deletions
@@ -0,0 +1,3 @@
"use strict";
const bindingx = {};
exports.bindingx = bindingx;
+344
View File
@@ -0,0 +1,344 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const components_firstui_fuiFab_mpjs = require("./mpjs.js");
const components_firstui_fuiFab_bindingx = require("./bindingx.js");
const block0 = {};
const _sfc_main = {
name: "fui-fab",
mixins: [components_firstui_fuiFab_mpjs.mpjs, components_firstui_fuiFab_bindingx.bindingx],
emits: ["click", "change", "opensetting", "launchapp", "contact"],
// components:{
// fuiIcon
// },
props: {
fabs: {
type: Array,
default() {
return [];
}
},
nameKey: {
type: String,
default: "name"
},
srcKey: {
type: String,
default: "src"
},
textKey: {
type: String,
default: "text"
},
position: {
type: String,
default: "right"
},
distance: {
type: [Number, String],
default: 80
},
bottom: {
type: [Number, String],
default: 120
},
width: {
type: [Number, String],
default: 108
},
background: {
type: String,
default: ""
},
color: {
type: String,
default: "#fff"
},
mask: {
type: Boolean,
default: true
},
maskBackground: {
type: String,
default: "rgba(0,0,0,.6)"
},
maskClosable: {
type: Boolean,
default: false
},
zIndex: {
type: [Number, String],
default: 99
},
//V1.9.8+
isDrag: {
type: Boolean,
default: false
},
//v2.3.0+
openType: {
type: String,
default: ""
},
appParameter: {
type: String,
default: ""
},
lang: {
type: String,
default: "en"
},
sessionFrom: {
type: String,
default: ""
},
sendMessageTitle: {
type: String,
default: ""
},
sendMessagePath: {
type: String,
default: ""
},
sendMessageImg: {
type: String,
default: ""
},
showMessageCard: {
type: Boolean,
default: false
}
},
computed: {
getStyles() {
let styles = `bottom:${this.bottom}rpx;z-index:${this.zIndex};`;
if (this.position === "left") {
styles += `left:${this.distance}rpx;`;
} else {
styles += `right:${this.distance}rpx;`;
}
return styles;
},
getStyle() {
return `background:${this.maskBackground};z-index:${Number(this.zIndex) - 10};`;
},
getBgColor() {
let color = this.background;
return color;
}
},
watch: {
isShow(val) {
this.$emit("change", {
isShow: val
});
},
position(val) {
this.resetNum++;
this.$nextTick(() => {
setTimeout(() => {
this._getSize();
}, 80);
});
}
},
data() {
let isApp = 0;
return {
isApp,
isShow: false,
isHidden: true,
timer: null,
maxWidth: 0,
maxHeight: 0,
eLeft: 0,
eTop: 0,
resetNum: 0
};
},
beforeUnmount() {
clearTimeout(this.timer);
this.timer = null;
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
this._getSize();
}, 50);
});
},
methods: {
stop() {
},
_getSize() {
if (!this.isDrag)
return;
const sys = common_vendor.index.getSystemInfoSync();
common_vendor.index.createSelectorQuery().in(this).select(".fui-fab__btn-wrap").boundingClientRect().exec((ret) => {
if (ret) {
this.maxWidth = sys.windowWidth - ret[0].width - ret[0].left;
this.maxHeight = sys.windowHeight - ret[0].height - ret[0].top;
this.eLeft = ret[0].left || 0;
this.eTop = ret[0].top || 0;
}
});
},
handleClick: function(e, index) {
this.isHidden = false;
clearTimeout(this.timer);
this.$nextTick(() => {
if (index === -1 && this.fabs.length > 0) {
this.isShow = !this.isShow;
} else {
this.$emit("click", {
index
});
this.isShow = false;
}
if (!this.isShow) {
this.timer = setTimeout(() => {
this.isHidden = true;
}, 250);
}
});
},
maskClick(e) {
if (!this.maskClosable)
return;
this.isShow = false;
this.timer = setTimeout(() => {
this.isHidden = true;
}, 250);
},
bindopensetting({
detail = {}
} = {}) {
this.$emit("opensetting", detail);
},
bindlaunchapp({
detail = {}
} = {}) {
this.$emit("launchapp", detail);
},
bindcontact({
detail = {}
} = {}) {
this.$emit("contact", detail);
}
}
};
if (!Array) {
const _easycom_fui_icon2 = common_vendor.resolveComponent("fui-icon");
_easycom_fui_icon2();
}
const _easycom_fui_icon = () => "../fui-icon/fui-icon.js";
if (!Math) {
_easycom_fui_icon();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.mask
}, $props.mask ? {
b: $data.isShow ? 1 : "",
c: common_vendor.s($options.getStyle),
d: common_vendor.o((...args) => $options.maskClick && $options.maskClick(...args))
} : {}, {
e: common_vendor.f($props.fabs, (btn, idx, i0) => {
return common_vendor.e({
a: btn[$props.textKey]
}, btn[$props.textKey] ? {
b: common_vendor.t(btn[$props.textKey]),
c: (btn.size || 32) + "rpx",
d: btn.color || "#fff",
e: $props.position === "left" ? "left" : "right"
} : {}, {
f: btn[$props.nameKey]
}, btn[$props.nameKey] ? {
g: "2c25f223-0-" + i0,
h: common_vendor.p({
name: btn[$props.nameKey],
color: btn.abbrColor || "#fff",
size: btn.abbrSize || 64
})
} : {}, {
i: !btn[$props.nameKey] && btn[$props.srcKey]
}, !btn[$props.nameKey] && btn[$props.srcKey] ? {
j: btn[$props.srcKey],
k: (btn.width || 56) + "rpx",
l: (btn.height || 56) + "rpx",
m: (btn.radius || 0) + "rpx"
} : {}, {
n: !btn[$props.nameKey] && !btn[$props.srcKey] && btn.abbr
}, !btn[$props.nameKey] && !btn[$props.srcKey] && btn.abbr ? {
o: common_vendor.t(btn.abbr),
p: (btn.abbrSize || 36) + "rpx",
q: (btn.abbrSize || 36) + "rpx",
r: btn.abbrColor || "#fff"
} : {}, {
s: !$options.getBgColor && !btn.background ? 1 : "",
t: btn.background || $options.getBgColor,
v: btn.openType
}, btn.openType ? {
w: btn.openType,
x: btn.appParameter,
y: btn.lang,
z: btn.sessionFrom,
A: btn.sendMessageTitle,
B: btn.sendMessagePath,
C: btn.sendMessageImg,
D: btn.showMessageCard,
E: common_vendor.o((...args) => $options.bindcontact && $options.bindcontact(...args), idx),
F: common_vendor.o((...args) => $options.bindopensetting && $options.bindopensetting(...args), idx),
G: common_vendor.o((...args) => $options.bindlaunchapp && $options.bindlaunchapp(...args), idx)
} : {}, {
H: idx,
I: common_vendor.o(($event) => $options.handleClick($event, idx), idx)
});
}),
f: $props.width + "rpx",
g: $props.width + "rpx",
h: common_vendor.n($props.position === "left" ? "fui-fab__button-left" : "fui-fab__button-right"),
i: $data.isHidden ? 1 : "",
j: $data.isShow ? 1 : "",
k: $props.position === "left" ? 1 : "",
l: $props.position === "right" ? 1 : "",
m: common_vendor.p({
name: "plus",
color: $props.color,
size: 80
}),
n: $data.isShow ? 1 : "",
o: $props.openType
}, $props.openType ? {
p: $props.openType,
q: $props.appParameter,
r: $props.lang,
s: $props.sessionFrom,
t: $props.sendMessageTitle,
v: $props.sendMessagePath,
w: $props.sendMessageImg,
x: $props.showMessageCard,
y: common_vendor.o((...args) => $options.bindcontact && $options.bindcontact(...args)),
z: common_vendor.o((...args) => $options.bindopensetting && $options.bindopensetting(...args)),
A: common_vendor.o((...args) => $options.bindlaunchapp && $options.bindlaunchapp(...args))
} : {}, {
B: !$options.getBgColor ? 1 : "",
C: $props.width + "rpx",
D: $props.width + "rpx",
E: $options.getBgColor,
F: common_vendor.o(($event) => $options.handleClick($event, -1)),
G: $props.isDrag ? 0 : 1,
H: $data.maxWidth,
I: $data.maxHeight,
J: $data.eLeft,
K: $data.eTop,
L: $data.isApp,
M: $data.resetNum,
N: common_vendor.n($props.position === "left" ? "fui-fab__wrap-left" : "fui-fab__wrap-right"),
O: common_vendor.s($options.getStyles),
P: common_vendor.o((...args) => $options.stop && $options.stop(...args))
});
}
if (typeof block0 === "function")
block0(_sfc_main);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2c25f223"]]);
wx.createComponent(Component);
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"fui-icon": "../fui-icon/fui-icon"
}
}
@@ -0,0 +1,2 @@
<wxs src="./index.wxs" module="handler"/>
<view catchtouchmove="{{P}}" class="{{['data-v-2c25f223', virtualHostClass]}}" style="{{virtualHostStyle}}"><view wx:if="{{a}}" class="{{['fui-fab__mask', 'data-v-2c25f223', b && 'fui-fab__mask-show']}}" style="{{c}}" ref="fui_mask_ani" catchtap="{{d}}"></view><view data-disabled="{{G}}" data-width="{{H}}" data-height="{{I}}" data-left="{{J}}" data-top="{{K}}" data-app="{{L}}" prop="{{M}}" change:prop="{{handler.fabreset}}" bindtouchstart="{{handler.touchstart}}" bindtouchmove="{{handler.touchmove}}" bindmousedown="{{handler.mousedown}}" class="{{['fui-fab__btn-wrap', 'data-v-2c25f223', N]}}" style="{{O}}"><view class="{{['fui-fab__btn-list', 'data-v-2c25f223', i && 'fui-fab__btn-hidden', j && 'fui-fab__list-ani', k && 'fui-fab__list-left', l && 'fui-fab__list-right']}}" ref="fui_fab_ani"><view wx:for="{{e}}" wx:for-item="btn" wx:key="H" class="{{['fui-fab__button-box', 'data-v-2c25f223', h]}}" catchtap="{{btn.I}}"><text wx:if="{{btn.a}}" class="fui-fab__btn-text data-v-2c25f223" style="{{'font-size:' + btn.c + ';' + ('color:' + btn.d) + ';' + ('text-align:' + btn.e)}}">{{btn.b}}</text><view class="{{['fui-fab__button', 'data-v-2c25f223', btn.s && 'fui-fab__btn-color']}}" style="{{'width:' + f + ';' + ('height:' + g) + ';' + ('background:' + btn.t)}}"><fui-icon wx:if="{{btn.f}}" class="data-v-2c25f223" virtualHostClass="data-v-2c25f223" u-i="{{btn.g}}" bind:__l="__l" u-p="{{btn.h}}"></fui-icon><image wx:if="{{btn.i}}" class="data-v-2c25f223" src="{{btn.j}}" style="{{'width:' + btn.k + ';' + ('height:' + btn.l) + ';' + ('border-radius:' + btn.m)}}" mode="widthFix"></image><text wx:if="{{btn.n}}" class="fui-fab__btn-abbr data-v-2c25f223" style="{{'font-size:' + btn.p + ';' + ('line-height:' + btn.q) + ';' + ('color:' + btn.r)}}">{{btn.o}}</text></view><button wx:if="{{btn.v}}" class="fui-fab__opentype-btn data-v-2c25f223" open-type="{{btn.w}}" app-parameter="{{btn.x}}" lang="{{btn.y}}" sessionFrom="{{btn.z}}" sendMessageTitle="{{btn.A}}" sendMessagePath="{{btn.B}}" sendMessageImg="{{btn.C}}" showMessageCard="{{btn.D}}" bindcontact="{{btn.E}}" bindopensetting="{{btn.F}}" bindlaunchapp="{{btn.G}}"></button></view></view><view class="{{['fui-fab__btn-main', 'data-v-2c25f223', B && 'fui-fab__btn-color']}}" style="{{'width:' + C + ';' + ('height:' + D) + ';' + ('background:' + E)}}" catchtap="{{F}}"><view class="{{['fui-fab__btn-inner', 'data-v-2c25f223', n && 'fui-fab__btn-ani']}}" ref="fui_fm_ani"><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><fui-icon wx:if="{{m}}" class="data-v-2c25f223" virtualHostClass="data-v-2c25f223" u-i="2c25f223-1" bind:__l="__l" u-p="{{m}}"></fui-icon></block></view><button wx:if="{{o}}" class="fui-fab__opentype-btn data-v-2c25f223" open-type="{{p}}" app-parameter="{{q}}" lang="{{r}}" sessionFrom="{{s}}" sendMessageTitle="{{t}}" sendMessagePath="{{v}}" sendMessageImg="{{w}}" showMessageCard="{{x}}" bindcontact="{{y}}" bindopensetting="{{z}}" bindlaunchapp="{{A}}"></button></view></view></view>
@@ -0,0 +1,165 @@
.fui-fab__mask.data-v-2c25f223 {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0;
visibility: hidden;
transition-property: visibility, opacity;
transition-duration: .25s;
}
.fui-fab__mask-show.data-v-2c25f223 {
opacity: 1;
visibility: visible;
}
.fui-fab__btn-wrap.data-v-2c25f223 {
display: flex;
flex-direction: column;
justify-content: center;
position: fixed;
bottom: 120rpx;
}
.fui-fab__wrap-left.data-v-2c25f223 {
align-items: flex-start;
left: 80rpx;
}
.fui-fab__wrap-right.data-v-2c25f223 {
align-items: flex-end;
right: 80rpx;
}
.fui-fab__btn-list.data-v-2c25f223 {
display: flex;
visibility: hidden;
transition: all 0.25s ease-in-out;
transform: scale3d(0, 0, 1);
opacity: 0;
flex-direction: column;
}
.fui-fab__list-left.data-v-2c25f223 {
transform-origin: 0 100%;
align-items: flex-start;
}
.fui-fab__list-right.data-v-2c25f223 {
transform-origin: 100% 100%;
align-items: flex-end;
}
.fui-fab__btn-hidden.data-v-2c25f223 {
width: 0;
height: 0;
}
.fui-fab__list-ani.data-v-2c25f223 {
opacity: 1;
transform: scale3d(1, 1, 1);
visibility: visible;
}
.fui-fab__button-box.data-v-2c25f223 {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
margin-bottom: 32rpx;
position: relative;
}
.fui-fab__button-left.data-v-2c25f223 {
flex-direction: row-reverse;
justify-content: flex-start;
}
.fui-fab__button-right.data-v-2c25f223 {
flex-direction: row;
justify-content: flex-end;
}
.fui-fab__btn-text.data-v-2c25f223 {
box-sizing: border-box;
padding-left: 24rpx;
padding-right: 24rpx;
font-weight: normal;
}
.fui-fab__button.data-v-2c25f223 {
display: flex;
border-radius: 50%;
flex-direction: row;
align-items: center;
justify-content: center;
}
.fui-fab__btn-abbr.data-v-2c25f223 {
text-align: center;
font-weight: normal;
}
.fui-fab__btn-main.data-v-2c25f223 {
display: flex;
border-radius: 50%;
box-shadow: 0 10rpx 14rpx 0 rgba(0, 0, 0, 0.1);
align-items: center;
justify-content: center;
transform: rotate(0deg);
overflow: hidden;
position: relative;
}
.fui-fab__btn-inner.data-v-2c25f223 {
display: flex;
transform: rotate(0deg);
transition: transform .25s;
align-items: center;
justify-content: center;
}
.fui-fab__btn-ani.data-v-2c25f223 {
transform: rotate(135deg);
}
.fui-fab__btn-color.data-v-2c25f223 {
background: var(--fui-color-primary, #465CFF) !important;
}
.fui-fab__opentype-btn.data-v-2c25f223 {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
border-width: 0;
background-color: rgba(0, 0, 0, 0);
opacity: 0;
z-index: 1;
}
.fui-fab__opentype-btn.data-v-2c25f223::after {
border-width: 0;
}
+126
View File
@@ -0,0 +1,126 @@
// 本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID:112 7,营业执照号:91 4 4 0 605 MA 556H1KX H)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
var movable = {
width: 100,
height: 100,
disabled: false,
left: 0,
top: 0,
app: false
}
function isPC() {
if (typeof navigator !== 'object') return false;
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
var isH5 = false
if (typeof window === 'object') isH5 = true
function setInitValue(dataset) {
movable.width = +dataset.width
movable.height = +dataset.height
movable.top = +dataset.top
movable.left = +dataset.left
//H5获取bool值为undefined
movable.disabled = (+dataset.disabled) == 1 ? true : false
movable.app = (+dataset.app) == 1 ? true : false
}
function touchstart(e, ins) {
var state = e.instance.getState()
var touch = e.touches[0] || e.changedTouches[0];
if (isH5 && isPC()) {
touch = e;
}
var dataset = e.instance.getDataset()
state.startX = touch.clientX
state.startY = touch.clientY
setInitValue(dataset)
}
function styleChange(left, top, ins) {
if (!ins) return;
var mview = ins.selectComponent('.fui-fab__btn-wrap');
if (!mview) return;
mview.setStyle({
transform: 'translate3d(' + left + 'px,' + top + 'px,0)'
})
}
function touchmove(e, ins, events) {
if (movable.disabled) return;
if (e.preventDefault) {
e.preventDefault()
}
if (movable.app && event && event.preventDefault && event.cancelable) {
event.preventDefault()
}
var state = {}
var touch = {}
if (isH5 && isPC()) {
touch = e;
if (events && events.instance) {
state = events.instance.getState()
}
} else {
touch = e.touches[0] || e.changedTouches[0]
state = e.instance.getState()
}
var pageX = touch.clientX;
var pageY = touch.clientY;
var left = pageX - state.startX + (state.lastLeft || 0);
left = left < -movable.left ? -movable.left : left;
left = left > movable.width ? movable.width : left;
state.startX = pageX
var top = pageY - state.startY + (state.lastTop || 0);
top = top < -movable.top ? -movable.top : top;
top = top > movable.height ? movable.height : top;
state.startY = pageY
state.lastLeft = left
state.lastTop = top
styleChange(left, top, ins)
}
var _movable = false;
function mousedown(e, ins) {
if (!isH5 || !isPC()) return
touchstart(e, ins)
_movable = true
window.onmousemove = function(event) {
if (!isH5 || !isPC() || !_movable) return
touchmove(event, ins, e)
}
window.onmouseup = function(event) {
if (!isH5 || !isPC() || !_movable) return
_movable = false
}
}
function fabreset(reset, oldreset, owner, ins) {
if (reset > 0) {
var state = ins.getState()
state.startY = 0;
state.startX = 0;
state.lastLeft = 0;
state.lastTop = 0;
styleChange(0, 0, owner)
}
}
module.exports = {
touchstart: touchstart,
touchmove: touchmove,
mousedown: mousedown,
fabreset: fabreset
}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
const mpjs = {};
exports.mpjs = mpjs;