This commit is contained in:
yunkexin 2024-07-25 14:55:26 +08:00
parent d3e717bc94
commit 0cfc3295d4
3 changed files with 54 additions and 38 deletions

View File

@ -46,10 +46,12 @@
onReady() {}, onReady() {},
methods: { methods: {
submit() { submit() {
// uni.navigateBack() uni.navigateBack({
uni.reLaunch({ delta:2
url: '/pages/index/index'
}) })
// uni.reLaunch({
// url: '/pages/index/index'
// })
}, },
} }

View File

@ -219,6 +219,14 @@
this.model2.userInfo.Sex = '0' this.model2.userInfo.Sex = '0'
} }
const json = this.model2.userInfo const json = this.model2.userInfo
// const json = {
// Name: '',
// Sex: '0',
// Phone: '18480141719',
// ID_CARD: '230182200000000000',
// InTime: '2024-07-25',
// WORKINGYEAR: '0',
// }
RegisterUser(json).then((res) => { RegisterUser(json).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log('成功', res); console.log('成功', res);

View File

@ -20,7 +20,7 @@ export default (params) => {
} else { } else {
tenantId = '0001' tenantId = '0001'
} }
console.log(tenantId,'tenantId') console.log(tenantId, 'tenantId')
let url = params.url; let url = params.url;
let method = params.method || "get"; let method = params.method || "get";
let data = params.data || {}; let data = params.data || {};
@ -56,34 +56,34 @@ export default (params) => {
uni.clearStorageSync() uni.clearStorageSync()
switch (res.statusCode) { switch (res.statusCode) {
case 401: case 401:
// uni.showModal({ setTimeout(() => {
// title: "提示", uni.showToast({
// content: "请登录", icon: 'error',
// showCancel: false, title: '请稍后重试...',
// success() { duration: 3000,
// setTimeout(() => { })
// uni.navigateTo({ }, 10)
// url: "/pages/login/index",
// })
// }, 1000);
// },
// });
uni.showToast({
title: '请登录...',
duration: 2000,
})
break; break;
case 404: case 404:
uni.showToast({ setTimeout(() => {
title: '请求地址不存在...', uni.showToast({
duration: 2000, icon: 'error',
}) title: '请求地址不存在...',
duration: 3000,
})
}, 10)
break; break;
default: default:
uni.showToast({ setTimeout(() => {
title: '请重试...', uni.showToast({
duration: 2000, icon: 'error',
}) title: '服务器内部错误...',
duration: 3000,
})
}, 10)
break; break;
} }
} }
@ -91,23 +91,29 @@ export default (params) => {
fail(err) { fail(err) {
console.log(err) console.log(err)
if (err.errMsg.indexOf('request:fail') !== -1) { if (err.errMsg.indexOf('request:fail') !== -1) {
uni.showToast({ setTimeout(() => {
title: '网络异常', uni.showToast({
icon: "error", title: '网络异常',
duration: 2000 icon: "error",
}) duration: 2000
})
}, 10)
} else { } else {
uni.showToast({ setTimeout(() => {
title: '未知异常', uni.showToast({
duration: 2000 title: '未知异常',
}) duration: 2000
})
}, 10)
} }
reject(err); reject(err);
}, },
complete() { complete() {
// 不管成功还是失败都会执行 // 不管成功还是失败都会执行
uni.hideLoading(); // uni.hideLoading();
uni.hideToast(); uni.hideToast();
} }
}); });