bug修复

This commit is contained in:
BianLzhaoMin 2025-04-02 08:49:50 +08:00
parent b7b302b3c5
commit 2f206974e9
4 changed files with 31 additions and 4 deletions

6
package-lock.json generated
View File

@ -25,6 +25,7 @@
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001", "@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"lodash-es": "^4.17.21",
"pinia": "^2.3.0", "pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^4.2.0", "pinia-plugin-persistedstate": "^4.2.0",
"uview-plus": "^3.3.62", "uview-plus": "^3.3.62",
@ -9112,6 +9113,11 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true "dev": true
}, },
"node_modules/lodash-es": {
"version": "4.17.21",
"resolved": "https://repo.huaweicloud.com/repository/npm/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
},
"node_modules/lodash.camelcase": { "node_modules/lodash.camelcase": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://repo.huaweicloud.com/repository/npm/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",

View File

@ -51,6 +51,7 @@
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001", "@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"lodash-es": "^4.17.21",
"pinia": "^2.3.0", "pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^4.2.0", "pinia-plugin-persistedstate": "^4.2.0",
"uview-plus": "^3.3.62", "uview-plus": "^3.3.62",

View File

@ -93,13 +93,24 @@
showCancelButton showCancelButton
@confirm="onConfirm" @confirm="onConfirm"
/> />
<up-loading-page
:loading="sendLoading"
loading-text="正在提交,请稍后..."
bg-color="rgba(0,0,0,0.3)"
color="#333"
loadingColor="#2979ff"
fontSize="16"
/>
</view> </view>
</template> </template>
<script setup> <script setup>
import { submitOptionsApi } from '@/services/options.js' import { submitOptionsApi } from '@/services/options.js'
import { debounce } from 'lodash-es'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue' import { ref } from 'vue'
const sendLoading = ref(false)
// //
const opinionModel = ref({ const opinionModel = ref({
@ -184,7 +195,7 @@ const isSuccess = ref(false)
const showModal = ref(false) const showModal = ref(false)
// //
const onSubmitOptions = () => { const onSubmitOptions = debounce(() => {
opinionModelRef.value opinionModelRef.value
.validate() .validate()
.then(async (valid) => { .then(async (valid) => {
@ -200,6 +211,8 @@ const onSubmitOptions = () => {
files.push(d) files.push(d)
}) })
sendLoading.value = true
uni.uploadFile({ uni.uploadFile({
url: '/manager/option/appUploadFile', url: '/manager/option/appUploadFile',
files: files, files: files,
@ -208,6 +221,7 @@ const onSubmitOptions = () => {
param: JSON.stringify(opinionModel.value), param: JSON.stringify(opinionModel.value),
}, },
success: (res) => { success: (res) => {
sendLoading.value = false
res = JSON.parse(res.data) res = JSON.parse(res.data)
if (res.data === '添加成功') { if (res.data === '添加成功') {
uni.$u.toast('提交成功') uni.$u.toast('提交成功')
@ -223,9 +237,12 @@ const onSubmitOptions = () => {
uni.$u.toast('添加失败' + res.data) uni.$u.toast('添加失败' + res.data)
} }
}, },
fail: (err) => {}, fail: (err) => {
sendLoading.value = false
},
}) })
} else { } else {
sendLoading.value = true
const boundary = '----WebKitFormBoundary' + Math.random().toString(16).substr(2) const boundary = '----WebKitFormBoundary' + Math.random().toString(16).substr(2)
const data = const data =
`--${boundary}\r\n` + `--${boundary}\r\n` +
@ -241,6 +258,7 @@ const onSubmitOptions = () => {
}, },
data: data, data: data,
success: (res) => { success: (res) => {
sendLoading.value = false
if (res.data.data === '添加成功') { if (res.data.data === '添加成功') {
uni.$u.toast('提交成功') uni.$u.toast('提交成功')
opinionModel.value = { opinionModel.value = {
@ -257,6 +275,7 @@ const onSubmitOptions = () => {
}, },
fail: (err) => { fail: (err) => {
// //
sendLoading.value = false
}, },
}) })
@ -267,7 +286,7 @@ const onSubmitOptions = () => {
.catch(() => { .catch(() => {
// //
}) })
} }, 800)
// //
const onContinueFill = () => { const onContinueFill = () => {

View File

@ -7,7 +7,8 @@ export default defineConfig({
proxy: { proxy: {
// 在此处编写代理规则 // 在此处编写代理规则
'/api': { '/api': {
target: 'http://192.168.0.38:8080', // 测试服务 // target: 'http://192.168.0.38:21666', // 测试服务
target: 'http://192.168.0.14:21666', // 测试服务
changeOrigin: true, changeOrigin: true,
rewrite: (path) => { rewrite: (path) => {
return path.replace(/\/api/, '') return path.replace(/\/api/, '')