工单信息修正、小程序登录修正

This commit is contained in:
2025-12-28 14:58:09 +08:00
parent 7eddf00705
commit 8448a801ce
11 changed files with 62 additions and 27 deletions

View File

@@ -164,9 +164,9 @@
// 开发环境使用mock数据
if (isMockMode.value) {
userInfo.value = {
wechatId: '17857100377',
wechatId: '17857100378',
username: '访客用户',
phone: '17857100377',
phone: '17857100378',
userId: ''
}
await doIdentify()
@@ -176,12 +176,12 @@
// 切换mock用户开发调试用
function switchMockUser() {
uni.showActionSheet({
itemList: ['员工 (17857100375)', '访客 (17857100377)'],
itemList: ['员工 (17857100375)', '访客 (17857100378)'],
success: (res) => {
if (res.tapIndex === 0) {
userInfo.value = { wechatId: '17857100375', username: '员工用户', phone: '17857100375', userId: '' }
} else {
userInfo.value = { wechatId: '17857100377', username: '访客用户', phone: '17857100377', userId: '' }
userInfo.value = { wechatId: '17857100378', username: '访客用户', phone: '17857100378', userId: '' }
}
doIdentify()
}
@@ -190,6 +190,12 @@
// 调用identify接口
async function doIdentify() {
// 先清空本地存储的登录信息,确保重新识别身份
uni.removeStorageSync('token')
uni.removeStorageSync('userInfo')
uni.removeStorageSync('loginDomain')
uni.removeStorageSync('wechatId')
uni.showLoading({ title: '登录中...' })
try {
const res = await guestAPI.identify({

View File

@@ -816,7 +816,7 @@ function chooseAssignFile() {
const uploadRes = await fileAPI.uploadFile(file.path, {
module: 'workcase',
optsn: workcase.workcaseId || 'temp'
})
}, file.name)
if (uploadRes.success && uploadRes.data?.fileId) {
assignForm.files.push({
name: file.name,
@@ -842,12 +842,12 @@ function chooseAssignFile() {
uni.showLoading({ title: '上传中...' })
try {
for (const filePath of imgRes.tempFilePaths) {
const fileName = filePath.split('/').pop() || '图片.jpg'
const uploadRes = await fileAPI.uploadFile(filePath, {
module: 'workcase',
optsn: workcase.workcaseId || 'temp'
})
}, fileName)
if (uploadRes.success && uploadRes.data?.fileId) {
const fileName = filePath.split('/').pop() || '图片'
assignForm.files.push({
name: fileName,
fileId: uploadRes.data.fileId
@@ -974,12 +974,13 @@ async function chooseFaultImages() {
// 上传图片到服务器
uni.showLoading({ title: '上传中...' })
try {
const uploadPromises = res.tempFilePaths.map(filePath =>
fileAPI.uploadFile(filePath, {
const uploadPromises = res.tempFilePaths.map((filePath, index) => {
const fileName = `故障图片_${Date.now()}_${index}.jpg`
return fileAPI.uploadFile(filePath, {
module: 'workcase',
optsn: workcase.workcaseId || 'temp'
})
)
}, fileName)
})
const results = await Promise.all(uploadPromises)
@@ -1022,10 +1023,11 @@ async function chooseNameplateImage() {
// 上传铭牌照片到服务器
uni.showLoading({ title: '上传中...' })
try {
const fileName = `设备铭牌_${Date.now()}.jpg`
const result = await fileAPI.uploadFile(res.tempFilePaths[0], {
module: 'workcase',
optsn: workcase.workcaseId || 'temp'
})
}, fileName)
if (result.success && result.data?.fileId) {
workcase.deviceNamePlateImg = result.data.fileId
@@ -1187,7 +1189,7 @@ async function chooseProcessFile() {
const result = await fileAPI.uploadFile(file.path, {
module: 'workcase',
optsn: workcase.workcaseId || 'temp'
})
}, file.name)
if (result.success && result.data?.fileId) {
return {
name: file.name,