Commit 4f9dce92 authored by verestrasz's avatar verestrasz

Merge branch 'test' into dev

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