Commit 4c3ba8ed authored by ganjingcun's avatar ganjingcun

时区修正

parent 5fb0c7f6
......@@ -105,7 +105,9 @@
} else {
this.isNew = false;
this.avatar_url = res.data.data.url
this.avatar_url_new = res.data.data.url
this.form.desc = res.data.data.content
this.form.desc_new = res.data.data.content
}
}, (res) => {
this.hasError = true
......
......@@ -165,10 +165,10 @@
}
},
formatter1(row, column) {
return moment(row.start_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm')
return moment(row.start_time).format('YYYY-MM-DD HH:mm')
},
formatter2(row, column) {
return moment(row.end_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm')
return moment(row.end_time).format('YYYY-MM-DD HH:mm')
},
renderTable: function () {
var params = {
......
......@@ -154,7 +154,6 @@
<script>
import querystring from 'querystring';
import language from './lang';
import img1 from '../assets/img/images1.jpeg'
import img2 from '../assets/img/images2.jpeg'
......@@ -196,9 +195,6 @@
}
},
created: function () {
this.init()
var lang = localStorage.getItem('lang');
this.initLang(lang);
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var u = navigator.userAgent;
......@@ -213,21 +209,19 @@
}
},
events: {
'lang-change': function (lang) {
this.initLang(lang)
}
},
watch: {
lang: function (val) {
console.log('lang change1', val)
this.init2()
this.init()
},
},
mounted: function () {
this.init2();
var _this = this
$("#search").click(function () {
_this.renderPage();
})
this.init()
window.onhashchange = this.init;
},
......@@ -238,17 +232,18 @@
},
methods: {
onSubmit: function () {
this.searchByUsername(this.searchText)
},
init: function () {
var username = querystring.parse(location.hash.slice(11)).username
this.searchText = username;
this.searchByUsername(username)
},
init2: function () {
function renderPage() {
renderPage: function () {
if (rankTable) {
rankTable.destroy();
}
......@@ -257,12 +252,11 @@
rankTable2.destroy();
}
var username = $("#searchText").val()
var username = this.searchText
var type = 1;
rankTable = renderRankTable("#athletic_rank");
rankTable2 = renderRankTable("#entertain_rank");
rankTable = this.renderRankTable("#athletic_rank");
rankTable2 = this.renderRankTable("#entertain_rank");
if (!username) return;
......@@ -270,7 +264,7 @@
if (rankTable) {
rankTable.destroy();
}
rankTable = renderRankTable("#athletic_rank", res.data.data)
rankTable = this.renderRankTable("#athletic_rank", res.data.data)
}, (res) => {
console.log(res)
});
......@@ -279,20 +273,19 @@
if (rankTable2) {
rankTable2.destroy();
}
rankTable2 = renderRankTable("#entertain_rank", res.data.data)
rankTable2 = this.renderRankTable("#entertain_rank", res.data.data)
}, (res) => {
console.log(res)
});
},
}
function renderRankTable(id, tableData) {
renderRankTable: function (id, tableData) {
tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn';
var rank = 1;
var processData = tableData.map(function (d) {
return [d.usernamea, d.usernameb, moment(d.start_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm'), moment(d.end_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm'), d.userscorea, d.userscoreb];
return [d.usernamea, d.usernameb, moment(d.start_time).format('YYYY-MM-DD HH:mm'), moment(d.end_time).format('YYYY-MM-DD HH:mm'), d.userscorea, d.userscoreb];
});
var table = $(id).DataTable({
paging: true,
......@@ -347,21 +340,8 @@
});
return table;
}
renderPage();
$("#search").click(function () {
renderPage();
})
},
initLang: function (lang) {
this.lang = language[lang]
$("#search").trigger('click');
},
searchByUsername: function (username) {
// 0 1 2
var rand = Math.floor(Math.random() * 3);
......
......@@ -172,10 +172,10 @@
}
},
formatter1(row, column) {
return moment(row.start_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm')
return moment(row.start_time).format('YYYY-MM-DD HH:mm')
},
formatter2(row, column) {
return moment(row.end_time).subtract(8, 'h').format('YYYY-MM-DD HH:mm')
return moment(row.end_time).format('YYYY-MM-DD HH:mm')
},
renderTable: function(){
// var URL = "http://localhost:3000"
......
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