完善投票编辑模式及收藏/历史列表兜底展示
This commit is contained in:
@@ -33,6 +33,13 @@
|
||||
<three-cover v-else-if="item.thumbnail && item.thumbnail.length === 3" :ctype="'historyList'"
|
||||
:data="getNewItem(item)"></three-cover>
|
||||
</view>
|
||||
<view class="" v-else>
|
||||
<view class="main">
|
||||
<view>
|
||||
<text class="title">该文章已被下架或删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
|
||||
@@ -130,9 +137,6 @@
|
||||
async function listLoad(data) {
|
||||
if (data.length !== 0) {
|
||||
const tempListData = data.map(item => {
|
||||
if (typeof item.article_id.thumbnail === 'string') {
|
||||
item.article_id[0].thumbnail = [item.article_id[0].thumbnail]
|
||||
}
|
||||
item.article_id[0].user_id = item.user_id[0]
|
||||
item.article_id[0].last_view_time = new Date(item.last_view_time).getTime()
|
||||
return item.article_id[0]
|
||||
@@ -309,4 +313,20 @@
|
||||
.pages .uni-list ::v-deep .uni-list--border:after {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-top: 24rpx;
|
||||
padding-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
color: #bbb;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -138,9 +138,6 @@
|
||||
if (data.length <= 0) return
|
||||
if (data[0].article_id) {
|
||||
const tempListData = data.map(item => {
|
||||
if (item.article_id[0] && typeof item.article_id[0].thumbnail === 'string') {
|
||||
item.article_id[0].thumbnail = [item.article_id[0].thumbnail]
|
||||
}
|
||||
item.article_id[0].user_id = item.user_id[0]
|
||||
item.article_id[0].last_view_time = new Date(item.last_view_time).getTime()
|
||||
return item.article_id[0]
|
||||
|
||||
+24
-15
@@ -58,7 +58,7 @@
|
||||
@submit="handleSubmit"
|
||||
:start-year="2000"
|
||||
:end-year="2099"
|
||||
:time-init="1688860800000"
|
||||
:time-init="defaultTime"
|
||||
:time-hide="[true, true, true, true, true, true]"
|
||||
:time-label="['年', '月', '日', '时', '分', '秒']"
|
||||
/>
|
||||
@@ -68,7 +68,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, onLoad } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
@@ -79,24 +79,34 @@
|
||||
const select = ref(0)
|
||||
const voteTitle = ref("")
|
||||
const pageType = ref("add")
|
||||
const defaultTime = ref(Date.now())
|
||||
const voteLst = ref([
|
||||
{ value: "" },
|
||||
{ value: "" },
|
||||
{ value: "" },
|
||||
])
|
||||
|
||||
onMounted(() => {
|
||||
// 模拟 onLoad
|
||||
})
|
||||
|
||||
function generateRandomCode() {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
let code = ''
|
||||
for (let i = 0; i < 24; i++) {
|
||||
code += chars.charAt(Math.floor(Math.random() * chars.length))
|
||||
onLoad((options) => {
|
||||
if (options.type === "edit") {
|
||||
pageType.value = "edit"
|
||||
let index = uni.getStorageSync("selectIndex")
|
||||
let cms = uni.getStorageSync("cms")
|
||||
if (cms && cms.cmsLst && cms.cmsLst[index] && cms.cmsLst[index].vote) {
|
||||
const vote = cms.cmsLst[index].vote
|
||||
voteTitle.value = vote.voteTitle || ""
|
||||
vote_id.value = vote.vote_id || ""
|
||||
voteLst.value = vote.voteLst && vote.voteLst.length
|
||||
? vote.voteLst.map(i => ({ value: i.value || "" }))
|
||||
: [{ value: "" }]
|
||||
let typeIndex = array.value.indexOf(vote.type)
|
||||
select.value = typeIndex >= 0 ? typeIndex : 0
|
||||
birthday.value = vote.datetime || ""
|
||||
if (vote.datetime) {
|
||||
defaultTime.value = new Date(vote.datetime.replace(/-/g, '/')).getTime() || Date.now()
|
||||
}
|
||||
}
|
||||
}
|
||||
return code
|
||||
}
|
||||
})
|
||||
|
||||
function openDatetimePicker() {
|
||||
myPicker.value.show()
|
||||
@@ -152,7 +162,6 @@
|
||||
} else {
|
||||
vote.selectValue = []
|
||||
}
|
||||
vote.selectValu = false
|
||||
if (pageType.value === "add") {
|
||||
cms.cmsLst.splice(index, 0, {
|
||||
type: "vote",
|
||||
@@ -192,8 +201,8 @@
|
||||
select,
|
||||
voteTitle,
|
||||
pageType,
|
||||
defaultTime,
|
||||
voteLst,
|
||||
generateRandomCode,
|
||||
openDatetimePicker,
|
||||
handleSubmit,
|
||||
bindPickerChange,
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
:data="getNewItem(item)"></not-cover>
|
||||
<right-small-cover v-else-if="item.thumbnail && item.thumbnail.length === 1" :ctype="'historyList'"
|
||||
:data="getNewItem(item)"></right-small-cover>
|
||||
<three-cover v-else-if="item.thumbnail && item.thumbnail.length === 3" :ctype="'historyList'"
|
||||
<three-cover v-else :ctype="'historyList'"
|
||||
:data="getNewItem(item)"></three-cover>
|
||||
</view>
|
||||
</template>
|
||||
@@ -145,9 +145,6 @@
|
||||
if (data[0].article_id) {
|
||||
const tempListData = data.map(item => {
|
||||
if (item.article_id.length === 0) return
|
||||
if (typeof item.article_id.thumbnail === 'string') {
|
||||
item.article_id[0].thumbnail = [item.article_id[0].thumbnail]
|
||||
}
|
||||
item.article_id[0].user_id = item.user_id[0]
|
||||
item.article_id[0].last_view_time = new Date(item.last_view_time).getTime()
|
||||
return item.article_id[0]
|
||||
|
||||
Reference in New Issue
Block a user