修复地图定位bug
This commit is contained in:
+43
-24
@@ -4,13 +4,13 @@
|
||||
<!-- 问题类型选择 -->
|
||||
<view class="type-section">
|
||||
<view class="section-title">{{ $t('feedback.issueType') }}</view>
|
||||
<view class="type-grid">
|
||||
<view v-for="(type, index) in types" :key="index" class="type-item"
|
||||
:class="{ active: selectedType === index }" @click="selectType(index)">
|
||||
{{ $t(type) }}
|
||||
<view class="type-grid">
|
||||
<view v-for="(type, index) in types" :key="index" class="type-item"
|
||||
:class="{ active: selectedType === index }" @click="selectType(index)">
|
||||
{{ $t(type) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 问题描述 -->
|
||||
<view class="description-section">
|
||||
@@ -23,23 +23,23 @@
|
||||
<!-- 图片上传 -->
|
||||
<view class="upload-section">
|
||||
<view class="section-title">{{ $t('feedback.imageUpload') }}</view>
|
||||
<view class="upload-grid">
|
||||
<view class="upload-item" v-for="(img, index) in images" :key="index">
|
||||
<image :src="img" mode="aspectFill" />
|
||||
<view class="delete-btn" @click="deleteImage(index)">×</view>
|
||||
</view>
|
||||
<view class="upload-grid">
|
||||
<view class="upload-item" v-for="(img, index) in images" :key="index">
|
||||
<image :src="img" mode="aspectFill" />
|
||||
<view class="delete-btn" @click="deleteImage(index)">×</view>
|
||||
</view>
|
||||
<view class="upload-btn" @click="chooseImage" v-if="images.length < 3">
|
||||
<text class="plus">+</text>
|
||||
<text class="tip">{{ $t('feedback.uploadImage') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<view class="contact-section">
|
||||
<view class="section-title">{{ $t('feedback.contactInfo') }}</view>
|
||||
<input class="contact-input" v-model="contact" :placeholder="$t('feedback.contactPlaceholder')" type="number"
|
||||
maxlength="11" name="contact" />
|
||||
<input class="contact-input" v-model="contact" :placeholder="$t('feedback.contactPlaceholder')"
|
||||
type="number" maxlength="11" name="contact" />
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
@@ -55,6 +55,9 @@
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
URL,
|
||||
appid
|
||||
@@ -65,9 +68,12 @@
|
||||
import {
|
||||
addUserFeedback
|
||||
} from '../../config/api/feedback'
|
||||
import { useI18n } from '@/utils/i18n.js'
|
||||
|
||||
const { t: $t } = useI18n()
|
||||
import {
|
||||
useI18n
|
||||
} from '@/utils/i18n.js'
|
||||
const {
|
||||
t: $t
|
||||
} = useI18n()
|
||||
|
||||
onMounted(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
@@ -75,6 +81,12 @@
|
||||
})
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
if (uni.getStorageSync("userInfo").phone) {
|
||||
contact.value = uni.getStorageSync('userInfo').phone;
|
||||
}
|
||||
})
|
||||
|
||||
// 响应式数据
|
||||
const types = ref(['feedback.deviceFault', 'feedback.chargingIssue', 'feedback.usageSuggestion', 'feedback.other'])
|
||||
const selectedType = ref(-1)
|
||||
@@ -89,6 +101,7 @@
|
||||
selectedType.value = index
|
||||
}
|
||||
|
||||
|
||||
const chooseImage = () => {
|
||||
uni.chooseImage({
|
||||
count: 3 - images.value.length,
|
||||
@@ -109,7 +122,10 @@
|
||||
if (idx !== -1) {
|
||||
images.value.splice(idx, 1)
|
||||
}
|
||||
uni.showToast({ title: '图片上传失败', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,11 +161,12 @@
|
||||
return
|
||||
}
|
||||
|
||||
if (types.value[selectedType.value] === 'feedback.deviceFault' || types.value[selectedType.value] === 'feedback.chargingIssue') {
|
||||
paramsType.value = 'complain'
|
||||
} else {
|
||||
paramsType.value = 'suggestion'
|
||||
}
|
||||
if (types.value[selectedType.value] === 'feedback.deviceFault' || types.value[selectedType.value] ===
|
||||
'feedback.chargingIssue') {
|
||||
paramsType.value = 'complain'
|
||||
} else {
|
||||
paramsType.value = 'suggestion'
|
||||
}
|
||||
|
||||
// 构建反馈数据
|
||||
const feedbackData = {
|
||||
@@ -172,7 +189,8 @@
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
// 兼容后端返回 { code: 200 } 或 HTTP 200 情况
|
||||
if ((res.statusCode === 200) && ((res.data && res.data.code === 200) || res.data === true || res.data?.success === true)) {
|
||||
if ((res.statusCode === 200) && ((res.data && res.data.code === 200) || res.data ===
|
||||
true || res.data?.success === true)) {
|
||||
uni.showToast({
|
||||
title: $t('feedback.submitSuccess'),
|
||||
icon: 'success'
|
||||
@@ -183,7 +201,8 @@
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: (res.data && (res.data.msg || res.data.message)) || $t('feedback.submitFailed'),
|
||||
title: (res.data && (res.data.msg || res.data.message)) || $t(
|
||||
'feedback.submitFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user