登录页面和文件打开方式
This commit is contained in:
@@ -346,6 +346,7 @@
|
||||
chooseFile
|
||||
} from '@/uni_modules/lime-choose-file'
|
||||
import socketManager from '../../utils/socket';
|
||||
import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.js'
|
||||
|
||||
const friendSocketStore = useFriendSocketStore()
|
||||
// 连接实时通讯eriendsocket
|
||||
@@ -523,15 +524,7 @@
|
||||
}
|
||||
// 打开文件
|
||||
const openFile = (url) => {
|
||||
uni.downloadFile({
|
||||
url: url,
|
||||
success: (res) => {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
showMenu: true
|
||||
})
|
||||
}
|
||||
})
|
||||
downloadAndOpen(url);
|
||||
}
|
||||
// 文件大小格式化
|
||||
const formatFileSize = (size) => {
|
||||
@@ -906,12 +899,8 @@
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
hideDownloadToast()
|
||||
uni.openDocument({
|
||||
filePath: downloadRes.tempFilePath,
|
||||
showMenu: true,
|
||||
fail: () => {
|
||||
showDownloadToast('error', '无法打开此文件', 2500)
|
||||
}
|
||||
openFileNative(downloadRes.tempFilePath, () => {
|
||||
showDownloadToast('error', '无法打开此文件', 2500)
|
||||
})
|
||||
} else {
|
||||
showDownloadToast('error', '下载失败', 2500)
|
||||
@@ -1188,14 +1177,16 @@
|
||||
if (reason === 'pc offline') {
|
||||
isThinking.value = false
|
||||
socketStore.authFailReason = ''
|
||||
nextTick(() => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: 'PC端不在线,不可聊天',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
uni.showToast({
|
||||
title: 'PC端不在线,请先登录',
|
||||
icon: 'none',
|
||||
duration: 500
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/Login/Login'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user