Commit 138149d0 authored by Friends233's avatar Friends233

滑块、字体边框

parent 74ebd95d
......@@ -62,6 +62,11 @@
color: transparent;
}
.text-shadow(@px,@color) {
text-shadow: -@px @px 0 @color, @px @px 0 @color, @px -@px 0 @color, -@px -@px 0 @color;
}
//按钮呼吸动效
.btnBreathStyle(@s:2s) {
animation: btnBreathAni @s forwards infinite;
......
import { domain, ensureDomain } from "@spark/dbdomain";
import {
start,
updateShare,
......@@ -84,5 +85,10 @@ export const miniDoShare = (opts) => {
});
}
export const getUrl = async () => {
await ensureDomain()
return domain + '/projectx/' + CFG.projectId + '/share.html?appKey=u26X3eGsbsS9xUobMQYehR52gNN&appID=' + CFG.appID + '&openBs=openbs';
}
/*
* @Author: all
* @Date: 2021-11-01 09:30:00
* @LastEditTime: 2023-03-20 11:29:19
* @LastEditTime: 2023-05-26 11:22:48
* @LastEditors: Please set LastEditors
* @Description:
*/
import { hideLoading, showLoading, Toast } from "@spark/ui";
import { ERROR_MESSAGE } from "./constants"
import { useRef, useEffect, useCallback } from "react";
import { startNecCaptcha } from "@spark/utils";
export {
showToast, // 展示Toast
......@@ -37,7 +38,7 @@ export {
*/
/** */
function showToast(errCode, message) {
Toast(ERROR_MESSAGE(errCode) || message || "网络异常,请稍后再试~", 2000, {hideOthers:true});
Toast(ERROR_MESSAGE(errCode) || message || "网络异常,请稍后再试~", 2000, { hideOthers: true });
}
/**
......@@ -62,7 +63,7 @@ const _throttle = (fun, delay = 2000) => {
};
function useThrottle(fn, delay=2000, dep = []) {
function useThrottle(fn, delay = 2000, dep = []) {
const { current } = useRef({ fn, timer: null });
useEffect(function () {
current.fn = fn;
......@@ -83,16 +84,16 @@ function useThrottle(fn, delay=2000, dep = []) {
* @param {(Function, number?, boolean? )}
* @return {Function}
*/
const _debounce = (fn, wait=2000, immediate = false) =>{
const _debounce = (fn, wait = 2000, immediate = false) => {
let timer = null
return function() {
const later = function() {
return function () {
const later = function () {
fn.apply(this, arguments)
}
if (immediate && !timer) {
later()
}
if(timer) clearTimeout(timer)
if (timer) clearTimeout(timer)
timer = setTimeout(later, wait)
}
}
......@@ -119,8 +120,8 @@ function getCookie(cookieName) {
function getUrlParam(name) {
const search = window.location.search;
const matched = search
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null;
}
/**
......@@ -160,32 +161,32 @@ function delUrlParam(url, ref) {
const dateFormatter = (date, format = "yyyy/MM/dd") => {
if (!date) return "-";
date = new Date(
typeof date === "string" && isNaN(date)
? date.replace(/-/g, "/")
: Number(date)
typeof date === "string" && isNaN(date)
? date.replace(/-/g, "/")
: Number(date)
);
const o = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds(),
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds(),
};
if (/(y+)/.test(format)) {
format = format.replace(
RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length)
);
format = format.replace(
RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length)
);
}
for (const k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
);
}
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
);
}
}
return format;
};
......@@ -255,10 +256,10 @@ function subStringCE(str, sub_length) {
*/
function shuffleArr(arr) {
for (let i = arr.length - 1; i >= 0; i--) {
const randomIndex = Math.floor(Math.random() * (i + 1))
const itemAtIndex = arr[randomIndex]
arr[randomIndex] = arr[i]
arr[i] = itemAtIndex
const randomIndex = Math.floor(Math.random() * (i + 1))
const itemAtIndex = arr[randomIndex]
arr[randomIndex] = arr[i]
arr[i] = itemAtIndex
}
return arr
}
......@@ -282,7 +283,7 @@ function randomNum(min, max) {
*/
function flatten(arr) {
return arr.reduce((result, item) => {
return result.concat(Array.isArray(item) ? flatten(item) : item)
return result.concat(Array.isArray(item) ? flatten(item) : item)
}, [])
}
......@@ -291,19 +292,19 @@ const check2Object = (obj1, obj2) => {
const o1 = obj1 instanceof Object
const o2 = obj2 instanceof Object
if (!o1 || !o2) { /* 判断不是对象 */
return obj1 === obj2
return obj1 === obj2
}
if (Object.keys(obj1).length !== Object.keys(obj2).length) {
return false
return false
}
for (const attr in obj1) {
const t1 = obj1[attr] instanceof Object
const t2 = obj2[attr] instanceof Object
if (t1 && t2) {
return check2Object(obj1[attr], obj2[attr])
} else if (obj1[attr] !== obj2[attr]) {
return false
}
const t1 = obj1[attr] instanceof Object
const t2 = obj2[attr] instanceof Object
if (t1 && t2) {
return check2Object(obj1[attr], obj2[attr])
} else if (obj1[attr] !== obj2[attr]) {
return false
}
}
return true
}
......@@ -375,9 +376,9 @@ const bodyScroll = (event) => {
}
const onCtrScroll = (flag = true) => {
if (flag) { // 禁止滚动
document.body.addEventListener('touchmove', bodyScroll, { passive: false });
document.body.addEventListener('touchmove', bodyScroll, { passive: false });
} else { // 开启滚动
document.body.removeEventListener('touchmove', bodyScroll, { passive: false });
document.body.removeEventListener('touchmove', bodyScroll, { passive: false });
}
}
......@@ -397,4 +398,31 @@ export const addLoading = async (fn) => {
hideLoading()
}
return Promise.resolve(res)
}
/** 获取倒计时时间 */
export const getTime = (countDown) => {
const secondTotal = countDown / 1000
const day = String(Math.floor(secondTotal / (60 * 60 * 24))).padStart(1, '0')// 剩余天数
const hour = String(Math.floor((secondTotal / (60 * 60))) % 24).padStart(1, '0')// 剩余小时数
const minute = String(Math.floor(secondTotal / 60 % 60)).padStart(1, '0')// 剩余分钟数
const second = String(Math.floor(secondTotal % 60)).padStart(1, '0')// 剩余秒数
}
/** 滑块校验 */
export const verify = async () => {
console.log('滑块校验')
let validate;
while (1) {
validate = await startNecCaptcha(
"a869bfdfb9bd4cdf88e1ff2f8667a114"
).catch(e => {
console.log("验证失败,错误:", e);
Toast("用户校验失败")
});
if (validate) {
console.log('val', validate)
return validate
}
}
}
\ No newline at end of file
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