Commit 5ce0151f by test

朋友圈同步时间限制

1 parent 3ab392ce
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div> <div>
<div style="margin:10px 0;display:flex;"> <div style="margin:10px 0;display:flex;">
<el-button type="primary" size="mini" @click="gotoRoute">发表动态</el-button> <el-button type="primary" size="mini" @click="gotoRoute">发表动态</el-button>
<el-button type="primary" size="mini" @click="syncFn">同步朋友圈</el-button> <el-button type="primary" :disabled="disable" size="mini" @click="syncFn">同步朋友圈</el-button>
<div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div> <div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div>
<div class="time" v-else>暂无记录,请手动点击同步</div> <div class="time" v-else>暂无记录,请手动点击同步</div>
</div> </div>
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
}, },
data () { data () {
return { return {
disable: false,
value1: [], value1: [],
dialogVisible: false, dialogVisible: false,
userArray: [], userArray: [],
...@@ -199,6 +200,7 @@ ...@@ -199,6 +200,7 @@
.then(res => { .then(res => {
this.tableData = res.rows this.tableData = res.rows
this.lastSyncTime = res.lastSyncTime this.lastSyncTime = res.lastSyncTime
this.setTimeDiff()
this.total = Number(res.total) this.total = Number(res.total)
this.loading = false this.loading = false
}) })
...@@ -206,6 +208,20 @@ ...@@ -206,6 +208,20 @@
this.loading = false this.loading = false
}) })
}, },
setTimeDiff () {
if (this.lastSyncTime) {
let date1 = moment(this.lastSyncTime)
let date2 = moment()
let date3 = date2.diff(date1,'minute')
const h = Math.floor(date3/60)
console.log(h)
if (h >= 2) {
this.disable = false
} else {
this.disable = true
}
}
}
}, },
mounted () { mounted () {
this.query.beginTime = moment(this.value1[0]).format('YYYY-MM-DD') this.query.beginTime = moment(this.value1[0]).format('YYYY-MM-DD')
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div> <div>
<div style="margin:10px 0;display:flex;"> <div style="margin:10px 0;display:flex;">
<el-button type="primary" size="mini" @click="syncFn">同步朋友圈</el-button> <el-button type="primary" :disabled="disable" size="mini" @click="syncFn">同步朋友圈</el-button>
<div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div> <div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div>
<div class="time" v-else>暂无记录,请手动点击同步</div> <div class="time" v-else>暂无记录,请手动点击同步</div>
</div> </div>
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
}, },
data () { data () {
return { return {
disable: false,
value1: [], value1: [],
dialogVisible: false, dialogVisible: false,
userArray: [], userArray: [],
...@@ -164,6 +165,7 @@ ...@@ -164,6 +165,7 @@
.then(res => { .then(res => {
this.tableData = res.rows this.tableData = res.rows
this.lastSyncTime = res.lastSyncTime this.lastSyncTime = res.lastSyncTime
this.setTimeDiff()
this.total = Number(res.total) this.total = Number(res.total)
this.loading = false this.loading = false
}) })
...@@ -171,6 +173,20 @@ ...@@ -171,6 +173,20 @@
this.loading = false this.loading = false
}) })
}, },
setTimeDiff () {
if (this.lastSyncTime) {
let date1 = moment(this.lastSyncTime)
let date2 = moment()
let date3 = date2.diff(date1,'minute')
const h = Math.floor(date3/60)
console.log(h)
if (h >= 2) {
this.disable = false
} else {
this.disable = true
}
}
}
}, },
mounted () { mounted () {
this.query.beginTime = moment(this.value1[0]).format('YYYY-MM-DD') this.query.beginTime = moment(this.value1[0]).format('YYYY-MM-DD')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!