update @Dev

master
管理员 12 months ago
parent 4983d8d821
commit 33ba845ddc

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/sse-test") @RequestMapping("/sse-test")
@ConditionalOnProperty(prefix = "ruoyi",name = "dev",havingValue = "true") @Dev
@Slf4j @Slf4j
public class SseTestApi extends SseApiSupport { public class SseTestApi extends SseApiSupport {

@ -1,9 +1,12 @@
package com.ruoyi.common.annotation; package com.ruoyi.common.annotation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import java.lang.annotation.*; import java.lang.annotation.*;
@Target(ElementType.METHOD) @Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Inherited @Inherited
@ConditionalOnProperty(prefix = "ruoyi", name = "dev", havingValue = "true")
public @interface Dev { public @interface Dev {
} }

@ -1,5 +1,54 @@
export const sleep = (time) => {
return new Promise((resove, reject) => {
setTimeout(() => {
resove();
}, time);
});
}
//计算两点距离
export const commonDistance = function (lat1, lng1, lat2, lng2) {
let f = ((lat1 + lat2) / 2) * Math.PI / 180.0;
let g = ((lat1 - lat2) / 2) * Math.PI / 180.0;
let l = ((lng1 - lng2) / 2) * Math.PI / 180.0;
let sg = Math.sin(g);
let sl = Math.sin(l);
let sf = Math.sin(f);
let s, c, w, r, d, h1, h2;
let a = 6378137.0; //地球的直径
let fl = 1 / 298.257;
sg = sg * sg;
sl = sl * sl;
sf = sf * sf;
s = sg * (1 - sl) + (1 - sf) * sl;
c = (1 - sg) * (1 - sl) + sf * sl;
w = Math.atan(Math.sqrt(s / c));
r = Math.sqrt(s * c) / w;
d = 2 * w * a;
h1 = (3 * r - 1) / 2 / c;
h2 = (3 * r + 1) / 2 / s;
let num = d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg))
return num || 0;
}
export const distanceShow = (num) => {
// 换算单位
if (!num) {
return "0.0 m"
}
if (num < 1000) {
return num.toFixed(1) + "m"
} else if (num > 1000) {
return (num / 1000).toFixed(1) + "km"
}
}
// px转upx
export const px2upx = function (n) {
return n / (uni.upx2px(n) / n);
}
// 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时 // 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时

Loading…
Cancel
Save