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