9.8 17:44

This commit is contained in:
zoujiandong
2025-09-08 17:44:31 +08:00
parent 1556ea2ec7
commit d827caed33
11 changed files with 2779 additions and 195 deletions
+69 -15
View File
@@ -3,7 +3,7 @@
<!-- 顶部导航栏 -->
<uni-nav-bar
left-icon="left"
title="修改邮箱"
:title="title"
@clickLeft="goBack"
fixed
color="#8B2316"
@@ -11,21 +11,28 @@
:border="false"
backgroundColor="#eeeeee"
/>
<view class="content">
<!-- 邮箱输入框 -->
<!-- 输入区域邮箱或其他文本 -->
<view class="input-wrapper">
<input
v-if="editType === 'email'"
class="input"
type="text"
placeholder="请输入您的邮箱"
:placeholder="placeholder"
placeholder-class="ph"
v-model.trim="email"
/>
v-model.trim="content"
>
</input>
<textarea v-else v-model.trim="content" :placeholder="placeholderTextArea" placeholder-class="ph" auto-height> </textarea>
</view>
<!-- 提示文案 -->
<view class="hint">请填写您的真实邮箱以便联系上您</view>
<view class="hint">{{ hint }}</view>
</view>
<!-- 底部保存按钮 -->
@@ -37,8 +44,47 @@
<script setup>
import { ref } from 'vue'
const title = ref('修改邮箱');
import { onLoad } from '@dcloudio/uni-app';
const content = ref('')
const editType = ref('');
const placeholder = ref('请输入您的邮箱');
const placeholderTextArea = ref('请输入您的个人简介(500字以内)');
const hint = ref('请填写您的真实邮箱,以便联系上您');
onLoad((options) => {
editType.value = options && options.editType ? options.editType : '';
content.value = (options && options.value) ? options.value : '';
switch (editType.value) {
case 'email':
title.value = '修改邮箱';
placeholder.value = '请输入您的邮箱';
hint.value = '请填写您的真实邮箱,以便联系上您';
break;
case 'name':
title.value = '修改姓名';
placeholder.value = '请输入您的姓名';
hint.value = '';
break;
case 'officePhone':
title.value = '修改科室电话';
placeholder.value = '请输入您的科室电话';
hint.value = '';
break;
case 'certificate':
title.value = '修改执业医师证编号';
placeholder.value = '请输入您的执业医师证编号';
hint.value = '';
break;
case 'intro':
title.value = '修改个人简介';
placeholderTextArea.value = '请输入您的个人简介(500字以内)';
hint.value = '';
break;
default:
break;
}
})
const email = ref('')
const goBack = () => {
uni.navigateBack()
@@ -51,15 +97,20 @@ const isValidEmail = (val) => {
}
const onSave = () => {
if (!isValidEmail(email.value)) {
// 校验:邮箱时才校验格式
if (editType.value === 'email' && !isValidEmail(content.value)) {
uni.showToast({ title: '请输入有效的邮箱', icon: 'none' })
return
}
// 这里调用保存接口(占位)
// await api.updateEmail({ email: email.value })
// 将数据回传到上一页(personInfo),监听事件名:writeInfoSaved
uni.$emit('writeInfoSaved', {
editType: editType.value,
content: content.value
})
uni.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => goBack(), 800)
setTimeout(() => goBack(), 300)
}
</script>
@@ -71,6 +122,9 @@ const onSave = () => {
.content {
padding: 24rpx 30rpx;
textarea{
min-height:400rpx;
}
}
.input-wrapper {
@@ -81,8 +135,8 @@ const onSave = () => {
}
.input {
height: 72rpx;
line-height: 72rpx;
height: 60rpx;
line-height:60rpx;
font-size: 28rpx;
color: #333;
}
@@ -94,7 +148,7 @@ const onSave = () => {
.hint {
margin-top: 24rpx;
font-size: 26rpx;
color: #666;
color: #333;
}
.footer {
-132
View File
@@ -1,132 +0,0 @@
<template>
<view class="page">
<!-- 顶部导航栏 -->
<uni-nav-bar
left-icon="left"
title="修改邮箱"
@clickLeft="goBack"
fixed
color="#8B2316"
height="140rpx"
:border="false"
backgroundColor="#eeeeee"
/>
<view class="content">
{{ eitType === 'email' }}
<!-- 邮箱输入框 -->
<view class="input-wrapper">
<input
v-if="eitType === 'email'"
class="input"
type="text"
:placeholder="placeholder"
placeholder-class="ph"
v-model.trim="content"
>
</input>
<textarea v-model.trim="content" placeholder="请输入您的个人简介(500字以内)" placeholder-class="ph" auto-height v-else > </textarea>
</view>
<!-- 提示文案 -->
<view class="hint">请填写您的真实邮箱以便联系上您</view>
</view>
<!-- 底部保存按钮 -->
<view class="footer">
<button class="save-btn" @click="onSave">保存</button>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
const content = ref('')
const eitType = ref('1ww');
const placeholder = ref('请输入您的邮箱');
const goBack = () => {
uni.navigateBack()
}
const isValidEmail = (val) => {
if (!val) return false
const re = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/
return re.test(val)
}
const onSave = () => {
if (!isValidEmail(email.value)) {
uni.showToast({ title: '请输入有效的邮箱', icon: 'none' })
return
}
// 这里调用保存接口(占位)
// await api.updateEmail({ email: email.value })
uni.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => goBack(), 800)
}
</script>
<style lang="scss" scoped>
.page {
background-color: #fff;
min-height: 100vh;
}
.content {
padding: 24rpx 30rpx;
}
.input-wrapper {
background: #fff;
border: 2rpx solid #e6e6e6;
border-radius: 16rpx;
padding: 16rpx 20rpx;
}
.input {
height: 60rpx;
line-height:60rpx;
font-size: 28rpx;
color: #333;
}
.ph {
color: #c7c7c7;
}
.hint {
margin-top: 24rpx;
font-size: 26rpx;
color: #333;
}
.footer {
position: fixed;
left: 0;
right: 0;
bottom: env(safe-area-inset-bottom);
padding: 24rpx 30rpx calc(24rpx + env(safe-area-inset-bottom));
background-color: #fff;
}
.save-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
color: #8b2316;
font-size: 30rpx;
border: 2rpx solid #8b2316;
border-radius: 16rpx;
background: #fff;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}
</style>