项目公共js(vue.js)
var urlHead = "http://hm.runorout.com/";
// var urlHead = "/";
/*加入跑班相关*/
var urlGetIndex = urlHead + "init/v2/teams"; //加入跑班初始进入
var urlGetIndexSearch = urlHead + "teams/search"; //加入跑班,搜索
var urlGetClassInfo = urlHead + "init/team"; //加入跑班,班级详情
var urlGetActivityList = urlHead + "init/activities"; //活动列表页
/*创建跑班相关--班级管理相关*/
var urlCreateClass = urlHead + "team"; //提交创建跑班
var urlUpdateClass = urlHead + "team"; //更新跑班信息(二维码等)
/*用户相关*/
var urlGetLastClass = urlHead + "user/team"; //获取最近一次报名班级
var urlSignIn = urlHead + "sign_in"; //提交打卡
var urlSignInInit = urlHead + "init/sign_in"; //打卡初始化
var urlGetOneSignIn = urlHead + "check_sign_in"; //查作业初始化
var urlCheckSignIn = urlHead + "sign_in/judgment"; //提交检查结果
var urlCheckSignInInit = urlHead + "init/check/sign_in"; //查作业V2版
var urlGetAjaxCheckSignIn = urlHead + "ajax/check/sign_in"; //查作业V2版获取接口
var urlJudgmentSignIn = urlHead + "ajax/check/sign_in/judge"; //判断作业
var urlGetAjaxCheckSignInHistory = urlHead + "ajax/check/sign_in/history"; //查作业V2版获取接口-历史
var urlGetUserCenter = urlHead + "init/user_home"; //个人中心数据初始化
var urlGetSignInRecord = urlHead + "user/calendar"; //获取打卡记录
var urlGetAccoutInfo = urlHead + "init/user_account"; //个人账户
var urlGetMoneyDetails = urlHead + "money_tally"; //资金详情
var urlUserInfoInit = urlHead + "init/user_info"; //个人信息进入页面
var urlUpdateUserInfo = urlHead + "user_info"; //更新个人信息
var urlGetMyClass = urlHead + "init/user/history_team"; //我的跑班页面
var urlSubFeedBack = urlHead + "feedback/advice";
var urlSubReport = urlHead + "feedback/report";
var urlSettingTimeInit = urlHead + "init/user/param/alert"; //设置打卡提醒是否开启
var urlSettingTime = urlHead + "ajax/user/param/alert"; //设置打卡提醒时间
/*用户排名*/
var urlInitRankList = urlHead + "init/v3/rank/team"; //距离-班级排名页面初始化
var urlDistanceRankList = urlHead + "init/v2/rank/team"; //距离-班级排名页面
var urlInitPlateRankList = urlHead + "init/v2/rank/global"; //距离-平台排名页面初始化
var urlPlateRankList = urlHead + "rank/global"; //距离-平台排名页面
var urlClassRankList = urlHead + "init/rank/teams";
var urlRunnerWall = urlHead + "init/team/wall"; //跑友墙
var urlFavorUser = urlHead + "thumb_up"; //点赞
var urlCancelFavor = urlHead + "thumb_up/cancel"; //取消点赞
/*支付相关*/
var urlPayOrder = urlHead + "order"; //创建支付订单
var urlGetOrderMoney = urlHead + "order/price"; //获得订单价格等
var urlGetUserAccoutMoney = urlHead + "user/money"; //获取用户账户余额
var urlPayByAccount = urlHead + "pay/account"; //用账户支付
var urlGetWeiPayId = urlHead + "pay/weixin"; //微信支付
var urlWithdraw = urlHead + "withdraw"; //提现
/* 积分商城 */
var urlPoint = urlHead + "init/point"; //积分首页
var urlPointTally = urlHead + "init/point/point_tally"; //积分列表
var urlPointTask = urlHead + "init/point/point_task"; //赚积分
var urlShop = urlHead + "init/shop"; //商城首页
var urlShopItem = urlHead + "init/shop/item"; //每个商品
var urlShopItemPool = urlHead + "init/shop/item/pool"; //拉取可以使用道具的班级种和时间
var urlShopItemOrder = urlHead + "shop/item/order"; //提交兑换信息
/***** 公用方法 *****/
var urlUploadImg = urlHead + "upload"; //上传图片
var urlGetConfig = urlHead + "jssdk/config"; //获取微信接口参数
var urlGetInviteCard = urlHead + "card/invite"; //获取邀请卡
//截取url参数
$.getUrlParam = function(name) { //获取url参数
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
//检测动画是否完成
$.fn.transitionEnd = function(callback) {
var events = ['webkitTransitionEnd', 'transitionend'],
i, dom = this;
function fireCallBack(e) {
/*jshint validthis:true */
if (e.target !== this) return;
callback.call(this, e);
for (i = 0; i < events.length; i++) {
dom.off(events[i], fireCallBack);
}
}
if (callback) {
for (i = 0; i < events.length; i++) {
dom.on(events[i], fireCallBack);
}
}
return this;
};
//校验手机号
function checkTel(value) {
var isMob = /^((\+?86)|(\(\+86\)))?(13[0123456789][0-9]{8}|15[0123456789][0-9]{8}|18[0123456789][0-9]{8}|17[0123456789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;
if (isMob.test(value)) {
return true;
} else {
return false;
}
}
function setLocalStorage(key, value) {
window.sessionStorage[key] = value;
}
function getLocalStorage(key, defaultValue) {
return window.sessionStorage[key] || defaultValue;
}
function removeLocalStorage(key) {
window.sessionStorage.removeItem(key);
}
function setCookie(c_name, value, expiredays) {
//alert(c_name)
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
}
//取回cookie
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))
}
}
return ""
}
function delCookie(name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = getCookie(name);
if (cval != null)
document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
//转化为两位小数
function toDecimal2(x) {
var resalt = "";
if (x != null && x != "") {
var f = parseFloat(x);
if (isNaN(f)) {
return false;
}
var f = Math.round(x * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
s += '.';
}
while (s.length <= rs + 2) {
s += '0';
}
resalt = s;
} else {
resalt = "0.00"
}
return resalt;
}
Vue.filter('toDecimal2',function(x) {
var resalt = "";
if (x != null && x != "") {
var f = parseFloat(x);
if (isNaN(f)) {
return false;
}
var f = Math.round(x * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
s += '.';
}
while (s.length <= rs + 2) {
s += '0';
}
resalt = s;
} else {
resalt = "0.00"
}
return resalt;
})
Vue.filter('notNull', function(value) {
if (value != null && value != '') {
return value;
} else {
return '--';
}
})
Vue.filter('chooseNumber', function(value) {
if (value != null && value != '') {
if (value.length <= 5) {
return value.length;
} else {
return 5;
}
} else {
return "";
}
})
Vue.filter('nullImg', function(value) {
if (value != null && value != '') {
return value;
} else {
return 'https://www.runorout.cn/images/photo.png';
}
})
Vue.filter('toMoney', function(value) {
var resalt = "";
if (value != null && value != "") {
var f = parseFloat(value);
if (isNaN(f)) {
return false;
}
var f = Math.round(value * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
s += '.';
}
while (s.length <= rs + 2) {
s += '0';
}
resalt = s;
} else {
resalt = "0.00"
}
return resalt;
})
Vue.filter('toDate', function(value) {
var now = new Date(parseInt(value) * 1000);
var year = now.getFullYear();
var month = now.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
var date = now.getDate();
if (date < 10) {
date = "0" + date;
}
var hour = now.getHours();
if (hour < 10) {
hour = "0" + hour;
}
var minute = now.getMinutes();
if (minute < 10) {
minute = "0" + minute;
}
var second = now.getSeconds();
if (second < 10) {
second = "0" + second;
}
return year + "-" + month + "-" + date + " " + hour + ":" + minute;
})
Vue.filter('yearCut', function(value) {
if (value != null && value != '') {
var arr = value.split(" ")[0].split("-");
return parseInt(arr[1]) + "." + parseInt(arr[2]);
} else {
return '--';
}
});
Vue.filter('timestamp', function(value) {
if (value != null && value != '') {
return getLocalTime(value).split(" ")[0];
} else {
return '--';
}
});
Vue.filter('reverseTime', function(value) {
if (value != null && value != '') {
return timeTranse(value);
} else {
return '00:00';
}
});
function toMonth(value) {
var arr = value.split("-");
return (arr[1] + "." + arr[2]);
}
//时间戳转日期
function getLocalTime(nS) {
var now = new Date(parseInt(nS) * 1000);
var year = now.getFullYear();
var month = now.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
var date = now.getDate();
if (date < 10) {
date = "0" + date;
}
var hour = now.getHours();
if (hour < 10) {
hour = "0" + hour;
}
var minute = now.getMinutes();
if (minute < 10) {
minute = "0" + minute;
}
var second = now.getSeconds();
if (second < 10) {
second = "0" + second;
}
return year + "-" + month + "-" + date + " " + hour + ":" + minute;
}
//检测是否为两位小数
function checkMoney(s) {
var temp = /^[0-9]*(\.[0-9]{1,2})?$/;
var isTrue = true;
if (!temp.test(s)) {
isTrue = false;
}
return isTrue;
}
function checkAge(value) {
var r = /^[-+]?\d*$/;
if (r.test(value)) {
return true;
} else {
return false;
}
}
function getToday() {
var today = new Date();
var month = today.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
var day = today.getDate();
if (day < 10) {
day = "0" + day;
}
return today.getFullYear() + "-" + (month) + "-" + day;
}
function addByTransDate(dateParameter, num) { //dateParameter是2006-12-18格式
var translateDate = "",
dateString = "",
monthString = "",
dayString = "";
translateDate = dateParameter.replace("-", "/").replace("-", "/");
var newDate = new Date(translateDate);
newDate = newDate.valueOf();
newDate = newDate + num * 24 * 60 * 60 * 1000;
newDate = new Date(newDate);
//如果月份长度少于2,则前加 0 补位
if ((newDate.getMonth() + 1).toString().length == 1) {
monthString = 0 + "" + (newDate.getMonth() + 1).toString();
} else {
monthString = (newDate.getMonth() + 1).toString();
}
//如果天数长度少于2,则前加 0 补位
if (newDate.getDate().toString().length == 1) {
dayString = 0 + "" + newDate.getDate().toString();
} else {
dayString = newDate.getDate().toString();
}
dateString = newDate.getFullYear() + "-" + monthString + "-" + dayString;
return dateString;
}
function DateDiff(startDate, endDate) {
console.log(startDate + "," + endDate);
var startTime = new Date(Date.parse(startDate.replace(/-/g, "/"))).getTime();
var endTime = new Date(Date.parse(endDate.replace(/-/g, "/"))).getTime();
var dates = ((startTime - endTime)) / (1000 * 60 * 60 * 24);
return dates;
}
var constantProvinceList = ["北京市", "上海市", "天津市", "重庆市", "河北省", "山西省", "内蒙古自治区", "辽宁省", "吉林省", "黑龙江省", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", "湖北省", "湖南省", "广东省", "广西壮族自治区", "海南省", "四川省", "贵州省", "云南省", "西藏自治区", "陕西省", "甘肃省", "宁夏回族自治区", "青海省", "新疆维吾尔族自治区", "香港特别行政区", "澳门特别行政区", "台湾省", "海外"];
var constantProvinceCodeList = [{
name: '北京',
code: '110000'
}, {
name: '天津',
code: '120000'
}, {
name: '河北',
code: '130000'
}, {
name: '山西',
code: '140000'
}, {
name: '内蒙古',
code: '150000'
}, {
name: '辽宁',
code: '210000'
}, {
name: '吉林',
code: '220000'
}, {
name: '黑龙江',
code: '230000'
}, {
name: '上海',
code: '310000'
}, {
name: '江苏',
code: '320000'
}, {
name: '浙江',
code: '330000'
}, {
name: '安徽',
code: '340000'
}, {
name: '福建',
code: '350000'
}, {
name: '江西',
code: '360000'
}, {
name: '山东',
code: '370000'
}, {
name: '河南',
code: '410000'
}, {
name: '湖北',
code: '420000'
}, {
name: '湖南',
code: '430000'
}, {
name: '广东',
code: '440000'
}, {
name: '广西',
code: '450000'
}, {
name: '海南',
code: '460000'
}, {
name: '重庆',
code: '500000'
}, {
name: '四川',
code: '510000'
}, {
name: '贵州',
code: '520000'
}, {
name: '云南',
code: '530000'
}, {
name: '西藏',
code: '540000'
}, {
name: '陕西',
code: '610000'
}, {
name: '甘肃',
code: '620000'
}, {
name: '青海',
code: '630000'
}, {
name: '宁夏',
code: '640000'
}, {
name: '新疆',
code: '650000'
}, {
name: '台湾',
code: '710000'
}, {
name: '香港',
code: '810000'
}, {
name: '澳门',
code: '820000'
}, {
name: '海外',
code: '000000'
}, ];
function netWorkError(words) {
var str = '<div class="alert-out" id="alert-out-error">' + '<div class="alert-body">' + '<div class="alert-message">' + '<p class="alert-word">' + (words ? words : '啊哦,网络跑累了正在休息,快叫醒它吧~') + '</p>' + '</div>' + '<div class="alert-foot color-red" id="alert-foot" onclick="javascript:window.location.reload();"><span class="sure">刷新一下~</span></div>' + '</div>' + '<div class="alert-mask"></div>' + '</div>';
var className = $("#alert-out-error").attr("class");
if (className != null || className != "") {
$("body").append(str);
}
}
/* 加载loading引入 */
if ($("#loadingToast").attr("class") != null || $("#loadingToast").attr("class") != "") {
var loadingStr = '<div id="loadingToast" class="dz_loading_toast" style="display: none;">' + '<div class="dz_mask_transparent"></div>' + '<div class="dz_toast_loading small">' + '<div class="dz_loading">' + '<div class="dz_loading_leaf dz_loading_leaf_0"></div><div class="dz_loading_leaf dz_loading_leaf_1"></div><div class="dz_loading_leaf dz_loading_leaf_2"></div><div class="dz_loading_leaf dz_loading_leaf_3"></div><div class="dz_loading_leaf dz_loading_leaf_4"></div><div class="dz_loading_leaf dz_loading_leaf_5"></div><div class="dz_loading_leaf dz_loading_leaf_6"></div><div class="dz_loading_leaf dz_loading_leaf_7"></div><div class="dz_loading_leaf dz_loading_leaf_8"></div><div class="dz_loading_leaf dz_loading_leaf_9"></div><div class="dz_loading_leaf dz_loading_leaf_10"></div><div class="dz_loading_leaf dz_loading_leaf_11"></div>' + '</div>' + '</div>' + '</div>';
$("body").append(loadingStr);
}
/*
//demo
var dialog = new Alert();
dialog.init({
content:"我是提示哦",
sure: function(){
dialog.hide();
}
})
*/
项目公共js(vue.js)的更多相关文章
- pycharm中新建Vue项目时没有vue.js的解决办法
可能很多小伙伴在使用pycharm 1,新建vue项目的时候并没有发现vue.js的名字, 2,新建.vue文件(即单文件组件)的时候没有 下面就来帮助大家一下,仅供参考 如图: 1.首先我们打开设置 ...
- Springboot 项目源码 vue.js html 跨域 前后分离 shiro权限
官网:www.fhadmin.org 特别注意: Springboot 工作流 前后分离 + 跨域 版本 (权限控制到菜单和按钮) 后台框架:springboot2.1.2+ activiti6.0 ...
- vue项目从引入vue.js 改为使用vue-cil (webpack)时修改的一些内容
在元素属性中不要写js关键字,会报使用关键字的错如@click='if(){}else{}', if-else 语句可以使用三元表达式或短路运算符来实现 v-for 不写:key 会有警告 ,使用: ...
- SpringBoot+Activiti+bpmn.js+Vue.js+Elementui(OA系统审批流)
引言:OA系统用到请假.加班.调休.离职,需要使用工作流进行流程审批 一:activiti流程设计器的选择(通过学习activiti工作流过程中,发现一款好的流程设计器将会更好的方便的设计好流程(主要 ...
- Node.js/Vue.js使用jsSHA库进行SHA1/2/3加密
1 概述 jsSHA是一个用JS+TS实现完整SHA系列加密算法的加密库,包括: SHA1 SHA-224/256/384/512 SHA3-224/256/384/512 SHAKE128/256 ...
- Awesome Vue.js vue.js学习资源链接大全 中文
https://blog.csdn.net/caijunfen/article/details/78216868
- 【Vue】转-Vue.js经典开源项目汇总
版权声明:本文为EnweiTech原创文章,未经博主允许不得转载. https://blog.csdn.net/English0523/article/details/88694219 Vue是什么? ...
- 【前端】Vue.js经典开源项目汇总
Vue.js经典开源项目汇总 原文链接:http://www.cnblogs.com/huyong/p/6517949.html Vue是什么? Vue.js(读音 /vjuː/, 类似于 view) ...
- Vue.js经典开源项目汇总
Vue.js经典开源项目汇总 原文链接:http://www.cnblogs.com/huyong/p/6517949.html Vue是什么? Vue.js(读音 /vjuː/, 类似于 view) ...
随机推荐
- 用shell脚本监控进程是否存在 不存在则启动的实例
用shell脚本监控进程是否存在 不存在则启动的实例,先上代码干货: #!/bin/shps -fe|grep processString |grep -v grepif [ $? -ne 0 ]th ...
- 笔记--MySQL相关操作
一 登录数据库 1 用户无密码: mysql -uroot -p mysql-> 2 用户有密码: MySQL -root -p[passwd] mysql-> 二 创建数据库: 查询 ...
- ToJson
/// <summary> /// DataTable转成Json /// </summary> /// <param name="jsonName" ...
- DNS
- Is the Information Reliable? -POJ2983差分约束
Time Limit: 3000MS Memory Limit: 131072K Description The galaxy war between the Empire Draco and the ...
- CentOS 安装 Dubbo 管理控制台
安装之前需要安装zookeeper详情http://www.cnblogs.com/zuge/p/6141101.html Dubbo 管控台可以对注册到 zookeeper 注册中心的服务或服务消费 ...
- Android项目架构之业务组件化
前言: 从个人经历来说的话,从事APP开发这么多年来,所接触的APP的体积变得越来越大,业务的也变得越来越复杂,总来来说只有一句话:这是一个APP臃肿的时代!所以为了告别APP臃肿的时代,让我们进入一 ...
- Oracle(修改表结构和约束)
目标: 1.添加和修改列 2.添加,enable,disable,或者remove约束 3.删除表 4.删除表中所有数据并回到表定义的初始状态(截断表) 5.修改对象的名字 6.给对象添加注释,从数据 ...
- windows平台解决quick3.5final + sublimeText3 模拟器找不到的问题
下载了quick3.5 准备在sublime上进行开发,结果发现quick3.5中的player模拟器不见了,原来模拟器移到了quick引擎主目录下的 /tools/simulator/runtime ...
- 【分享】图解Windows Server 2012 R2 配置IIS 8全过程
最近计划更换服务器,包括IIS服务器与数据库服务器,操作系统都是Windows Server 2012 R2,第一次接触Windows Server 2012,感觉比较新鲜,一路摸索完成了IIS 8 ...