Commit 4f9dce92 authored by verestrasz's avatar verestrasz

Merge branch 'test' into dev

parents 0d913391 5e02d477
...@@ -32,14 +32,29 @@ export default { ...@@ -32,14 +32,29 @@ export default {
methods: { methods: {
// ...mapActions(["getShoppingCart"]), // ...mapActions(["getShoppingCart"]),
...mapMutations(['setAppVersion',"setCurrentTime"]), ...mapMutations(['setAppVersion',"setCurrentTime"]),
_getSystemTime(){
this.$api({
apiName:"getSystemTime",
success:(res)=>{
let time=new Date(res).getTime()
this.setCurrentTime(time)
this.timeTask = setInterval(() => {
time+=1000
this.setCurrentTime(time)
}, 1000);
},
fail: (err)=>{
this.timeTask = setInterval(() => {
this.setCurrentTime(+new Date())
}, 1000);
}
})
}
}, },
mounted() { mounted() {
var local = window.location.href // 获取页面url var local = window.location.href // 获取页面url
var appid = 'wxbdddd81913c795e9' var appid = 'wxbdddd81913c795e9'
let url=window.location.origin+"/"+window.location.hash let url=window.location.origin+"/"+window.location.hash
this.timeTask = setInterval(() => {
this.setCurrentTime(+new Date())
}, 1000);
this.code = getUrlParam('code') // 截取code this.code = getUrlParam('code') // 截取code
if (this.code == null || this.code === ''){ if (this.code == null || this.code === ''){
// 没有code去拿code; // 没有code去拿code;
...@@ -72,7 +87,8 @@ export default { ...@@ -72,7 +87,8 @@ export default {
this.getVersionCode(e => { this.getVersionCode(e => {
this.setAppVersion(e) this.setAppVersion(e)
}) })
}, this._getSystemTime()
}
}; };
</script> </script>
......
...@@ -63,3 +63,9 @@ export const getSysVersion = { ...@@ -63,3 +63,9 @@ export const getSysVersion = {
requireAuth: false, requireAuth: false,
method: 'get' method: 'get'
} }
// 获取服务器时间
export const getSystemTime = {
url: '/without/read/systemTime',
requireAuth: false,
type:'system'
}
...@@ -5,11 +5,13 @@ export default { ...@@ -5,11 +5,13 @@ export default {
baseUrl: { baseUrl: {
dev: { dev: {
root: '/root/mall', root: '/root/mall',
chat: '/chat/mallcustomer' chat: '/chat/mallcustomer',
system:"/root/sys-config"
}, },
pro: { pro: {
root: '/root/mall', root: '/root/mall',
chat: '/chat/mallcustomer' chat: '/chat/mallcustomer',
system:"/root/sys-config"
} }
} }
} }
...@@ -301,7 +301,7 @@ export default { ...@@ -301,7 +301,7 @@ export default {
let oids=JSON.parse(res.oidsJson) let oids=JSON.parse(res.oidsJson)
this.oid=oids[0] || "" this.oid=oids[0] || ""
this.payInfo = res; this.payInfo = res;
let timeOut = this.payInfo.createTime + 3 * 60 * 1000 - +new Date(); let timeOut = this.payInfo.createTime + 3 * 60 * 1000 - this.currentTime;
this.leftTime = timeOut > 0 ? timeOut : 0; this.leftTime = timeOut > 0 ? timeOut : 0;
setTimeout(() => { setTimeout(() => {
this.$hideLoading(); this.$hideLoading();
......
...@@ -391,7 +391,7 @@ export default { ...@@ -391,7 +391,7 @@ export default {
let data = this.list.find((x) => { let data = this.list.find((x) => {
return x.messageId === obj.messageId && x.Listid === obj.Listid; return x.messageId === obj.messageId && x.Listid === obj.Listid;
}); });
data.sendTime = new Date().getTime(); data.sendTime = this.currentTime;
data.status = ChatMsgStatus.SUCCESS; data.status = ChatMsgStatus.SUCCESS;
console.log("消息发送成功"); console.log("消息发送成功");
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
filters: { filters: {
getTimeStr(val) { getTimeStr(val) {
if (val) { if (val) {
const toDay = formatTime(new Date(), "yyyy-MM-dd"); const toDay = formatTime(new Date(this.currentTime), "yyyy-MM-dd");
const itemDay = formatTime(new Date(val), "yyyy-MM-dd hh:mm:ss"); const itemDay = formatTime(new Date(val), "yyyy-MM-dd hh:mm:ss");
if (itemDay.includes(toDay)) { if (itemDay.includes(toDay)) {
return itemDay.substr(11, 5); return itemDay.substr(11, 5);
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
filters: { filters: {
getTimeStr(val) { getTimeStr(val) {
if (val) { if (val) {
const toDay = formatTime(new Date(), "yyyy-MM-dd"); const toDay = formatTime(new Date(this.currentTime), "yyyy-MM-dd");
const itemDay = formatTime(new Date(val), "yyyy-MM-dd hh:mm:ss"); const itemDay = formatTime(new Date(val), "yyyy-MM-dd hh:mm:ss");
if (itemDay.includes(toDay)) { if (itemDay.includes(toDay)) {
return itemDay.substr(11, 5); return itemDay.substr(11, 5);
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
this.$hideLoading(); this.$hideLoading();
this.data = res; this.data = res;
let timeOut = res.createTime + 3 * 60 * 1000; let timeOut = res.createTime + 3 * 60 * 1000;
let timeNow = +new Date(); let timeNow = this.currentTime;
this.leftTime = timeOut > timeNow ? timeOut - timeNow : 0; this.leftTime = timeOut > timeNow ? timeOut - timeNow : 0;
}, },
}); });
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</template> </template>
<script> <script>
const date = new Date(); const date = new Date(this.currentTime);
const years = []; const years = [];
const year = date.getFullYear(); const year = date.getFullYear();
const months = []; const months = [];
......
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