刘翔宇-旅管家 3 years ago
parent 4ca067a750
commit ec3b113e47

@ -0,0 +1,16 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

@ -16,6 +16,7 @@
}
</script>
<style>
<style>
@import "@/static/css/iconfont.css";
/*每个页面公共css */
</style>

@ -1,25 +1,29 @@
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
// main.js
import uView from "uview-ui";
Vue.use(uView);
// #endif
// main.js
import uView from "uview-ui";
Vue.use(uView);
import util from "@/utils/util";
Vue.prototype.util = util;

@ -1,22 +1,97 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
<template>
<view class="content">
<map id="map" class="map" style="width: 100%;height: 100vh;" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
</view>
</template>
<script>
const img = '../../../static/img/logo.png';
export default {
data() {
return {
latitude: 23.099994,
longitude: 113.324520,
}
},
onReady() {
this._mapContext = uni.createMapContext("map", this);
// on.("markerClusterCreate", (e) => {})
this._mapContext.initMarkerCluster({
enableDefaultStyle: false,
zoomOnClick: true,
gridSize: 60,
complete(res) {
console.log('initMarkerCluster', res)
}
});
this._mapContext.on("markerClusterCreate", (e) => {
console.log("markerClusterCreate", e);
});
this.addMarkers();
},
methods: {
addMarkers() {
const marker = {
id: 1,
iconPath: img,
width: 50,
height: 50,
joinCluster: true, //
label: {
width: 50,
height: 30,
borderWidth: 1,
borderRadius: 10,
bgColor: '#ffffff'
}
};
const positions = [{
latitude: 23.099994,
longitude: 113.324520,
}, {
latitude: 23.099994,
longitude: 113.322520,
}, {
latitude: 23.099994,
longitude: 113.326520,
}, {
latitude: 23.096994,
longitude: 113.329520,
}]
const markers = []
positions.forEach((p, i) => {
const newMarker = Object.assign(marker, p)
newMarker.id = i + 1
newMarker.label.content = `label ${i + 1}`
markers.push(newMarker)
this._mapContext.addMarkers({
markers,
clear: false,
complete(res) {
console.log('addMarkers', res)
}
})
})
}
}
}
</script>
<style>
.content {
flex: 1;
}
.map {
flex: 1;
}
</style>

@ -3,15 +3,16 @@
<u-form :model="form" ref="uForm">
<u-form-item label="问题类型" label-position="top">
<u-input v-model="form.typeName" type="select" :border="true" @click="typeshow = true" />
<u-select v-model="typeshow" mode="single-column" :list="list" @confirm="confirmType"></u-select>
<u-select v-model="typeshow" mode="single-column" value-name="id" label-name="value" :list="plist"
@confirm="confirmType"></u-select>
</u-form-item>
<u-form-item label="问题内容" label-position="top">
<u-input v-model="form.contentName" type="select" :border="true" @click="contentshow = true" />
<u-select v-model="contentshow" mode="single-column" :list="list" @confirm="confirmContent"></u-select>
<u-select v-model="contentshow" mode="single-column" value-name="id" label-name="value" :list="list" @confirm="confirmContent"></u-select>
</u-form-item>
<u-form-item label="位置" label-position="top">
<text>江苏省苏州市通园路66号</text>
<u-button shape="square" slot='right' size="mini" @click="showMap=true" type="info">重新获取</u-button>
<u-button shape="square" slot='right' size="mini" @click="toshowMap" type="info">重新获取</u-button>
</u-form-item>
<u-form-item label-position="top" label="描述" prop="intro">
<u-input v-model="form.intro" type='textarea' height='100' :border="true" />
@ -25,10 +26,10 @@
<view>
<view class="popuptitle">选择位置</view>
<map :style="{width:width+'px',height:height+ 'px'}" :latitude="location.latitude"
:longitude="location.longitude">
:longitude="location.longitude" id="map">
</map>
<view>
<u-button type="success" shape="square">确认选择</u-button>
<u-button type="primary" shape="square">确认选择</u-button>
</view>
</view>
</u-popup>
@ -44,15 +45,8 @@
contentshow: false,
action: "",
location: {},
list: [{
value: '1',
label: '江'
},
{
value: '2',
label: '湖'
}
],
plist: [],
list: [],
form: {
type: "",
content: "",
@ -63,9 +57,19 @@
height: 300
}
},
onLoad() {
var that = this;
this.loadType({
'number': "general_type",
}, function(res) {
that.plist = res;
});
},
onReady() {
this._mapContext = uni.createMapContext("map", this);
let that = this;
uni.getLocation({
type: "gcj02",
success(res) {
that.location = res;
}
@ -79,15 +83,66 @@
},
methods: {
loadType(data, call) {
let that = this;
this.util.request({
api: '/api/admin/parameter/show',
data: data,
utilSuccess: function(res) {
call(res.detail)
},
utilFail: function(res) {
this.util.alert(res);
}
});
},
toshowMap() {
this.showMap = true;
this.addMaker();
},
submit() {},
confirmType(e) {
var that = this;
this.form.type = e[0].value
this.form.typeName = e[0].label
this.loadType({
pid: e[0].value
}, function(res) {
that.list = res;
})
},
confirmContent(e) {
this.form.content = e[0].value
this.form.contentName = e[0].label
},
addMaker() {
let img = "../../../static/img/location.png"
const marker = {
id: 1,
iconPath: img,
width: 50,
height: 50,
label: {
width: 50,
height: 30,
borderWidth: 1,
borderRadius: 10,
bgColor: '#ffffff'
},
latitude: this.location.latitude,
longitude: this.location.longitude
};
this._mapContext.addMarkers({
marker,
clear: true,
complete(res) {
console.log('addMarkers', res)
},
fail(res) {
console.log('fail', res)
}
});
}
}
}

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

@ -3,12 +3,30 @@
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "巡查登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "巡查养护",
"navigationStyle": "custom"
}
}, {
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
],
"subPackages": [{
@ -29,6 +47,16 @@
"navigationStyle": "custom"
}
}]
}, {
"root": "packageB/pages",
"pages": [{
"path": "dailyInspection/dailyInspection",
"style": {
"navigationBarTitleText": "日常监管巡查",
"enablePullDownRefresh": false
}
}]
}],
"globalStyle": {

@ -1,24 +1,47 @@
<template>
<view class="wrap">
<u-row gutter="16" justify="space-between">
<u-col span="12">
<view class="demo-layout bg-blue" style="text-align: left;padding-left: 20rpx;">当前登录人张三</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple" @click="togeneral">
通用巡查
<u-col span="6">
<view class="demo-layout bg-purple-light">
<text class="iconfont icon-guanxianxuncha"></text>
<text class="navtxt">雨管巡查</text>
</view>
</u-col>
<u-col span="4">
<view class="demo-layout bg-purple-light"></view>
<u-col span="6">
<view class="demo-layout bg-purple">
<text class="iconfont icon-guanxianyanghu"></text>
<text class="navtxt">雨管养护</text>
</view>
</u-col>
<u-col span="5">
<view class="demo-layout bg-purple-dark"></view>
</u-row>
<u-row gutter="16">
<u-col span="12">
<view class="demo-layout bg-purple-light">
<text class="iconfont icon-zaixianjiance"></text>
<text class="navtxt">日常监督巡查</text>
</view>
</u-col>
</u-row>
<u-row gutter="16" justify="space-between">
<u-col span="3">
<view class="demo-layout bg-purple"></view>
<u-col span="8">
<view class="demo-layout bg-purple" @click="toview(1)">
<text class="iconfont icon-caidanguanli"></text>
<text class="navtxt">通用巡查</text>
</view>
</u-col>
<u-col span="9">
<view class="demo-layout bg-purple-light"></view>
<u-col span="4">
<view class="demo-layout bg-purple-light" @click="toview(2)">
<text class="iconfont icon-yonghugerenzhongxin"></text>
<text class="navtxt">我的</text>
</view>
</u-col>
</u-row>
</view>
@ -34,9 +57,13 @@
},
methods: {
togeneral() {
toview(type) {
let url = "/packageA/pages/generalPatrol/generalPatrol";
if (type == 2) {
url = "/pages/mine/mine"
}
uni.navigateTo({
url: "/packageA/pages/generalPatrol/generalPatrol"
url: url
})
}
}
@ -53,16 +80,33 @@
}
.demo-layout {
height: 80rpx;
border-radius: 8rpx;
line-height: 80rpx;
text-align: center;
display: flex;
flex-direction: column;
padding: 20rpx 0rpx;
}
.navtxt {
margin-top: 20rpx;
color: #000000;
}
.iconfont {
color: #338de3;
font-size: 64rpx;
}
.bg-purple {
background: #d3dce6;
}
.bg-blue {
background: #338de3;
color: #fff;
}
.bg-purple-light {
background: #e5e9f2;
}

@ -0,0 +1,116 @@
<template>
<view class="loginPage">
<view class="loginHeader">
<view class="loginHeaderTitle">欢迎使用巡查上报系统</view>
</view>
<view class="loginBox">
<u-field v-model="username" label-width=0 icon="account" placeholder="请填写登陆名">
</u-field>
<u-field v-model="password" label-width=0 icon="lock" password=true placeholder="请填写密码">
</u-field>
</view>
<view class="loginFoot">
<u-button :ripple="true" @click="loginBind" ripple-bg-color="#2979ff" type="primary">登陆</u-button>
</view>
</view>
</template>
<script>
var util = require("../../utils/util.js");
export default {
data() {
return {
username: '',
password: ''
}
},
onLoad: function() {
var user = uni.getStorageSync('userInfo');
if (!util.isNull(user.access_token)) {
util.request({
api: 'worker/check-token',
utilSuccess: function(res) {
if (res.token_available) {
uni.redirectTo({
url: '/pages/index/index'
});
}
},
utilFail: function(res) {
console.log(res)
}
});
}
},
methods: {
loginBind: function() {
let that = this;
if (that.username == "") {
util.alert("请输入登陆账号");
return false;
}
if (that.password == "") {
util.alert("请输入密码");
return false;
}
util.request({
api: 'worker/login-by-username',
method: 'POST',
data: {
'mobile': that.username,
'password': that.password
},
utilSuccess: function(res) {
console.log(res)
uni.setStorageSync('userInfo', res);
uni.redirectTo({
url: '/pages/index/index'
});
},
utilFail: function(res) {
console.log(res)
util.alert(res);
}
});
}
}
}
</script>
<style>
.loginPage {}
.loginFoot {
padding: 40rpx;
margin-top: 100rpx;
}
.loginBox {
padding: 120rpx 40rpx;
background: #FFFFFF;
margin-top: -50rpx;
background: #FFFFFF;
border-radius: 50rpx;
}
.loginHeaderTitle {
display: flex;
font-size: 40rpx;
padding: 80rpx 0;
color: #fff;
}
.loginHeader {
padding: 80rpx 40rpx;
background: #2979ff;
}
</style>

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

@ -0,0 +1,495 @@
@font-face {
font-family: 'iconfont'; /* Project id 3452172 */
src: url('//at.alicdn.com/t/font_3452172_uf51typgi.woff2?t=1654567019358') format('woff2'),
url('//at.alicdn.com/t/font_3452172_uf51typgi.woff?t=1654567019358') format('woff'),
url('//at.alicdn.com/t/font_3452172_uf51typgi.ttf?t=1654567019358') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-guanxianyanghu:before {
content: "\e8a4";
}
.icon-guanxianxuncha:before {
content: "\e8a5";
}
.icon-bengcanshuxinxi:before {
content: "\e76d";
}
.icon-dianchaxun:before {
content: "\e76e";
}
.icon-daoludingwei:before {
content: "\e76f";
}
.icon-bilichi:before {
content: "\e770";
}
.icon-fuhaohuafanganguanli:before {
content: "\e771";
}
.icon-dianxianbiaozhundaima:before {
content: "\e772";
}
.icon-fangda:before {
content: "\e773";
}
.icon-fuhaoguanli:before {
content: "\e774";
}
.icon-fuzhuxianshuxingshuju:before {
content: "\e775";
}
.icon-duobianxingchaxun:before {
content: "\e776";
}
.icon-fushuwuweihu:before {
content: "\e777";
}
.icon-erweiditu:before {
content: "\e778";
}
.icon-gongchengxinxishuju:before {
content: "\e779";
}
.icon-guanxianbiaozhu:before {
content: "\e77a";
}
.icon-juliceliang:before {
content: "\e77b";
}
.icon-manyou:before {
content: "\e77c";
}
.icon-juxingchaxun:before {
content: "\e77d";
}
.icon-houyishitu:before {
content: "\e77e";
}
.icon-guandianbiaozhu:before {
content: "\e77f";
}
.icon-jieliusheshijichushuju:before {
content: "\e780";
}
.icon-jianchajingjichushuju:before {
content: "\e781";
}
.icon-paishuiguandianshuju:before {
content: "\e782";
}
.icon-paishuiguanxianshuju:before {
content: "\e783";
}
.icon-paifangkoujichushuju:before {
content: "\e784";
}
.icon-paishuiqujichushuju:before {
content: "\e785";
}
.icon-qingping:before {
content: "\e786";
}
.icon-quantuxianshi:before {
content: "\e787";
}
.icon-quexianjiancechaxun:before {
content: "\e788";
}
.icon-sheshimianshuxingshuju:before {
content: "\e789";
}
.icon-qianyishitu:before {
content: "\e78a";
}
.icon-paishuibengzhanjichushuju:before {
content: "\e78b";
}
.icon-sheshikongjianfanweishuju:before {
content: "\e78c";
}
.icon-sanweiditu:before {
content: "\e78d";
}
.icon-shiguyinhuanshuju:before {
content: "\e78e";
}
.icon-shuxingchaxun:before {
content: "\e78f";
}
.icon-sheshiquanshujiyanghuxinxi:before {
content: "\e790";
}
.icon-tezhengdianweihu:before {
content: "\e791";
}
.icon-xitongxinxiweihu:before {
content: "\e792";
}
.icon-suoxiao:before {
content: "\e793";
}
.icon-shuaxinditu:before {
content: "\e794";
}
.icon-tufuhaochaxun:before {
content: "\e795";
}
.icon-yinhuanleibieweihu:before {
content: "\e796";
}
.icon-yushuikoujichushuju:before {
content: "\e797";
}
.icon-yujingshujuweihu:before {
content: "\e798";
}
.icon-ziliaoshoujiqingkuang:before {
content: "\e799";
}
.icon-zidianbiaoguanli:before {
content: "\e79a";
}
.icon-zuobiaodingwei:before {
content: "\e79b";
}
.icon-zhuantiweihu:before {
content: "\e79c";
}
.icon-yuanshujushuxingmiaoshu:before {
content: "\e79d";
}
.icon-zhamenjichushuju:before {
content: "\e79e";
}
.icon-shujulianjieguanli:before {
content: "\e79f";
}
.icon-mianjiceliang:before {
content: "\e7a0";
}
.icon-tucengkongzhi:before {
content: "\e7a1";
}
.icon-shujugongxiang:before {
content: "\e861";
}
.icon-shujujicheng:before {
content: "\e862";
}
.icon-ziyuanmuluguanli:before {
content: "\e865";
}
.icon-shipinjiankongyemian:before {
content: "\e866";
}
.icon-shipindianweiguanli:before {
content: "\e867";
}
.icon-bangonggongwenshuju:before {
content: "\e868";
}
.icon-huanjingjianchazhifashuju:before {
content: "\e869";
}
.icon-shuihuanjingzhiliangbaogao:before {
content: "\e86a";
}
.icon-shujuguanli:before {
content: "\e86b";
}
.icon-baoguanfenxi:before {
content: "\e86c";
}
.icon-chuizhijingjucesuan:before {
content: "\e86d";
}
.icon-chaxunfangan:before {
content: "\e86e";
}
.icon-chaxuntongji:before {
content: "\e86f";
}
.icon-ditushezhi:before {
content: "\e870";
}
.icon-futufenxi:before {
content: "\e871";
}
.icon-gongchengdanganguanli:before {
content: "\e872";
}
.icon-guanxianbaojiandengji:before {
content: "\e873";
}
.icon-gongnengxingquexianshuju:before {
content: "\e874";
}
.icon-hengduanmianfenxi:before {
content: "\e875";
}
.icon-guanxiantuopufenxi:before {
content: "\e876";
}
.icon-hunjiedianxinxi:before {
content: "\e877";
}
.icon-huanchongqufenxi:before {
content: "\e878";
}
.icon-jianzhuwuyangtaipaishuixinxi:before {
content: "\e879";
}
.icon-jungongtuguanli:before {
content: "\e87a";
}
.icon-kaiwafenxi:before {
content: "\e87b";
}
.icon-jungongyanshouguanli:before {
content: "\e87c";
}
.icon-mohuchaxun:before {
content: "\e87d";
}
.icon-loudianweixiu:before {
content: "\e87e";
}
.icon-jiegouxingquexianshuju:before {
content: "\e87f";
}
.icon-paishuihuxinxi:before {
content: "\e880";
}
.icon-quyuchaxun:before {
content: "\e881";
}
.icon-quyuhunjieshuxingshuju:before {
content: "\e882";
}
.icon-qiangxianfenxi:before {
content: "\e883";
}
.icon-paishuikouxinxi:before {
content: "\e884";
}
.icon-pengzhuangfenxi:before {
content: "\e885";
}
.icon-sheshitongji:before {
content: "\e886";
}
.icon-shigongguihuafenxi:before {
content: "\e887";
}
.icon-shebeiweihu:before {
content: "\e888";
}
.icon-shuipingjingjucesuan:before {
content: "\e889";
}
.icon-tiaojianchaxun:before {
content: "\e88a";
}
.icon-tuichu:before {
content: "\e88b";
}
.icon-tuxingbiaozhu:before {
content: "\e88c";
}
.icon-wentishouli:before {
content: "\e88d";
}
.icon-xinxiguanlishangbao:before {
content: "\e88e";
}
.icon-yuwuhunjiefenxi:before {
content: "\e88f";
}
.icon-yujingfenxi:before {
content: "\e890";
}
.icon-xiaoqupaishuixitong:before {
content: "\e891";
}
.icon-yewuliuchengshenpiguanli:before {
content: "\e892";
}
.icon-yuanxingchaxun:before {
content: "\e893";
}
.icon-zaixianjiance:before {
content: "\e894";
}
.icon-zongduanmianfenxi:before {
content: "\e895";
}
.icon-xuanqu:before {
content: "\e896";
}
.icon-gongxiangmulu:before {
content: "\e897";
}
.icon-jiekouqingdan:before {
content: "\e898";
}
.icon-anquanrenzheng:before {
content: "\e899";
}
.icon-yonghugerenzhongxin:before {
content: "\e89a";
}
.icon-caidanguanli:before {
content: "\e89b";
}
.icon-rizhiguanli:before {
content: "\e89c";
}
.icon-zuzhijiagouguanli:before {
content: "\e89d";
}
.icon-shujushenqingguanli:before {
content: "\e89e";
}
.icon-hangzhengquhuaguanli:before {
content: "\e89f";
}
.icon-jiaoseguanli:before {
content: "\e8a0";
}
.icon-manyou1:before {
content: "\e8a1";
}
.icon-dayin:before {
content: "\e8a2";
}
.icon-guanbi:before {
content: "\e8a3";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

@ -0,0 +1,11 @@
import WeChat from "./WeChat";
export default class BasePage {
constructor() {
this.data = {};
}
onLoad(o) {
console.log('BasePage loaded');
}
}

@ -0,0 +1,10 @@
// 小程序全局对象
const WeChat = {};
WeChat.Page = Page; // 注册页面
WeChat.register = function (PageClass) {
let page = new PageClass();
WeChat.Page(page);
};
export default WeChat;

126
utils/md5.min.js vendored

@ -0,0 +1,126 @@
!function (n) {
"use strict";
function t(n, t) {
var r = (65535 & n) + (65535 & t);
return (n >> 16) + (t >> 16) + (r >> 16) << 16 | 65535 & r;
}
function r(n, t) {
return n << t | n >>> 32 - t;
}
function e(n, e, o, u, c, f) {
return t(r(t(t(e, n), t(u, f)), c), o);
}
function o(n, t, r, o, u, c, f) {
return e(t & r | ~t & o, n, t, u, c, f);
}
function u(n, t, r, o, u, c, f) {
return e(t & o | r & ~o, n, t, u, c, f);
}
function c(n, t, r, o, u, c, f) {
return e(t ^ r ^ o, n, t, u, c, f);
}
function f(n, t, r, o, u, c, f) {
return e(r ^ (t | ~o), n, t, u, c, f);
}
function i(n, r) {
n[r >> 5] |= 128 << r % 32, n[14 + (r + 64 >>> 9 << 4)] = r;
var e,
i,
a,
d,
h,
l = 1732584193,
g = -271733879,
v = -1732584194,
m = 271733878;
for (e = 0; e < n.length; e += 16) i = l, a = g, d = v, h = m, g = f(g = f(g = f(g = f(g = c(g = c(g = c(g = c(g = u(g = u(g = u(g = u(g = o(g = o(g = o(g = o(g, v = o(v, m = o(m, l = o(l, g, v, m, n[e], 7, -680876936), g, v, n[e + 1], 12, -389564586), l, g, n[e + 2], 17, 606105819), m, l, n[e + 3], 22, -1044525330), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 4], 7, -176418897), g, v, n[e + 5], 12, 1200080426), l, g, n[e + 6], 17, -1473231341), m, l, n[e + 7], 22, -45705983), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 8], 7, 1770035416), g, v, n[e + 9], 12, -1958414417), l, g, n[e + 10], 17, -42063), m, l, n[e + 11], 22, -1990404162), v = o(v, m = o(m, l = o(l, g, v, m, n[e + 12], 7, 1804603682), g, v, n[e + 13], 12, -40341101), l, g, n[e + 14], 17, -1502002290), m, l, n[e + 15], 22, 1236535329), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 1], 5, -165796510), g, v, n[e + 6], 9, -1069501632), l, g, n[e + 11], 14, 643717713), m, l, n[e], 20, -373897302), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 5], 5, -701558691), g, v, n[e + 10], 9, 38016083), l, g, n[e + 15], 14, -660478335), m, l, n[e + 4], 20, -405537848), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 9], 5, 568446438), g, v, n[e + 14], 9, -1019803690), l, g, n[e + 3], 14, -187363961), m, l, n[e + 8], 20, 1163531501), v = u(v, m = u(m, l = u(l, g, v, m, n[e + 13], 5, -1444681467), g, v, n[e + 2], 9, -51403784), l, g, n[e + 7], 14, 1735328473), m, l, n[e + 12], 20, -1926607734), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 5], 4, -378558), g, v, n[e + 8], 11, -2022574463), l, g, n[e + 11], 16, 1839030562), m, l, n[e + 14], 23, -35309556), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 1], 4, -1530992060), g, v, n[e + 4], 11, 1272893353), l, g, n[e + 7], 16, -155497632), m, l, n[e + 10], 23, -1094730640), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 13], 4, 681279174), g, v, n[e], 11, -358537222), l, g, n[e + 3], 16, -722521979), m, l, n[e + 6], 23, 76029189), v = c(v, m = c(m, l = c(l, g, v, m, n[e + 9], 4, -640364487), g, v, n[e + 12], 11, -421815835), l, g, n[e + 15], 16, 530742520), m, l, n[e + 2], 23, -995338651), v = f(v, m = f(m, l = f(l, g, v, m, n[e], 6, -198630844), g, v, n[e + 7], 10, 1126891415), l, g, n[e + 14], 15, -1416354905), m, l, n[e + 5], 21, -57434055), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 12], 6, 1700485571), g, v, n[e + 3], 10, -1894986606), l, g, n[e + 10], 15, -1051523), m, l, n[e + 1], 21, -2054922799), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 8], 6, 1873313359), g, v, n[e + 15], 10, -30611744), l, g, n[e + 6], 15, -1560198380), m, l, n[e + 13], 21, 1309151649), v = f(v, m = f(m, l = f(l, g, v, m, n[e + 4], 6, -145523070), g, v, n[e + 11], 10, -1120210379), l, g, n[e + 2], 15, 718787259), m, l, n[e + 9], 21, -343485551), l = t(l, i), g = t(g, a), v = t(v, d), m = t(m, h);
return [l, g, v, m];
}
function a(n) {
var t,
r = "",
e = 32 * n.length;
for (t = 0; t < e; t += 8) r += String.fromCharCode(n[t >> 5] >>> t % 32 & 255);
return r;
}
function d(n) {
var t,
r = [];
for (r[(n.length >> 2) - 1] = void 0, t = 0; t < r.length; t += 1) r[t] = 0;
var e = 8 * n.length;
for (t = 0; t < e; t += 8) r[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32;
return r;
}
function h(n) {
return a(i(d(n), 8 * n.length));
}
function l(n, t) {
var r,
e,
o = d(n),
u = [],
c = [];
for (u[15] = c[15] = void 0, o.length > 16 && (o = i(o, 8 * n.length)), r = 0; r < 16; r += 1) u[r] = 909522486 ^ o[r], c[r] = 1549556828 ^ o[r];
return e = i(u.concat(d(t)), 512 + 8 * t.length), a(i(c.concat(e), 640));
}
function g(n) {
var t,
r,
e = "";
for (r = 0; r < n.length; r += 1) t = n.charCodeAt(r), e += "0123456789abcdef".charAt(t >>> 4 & 15) + "0123456789abcdef".charAt(15 & t);
return e;
}
function v(n) {
return unescape(encodeURIComponent(n));
}
function m(n) {
return h(v(n));
}
function p(n) {
return g(m(n));
}
function s(n, t) {
return l(v(n), v(t));
}
function C(n, t) {
return g(s(n, t));
}
function A(n, t, r) {
return t ? r ? s(t, n) : C(t, n) : r ? m(n) : p(n);
}
"function" == typeof define && define.amd ? define(function () {
return A;
}) : "object" == typeof module && module.exports ? module.exports = A : n.md5 = A;
}(this); //# sourceMappingURL=md5.min.js.map

@ -0,0 +1,672 @@
import md5 from "./md5.min";
const HOSTARR = {
'development': 'http://118.31.104.155:9003',
'production': 'http://118.31.104.155:9003'
}; // 审核状态
const HOST = HOSTARR[process.env.NODE_ENV]; //"https://tiantianxinye.365care.langye.net/";//HOSTARR[process.env.NODE_ENV];//
const formatTime = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return [year, month, day].map(formatNumber).join('-');
};
const stateArr = {
"save": "待处理",
"ongoing": "处理中",
"finished": "已处理"
}
const formatTimeAll = date => {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(
':');
};
const formatNumber = n => {
n = n.toString();
return n[1] ? n : '0' + n;
}; // 快捷显示alert
const alert = msg => {
uni.showModal({
title: '',
content: msg,
showCancel: false
});
}; // 订单状态
const orderStatusDic = {
'0': '待确认',
'10': '待派单',
'20': '进行中',
'100': '已完成'
}; // 审核状态
const auditStatusDic = {
'0': '待审核',
'1': '已审核',
'-1': '已拒绝'
}; // 请求封装
const request = options => {
if (!options.customLoading) {
uni.showLoading({
title: '正在加载'
});
} else {
// 当前页面请求数量+1
if (options.bindThis) {
options.bindThis.setData({
//loadingCount: options.bindThis.data.loadingCount + 1
});
}
}
options.url = HOST + options.api;
options.header = {
...options.header,
//'Accept': 'application/json',
//'Connection': 'keep-alive'
//'content-type': 'application/json'
}; // 如果已登录,请求中拼openId
var access_token = uni.getStorageSync('userInfo').access_token;
if (isLogin()) {
options.data = {
...options.data,
'token': access_token
};
} // 如果是POST方法
if (options.method == 'POST' && !isNull(access_token)) {
// 拼时间戳
options.data.ts = new Date().getTime();
}
uni.request({
...options,
success: function(res) {
if (res.statusCode != 200) {
if (options.utilFail != undefined) {
if (res.statusCode == 401) {
uni.clearStorageSync();
uni.navigateTo({
url: '/pages/login/login'
});
} else {
options.utilFail('TODO: 特殊处理非200错误(' + res.statusCode + ')');
}
}
} else {
if (!isNull(res.data.errorcode) || res.data.errorcode == 0) {
if (options.utilFail != undefined) {
options.utilFail(res.data.errormsg || '接口发生未知错误');
} else {
options.utilFail(res.data.errormsg);
}
} else {
if (options.utilSuccess != undefined) {
options.utilSuccess(res.data);
}
}
}
},
fail: options.utilFail,
complete: function(res) {
if (!options.customLoading) {
uni.hideNavigationBarLoading();
uni.hideLoading();
} else {
// 当前页面请求数量-1
if (options.bindThis) {
options.bindThis.setData({
loadingCount: options.bindThis.data.loadingCount - 1
});
}
}
}
});
}; // 提交formID封装
const uploadFormID = formID => {
var timestamp = Math.floor(new Date().getTime() / 1000);
request({
api: 'WeChat/SaveFormID',
method: 'POST',
data: {
FormIDs: formID
},
utilSuccess: function(res) {
console.log('上传formID成功');
},
utilFail: function(err) {
console.log('上传formID失败');
}
});
}; // 支付
const payOrder = (orderID, orderType, success, fail) => {
uni.request({
url: HOST + 'WxPay/ToPay?openId=' + uni.getStorageSync('userInfo').WeChatOpenID + '&orderId=' +
orderID + '&OrderType=' + orderType,
method: 'GET',
header: {
'content-type': 'application/json'
},
success: function(res) {
// 内容为空, 代表失败
if (res.data == '') {
fail('当前网络状况不好');
return;
} // 去掉转义字符
var pureStr = res.data.replace(/\\/g, '');
res.data = JSON.parse(pureStr);
var index = res.data.package.indexOf('=') + 1;
var prepayId = res.data.package.substring(index); // wxpay
uni.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: function(res) {
success(res); // 发送成功通知
request({
api: 'WxPay/PayTemplateMsg',
data: {
prepay_id: prepayId,
orderId: orderID,
isSuccess: 1,
failMsg: '',
xType: orderType
}
});
},
fail: function(res) {
fail(res);
var errMsg = res == 'requestPayment:fail cancel' ? '用户取消支付' :
res; // 发送失败通知
request({
api: 'WxPay/PayTemplateMsg',
data: {
prepay_id: prepayId,
orderId: orderID,
isSuccess: 0,
failMsg: errMsg,
xType: orderType
}
});
}
});
},
fail: function(err) {
fail('当前网络状况不好');
}
});
}; // 判断是否已登录同时有open-id和PhoneNum, 则认为已登录)
const scanPay = (orderID, amt, scan, type, success, fail) => {
var access_token = uni.getStorageSync('userInfo').access_token;
console.log("1.支付进入")
var data = {
token: access_token,
order_id: orderID,
money: amt,
auth_code: scan,
type: type
};
console.log("2.参数")
console.log(data)
uni.showLoading({
title: '正在加载',
});
uni.request({
url: HOST + 'manager/scan-pay/' + orderID,
method: 'POST',
data: {
token: access_token,
order_id: orderID,
money: amt,
auth_code: scan,
type: type
},
header: {
'content-type': 'application/json'
},
success: function(res) {
uni.hideLoading();
if (isNull(res.data.errorcode)) {
success(res);
console.log("3.支付成功")
console.log(res)
} else {
alert("支付失败:" + res.data.errormsg);
console.log("4.支付失败")
console.log(res)
}
},
fail: function(err) {
fail('当前网络状况不好');
console.log("4.支付失败")
console.log(res)
}
});
}; // 判断是否已登录同时有open-id和PhoneNum, 则认为已登录)
const isLogin = () => {
var userInfo = uni.getStorageSync('userInfo');
return !isNull(userInfo.access_token);
}; // 判断是否为空
const getfile = (id, success, fail) => {
var access_token = uni.getStorageSync('userInfo').access_token;
var url = HOST + 'manager/get-attachment/' + id + '?token=' + access_token;
success(url);
// uni.request({
// url: HOST + 'manager/get-attachment/' + id + '?token=' + access_token,
// method: 'GET',
// header: {
// 'content-type': 'application/json'
// },
// success: function(res) {
// success(res); // 发送成功通知
// },
// fail: function(res) {
// fail(res);
// }
// });
};
//获取订单详情
const getOrderInfo = (id, success, fail) => {
var access_token = uni.getStorageSync('userInfo').access_token;
var url = HOST + 'manager/get-order/' + id + '?token=' + access_token;
uni.request({
url: url,
method: 'GET',
header: {
'content-type': 'application/json'
},
success: function(res) {
res.data.factorjson = JSON.parse(res.data.factors);
success(res); // 发送成功通知
},
fail: function(res) {
fail(res);
}
});
};
//获取订单详情
const getOrderItemInfo = (id, success, fail) => {
var access_token = uni.getStorageSync('userInfo').access_token;
var url = HOST + 'manager/get-order-item/' + id + '?token=' + access_token;
uni.request({
url: url,
method: 'GET',
header: {
'content-type': 'application/json'
},
success: function(res) {
res.data.factorjson = JSON.parse(res.data.factors);
success(res.data); // 发送成功通知
},
fail: function(res) {
fail(res);
}
});
};
const isNull = p => {
return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null';
}; // 正则
const phoneRegex = /^1\d{10}$/;
const idCardRegex = /^\d{17}([0-9]|X)$/; // 去掉特殊字符
const filterSpecialChars = str => {
return str.replace(/[^\u4e00-\u9fa5a-zA-Z0-9\w]/g, '');
}; // 生成随机字符串
const randomStr = length => {
var ret = '';
var arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C',
'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z'
];
for (var i = 0; i < length; i++) {
var randomIndex = Math.round(Math.random() * (arr.length - 1));
ret += arr[randomIndex];
}
return ret;
}; // proType对应的中文描述
const proTypeDic = {}; // 排序字段
const orderByArr = [{
id: '1',
name: '近期销量最高'
}, // { id: '2', name: '产品评价最高' },
{
id: '3',
name: '价格由高到低'
}, {
id: '4',
name: '价格由低到高'
}
]; // 日期天数
const travelDaysArr = [{
id: '1',
name: '2日',
minDay: 2,
maxDay: 2
}, {
id: '2',
name: '3日',
minDay: 3,
maxDay: 3
}, {
id: '3',
name: '4日',
minDay: 4,
maxDay: 4
}, {
id: '4',
name: '5日',
minDay: 5,
maxDay: 5
}, {
id: '5',
name: '6日',
minDay: 6,
maxDay: 6
}, {
id: '6',
name: '7日',
minDay: 7,
maxDay: 7
}, {
id: '7',
name: '8日',
minDay: 8,
maxDay: 8
}, {
id: '8',
name: '9日',
minDay: 9,
maxDay: 9
}, {
id: '9',
name: '10日',
minDay: 10,
maxDay: 10
}, {
id: '10',
name: '10日以上',
minDay: 11,
maxDay: 0
}]; // 中文星期
const weekdayArr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; // 是否合法的身份证
const isValidCardID = cardID => {
// Step1: 先判断格式
if (!idCardRegex.test(cardID)) return false; // Step2: 校验最后一位
var code = cardID.split(''); //加权因子
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; //校验位
var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
var sum = 0;
var ai = 0;
var wi = 0;
for (var i = 0; i < 17; i++) {
ai = code[i];
wi = factor[i];
sum += ai * wi;
}
var last = parity[sum % 11];
return parity[sum % 11] == code[17];
};
/**
* UTF16和UTF8转换对照表
* U+00000000 U+0000007F 0xxxxxxx
* U+00000080 U+000007FF 110xxxxx 10xxxxxx
* U+00000800 U+0000FFFF 1110xxxx 10xxxxxx 10xxxxxx
* U+00010000 U+001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
* U+00200000 U+03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
* U+04000000 U+7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
*/
var Base64 = {
// 转码表
table: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U',
'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '+',
'/'
],
UTF16ToUTF8: function(str) {
var res = [],
len = str.length;
for (var i = 0; i < len; i++) {
var code = str.charCodeAt(i);
if (code > 0x0000 && code <= 0x007F) {
// 单字节这里并不考虑0x0000因为它是空字节
// U+00000000 U+0000007F 0xxxxxxx
res.push(str.charAt(i));
} else if (code >= 0x0080 && code <= 0x07FF) {
// 双字节
// U+00000080 U+000007FF 110xxxxx 10xxxxxx
// 110xxxxx
var byte1 = 0xC0 | code >> 6 & 0x1F; // 10xxxxxx
var byte2 = 0x80 | code & 0x3F;
res.push(String.fromCharCode(byte1), String.fromCharCode(byte2));
} else if (code >= 0x0800 && code <= 0xFFFF) {
// 三字节
// U+00000800 U+0000FFFF 1110xxxx 10xxxxxx 10xxxxxx
// 1110xxxx
var byte1 = 0xE0 | code >> 12 & 0x0F; // 10xxxxxx
var byte2 = 0x80 | code >> 6 & 0x3F; // 10xxxxxx
var byte3 = 0x80 | code & 0x3F;
res.push(String.fromCharCode(byte1), String.fromCharCode(byte2), String.fromCharCode(
byte3));
} else if (code >= 0x00010000 && code <= 0x001FFFFF) { // 四字节
// U+00010000 U+001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
} else if (code >= 0x00200000 && code <= 0x03FFFFFF) { // 五字节
// U+00200000 U+03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
} else
/** if (code >= 0x04000000 && code <= 0x7FFFFFFF)*/
{ // 六字节
// U+04000000 U+7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
}
}
return res.join('');
},
UTF8ToUTF16: function(str) {
var res = [],
len = str.length;
var i = 0;
for (var i = 0; i < len; i++) {
var code = str.charCodeAt(i); // 对第一个字节进行判断
if ((code >> 7 & 0xFF) == 0x0) {
// 单字节
// 0xxxxxxx
res.push(str.charAt(i));
} else if ((code >> 5 & 0xFF) == 0x6) {
// 双字节
// 110xxxxx 10xxxxxx
var code2 = str.charCodeAt(++i);
var byte1 = (code & 0x1F) << 6;
var byte2 = code2 & 0x3F;
var utf16 = byte1 | byte2;
res.push(Sting.fromCharCode(utf16));
} else if ((code >> 4 & 0xFF) == 0xE) {
// 三字节
// 1110xxxx 10xxxxxx 10xxxxxx
var code2 = str.charCodeAt(++i);
var code3 = str.charCodeAt(++i);
var byte1 = code << 4 | code2 >> 2 & 0x0F;
var byte2 = (code2 & 0x03) << 6 | code3 & 0x3F;
utf16 = (byte1 & 0x00FF) << 8 | byte2;
res.push(String.fromCharCode(utf16));
} else if ((code >> 3 & 0xFF) == 0x1E) { // 四字节
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
} else if ((code >> 2 & 0xFF) == 0x3E) { // 五字节
// 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
} else
/** if (((code >> 1) & 0xFF) == 0x7E)*/
{ // 六字节
// 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
}
}
return res.join('');
},
encode: function(str) {
if (!str) {
return '';
}
var utf8 = this.UTF16ToUTF8(str); // 转成UTF8
var i = 0; // 遍历索引
var len = utf8.length;
var res = [];
while (i < len) {
var c1 = utf8.charCodeAt(i++) & 0xFF;
res.push(this.table[c1 >> 2]); // 需要补2个=
if (i == len) {
res.push(this.table[(c1 & 0x3) << 4]);
res.push('==');
break;
}
var c2 = utf8.charCodeAt(i++); // 需要补1个=
if (i == len) {
res.push(this.table[(c1 & 0x3) << 4 | c2 >> 4 & 0x0F]);
res.push(this.table[(c2 & 0x0F) << 2]);
res.push('=');
break;
}
var c3 = utf8.charCodeAt(i++);
res.push(this.table[(c1 & 0x3) << 4 | c2 >> 4 & 0x0F]);
res.push(this.table[(c2 & 0x0F) << 2 | (c3 & 0xC0) >> 6]);
res.push(this.table[c3 & 0x3F]);
}
return res.join('');
},
decode: function(str) {
if (!str) {
return '';
}
var len = str.length;
var i = 0;
var res = [];
while (i < len) {
var code1 = this.table.indexOf(str.charAt(i++));
var code2 = this.table.indexOf(str.charAt(i++));
var code3 = this.table.indexOf(str.charAt(i++));
var code4 = this.table.indexOf(str.charAt(i++));
var c1 = code1 << 2 | code2 >> 4;
var c2 = (code2 & 0xF) << 4 | code3 >> 2;
var c3 = (code3 & 0x3) << 6 | code4;
res.push(String.fromCharCode(c1));
if (code3 != 64) {
res.push(String.fromCharCode(c2));
}
if (code4 != 64) {
res.push(String.fromCharCode(c3));
}
}
return this.UTF8ToUTF16(res.join(''));
}
};
module.exports = {
HOST: HOST,
formatTime: formatTime,
formatTimeAll: formatTimeAll,
formatNumber: formatNumber,
alert: alert,
getfile: getfile,
request: request,
uploadFormID: uploadFormID,
payOrder: payOrder,
scanPay: scanPay,
isLogin: isLogin,
isNull: isNull,
phoneRegex: phoneRegex,
idCardRegex: idCardRegex,
filterSpecialChars: filterSpecialChars,
randomStr: randomStr,
proTypeDic: proTypeDic,
orderByArr: orderByArr,
travelDaysArr: travelDaysArr,
weekdayArr: weekdayArr,
Base64: Base64,
orderStatusDic: orderStatusDic,
auditStatusDic: auditStatusDic,
getOrderInfo: getOrderInfo,
getOrderItemInfo: getOrderItemInfo,
stateArr: stateArr
};

@ -0,0 +1,120 @@
// 从2018-09-01 15:30:27 中提取出 15:30
var hmTimeFrom = function (dateStr) {
return dateStr.substring(11, 16);
}; // 算出2个dateStr间的时间间隔例如 2018-09-01 15:30:27 到 2018-09-02 03:28:09,中间相差'd天h小时m分钟'
var intervalBetween = function (startDateStr, endDateStr) {
var startDate = dateFromDateStr(startDateStr);
var endDate = dateFromDateStr(endDateStr);
var startTimestamp = startDate.getTime();
var endTimestamp = endDate.getTime();
var deltaTimestamp = Math.floor((endTimestamp - startTimestamp) / 1000);
var days = Math.floor(deltaTimestamp / (24 * 3600));
var hours = Math.floor((deltaTimestamp - days * 24 * 3600) / 3600);
var minutes = Math.floor((deltaTimestamp - days * 24 * 3600 - hours * 3600) / 60);
var ret = '';
if (days > 0) ret += days + 'd';
if (hours > 0) ret += hours + 'h';
if (minutes > 0) ret += minutes + 'm';
return ret;
}; // 算出24小时内的2个时间间隔例如 12:00 到 15:30,中间相差'h小时m分钟'
var intervalBetween24h = function (startDateStr, endDateStr, isCN) {
var startComponents = startDateStr.split(':');
var endComponents = endDateStr.split(':');
var startH = startComponents[0];
var startM = startComponents[1];
var endH = endComponents[0];
var endM = endComponents[1];
var deltaTimestamp = 0;
if (endH > startH || endH == startH && endM > startM) {
// 不跨天
// Start
var startDate = getDate(2018, 1, 1, startH, startM, 0);
var startTimestamp = startDate.getTime(); // End
var endDate = getDate(2018, 1, 1, endH, endM, 0);
var endTimestamp = endDate.getTime(); // delta
deltaTimestamp = Math.floor((endTimestamp - startTimestamp) / 1000);
} else {
// 跨天
// Start
var startDate = getDate(2018, 1, 1, startH, startM, 0);
var startTimestamp = startDate.getTime(); // End
var endDate = getDate(2018, 1, 2, endH, endM, 0);
var endTimestamp = endDate.getTime(); // delta
deltaTimestamp = Math.floor((endTimestamp - startTimestamp) / 1000);
} // 拼接返回值
var days = Math.floor(deltaTimestamp / (24 * 3600));
var hours = Math.floor((deltaTimestamp - days * 24 * 3600) / 3600);
var minutes = Math.floor((deltaTimestamp - days * 24 * 3600 - hours * 3600) / 60);
var ret = '';
if (isCN) {
if (days > 0) ret += days + '天';
if (hours > 0) ret += hours + '小时';
if (minutes > 0) ret += minutes + '分钟';
} else {
if (days > 0) ret += days + 'd';
if (hours > 0) ret += hours + 'h';
if (minutes > 0) ret += minutes + 'm';
}
return ret;
}; // dateStr转Date类型
var dateFromDateStr = function (dateStr) {
var components = dateStr.split(' ');
var dateComponents = components[0].split('-');
var timeComponents = components[1].split(':');
var totalComponents = dateComponents.concat(timeComponents);
return getDate(parseInt(totalComponents[0]), parseInt(totalComponents[1]) - 1, parseInt(totalComponents[2]), parseInt(totalComponents[3]), parseInt(totalComponents[4]), parseInt(totalComponents[5]), 0);
}; // 判断是否跨天, 例如 12:00 到 11:30 为跨天
var isCrossDay = function (startDateStr, endDateStr) {
var startComponents = startDateStr.split(':');
var endComponents = endDateStr.split(':');
var startH = startComponents[0];
var startM = startComponents[1];
var endH = endComponents[0];
var endM = endComponents[1];
return endH < startH || endH == startH && endM < startM;
};
var numberUtil = {
numberFormat: function (value) {
var v = parseFloat(value); //强转Int毕竟有可能返回是String类型的数字
return v.toFixed(2);
}
};
var rorderStatusDic = function (status) {
var orderStatusDic = {
'0': '待确认',
'10': '待派单',
'20': '进行中',
'100': '已完成'
};
return orderStatusDic[status];
};
module.exports = {
hmTimeFrom: hmTimeFrom,
intervalBetween: intervalBetween,
intervalBetween24h: intervalBetween24h,
isCrossDay: isCrossDay,
numberFormat: numberUtil.numberFormat,
//暴露接口调用
rorderStatusDic: rorderStatusDic
};

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save