This commit is contained in:
2026-08-15 22:16:58 +08:00
parent a344aaedf3
commit aed71d237d
15 changed files with 13296 additions and 306 deletions
+49 -44
View File
@@ -17,23 +17,21 @@
<!-- 第一步:验证租户和账号 -->
<view v-if="currentStep === 1" class="form">
<view class="field">
<u-input
<input
class="field-input"
v-model="form.tenant_name"
type="text"
placeholder="租户名称"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.account"
type="text"
placeholder="账号"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
@@ -54,15 +52,13 @@
</view>
<view v-if="verifyResult.phone" class="field">
<u-input
<input
class="field-input"
v-model="form.phone"
placeholder="手机号"
type="number"
type="tel"
maxlength="11"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="手机号"
placeholder-class="field-placeholder"
/>
</view>
<view v-else class="empty-contact">
@@ -70,15 +66,13 @@
</view>
<view class="field field-row">
<u-input
<input
class="field-input"
v-model="form.sms_code"
placeholder="短信验证码"
type="number"
maxlength="6"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="短信验证码"
placeholder-class="field-placeholder"
/>
<text
class="code-link"
@@ -109,25 +103,21 @@
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.new_password"
placeholder="新密码"
type="password"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="新密码"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.confirm_password"
placeholder="确认新密码"
type="password"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="确认新密码"
placeholder-class="field-placeholder"
/>
</view>
@@ -170,14 +160,6 @@ const verifyResult = reactive({
email: ''
})
const inputStyle = {
backgroundColor: 'transparent',
padding: '0 8rpx',
height: '96rpx',
fontSize: '28rpx'
}
const placeholderStyle = 'color: #909399; font-size: 28rpx'
function startCountdown() {
countdown.value = 60
if (timer) clearInterval(timer)
@@ -386,12 +368,35 @@ onUnmounted(() => {
background: $color-bg-page;
border-radius: $radius-md;
padding: 0 24rpx;
overflow: hidden;
min-height: 96rpx;
}
.field-input {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
color: $color-text;
background: transparent;
border: none;
outline: none;
box-sizing: border-box;
-webkit-appearance: none;
}
.field-placeholder {
color: $color-text-muted;
font-size: 32rpx;
}
.field-row {
display: flex;
align-items: center;
.field-input {
flex: 1;
min-width: 0;
}
}
.code-link {
+59 -52
View File
@@ -22,43 +22,35 @@
<view class="form-card">
<view class="form">
<view class="field">
<u-input
<input
class="field-input"
v-model="tenantName"
type="text"
placeholder="请输入租户名称"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<template v-if="loginType === 'phone'">
<view class="field">
<u-input
<view class="field field-phone">
<text class="prefix">+86</text>
<input
class="field-input"
v-model="phone"
placeholder="请输入手机号"
type="number"
type="tel"
maxlength="11"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
>
<template #prefix>
<text class="prefix">+86</text>
</template>
</u-input>
placeholder="请输入手机号"
placeholder-class="field-placeholder"
/>
</view>
<view class="field field-row">
<u-input
<input
class="field-input"
v-model="smsCode"
placeholder="请输入验证码"
type="number"
maxlength="6"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
/>
<text
class="code-link"
@@ -70,37 +62,31 @@
<template v-else>
<view class="field">
<u-input
<input
class="field-input"
v-model="username"
type="text"
placeholder="请输入账号"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="password"
placeholder="请输入密码"
type="password"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="请输入密码"
placeholder-class="field-placeholder"
/>
</view>
<!-- 后台开启短信/邮箱登录校验时展示 -->
<view v-if="needLoginCode" class="field field-row">
<u-input
<input
class="field-input"
v-model="verifyCode"
placeholder="请输入登录验证码"
type="number"
maxlength="8"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="请输入登录验证码"
placeholder-class="field-placeholder"
/>
<text
class="code-link"
@@ -180,14 +166,6 @@ const openVerify = ref(false)
const verifyType = ref('')
let timer = null
const inputStyle = {
backgroundColor: 'transparent',
padding: '0 8rpx',
height: '96rpx',
fontSize: '28rpx'
}
const placeholderStyle = 'color: #909399; font-size: 28rpx'
const needLoginCode = computed(() => {
return openVerify.value && (verifyType.value === 'sms' || verifyType.value === 'email')
})
@@ -428,7 +406,8 @@ function goForget() {
.page-inner {
padding: 0 48rpx;
padding-top: calc(var(--status-bar-height, 44px) + 80rpx);
padding-top: calc(env(safe-area-inset-top, 0px) + 80rpx);
padding-bottom: env(safe-area-inset-bottom, 0px);
}
.header {
@@ -488,12 +467,40 @@ function goForget() {
background: $color-bg-page;
border-radius: $radius-md;
padding: 0 24rpx;
overflow: hidden;
min-height: 96rpx;
}
.field-input {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
color: $color-text;
background: transparent;
border: none;
outline: none;
box-sizing: border-box;
-webkit-appearance: none;
}
.field-placeholder {
color: $color-text-muted;
font-size: 32rpx;
}
.field-phone {
display: flex;
align-items: center;
}
.field-row {
display: flex;
align-items: center;
.field-input {
flex: 1;
min-width: 0;
}
}
.prefix {
+57 -54
View File
@@ -14,57 +14,50 @@
<view class="form-card">
<view class="form">
<view class="field">
<u-input
<input
class="field-input"
v-model="form.tenant_name"
type="text"
placeholder="租户名称"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.account"
type="text"
placeholder="账号"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.name"
type="text"
placeholder="姓名"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.phone"
placeholder="手机号"
type="number"
type="tel"
maxlength="11"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="手机号"
placeholder-class="field-placeholder"
/>
</view>
<view class="field field-row">
<u-input
<input
class="field-input"
v-model="form.sms_code"
placeholder="短信验证码"
type="number"
maxlength="6"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="短信验证码"
placeholder-class="field-placeholder"
/>
<text
class="code-link"
@@ -73,35 +66,30 @@
>{{ countdown > 0 ? `${countdown}s` : (codeLoading ? '发送中' : '获取验证码') }}</text>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.email"
type="text"
placeholder="邮箱(可选)"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.password"
placeholder="密码"
type="password"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="密码"
placeholder-class="field-placeholder"
/>
</view>
<view class="field">
<u-input
<input
class="field-input"
v-model="form.confirm_password"
placeholder="确认密码"
type="password"
border="none"
color="#303133"
:customStyle="inputStyle"
:placeholderStyle="placeholderStyle"
placeholder="确认密码"
placeholder-class="field-placeholder"
/>
</view>
@@ -138,14 +126,6 @@ const form = reactive({
confirm_password: ''
})
const inputStyle = {
backgroundColor: 'transparent',
padding: '0 8rpx',
height: '96rpx',
fontSize: '28rpx'
}
const placeholderStyle = 'color: #909399; font-size: 28rpx'
function startCountdown() {
countdown.value = 60
if (timer) clearInterval(timer)
@@ -291,12 +271,35 @@ onUnmounted(() => {
background: $color-bg-page;
border-radius: $radius-md;
padding: 0 24rpx;
overflow: hidden;
min-height: 96rpx;
}
.field-input {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 32rpx;
color: $color-text;
background: transparent;
border: none;
outline: none;
box-sizing: border-box;
-webkit-appearance: none;
}
.field-placeholder {
color: $color-text-muted;
font-size: 32rpx;
}
.field-row {
display: flex;
align-items: center;
.field-input {
flex: 1;
min-width: 0;
}
}
.code-link {
+10 -33
View File
@@ -15,14 +15,11 @@
<view class="field content-field">
<text class="field-label">内容</text>
<editor
id="noteEditor"
class="note-editor"
:placeholder="'记录你的想法...'"
:value="form.content"
@ready="onEditorReady"
@input="onEditorInput"
/>
<NoteRichEditor
v-model="form.content"
class="note-editor"
placeholder="记录你的想法..."
/>
</view>
<view class="switch-row" @tap="form.pinned = !form.pinned">
@@ -52,10 +49,10 @@ import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getNote, createNote, updateNote, deleteNote } from '@/api/note.js'
import { formatDate } from '@/utils/date.js'
import NoteRichEditor from '@/components/NoteRichEditor.vue'
const noteId = ref('')
const saving = ref(false)
const editorCtx = ref(null)
const form = reactive({
title: '',
content: '',
@@ -65,21 +62,6 @@ const meta = reactive({
updatedAt: 0
})
function onEditorReady() {
uni.createSelectorQuery().select('#noteEditor').context((res) => {
if (res && res.context) {
editorCtx.value = res.context
if (form.content) {
editorCtx.value.setContents({ html: form.content })
}
}
}).exec()
}
function onEditorInput(e) {
form.content = e.detail.html || ''
}
onLoad(async (query) => {
if (query?.id) {
noteId.value = query.id
@@ -102,9 +84,6 @@ async function loadNote(id) {
form.content = note.content
form.pinned = !!note.pinned
meta.updatedAt = note.updatedAt
if (editorCtx.value && note.content) {
editorCtx.value.setContents({ html: note.content })
}
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
}
@@ -218,13 +197,11 @@ function onDelete() {
width: 100%;
flex: 1;
min-height: 0;
padding: 20rpx;
font-size: 28rpx;
color: $color-text;
box-sizing: border-box;
overflow-y: auto;
background: $color-bg-page;
border-radius: $radius-md;
overflow: hidden;
background: #f5f7fa;
border-radius: 12rpx;
padding: 20rpx;
}
.placeholder {
+23 -2
View File
@@ -111,7 +111,20 @@ function clearSearch() {
}
function preview(content) {
const text = (content || '').replace(/<[^>]+>/g, '').replace(/&nbsp;/g, ' ').replace(/\s+/g, ' ').trim()
if (!content) return '暂无内容'
let html = content
.replace(/<\/t[dh]>/gi, ' ')
.replace(/<\/tr>/gi, ' ')
.replace(/<\/p>/gi, ' ')
.replace(/<br\s*\/?>/gi, ' ')
const text = html
.replace(/<[^>]+>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/\s+/g, ' ')
.trim()
if (!text) return '暂无内容'
return text.length > 60 ? `${text.slice(0, 60)}...` : text
}
@@ -220,6 +233,7 @@ function onDelete(item) {
@include card;
padding: 28rpx 24rpx;
margin-bottom: 20rpx;
overflow: hidden;
&:active {
opacity: 0.92;
@@ -267,11 +281,18 @@ function onDelete(item) {
}
.note-preview {
display: block;
display: -webkit-box;
width: 100%;
overflow: hidden;
font-size: 26rpx;
color: $color-text-secondary;
line-height: 1.6;
margin-bottom: 20rpx;
word-break: break-all;
overflow-wrap: anywhere;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
}
.note-actions {