巡检点上传图片修正
This commit is contained in:
@@ -53,9 +53,8 @@ import { ref, getCurrentInstance, onMounted } from 'vue'
|
||||
const Searching = ref(true)
|
||||
const queryParmas = ref({
|
||||
value: '',
|
||||
|
||||
pageNum: 1,
|
||||
pageSize: 12
|
||||
pageSize: 10
|
||||
})
|
||||
/** 点击时切换到input,并聚焦 */
|
||||
function handleClick() {
|
||||
@@ -67,38 +66,69 @@ function handleInput() {
|
||||
Searching.value = true
|
||||
}
|
||||
}
|
||||
function handleSearch() {
|
||||
console.log('search')
|
||||
}
|
||||
function handleSearch() {}
|
||||
|
||||
const checkoutHouseid = ref(null)
|
||||
const checkoutHouseInfo = ref(null)
|
||||
/** 选择房屋,返回id*/
|
||||
function radioChange(res) {
|
||||
checkoutHouseid.value = Number(res.detail.value)
|
||||
}
|
||||
//
|
||||
const searchlist = ref()
|
||||
|
||||
function getlist() {
|
||||
const allnum = queryParmas.value.pageNum * queryParmas.value.pageSize
|
||||
|
||||
if (allnum < 50) {
|
||||
searchlist.value = Array.from({ length: allnum }).map((_, index) => {
|
||||
return {
|
||||
address: 'A栋3单元301',
|
||||
username: '里番',
|
||||
id: index + 1
|
||||
}
|
||||
})
|
||||
const find = searchlist.value.find(item => item.id === Number(res.detail.value))
|
||||
if (find) {
|
||||
checkoutHouseInfo.value = find
|
||||
}
|
||||
}
|
||||
getlist()
|
||||
|
||||
// -0---------------------------------------
|
||||
const searchlist = ref([])
|
||||
const isLoading = ref(false) // 加载锁
|
||||
const hasMore = ref(true) // 是否还有更多数据
|
||||
const total = ref(21)
|
||||
function scrolltolower() {
|
||||
// 必须加这两个判断!
|
||||
if (isLoading.value || !hasMore.value) {
|
||||
return
|
||||
}
|
||||
queryParmas.value.pageNum += 1
|
||||
getlist()
|
||||
}
|
||||
function getlist() {
|
||||
// 1. 如果正在加载或没有更多数据,直接返回
|
||||
if (isLoading.value || !hasMore.value) return
|
||||
// 2. 开启锁
|
||||
isLoading.value = true
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
const { pageNum, pageSize } = queryParmas.value
|
||||
|
||||
const startId = (pageNum - 1) * pageSize + 1
|
||||
const arr = Array.from({ length: pageSize }).map((_, index) => {
|
||||
const realId = startId + index // ✅ 修复 ID 错误
|
||||
return {
|
||||
id: realId,
|
||||
username: '李赫',
|
||||
address: 'A栋3单元3' + realId
|
||||
}
|
||||
})
|
||||
|
||||
// 追加数据(正确方式)
|
||||
searchlist.value = [...searchlist.value, ...arr]
|
||||
// 判断是否还有更多
|
||||
hasMore.value = searchlist.value.length < total.value
|
||||
isLoading.value = false
|
||||
uni.hideLoading()
|
||||
}
|
||||
getlist()
|
||||
function resetList() {
|
||||
searchlist.value = []
|
||||
queryParmas.value.pageNum = 1
|
||||
hasMore.value = true
|
||||
getlist()
|
||||
}
|
||||
|
||||
// -0---------------------------------------
|
||||
let eventChannel = null
|
||||
// 必须在 onMounted 里获取
|
||||
onMounted(() => {
|
||||
@@ -109,11 +139,11 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
function handleSelecthouse() {
|
||||
// 2. 发送数据 (触发 A 页面定义的 'backData' 事件)
|
||||
console.log(eventChannel)
|
||||
console.log(checkoutHouseInfo.value)
|
||||
if (!eventChannel) return
|
||||
eventChannel.emit('backData', {
|
||||
Houseid: checkoutHouseid.value,
|
||||
HouseName: 'A栋3单元301'
|
||||
HouseName: checkoutHouseInfo.value.address
|
||||
})
|
||||
// 3. 返回上一页
|
||||
uni.navigateBack()
|
||||
|
||||
Reference in New Issue
Block a user