Commit 7a420c89 authored by linwenqing's avatar linwenqing

refactor:证书更新时间

parent 3f1b73f8
......@@ -48,6 +48,7 @@ export default {
learnData: {},
certName: [],
topImage: process.uniEnv.qn_base_url + 'tezhongzuoyepingtai@2x.png',
logDate: null,
}
},
onLoad: function() {
......@@ -55,16 +56,21 @@ export default {
},
computed: {
nowDate() {
var Today = new Date()
let m = Today.getMonth() + 1
let d = Today.getDate()
return (
Today.getFullYear() +
'.' +
(String(m).length > 1 ? m : '0' + m) +
'.' +
(String(d).length > 1 ? d : '0' + d)
)
if (this.logDate) {
console.log('取数据的日期')
return this.logDate.split(' ')[0].replace('-', '.')
} else {
var Today = new Date()
let m = Today.getMonth() + 1
let d = Today.getDate()
return (
Today.getFullYear() +
'.' +
(String(m).length > 1 ? m : '0' + m) +
'.' +
(String(d).length > 1 ? d : '0' + d)
)
}
},
startDate() {
return this.learnData.startDate || ' '
......@@ -127,6 +133,7 @@ export default {
countryData[k][key].push(list[key]['filedValue_' + i])
}
}
this.logDate = certData[k].logDate || null
}
this.certName = certName
this.dataList = countryData
......
......@@ -143,6 +143,7 @@ export default {
name: '我的证书',
},
],
logTime: null,
certType: '',
certId: '',
certName: '',
......@@ -182,13 +183,13 @@ export default {
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
try {
if (param.tabs) {
this.current = param.tabs
this.swiperCurrent = param.tabs
}
} catch (e) {}
this.tabsChange(this.current)
// try {
// if (param.tabs) {
// this.current = param.tabs
// this.swiperCurrent = param.tabs
// }
// } catch (e) {}
// this.tabsChange(this.current)
},
methods: {
submit(){
......@@ -237,21 +238,28 @@ export default {
}
this.isEmptyList = true
let data = []
let logDate = '2000-01-01 00:00:00'
for(let key in res){
//判断是否是table数据格式,否则暂不展示,后面如果有再补充显示图片格式
if(
Number(res[key].certificateType) != 2){
continue
}
//获取最新查询时间当做最近登录查询时间
this.logTime = this.compareDate(logDate,res[key].updateTime)
let item = {}
item.certificateName = res[key].certificateName.replace('作业', '证')
item.bgImage = this.countryCertImage
item.type = 'country'
item.key = key
item.data = res[key] //传给详情页
item.logDate = this.logTime
data.push(item)
}
this.logTime = logDate
this.countryCertList = JSON.parse(JSON.stringify(data))
console.log('list data', this.countryCertList)
})
},
//获取学时数据
......@@ -302,6 +310,17 @@ export default {
})
}
},
compareDate(date1,date2){
var oDate1 = new Date(date1)
var oDate2 = new Date(date2)
if(oDate1.getTime() > oDate2.getTime()){
return date1
// console.log('第一个大')
} else {
return date2
// console.log('第二个大')
}
},
actionSheetCallback(index) {
this.value = this.actionSheetList[index].text
},
......
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