Commit 4c3ba8ed authored by ganjingcun's avatar ganjingcun

时区修正

parent 5fb0c7f6
...@@ -105,7 +105,9 @@ ...@@ -105,7 +105,9 @@
} else { } else {
this.isNew = false; this.isNew = false;
this.avatar_url = res.data.data.url 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 = res.data.data.content
this.form.desc_new = res.data.data.content
} }
}, (res) => { }, (res) => {
this.hasError = true this.hasError = true
......
...@@ -165,10 +165,10 @@ ...@@ -165,10 +165,10 @@
} }
}, },
formatter1(row, column) { 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) { 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 () { renderTable: function () {
var params = { var params = {
......
...@@ -154,7 +154,6 @@ ...@@ -154,7 +154,6 @@
<script> <script>
import querystring from 'querystring'; import querystring from 'querystring';
import language from './lang';
import img1 from '../assets/img/images1.jpeg' import img1 from '../assets/img/images1.jpeg'
import img2 from '../assets/img/images2.jpeg' import img2 from '../assets/img/images2.jpeg'
...@@ -196,9 +195,6 @@ ...@@ -196,9 +195,6 @@
} }
}, },
created: function () { 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 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; var u = navigator.userAgent;
...@@ -213,21 +209,19 @@ ...@@ -213,21 +209,19 @@
} }
}, },
events: {
'lang-change': function (lang) {
this.initLang(lang)
}
},
watch: { watch: {
lang: function (val) { lang: function (val) {
console.log('lang change1', val) this.init()
this.init2()
}, },
}, },
mounted: function () { mounted: function () {
this.init2(); var _this = this
$("#search").click(function () {
_this.renderPage();
})
this.init()
window.onhashchange = this.init; window.onhashchange = this.init;
}, },
...@@ -238,17 +232,18 @@ ...@@ -238,17 +232,18 @@
}, },
methods: { methods: {
onSubmit: function () { onSubmit: function () {
this.searchByUsername(this.searchText) this.searchByUsername(this.searchText)
}, },
init: function () { init: function () {
var username = querystring.parse(location.hash.slice(11)).username var username = querystring.parse(location.hash.slice(11)).username
this.searchText = username; this.searchText = username;
this.searchByUsername(username) this.searchByUsername(username)
}, },
init2: function () {
function renderPage() { renderPage: function () {
if (rankTable) { if (rankTable) {
rankTable.destroy(); rankTable.destroy();
} }
...@@ -257,12 +252,11 @@ ...@@ -257,12 +252,11 @@
rankTable2.destroy(); rankTable2.destroy();
} }
var username = $("#searchText").val() var username = this.searchText
var type = 1; var type = 1;
rankTable = this.renderRankTable("#athletic_rank");
rankTable = renderRankTable("#athletic_rank"); rankTable2 = this.renderRankTable("#entertain_rank");
rankTable2 = renderRankTable("#entertain_rank");
if (!username) return; if (!username) return;
...@@ -270,7 +264,7 @@ ...@@ -270,7 +264,7 @@
if (rankTable) { if (rankTable) {
rankTable.destroy(); rankTable.destroy();
} }
rankTable = renderRankTable("#athletic_rank", res.data.data) rankTable = this.renderRankTable("#athletic_rank", res.data.data)
}, (res) => { }, (res) => {
console.log(res) console.log(res)
}); });
...@@ -279,20 +273,19 @@ ...@@ -279,20 +273,19 @@
if (rankTable2) { if (rankTable2) {
rankTable2.destroy(); rankTable2.destroy();
} }
rankTable2 = renderRankTable("#entertain_rank", res.data.data) rankTable2 = this.renderRankTable("#entertain_rank", res.data.data)
}, (res) => { }, (res) => {
console.log(res) console.log(res)
}); });
},
} renderRankTable: function (id, tableData) {
function renderRankTable(id, tableData) {
tableData = tableData || []; tableData = tableData || [];
var lang = localStorage.getItem('lang') || 'cn'; var lang = localStorage.getItem('lang') || 'cn';
var rank = 1; var rank = 1;
var processData = tableData.map(function (d) { 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({ var table = $(id).DataTable({
paging: true, paging: true,
...@@ -347,21 +340,8 @@ ...@@ -347,21 +340,8 @@
}); });
return table; return table;
}
renderPage();
$("#search").click(function () {
renderPage();
})
}, },
initLang: function (lang) {
this.lang = language[lang]
$("#search").trigger('click');
},
searchByUsername: function (username) { searchByUsername: function (username) {
// 0 1 2 // 0 1 2
var rand = Math.floor(Math.random() * 3); var rand = Math.floor(Math.random() * 3);
......
...@@ -172,10 +172,10 @@ ...@@ -172,10 +172,10 @@
} }
}, },
formatter1(row, column) { 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) { 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(){ renderTable: function(){
// var URL = "http://localhost:3000" // 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