Commit 138149d0 authored by Friends233's avatar Friends233

滑块、字体边框

parent 74ebd95d
...@@ -62,6 +62,11 @@ ...@@ -62,6 +62,11 @@
color: transparent; 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) { .btnBreathStyle(@s:2s) {
animation: btnBreathAni @s forwards infinite; animation: btnBreathAni @s forwards infinite;
......
import { domain, ensureDomain } from "@spark/dbdomain";
import { import {
start, start,
updateShare, updateShare,
...@@ -84,5 +85,10 @@ export const miniDoShare = (opts) => { ...@@ -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 * @Author: all
* @Date: 2021-11-01 09:30:00 * @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 * @LastEditors: Please set LastEditors
* @Description: * @Description:
*/ */
import { hideLoading, showLoading, Toast } from "@spark/ui"; import { hideLoading, showLoading, Toast } from "@spark/ui";
import { ERROR_MESSAGE } from "./constants" import { ERROR_MESSAGE } from "./constants"
import { useRef, useEffect, useCallback } from "react"; import { useRef, useEffect, useCallback } from "react";
import { startNecCaptcha } from "@spark/utils";
export { export {
showToast, // 展示Toast showToast, // 展示Toast
...@@ -37,7 +38,7 @@ export { ...@@ -37,7 +38,7 @@ export {
*/ */
/** */ /** */
function showToast(errCode, message) { 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) => { ...@@ -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 }); const { current } = useRef({ fn, timer: null });
useEffect(function () { useEffect(function () {
current.fn = fn; current.fn = fn;
...@@ -83,16 +84,16 @@ function useThrottle(fn, delay=2000, dep = []) { ...@@ -83,16 +84,16 @@ function useThrottle(fn, delay=2000, dep = []) {
* @param {(Function, number?, boolean? )} * @param {(Function, number?, boolean? )}
* @return {Function} * @return {Function}
*/ */
const _debounce = (fn, wait=2000, immediate = false) =>{ const _debounce = (fn, wait = 2000, immediate = false) => {
let timer = null let timer = null
return function() { return function () {
const later = function() { const later = function () {
fn.apply(this, arguments) fn.apply(this, arguments)
} }
if (immediate && !timer) { if (immediate && !timer) {
later() later()
} }
if(timer) clearTimeout(timer) if (timer) clearTimeout(timer)
timer = setTimeout(later, wait) timer = setTimeout(later, wait)
} }
} }
...@@ -119,8 +120,8 @@ function getCookie(cookieName) { ...@@ -119,8 +120,8 @@ function getCookie(cookieName) {
function getUrlParam(name) { function getUrlParam(name) {
const search = window.location.search; const search = window.location.search;
const matched = search const matched = search
.slice(1) .slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')); .match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null; return search.length ? matched && matched[2] : null;
} }
/** /**
...@@ -160,32 +161,32 @@ function delUrlParam(url, ref) { ...@@ -160,32 +161,32 @@ function delUrlParam(url, ref) {
const dateFormatter = (date, format = "yyyy/MM/dd") => { const dateFormatter = (date, format = "yyyy/MM/dd") => {
if (!date) return "-"; if (!date) return "-";
date = new Date( date = new Date(
typeof date === "string" && isNaN(date) typeof date === "string" && isNaN(date)
? date.replace(/-/g, "/") ? date.replace(/-/g, "/")
: Number(date) : Number(date)
); );
const o = { const o = {
"M+": date.getMonth() + 1, "M+": date.getMonth() + 1,
"d+": date.getDate(), "d+": date.getDate(),
"h+": date.getHours(), "h+": date.getHours(),
"m+": date.getMinutes(), "m+": date.getMinutes(),
"s+": date.getSeconds(), "s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3), "q+": Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds(), S: date.getMilliseconds(),
}; };
if (/(y+)/.test(format)) { if (/(y+)/.test(format)) {
format = format.replace( format = format.replace(
RegExp.$1, RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length) (date.getFullYear() + "").substr(4 - RegExp.$1.length)
); );
} }
for (const k in o) { for (const k in o) {
if (new RegExp("(" + k + ")").test(format)) { if (new RegExp("(" + k + ")").test(format)) {
format = format.replace( format = format.replace(
RegExp.$1, RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length) RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
); );
} }
} }
return format; return format;
}; };
...@@ -255,10 +256,10 @@ function subStringCE(str, sub_length) { ...@@ -255,10 +256,10 @@ function subStringCE(str, sub_length) {
*/ */
function shuffleArr(arr) { function shuffleArr(arr) {
for (let i = arr.length - 1; i >= 0; i--) { for (let i = arr.length - 1; i >= 0; i--) {
const randomIndex = Math.floor(Math.random() * (i + 1)) const randomIndex = Math.floor(Math.random() * (i + 1))
const itemAtIndex = arr[randomIndex] const itemAtIndex = arr[randomIndex]
arr[randomIndex] = arr[i] arr[randomIndex] = arr[i]
arr[i] = itemAtIndex arr[i] = itemAtIndex
} }
return arr return arr
} }
...@@ -282,7 +283,7 @@ function randomNum(min, max) { ...@@ -282,7 +283,7 @@ function randomNum(min, max) {
*/ */
function flatten(arr) { function flatten(arr) {
return arr.reduce((result, item) => { 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) => { ...@@ -291,19 +292,19 @@ const check2Object = (obj1, obj2) => {
const o1 = obj1 instanceof Object const o1 = obj1 instanceof Object
const o2 = obj2 instanceof Object const o2 = obj2 instanceof Object
if (!o1 || !o2) { /* 判断不是对象 */ if (!o1 || !o2) { /* 判断不是对象 */
return obj1 === obj2 return obj1 === obj2
} }
if (Object.keys(obj1).length !== Object.keys(obj2).length) { if (Object.keys(obj1).length !== Object.keys(obj2).length) {
return false return false
} }
for (const attr in obj1) { for (const attr in obj1) {
const t1 = obj1[attr] instanceof Object const t1 = obj1[attr] instanceof Object
const t2 = obj2[attr] instanceof Object const t2 = obj2[attr] instanceof Object
if (t1 && t2) { if (t1 && t2) {
return check2Object(obj1[attr], obj2[attr]) return check2Object(obj1[attr], obj2[attr])
} else if (obj1[attr] !== obj2[attr]) { } else if (obj1[attr] !== obj2[attr]) {
return false return false
} }
} }
return true return true
} }
...@@ -375,9 +376,9 @@ const bodyScroll = (event) => { ...@@ -375,9 +376,9 @@ const bodyScroll = (event) => {
} }
const onCtrScroll = (flag = true) => { const onCtrScroll = (flag = true) => {
if (flag) { // 禁止滚动 if (flag) { // 禁止滚动
document.body.addEventListener('touchmove', bodyScroll, { passive: false }); document.body.addEventListener('touchmove', bodyScroll, { passive: false });
} else { // 开启滚动 } else { // 开启滚动
document.body.removeEventListener('touchmove', bodyScroll, { passive: false }); document.body.removeEventListener('touchmove', bodyScroll, { passive: false });
} }
} }
...@@ -397,4 +398,31 @@ export const addLoading = async (fn) => { ...@@ -397,4 +398,31 @@ export const addLoading = async (fn) => {
hideLoading() hideLoading()
} }
return Promise.resolve(res) 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