Commit ffb9b711 authored by 黄奎's avatar 黄奎

页面修改

parent 308e3d4b
......@@ -3,10 +3,10 @@ import axios from 'axios'
import md5 from 'js-md5'
//域名管理对象
Vue.prototype.domainManager = function() {
Vue.prototype.domainManager = function () {
let domainUrl = '';
domainUrl = "http://192.168.2.214:8082";
//domainUrl="http://192.168.0.110";
domainUrl = "http://192.168.0.110";
//let locationName = location.hostname;
// if (locationName.indexOf('testerp.oytour') !== -1) {
// domainUrl = "http://testapi.oytour.com";
......@@ -23,7 +23,7 @@ Vue.prototype.domainManager = function() {
}
//HTTP提交数据
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) {
Vue.prototype.apipost = function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") {
msg = {}
}
......@@ -59,7 +59,7 @@ Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) {
}
//获取缓存
Vue.prototype.getLocalStorage = function() {
Vue.prototype.getLocalStorage = function () {
try {
var localStorageData = window.localStorage["b2bUser"];
if (localStorageData !== undefined && localStorageData != 'undefined') {
......@@ -74,7 +74,7 @@ Vue.prototype.getLocalStorage = function() {
}
//向外跳转
Vue.prototype.OpenNewUrl = function(URL) {
Vue.prototype.OpenNewUrl = function (URL) {
if (URL && URL != '') {
if (URL.indexOf("https") != -1) {
var str = 'http://' + URL.substring(8);
......@@ -89,9 +89,96 @@ Vue.prototype.OpenNewUrl = function(URL) {
}
//公用跳转
Vue.prototype.CommonJump = function(path, obj) {
Vue.prototype.CommonJump = function (path, obj) {
this.$router.push({
path: path,
query: obj
});
}
Vue.prototype.createCalendar = function (dateStr) {
var days = [];
var date;
if (dateStr) {
date = new Date(dateStr);
} else {
var now = new Date();
date = new Date(this.formatDate(now.getFullYear(), now.getMonth() + 1, 1));
}
var currentDay = date.getDate();
var currentYear = date.getFullYear();
var currentMonth = date.getMonth() + 1;
var currentWeek = date.getDay(); // 1...6,0
var str = this.formatDate(
currentYear,
currentMonth,
currentDay
);
days.length = 0;
// 当月第一天是周日,放在第一行第1个位置,前面0个
//初始化第一周
for (var i = currentWeek; i >= 0; i--) {
var d = new Date(str);
d.setDate(d.getDate() - i);
var dayobject = {};
dayobject.day = d;
days.push(dayobject); //将日期放入data 中的days数组 供页面渲染使用
}
//其他周
var temp = 35;
if (
currentWeek +
new Date(currentYear, currentMonth, 0).getDate() > 35
) {
temp = 41;
}
for (var i = 1; i < temp - currentWeek; i++) {
var d = new Date(str);
d.setDate(d.getDate() + i);
var dayobject = {};
dayobject.day = d;
days.push(dayobject);
}
return {
DayArray: days,
CurrentDay: currentDay,
CurrentMonth: currentMonth,
CurrentYear: currentYear,
CurrentWeek: currentWeek
};
}
//格式化日期
Vue.prototype.formatDate = function (year, month, day) {
var y = year;
var m = month;
if (m < 10) m = "0" + m;
var d = day;
if (d < 10) d = "0" + d;
return y + "-" + m + "-" + d;
}
//格式化日期二
Vue.prototype.formatDate2=function(dateStr)
{
var date=new Date(dateStr);
return {
CYear:date.getFullYear(),
CMonth:(date.getMonth()+1),
CDay:date.getDate(),
}
}
//添加月份
Vue.prototype.AddMonth=function(dateStr,month)
{
var v = new Date(dateStr);
if (v) {
var t = new Date(v.getFullYear(), v.getMonth(), v.getDate(), v.getHours(), v.getMinutes(), v.getSeconds(), v.getMilliseconds());
t.setMonth(v.getMonth() + month);
if (t.getDate() != v.getDate()) { t.setDate(0); }
return t;
}
}
\ No newline at end of file
This diff is collapsed.
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