` if(dynamicsTypeOne==1){ if(dynamicsTitleOne){ let textBox = document.createElement('div') textBox.innerHTML = dynamicsTitleOne textBox.style.fontSize = '0.3rem' textBox.style.marginBottom = '0.3rem' textBox.style.textAlign = 'center' document.querySelector('.content').appendChild(textBox) } if(dynamicsCoverOne){ let videoBox = document.createElement('video') videoBox.src = imgHead(dynamicsCoverOne) videoBox.autoplay = true videoBox.loop = true videoBox.controls = true videoBox.style.width = '100%' videoBox.style.marginBottom = '0.2rem' document.querySelector('.content').appendChild(videoBox) } if(dynamicsDetailOne){ //好像是视频封面图 // dynamicsDetailOne = dynamicsDetailOne.split(',') // dynamicsDetailOne.forEach((item,value)=>{ // let imgBox = document.createElement('img') // imgBox.src = imgHead(item) // document.querySelector('.trends_detail_mainBox').appendChild(imgBox) // }) } }else if(dynamicsTypeOne==0) { console.log('00000000000123'); if(dynamicsTitleOne){ let textBox = document.createElement('div') textBox.innerHTML = dynamicsTitleOne textBox.style.fontSize = '0.3rem' textBox.style.marginBottom = '0.3rem' textBox.style.textAlign = 'center' document.querySelector('.content').appendChild(textBox) } if(dynamicsDetailOne){ if(dynamicsTitleOne){ let dynamicsDetail = JSON.parse(dynamicsDetailOne) dynamicsDetail.forEach(item=>{ if(item.type==1){ let textBox = document.createElement('div') textBox.innerHTML = item.value textBox.style.fontSize = '0.3rem' textBox.style.marginBottom = '0.3rem' textBox.style.textAlign = 'center' document.querySelector('.content').appendChild(textBox) } if(item.type==2){ let imgBox = document.createElement('img') imgBox.src = imgHead(item.value) document.querySelector('.content').appendChild(imgBox) } }) }else { let textBox = document.createElement('div') textBox.innerHTML = dynamicsDetailOne textBox.style.fontSize = '0.3rem' textBox.style.marginBottom = '0.3rem' textBox.style.textAlign = 'center' document.querySelector('.content').appendChild(textBox) } } if(dynamicsCoverOne){ dynamicsCoverOne = dynamicsCoverOne.split(',') dynamicsCoverOne.forEach((item,value)=>{ let imgBox = document.createElement('img') imgBox.src = imgHead(item) if(value == dynamicsCoverOne.length-1){ imgBox.style.marginBottom = '0.2rem' } document.querySelector('.content').appendChild(imgBox) }) } }else { if(dynamicsTitleOne && dynamicsTypeOne!=3){ let textBox = document.createElement('div') textBox.innerHTML = dynamicsTitleOne textBox.style.fontSize = '0.3rem' textBox.style.marginBottom = '0.3rem' textBox.style.textAlign = 'center' document.querySelector('.content').appendChild(textBox) } if(dynamicsCoverOne && dynamicsTypeOne!=3){ dynamicsCoverOne = dynamicsCoverOne.split(',') dynamicsCoverOne.forEach((item,value)=>{ let imgBox = document.createElement('img') imgBox.src = imgHead(item) if(value == dynamicsCoverOne.length-1){ imgBox.style.marginBottom = '0.2rem' } document.querySelector('.content').appendChild(imgBox) }) } if(dynamicsDetailOne){ let textBox = document.createElement('div') textBox.innerHTML = dynamicsDetailOne textBox.style.fontSize = '0.2rem' document.querySelector('.content').appendChild(textBox) } } let timeone = $(".middle_right").text() console.log(timeone,'timeone'); // 输出格式化后的日期字符串 if(timeone){ let timestamp = timeone.trim()*1; // 创建一个新的 Date 对象,并将时间戳作为参数传递 const date = new Date(timestamp); // 使用 Date 对象的方法来获取日期和时间 const year = date.getFullYear(); const month = date.getMonth() + 1; // 月份从 0 开始,所以要加 1 const day = date.getDate(); const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); console.log(year,'year'); console.log(month,'month'); console.log(day,'day'); console.log(hours,'hours'); console.log(minutes,'minutes'); console.log(seconds,'seconds'); // 格式化日期输出 const formattedDate = year+'-'+((month<10)?('0'+month):month)+'-'+((day<10)?('0'+day):day)+' '+((hours<10)?('0'+hours):hours)+':'+((minutes<10)?('0'+minutes):minutes); console.log(formattedDate); // 输出格式化后的日期字符串 let timetwo = '发布日期:'+formattedDate $(".middle_right").html(timetwo) }else{ $(".middle_right").html('') }