6/23修正预览,滚动事件

This commit is contained in:
Zy
2026-06-23 08:12:17 +08:00
parent 110d0707d2
commit ce2f31d74c
8 changed files with 79 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
* @Author: Zy * @Author: Zy
* @Date: 2026-05-15 08:50:47 * @Date: 2026-05-15 08:50:47
* @LastEditor: Zy * @LastEditor: Zy
* @LastEditTime: 2026-05-19 16:34:23 * @LastEditTime: 2026-06-18 09:47:21
*/ */
import request, { import request, {
filterParams, filterParams,

View File

@@ -25,6 +25,7 @@
<script setup> <script setup>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import baseUrl from '@/api/BaseUrl.js' import baseUrl from '@/api/BaseUrl.js'
import { requestAuth } from '@/utils/Auth.js'
// ====================== // ======================
// Props(可配置) // Props(可配置)
@@ -114,18 +115,37 @@ function choose() {
emit('success', { tempFilePaths: tempPaths }) emit('success', { tempFilePaths: tempPaths })
return return
} }
// 有上传接口,自动上传 // 有上传接口,自动上传
for (const path of tempPaths) { for (const path of tempPaths) {
await uploadSingle(path) await uploadSingle(path)
} }
}, },
fail: err => { fail: err => {
console.log('选图失败', err) // 捕获权限拒绝,弹提示引导设置
if (err.errMsg.includes('auth') || err.errMsg.includes('Permission')) {
uni.showModal({
title: '权限不足',
content: '相册/相机权限已被拒绝,请前往应用设置手动开启',
confirmText: '去设置',
cancelText: '取消',
success: m => {
if (m.confirm) {
// #ifdef APP-PLUS
uni.openAppAuthorizeSetting()
// #endif
// #ifdef MP-WEIXIN
uni.openSetting()
// #endif
}
},
fail() {
emit('fail', err) emit('fail', err)
} }
}) })
} }
}
})
}
// 2. 上传单张图片 // 2. 上传单张图片
async function uploadSingle(filePath) { async function uploadSingle(filePath) {
@@ -194,7 +214,6 @@ function remove(index) {
// 4. 预览图片 // 4. 预览图片
function preview(index) { function preview(index) {
console.log(innerList)
const urls = innerList.value.map(i => i.url).filter(Boolean) const urls = innerList.value.map(i => i.url).filter(Boolean)
if (urls.length <= 0) return if (urls.length <= 0) return
uni.previewImage({ uni.previewImage({

View File

@@ -151,7 +151,6 @@ function handleComplaint(id) {
} }
function scrolltolower() { function scrolltolower() {
console.log('触发')
if (isLoading.value || !hasMore.value) { if (isLoading.value || !hasMore.value) {
return return
} }

View File

@@ -92,7 +92,7 @@ function handleInput() {
resetList() resetList()
} else { } else {
queryParmas.value.keyword = '' queryParmas.value.keyword = ''
Searching.value = false Searching.value = true
resetList() resetList()
} }
} }

View File

@@ -66,9 +66,7 @@
</view> </view>
<view class="inspection_items"> <view class="inspection_items">
<view class="label">巡检结果:</view> <view class="label">巡检结果:</view>
<!-- <view class="desction_value"> {{ ite.desition }}</view> -->
<view class="desction_value"> <view class="desction_value">
<!-- <rich-text :nodes="ite.desition"></rich-text> -->
<textarea class="my_textarea" disabled auto-height :value="ite.desition" /> <textarea class="my_textarea" disabled auto-height :value="ite.desition" />
</view> </view>
</view> </view>
@@ -164,7 +162,7 @@ function handlePrivew(lists, index) {
if (lists.length <= 0) return if (lists.length <= 0) return
uni.previewImage({ uni.previewImage({
urls: lists, urls: lists,
count: index current: index
}) })
} }
</script> </script>

View File

@@ -259,7 +259,7 @@ function handlePrivew(items, index) {
if (items.length <= 0) return if (items.length <= 0) return
uni.previewImage({ uni.previewImage({
urls: items, urls: items,
count: index current: index
}) })
} }
</script> </script>

View File

@@ -294,7 +294,7 @@ function handlePrivew(items, index = 0) {
if (items.length <= 0) return if (items.length <= 0) return
uni.previewImage({ uni.previewImage({
urls: items, urls: items,
count: index current: index
}) })
} }
</script> </script>

View File

@@ -0,0 +1,51 @@
/**
* 请求权限
* @param {String} scope 权限标识
* @param {String} tip 拒绝后的提示文案
*/
export function requestAuth(scope, tip) {
return new Promise((resolve, reject) => {
// #ifdef APP-PLUS || MP-WEIXIN
uni.getSetting({
success: (res) => {
console.log(res)
// 1. 已授权
if (res.authSetting[scope]) {
resolve(true)
return
}
// 2. 未申请过,发起授权弹窗
uni.authorize({
scope,
success: () => resolve(true),
fail: () => {
// 3. 用户拒绝,引导去设置页开启
uni.showModal({
title: '权限申请',
content: tip,
confirmText: '去设置',
cancelText: '取消',
success: (modal) => {
if (modal.confirm) {
uni.openSetting({
success: (setRes) => {
resolve(setRes.authSetting[scope])
},
fail: () => reject(false)
})
} else {
reject(false)
}
}
})
}
})
},
fail: () => reject(false)
})
// #endif
// #ifdef H5
resolve(true)
// #endif
})
}