From 59fc1be7c79892fe710cd9b52a596254d00029e4 Mon Sep 17 00:00:00 2001 From: yunkexin <760754045@qq.com> Date: Mon, 2 Sep 2024 17:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/apply/index.vue | 43 ++++++++++++++++++++++++++++++------------- pages/index/index.vue | 10 +++++----- utils/request.js | 5 ++++- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/pages/apply/index.vue b/pages/apply/index.vue index 7dc98b5..42b7219 100644 --- a/pages/apply/index.vue +++ b/pages/apply/index.vue @@ -57,6 +57,7 @@ import { RegisterUser } from '../../services/apply.js' + import config from '../../config/common.js' import { isChinaMobilePhone, easyCheckID, @@ -66,9 +67,10 @@ data() { return { showSex: false, + appurl: config.uni_app_url, formatter: null, pickerShow: false, - loading:false, + loading: false, pickerColumns: [Array(60).fill(null).map((_, i) => i)], model1: { userInfo: { @@ -200,13 +202,13 @@ } this.loading = true const json = { - Name: this.model1.userInfo.Name, - Sex: this.model1.userInfo.Sex == '男'?'1':'0', - Phone: this.model1.userInfo.Phone, - ID_CARD: this.model1.userInfo.ID_CARD, - InTime: this.model1.userInfo.InTime, - WORKINGYEAR: this.model1.userInfo.WORKINGYEAR, - } + Name: this.model1.userInfo.Name, + Sex: this.model1.userInfo.Sex == '男' ? '1' : '0', + Phone: this.model1.userInfo.Phone, + ID_CARD: this.model1.userInfo.ID_CARD, + InTime: this.model1.userInfo.InTime, + WORKINGYEAR: this.model1.userInfo.WORKINGYEAR, + } // const json = { // Name: '云', // Sex: '0', @@ -217,16 +219,31 @@ // } RegisterUser(json).then((res) => { if (res.code == 200) { - console.log('成功', res); this.loading = false - uni.navigateTo({ - url: '/pages/apply/complete?type=success' + uni.showToast({ + title: '注册成功!', + icon: 'none' }) + setTimeout(() => { + uni.hideToast(); + location.href = this.appurl + // uni.redirectTo({ + // url: '/pages/webview/webview?url=' + this.appurl + // }) + },1500) + + // uni.navigateTo({ + // url: '/pages/apply/complete?type=success' + // }) } else { this.loading = false - uni.navigateTo({ - url: `/pages/apply/complete?type=failed&title=${res.msg}` + uni.showToast({ + title: res.msg, + icon: 'none' }) + // uni.navigateTo({ + // url: `/pages/apply/complete?type=failed&title=${res.msg}` + // }) } }).catch((err) => { diff --git a/pages/index/index.vue b/pages/index/index.vue index 33bd45f..08377a2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -117,18 +117,18 @@ // }) }, getCaidan() { - const json = { - Company: this.company, + Company: uni.getStorageSync('Company'), Post: '搬运工', Type: 1 } getMenu(json).then((res) => { - console.log('成功', res); this.baseList = res.data - }).catch((err) => { - console.error('失败', err); + uni.showToast({ + title: '请求错误', + icon: 'none' + }) }) } diff --git a/utils/request.js b/utils/request.js index 177eb1c..d1fb443 100644 --- a/utils/request.js +++ b/utils/request.js @@ -5,7 +5,10 @@ import handle401 from './handle401' export default { send(params) { - let Company = uni.getStorageSync('Company') + const pages = getCurrentPages() + const currentPage = pages[pages.length - 1] + const Options = currentPage.options + let Company = Options.Company?Options.Company:'XLK' let tenantId = '' if (Company == 'DCJD') { tenantId = 'A0000025'