Commit 7988a761 authored by liwei's avatar liwei

删除了没用的js文件

parent 5391d957
import {
AMAPKEY
} from "@/util/api.js" //这个就是你在第一步申请的key值
const amapFile = require('./amap-wx.130.js') //引入高德地图 ,根据自己放置的文件路径来决定
const myAmapFun = new amapFile.AMapWX({
key: AMAPKEY
}); //创建一个实例化对象
export default function wxGetAddress({
longitude,
latitude
}) {
//根据传递进来经纬度进行反解析,调用的是高德给的方法
return new Promise((resolve, reject) => {
myAmapFun.getRegeo({
location: `${longitude},${latitude}`,
success: (res) => {
resolve(res[0])
},
fail: (err) => {
resolve(null)
}
})
})
}
const util = {
mymethod(birthday) { //根据日期算年龄
if (birthday) {
birthday = birthday.split('-');
// 新建日期对象
let date = new Date();
// 今天日期,数组,同 birthday
let today = [date.getFullYear(), date.getMonth() + 1, date.getDate()];
// 分别计算年月日差值
let age = today.map((val, index) => {
return val - birthday[index]
})
// 当天数为负数时,月减 1,天数加上月总天数
if (age[2] < 0) {
// 简单获取上个月总天数的方法,不会错
let lastMonth = new Date(today[0], today[1], 0)
age[1]--
age[2] += lastMonth.getDate()
}
// 当月数为负数时,年减 1,月数加上 12
if (age[1] < 0) {
age[0]--
age[1] += 12
}
return age[0]
console.log(age[0] + '岁' + age[1] + '月' + age[2] + '天');
}
}
// mymethod(2020-08-08)
}
module.exports = util
export const BASE_URL = 'http://124.220.46.104:8088/'
\ No newline at end of file
//export const WS = 'ws://169.254.36.58:8888/ws'
export const WS = 'wss://www.wxmblog.com/wssojl'
\ 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