/**
* 转换日期 适配 ios 返回 :时间类型
* @param {String} 后端传过来的字符日期
*/
export const formatIOSReturnDate = n => {
let date = n.replace(/-/g, '/');
date = date.replace(/T/g, ' ')
let newDate = new Date(date)
return newDate
}
/**
* 转换日期 适配 ios 返回 :01-23 11:25
* @param {String} 后端传过来的字符日期
*/
export const formatIOSYearMonthDayHoursMinutes = n => {
let date = n.replace(/-/g, '/');
date = date.replace(/T/g, ' ')
let newDate = new Date(date)
// 年
let year = newDate.getFullYear()
// 月
let month = newDate.getMonth() + 1
// 日
let day = newDate.getDate()
// 时
let hours = formatNumber(newDate.getHours())
// 分
let minutes = formatNumber(newDate.getMinutes())
return `${year}年${month}月${day}日`
}
// loading加载提示
export const showLoading = () => {
return new Promise((resolve, reject) => {
wx.showLoading({
title: '加载中...',
mask: true,
success(res) {
console.log('显示loading')
resolve(res)
},
fail(err) {
reject(err)
}
})
})
}
// 关闭loading
export const hideLoading = () => {
return new Promise((resolve) => {
uni.hideLoading()
console.log('隐藏loading')
resolve()
})
}
/**
* 获取经纬度位置
*/
export const getLocation = () => {
return new Promise((resolve, reject) => {
uni.getLocation({
type: 'gcj02',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
let location = {
latitude,
longitude
}
resolve(location)
}
})
})
}
/**
* 获取用户code
*/
export const getUserCode = () => {
return new Promise((resolve, reject) => {
uni.login({
success(res) {
if (res.code) {
resolve(res.code)
} else {
console.log('登录失败!' + res.errMsg)
reject()
}
}
})
})
}
/**
* 小数加
*/
export const accAdd = (arg1, arg2) => {
var r1, r2, m;
try {
r1 = arg1.toString().split(".")[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split(".")[1].length
} catch (e) {
r2 = 0
}
m = Math.pow(10, Math.max(r1, r2))
return (arg1 * m + arg2 * m) / m
}
/**
* 小数减法
*/
export const Subtr = (arg1, arg2) => {
var r1, r2, m, n;
try {
r1 = arg1.toString().split(".")[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split(".")[1].length
} catch (e) {
r2 = 0
}
m = Math.pow(10, Math.max(r1, r2));
n = (r1 >= r2) ? r1 : r2;
return ((arg1 * m - arg2 * m) / m).toFixed(n);
}
/**
* 判断是否还有下一页
* @param {Number} total 总数量
* @param {Number} current 当前页码
* @param {Number} size 每页数量
*/
export const isExistNextPage = (total, current, size) => {
return new Promise((resolve, reject) => {
let currentNumber = current * size
if (currentNumber < total) {
resolve(true)
}
resolve(false)
})
}
没有合适的资源?快使用搜索试试~ 我知道了~
weiju-wechat-master.zip
共66个文件
vue:42个
png:10个
js:7个
0 下载量 72 浏览量
2022-12-16
15:42:36
上传
评论
收藏 95KB ZIP 举报
温馨提示
一人在外打拼,孤独感突然袭来。特别需要别人照顾的场景,比如生病。这个时候最无助。我想解决这一痛点。寻找陌生人相互陪伴。 准备开始制作uni-app 版本的了,我要把他做得更加的完善!
资源推荐
资源详情
资源评论
收起资源包目录
weiju-wechat-master.zip (66个子文件)
weiju-wechat-master
pages.json 5KB
pages
other
search.vue 5KB
postDetails.vue 857B
profiles
Profiles.vue 286B
message
message.vue 286B
streams
stream2.vue 7KB
stream3.vue 5KB
stream1.vue 6KB
showPage
showPage.vue 4KB
home
home2.vue 955B
home6.vue 902B
home3.vue 957B
home5.vue 785B
home4.vue 1KB
home.vue 2KB
notifications
notifications.vue 1KB
dynamicDetail.vue 5KB
welcome
signUp
signUp.vue 5KB
forgotPassword
forgotPassword.vue 4KB
enableNotifications
enableNotifications.vue 3KB
inviteFriends
inviteFriends.vue 4KB
welcome
welcome.vue 4KB
login
login.vue 5KB
App.vue 272B
LICENSE 35KB
manifest.json 5KB
main.js 150B
api
login.js 258B
user.js 65B
appeal.js 370B
utils
request.js 3KB
util.js 3KB
components
appeal
appeal1.vue 6KB
appeal6.vue 8KB
appeal5.vue 15KB
appeal3.vue 6KB
appeal4.vue 5KB
appeal2.vue 7KB
dynamic
dynamic1.vue 5KB
dynamicTag1.vue 4KB
search
search6.vue 1KB
search2.vue 1KB
search3.vue 2KB
search1.vue 1KB
search4.vue 2KB
events
events1.vue 4KB
live
live6.vue 4KB
live1.vue 5KB
live3.vue 4KB
live4.vue 4KB
live2.vue 5KB
前端代码规范.md 2KB
uni.scss 3KB
config.js 130B
.gitignore 49B
static
img
tabbar_icon
message.png 1KB
streamActive.png 2KB
profiles.png 1KB
profilesActive.png 2KB
indexActive.png 1KB
stream.png 1KB
notificationsActive1.png 1KB
index.png 1KB
notifications1.png 1KB
messageActive.png 1KB
.hbuilderx
launch.json 506B
共 66 条
- 1
资源评论
m0_72731342
- 粉丝: 2
- 资源: 1832
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功