使用uni.loading进行加载提示

This commit is contained in:
WindowBird 2025-09-12 09:05:57 +08:00
parent b5ef305654
commit b68be4a41b
7 changed files with 68 additions and 57 deletions

View File

@ -2,7 +2,7 @@
export const DEV_CONFIG = {
// 临时token用于开发测试
TEMP_TOKEN:
'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIwZGUwMWIxLTYyZTMtNDZiNi04ZDY2LWM5MGNkMzk0MzBkZSJ9.3XuGxoM7Q4sQBt7UJXYgHG_FWI88unIsvq7ni-Jg5_UDpgjLa7SaM-ZDIgWQw73r-Jrs37g5ubahxTa8aiZTkA',
'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjViMTMzOTU5LWRkOGYtNDUwZS1hNDNmLTQyNTZmNzljNjU4YyJ9.vEal-nq4biYni9F3YhBr6pt6mEepOYFQzlSeERQ-Ft_YejklpzmjhvIF9nO3PkjS7F5ns4unIUt8Ov0JEWnY2Q',
// 是否使用临时token
USE_TEMP_TOKEN: true,

View File

@ -341,9 +341,12 @@ export default {
}
console.log('续费数据:', renewData)
uni.showLoading({
title: '正在生成续费订单',
mask: 'true',
})
const response = await renewDevice(renewData)
uni.hideLoading()
if (response.code === 200) {
const data = response.data
const wxpPayParams = data.payParams

View File

@ -170,7 +170,6 @@
</view>
</view>
</uv-popup>
<uv-toast ref="toast"></uv-toast>
</view>
</template>
@ -481,15 +480,20 @@ export default {
content: `确认支付 ¥${this.payAmount} 吗?\n\n${this.formData.quantity}${this.formData.equipment}\n周期${this.formData.period}`,
success: async res => {
if (res.confirm) {
this.$refs.toast.show({
type: 'loading',
message: '正在提交订单中...',
overlay: true, //
duration: 10000,
// this.$refs.toast.show({
// type: 'loading',
// message: '...',
// overlay: true, //
// duration: 10000,
// })
uni.showLoading({
title: '正在生成订单',
mask: 'true',
})
// API
const response = await createLeaseOrder(this.formData)
this.$refs.toast.hide()
// this.$refs.toast.hide()
uni.hideLoading()
if (response.code === 200) {
const data = response.data
console.log(data)
@ -520,7 +524,7 @@ export default {
fail: function (res) {
uni.showToast({
title: '支付失败',
icon: 'fail',
icon: 'error',
})
},
complete: function (res) {

View File

@ -79,10 +79,11 @@
<script>
import { wxLogin } from '@/api/auth/auth.js'
import { forceHideLoading } from '@/utils/request.js'
// import { forceHideLoading } from '@/utils/request.js'
import { getServiceTerms, getPrivacyPolicy } from '@/api/article/article.js'
import { commonEnum } from '../../enum/commonEnum'
import { getNavBarHeight, getTitleBarHeight } from '../../utils/system'
import { mapState } from 'vuex'
export default {
data() {
@ -121,7 +122,7 @@ export default {
},
onUnload() {
forceHideLoading()
// forceHideLoading()
if (this.pageLoading) {
this.pageLoading.destroy()
}
@ -227,7 +228,7 @@ export default {
async Login() {
console.log('开始登录流程')
this.showLoading()
// this.showLoading()
try {
// 1.
@ -235,6 +236,10 @@ export default {
const confirmed = await this.showLoginConfirmation()
if (!confirmed) return
}
uni.showLoading({
title: '登录中',
mask: 'true',
})
// 2. code
const wxCode = await this.getWxLoginCode()
@ -242,25 +247,27 @@ export default {
// 3.
const loginResult = await this.executeLogin(wxCode)
uni.hideLoading()
// 4.
this.handleLoginSuccess(loginResult)
} catch (error) {
this.handleLoginError(error)
} finally {
this.hideLoading()
// this.hideLoading()
}
},
//
showLoading() {
this.pageLoading?.show('登录中...')
},
// showLoading() {
// this.pageLoading?.show('...')
// },
//
hideLoading() {
this.pageLoading?.hide()
forceHideLoading()
},
// hideLoading() {
// this.pageLoading?.hide()
// forceHideLoading()
// },
//
showLoginConfirmation() {

View File

@ -81,15 +81,12 @@ export default {
async getshuaxin() {
try {
// Toast30
this.$refs.toast.show({
type: 'loading',
message: '正在刷新实名信息...',
overlay: true,
duration: 30000,
uni.showLoading({
title: '正在刷新实名信息',
mask: 'true',
})
const res = await refreshRealName()
this.$refs.toast.hide()
uni.hideLoading()
if (res.code === 200) {
this.handleRefreshSuccess(res.data)
@ -97,7 +94,7 @@ export default {
this.handleRefreshFail(res.msg || '人脸认证失败')
}
} catch (error) {
this.$refs.toast.hide()
uni.hideLoading()
this.handleRefreshFail(error.message || '网络异常')
}
},

View File

@ -1,3 +1,29 @@
<template>
<view @click="open()">123</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {
open() {
uni.downloadFile({
url: 'https://api.ccttiot.com/安装协议(准备好)-1757570264575.pdf',
success: function (res) {
var filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {},
})
},
})
},
},
}
</script>
<style lang="scss"></style>
<!--<template>-->
<!-- <view style="width: 750rpx; height: 750rpx">-->
<!-- <l-signature-->
@ -64,29 +90,3 @@
<!--}-->
<!--</script>-->
<!--<style lang="scss"></style>-->
<template>
<view @click="open()">123</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {
open() {
uni.downloadFile({
url: 'https://api.ccttiot.com/安装协议(准备好)-1757570264575.pdf',
success: function (res) {
var filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {},
})
},
})
},
},
}
</script>
<style lang="scss"></style>

View File

@ -19,7 +19,7 @@ const ENV_CONFIG = {
release: {
// 正式版
// baseUrl: 'https://chu.chuangtewl.com/prod-api',
// baseUrl: 'http://192.168.2.88:4601',
// baseUrl: 'http://192.168.2.21:4601',
baseUrl: 'http://192.168.2.21:4601',
appId: 1,
},