From aa2264d46898a546eec2eed7420c1fd68c6c664d Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 28 Nov 2025 14:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/applyForm/index.vue | 86 +++- .../company-selector/company-selector.vue | 31 +- packages/my/index.vue | 51 ++- packages/register/index.vue | 431 ++++++++++-------- packages/register/login.vue | 23 +- pages/me/index.vue | 2 +- 6 files changed, 420 insertions(+), 204 deletions(-) diff --git a/components/applyForm/index.vue b/components/applyForm/index.vue index 155ddc3..1682d06 100644 --- a/components/applyForm/index.vue +++ b/components/applyForm/index.vue @@ -66,7 +66,24 @@ - + + + + + 输入公司名称 + + + + + 确定 + + + @@ -91,6 +108,8 @@ data() { return { showCompanySelector: false, + showCompanyInput: false, + manualCompanyName: '', submitForm: {}, now_fileld: 0, // 当前所操作的 filed index值 // 单选 @@ -123,6 +142,13 @@ fileList: [], formData: {}, rules: {}, + // 手动输入公司名称样式 + inputStyle: { + 'padding': '0rpx 30rpx', + 'height': '80rpx', + 'border': '1rpx solid #dad8d8;', + 'border-radius': '20rpx' + }, } @@ -178,6 +204,40 @@ }) console.log("this.course_forms",this.course_forms) }, + // 处理搜索无数据事件 + handleNoCompanyData(searchKeyword) { + uni.showModal({ + title: '提示', + content: '当前没有查询到公司信息,是否输入公司全称?', + success: (res) => { + if (res.confirm) { + // 关闭搜索窗口 + this.showCompanySelector = false; + // 设置默认值为搜索关键词 + this.manualCompanyName = searchKeyword || ''; + // 打开输入框 + this.showCompanyInput = true; + } + } + }); + }, + // 确认手动输入的公司名称 + confirmManualCompany() { + if (this.base.isNull(this.manualCompanyName)) { + this.base.toast('请输入公司名称'); + return; + } + // 将输入的公司名称赋给 course_forms 中 field === 'company_name' 的项的 value + this.course_forms.map(item1 => { + if (item1.field === 'company_name') { + this.$set(item1, 'value', this.manualCompanyName.trim()); + } + }); + // 关闭输入框 + this.showCompanyInput = false; + // 清空输入 + this.manualCompanyName = ''; + }, // 单选 showSelect(item, index) { this.selectList = item.select_item @@ -392,4 +452,28 @@ padding: 20rpx; } } + + .modal { + ::v-deep .u-drawer-bottom { + border-radius: 40rpx; + } + + &-tip { + text-align: center; + padding: 30rpx; + font-size: 32rpx; + } + + &-content { + padding: 0 30rpx; + } + } + + .login-form { + margin: 100rpx 50rpx; + + &>view { + border-radius: 20rpx; + } + } \ No newline at end of file diff --git a/components/company-selector/company-selector.vue b/components/company-selector/company-selector.vue index ddfb7d6..00a96d1 100644 --- a/components/company-selector/company-selector.vue +++ b/components/company-selector/company-selector.vue @@ -136,19 +136,26 @@ export default { this.loading = false; - // 处理返回的数据,确保是数组格式 - console.log("res",res) - if (res) { - this.companyList = res + // 处理返回的数据,检查是否有错误码 + console.log("res123",res) + + // 如果返回的是错误格式 {errorcode:1001,errormsg:""},说明没有数据 + if (res && typeof res === 'object' && res.errorcode === 1001) { + this.companyList = []; + // 触发无数据事件,通知父组件 + this.$emit('no-data', this.searchKeyword.trim()); + } else if (Array.isArray(res)) { + // 如果返回的是数组,正常处理 + this.companyList = res; + if (this.companyList.length === 0) { + // 触发无数据事件,通知父组件 + this.$emit('no-data', this.searchKeyword.trim()); + } } else { + // 其他情况,设置为空数组 this.companyList = []; - } - - if (this.companyList.length === 0) { - uni.showToast({ - title: '未找到相关公司', - icon: 'none' - }); + // 触发无数据事件,通知父组件 + this.$emit('no-data', this.searchKeyword.trim()); } } catch (error) { this.loading = false; @@ -157,6 +164,8 @@ export default { title: '搜索失败,请稍后重试', icon: 'none' }); + // 触发无数据事件,通知父组件 + this.$emit('no-data', this.searchKeyword.trim()); this.companyList = []; } }, diff --git a/packages/my/index.vue b/packages/my/index.vue index 9e9ff91..d15c528 100644 --- a/packages/my/index.vue +++ b/packages/my/index.vue @@ -96,7 +96,24 @@ - + + + + + 输入公司名称 + + + + + 确定 + + + @@ -150,6 +167,8 @@ plate1: '', plateNumber: ['苏', 'E', '', '', '', '', ''], showCompanySelector: false, + showCompanyInput: false, + manualCompanyName: '', rules: { mobile: [{ required: true, @@ -332,6 +351,36 @@ this.form.is_yuanhe = company.isYhInvested?'是':'否' console.log("this.form",this.form) }, + // 处理搜索无数据事件 + handleNoCompanyData(searchKeyword) { + uni.showModal({ + title: '提示', + content: '当前没有查询到公司信息,是否输入公司全称?', + success: (res) => { + if (res.confirm) { + // 关闭搜索窗口 + this.showCompanySelector = false; + // 设置默认值为搜索关键词 + this.manualCompanyName = searchKeyword || ''; + // 打开输入框 + this.showCompanyInput = true; + } + } + }); + }, + // 确认手动输入的公司名称 + confirmManualCompany() { + if (this.base.isNull(this.manualCompanyName)) { + this.base.toast('请输入公司名称'); + return; + } + // 将输入的公司名称赋给 form.company_name + this.form.company_name = this.manualCompanyName.trim(); + // 关闭输入框 + this.showCompanyInput = false; + // 清空输入 + this.manualCompanyName = ''; + }, saveUser(type) { if (type == 'add') { diff --git a/packages/register/index.vue b/packages/register/index.vue index 49777c4..c09ba90 100644 --- a/packages/register/index.vue +++ b/packages/register/index.vue @@ -1,36 +1,36 @@ - @@ -27,7 +30,7 @@ export default { data() { return { - hasSend: false, + hasSend: false, isDonate:false, count: 60, inputStyle: { @@ -51,7 +54,7 @@ } }, onLoad(options) { - this.type = options.id ? 'course' : 'me' + this.type = options.id ? 'course' : 'me' this.isDonate = options.isDonate?true:false }, onUnload() { @@ -145,6 +148,11 @@ uni.redirectTo({ url: '/packages/register/index' }) + }, + goHome() { + uni.switchTab({ + url: '/pages/index/index' + }) } } @@ -238,10 +246,15 @@ } &-msg { - text-align: center; - padding: 20rpx 0; + padding: 20rpx 20rpx; color: #0d0398; } + + &-links { + display: flex; + justify-content: center; + align-items: center; + } } } \ No newline at end of file diff --git a/pages/me/index.vue b/pages/me/index.vue index 0b95174..7da5840 100644 --- a/pages/me/index.vue +++ b/pages/me/index.vue @@ -317,7 +317,7 @@ this.showRegister = true this.hasMobile = false } else { - this.showRegister = false + this.showRegister = true this.hasMobile = true } })