Merge branch 'master' of https://git.yunzer.cn/yunzerwebsite/yunzerwebsiteallinone
This commit is contained in:
commit
5d7ed43570
16 files changed
+11811
-1008
No files matched your search
@@ -0,0 +1,77 @@
|
||||
import { request } from '@/api/request.js'
|
||||
|
||||
/**
|
||||
* 账号管理(密码库)——记录个人各平台账号。
|
||||
* 与 Web 端密码存储管理同一套数据(一个平台下挂多个账号)。
|
||||
* 服务端自动过滤当前登录用户的记录,无需传 user_id。
|
||||
*/
|
||||
export function fetchPasswordStores(keyword) {
|
||||
return request({
|
||||
url: '/api/passwordStore/list',
|
||||
data: keyword ? { keyword } : {}
|
||||
}).then(data => ({
|
||||
list: (data.list || []).map(normalizeStore),
|
||||
total: data.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
export function getPasswordStore(id) {
|
||||
return request({
|
||||
url: `/api/passwordStore/detail/${id}`
|
||||
}).then(normalizeStore)
|
||||
}
|
||||
|
||||
export function createPasswordStore(data) {
|
||||
return request({
|
||||
url: '/api/passwordStore/create',
|
||||
method: 'POST',
|
||||
data: pickStore(data)
|
||||
}).then(normalizeStore)
|
||||
}
|
||||
|
||||
export function updatePasswordStore(id, data) {
|
||||
return request({
|
||||
url: `/api/passwordStore/update/${id}`,
|
||||
method: 'POST',
|
||||
data: pickStore(data)
|
||||
}).then(normalizeStore)
|
||||
}
|
||||
|
||||
export function deletePasswordStore(id) {
|
||||
return request({
|
||||
url: `/api/passwordStore/delete/${id}`,
|
||||
method: 'DELETE'
|
||||
}).then(() => true)
|
||||
}
|
||||
|
||||
/** 只取服务端接收的字段 */
|
||||
function pickStore(data) {
|
||||
return {
|
||||
platform: data.platform || '',
|
||||
url: data.url || '',
|
||||
remark: data.remark || '',
|
||||
accounts: (data.accounts || []).map(a => ({
|
||||
username: a.username || '',
|
||||
password: a.password || '',
|
||||
registration_info: a.registration_info || '',
|
||||
remark: a.remark || ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
/** 统一账号列表结构,避免后端缺字段导致渲染报错 */
|
||||
function normalizeStore(item) {
|
||||
const store = item || {}
|
||||
return {
|
||||
...store,
|
||||
platform: store.platform || '',
|
||||
url: store.url || '',
|
||||
remark: store.remark || '',
|
||||
accounts: (store.accounts || []).map(a => ({
|
||||
username: a.username || '',
|
||||
password: a.password || '',
|
||||
registration_info: a.registration_info || '',
|
||||
remark: a.remark || ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -608,52 +608,32 @@ export default {
|
||||
<style lang="scss">
|
||||
@import '@/src/styles/rich-content.scss';
|
||||
|
||||
/* 全局表格规范:强制在所有终端与渲染层呈现清晰的表格边框与单元格背景 */
|
||||
.note-rich-editor {
|
||||
table {
|
||||
display: table !important;
|
||||
border-collapse: collapse !important;
|
||||
border-spacing: 0 !important;
|
||||
/* 小程序端用 class 选择器,避免标签选择器兼容性警告 */
|
||||
.note-rich-editor-table {
|
||||
display: table !important;
|
||||
border-collapse: collapse !important;
|
||||
border-spacing: 0 !important;
|
||||
border: 1px solid #dcdfe6 !important;
|
||||
width: 100% !important;
|
||||
margin: 12px 0 !important;
|
||||
.rich-table__body { display: table-row-group !important; }
|
||||
tr { display: table-row !important; border-bottom: 1px solid #ebeef5 !important; }
|
||||
th, td {
|
||||
display: table-cell !important;
|
||||
border: 1px solid #dcdfe6 !important;
|
||||
width: 100% !important;
|
||||
margin: 12px 0 !important;
|
||||
|
||||
tbody {
|
||||
display: table-row-group !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table-row !important;
|
||||
border-bottom: 1px solid #ebeef5 !important;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
display: table-cell !important;
|
||||
border: 1px solid #dcdfe6 !important;
|
||||
background-color: #ffffff;
|
||||
padding: 8px 12px !important;
|
||||
font-size: 26rpx !important;
|
||||
min-width: 44px !important;
|
||||
min-height: 36px !important;
|
||||
vertical-align: top !important;
|
||||
word-break: break-word !important;
|
||||
box-sizing: border-box !important;
|
||||
user-select: text !important;
|
||||
-webkit-user-select: text !important;
|
||||
cursor: text !important;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f5f7fa !important;
|
||||
font-weight: 600 !important;
|
||||
color: #303133 !important;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 !important;
|
||||
min-height: 1.4em !important;
|
||||
}
|
||||
background-color: #ffffff;
|
||||
padding: 8px 12px !important;
|
||||
font-size: 26rpx !important;
|
||||
min-width: 44px !important;
|
||||
min-height: 36px !important;
|
||||
vertical-align: top !important;
|
||||
word-break: break-word !important;
|
||||
box-sizing: border-box !important;
|
||||
user-select: text !important;
|
||||
-webkit-user-select: text !important;
|
||||
cursor: text !important;
|
||||
}
|
||||
th { background-color: #f5f7fa !important; font-weight: 600 !important; color: #303133 !important; }
|
||||
p { margin: 0 !important; min-height: 1.4em !important; }
|
||||
}
|
||||
</style>
|
||||
+505
-447
@@ -22,381 +22,6 @@
|
||||
"navigationBarTitleText": "子系统"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/crm/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/crm/functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/crm/todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/crm/mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/dashboard/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进销存工作台",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/document/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "单据列表",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/document/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "单据详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/document/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "开单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/basic/product",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/basic/product-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/basic/warehouse",
|
||||
"style": {
|
||||
"navigationBarTitleText": "仓库档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/partner/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客商管理",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/partner/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客商详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/stock/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "库存结存",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/stock/ledger",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收发存流水",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/stock/batch",
|
||||
"style": {
|
||||
"navigationBarTitleText": "批次效期",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/stock/warning",
|
||||
"style": {
|
||||
"navigationBarTitleText": "库存预警",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/finance/bill",
|
||||
"style": {
|
||||
"navigationBarTitleText": "应收应付",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/finance/bill-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "账单详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/finance/fund",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收付款单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/finance/fund-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收付款",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/erp/report/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报表中心",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "协同办公"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/notice/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "通知公告",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/dailyreport/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作日报",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/dailyreport/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "填写日报",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/dailyreport/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日报详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/notice/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "公告详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/document/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文档库",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/document/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文档详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/compensation/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的工资单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/compensation/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工资单明细",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/employeefile/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "员工档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/employeefile/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "档案详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/contact/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "通讯录",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/oa/contact/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "联系人详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/cms/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站内容管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/cms/functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/cms/todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/cms/mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/toolbox/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/toolbox/functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/toolbox/todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/toolbox/mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
@@ -475,90 +100,523 @@
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/crm",
|
||||
"pages": [
|
||||
{
|
||||
"path": "home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "客户关系 · 我的"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/notepad/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "记事本",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/erp",
|
||||
"pages": [
|
||||
{
|
||||
"path": "home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "进销存 · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "dashboard/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进销存工作台",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "document/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "单据列表",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "document/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "单据详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "document/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "开单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "basic/product",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "basic/product-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "basic/warehouse",
|
||||
"style": {
|
||||
"navigationBarTitleText": "仓库档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "partner/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客商管理",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "partner/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客商详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stock/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "库存结存",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stock/ledger",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收发存流水",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stock/batch",
|
||||
"style": {
|
||||
"navigationBarTitleText": "批次效期",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stock/warning",
|
||||
"style": {
|
||||
"navigationBarTitleText": "库存预警",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "finance/bill",
|
||||
"style": {
|
||||
"navigationBarTitleText": "应收应付",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "finance/bill-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "账单详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "finance/fund",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收付款单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "finance/fund-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收付款",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "report/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报表中心",
|
||||
"navigationBarBackgroundColor": "#F8FAFC",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/notepad/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建笔记",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/oa",
|
||||
"pages": [
|
||||
{
|
||||
"path": "home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "协同办公"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "OA · 我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "notice/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "通知公告",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "dailyreport/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作日报",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "dailyreport/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "填写日报",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "dailyreport/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日报详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "notice/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "公告详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "document/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文档库",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "document/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "文档详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "compensation/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的工资单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "compensation/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工资单明细",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "employeefile/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "员工档案",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "employeefile/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "档案详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "contact/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "通讯录",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "contact/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "联系人详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/schedule/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作日程",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/cms",
|
||||
"pages": [
|
||||
{
|
||||
"path": "home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站内容管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "网站管理 · 我的"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/schedule/reminder",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日程提醒",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/toolbox",
|
||||
"pages": [
|
||||
{
|
||||
"path": "home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "functions/functions",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 功能"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "todo/todo",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 待办"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "mine/mine",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "便捷工具 · 我的"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/schedule/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日程详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/tools",
|
||||
"pages": [
|
||||
{
|
||||
"path": "notepad/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "记事本",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "notepad/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建笔记",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "schedule/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作日程",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "schedule/reminder",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日程提醒",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "schedule/reminder-edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增日程提醒",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "schedule/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "日程详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "schedule/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建日程",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "expense/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报销管理",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "expense/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建报销单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "account/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "账号管理",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "account/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增账号",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "expense/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报销详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/schedule/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建日程",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/expense/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报销管理",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/expense/edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新建报销单",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tools/expense/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报销详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/approval/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "审批列表",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/approval/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "审批详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/approval/verify",
|
||||
"style": {
|
||||
"navigationBarTitleText": "待我审批",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
"root": "pages/approval",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "审批列表",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "审批详情",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "verify",
|
||||
"style": {
|
||||
"navigationBarTitleText": "待我审批",
|
||||
"navigationBarBackgroundColor": "#F8FAFC"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
+448
-303
@@ -1,161 +1,195 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<!-- 品牌区 -->
|
||||
<view class="brand">
|
||||
<view class="brand-logo">
|
||||
<FaIcon name="shield-halved" color="#ffffff" :size="20" />
|
||||
<!-- 背景装饰(纯视觉,不拦截点击) -->
|
||||
<view class="deco deco-a" />
|
||||
<view class="deco deco-b" />
|
||||
|
||||
<!-- 顶部自绘导航(账号密码 / 选择企业视图) -->
|
||||
<view v-if="step !== 'main'" class="nav-bar" :style="{ paddingTop: navPadTop }">
|
||||
<view class="nav-back" :class="{ invisible: !canGoBack }" @tap="onNavBack">
|
||||
<FaIcon name="chevron-left" color="#1e293b" :size="20" />
|
||||
</view>
|
||||
<text class="brand-name">云泽统一认证</text>
|
||||
<text class="brand-desc">欢迎回来,开启云泽服务</text>
|
||||
<text class="nav-title">{{ navTitle }}</text>
|
||||
<view class="nav-side" />
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<!-- ============ 选择企业(一人多企业) ============ -->
|
||||
<block v-if="step === 'tenant'">
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">选择企业</text>
|
||||
<text class="panel-sub">该账号已加入多家企业,请选择要进入的空间</text>
|
||||
<!-- 品牌区 + 表单卡片 -->
|
||||
<view class="login-body">
|
||||
<!-- 品牌区 -->
|
||||
<view class="brand" :class="{ compact: step !== 'main' }" :style="{ paddingTop: brandPadTop }">
|
||||
<view class="brand-logo">
|
||||
<FaIcon name="shield-halved" color="#ffffff" :size="22" />
|
||||
</view>
|
||||
<text class="brand-name">云泽统一认证</text>
|
||||
<text class="brand-desc">一次登录,全平台通行</text>
|
||||
</view>
|
||||
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
<text class="error-text">{{ errorMsg }}</text>
|
||||
</view>
|
||||
|
||||
<view class="tenant-list">
|
||||
<view
|
||||
v-for="item in tenants"
|
||||
:key="item.tid"
|
||||
class="tenant-item"
|
||||
:class="{ disabled: submitting }"
|
||||
@tap="chooseTenant(item)"
|
||||
>
|
||||
<view class="tenant-avatar">
|
||||
<FaIcon name="building" color="#2563eb" :size="18" />
|
||||
</view>
|
||||
<view class="tenant-info">
|
||||
<text class="tenant-name">{{ item.tenant_name || `企业${item.tid}` }}</text>
|
||||
<text class="tenant-meta">{{ item.name ? `${item.name} · ` : '' }}企业ID {{ item.tid }}</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="14" />
|
||||
<view class="card">
|
||||
<!-- ============ 主视图:微信一键登录 ============ -->
|
||||
<block v-if="step === 'main'">
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">欢迎登录</text>
|
||||
<text class="panel-sub">使用微信手机号,一键完成身份认证</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="back-row" @tap="backToAccount">
|
||||
<text class="link">不是我的账号?切换账号</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- ============ 登录(小程序端微信/账号密码 Tab 切换;H5/APK 仅账号密码) ============ -->
|
||||
<block v-else>
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">{{ showMiniLogin && activeTab === 'account' ? '账号登录' : '欢迎登录' }}</text>
|
||||
<text v-if="!(showMiniLogin && activeTab === 'account')" class="panel-sub">{{ panelSub }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
<text class="error-text">{{ errorMsg }}</text>
|
||||
</view>
|
||||
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 微信端默认突出一键登录,账号密码作为次要备用入口 -->
|
||||
|
||||
<!-- 微信登录面板 -->
|
||||
<block v-if="showMiniLogin && activeTab === 'wechat'">
|
||||
<button
|
||||
class="btn-wechat"
|
||||
open-type="getPhoneNumber"
|
||||
:class="{ disabled: submitting }"
|
||||
@getphonenumber="onGetPhoneNumber"
|
||||
>
|
||||
<FaIcon name="weixin" type="brands" color="#ffffff" :size="18" />
|
||||
<text>{{ submitting ? '登录中...' : '微信一键登录' }}</text>
|
||||
</button>
|
||||
<view class="tip-row">
|
||||
<text class="tip-text">微信安全授权,快捷登录云泽统一认证</text>
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
<text class="error-text">{{ errorMsg }}</text>
|
||||
</view>
|
||||
<view class="account-entry" @tap="switchTab('account')">
|
||||
<text class="account-entry-text">账号登录</text>
|
||||
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 微信端且服务端已开通:一键登录主 CTA -->
|
||||
<block v-if="showMiniLogin">
|
||||
<button
|
||||
class="btn-wechat"
|
||||
open-type="getPhoneNumber"
|
||||
:class="{ disabled: submitting }"
|
||||
@getphonenumber="onGetPhoneNumber"
|
||||
>
|
||||
<FaIcon name="weixin" type="brands" color="#ffffff" :size="20" />
|
||||
<text class="btn-wechat-text">{{ submitting ? '登录中...' : '微信手机号一键登录' }}</text>
|
||||
</button>
|
||||
<view class="tip-row">
|
||||
<text class="tip-text">首次使用请先用账号密码登录一次,自动完成微信绑定后即可一键登录</text>
|
||||
</view>
|
||||
</block>
|
||||
<view v-else class="loading-box">
|
||||
<text class="tip-text">正在加载登录方式…</text>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 弱化入口:切换到独立的账号密码登录视图 -->
|
||||
<view class="alt-entry" @tap="goAccount">
|
||||
<view class="alt-line" />
|
||||
<text class="alt-text">使用账号密码登录</text>
|
||||
<FaIcon name="chevron-right" color="#94a3b8" :size="12" />
|
||||
<view class="alt-line" />
|
||||
</view>
|
||||
</block>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 账号密码面板(未开通微信登录的端始终展示) -->
|
||||
<block v-if="!(showMiniLogin && activeTab === 'wechat')">
|
||||
<view v-if="showMiniLogin" class="account-mode-label" @tap="switchTab('wechat')">
|
||||
<text class="account-mode-back">‹ 微信一键登录</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">账号</text>
|
||||
<view class="input-wrap">
|
||||
<input
|
||||
v-model="account"
|
||||
class="field-input"
|
||||
type="text"
|
||||
placeholder="手机号 / 邮箱 / 企业账号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<!-- ============ 账号密码登录(独立视图) ============ -->
|
||||
<block v-else-if="step === 'account'">
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">欢迎回来</text>
|
||||
<text class="panel-sub">请输入您的账号与密码以继续</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">密码</text>
|
||||
<view class="input-wrap">
|
||||
<input
|
||||
v-model="password"
|
||||
class="field-input"
|
||||
:password="!showPassword"
|
||||
placeholder="请输入密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@confirm="handleLogin"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showPassword = !showPassword">
|
||||
<FaIcon
|
||||
:name="showPassword ? 'eye-slash' : 'eye'"
|
||||
color="#a7b1c7"
|
||||
:size="16"
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
<text class="error-text">{{ errorMsg }}</text>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">账号</text>
|
||||
<view class="input-wrap">
|
||||
<FaIcon name="user" color="#94a3b8" :size="16" />
|
||||
<input
|
||||
v-model="account"
|
||||
class="field-input"
|
||||
type="text"
|
||||
placeholder="手机号 / 邮箱 / 企业账号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row-extra">
|
||||
<view class="remember" @tap="rememberMe = !rememberMe">
|
||||
<view class="checkbox" :class="{ on: rememberMe }" />
|
||||
<text class="remember-text">记住账号</text>
|
||||
<view class="field">
|
||||
<text class="field-label">密码</text>
|
||||
<view class="input-wrap">
|
||||
<FaIcon name="lock" color="#94a3b8" :size="16" />
|
||||
<input
|
||||
v-model="password"
|
||||
class="field-input"
|
||||
:password="!showPassword"
|
||||
placeholder="请输入密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@confirm="handleLogin"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showPassword = !showPassword">
|
||||
<FaIcon
|
||||
:name="showPassword ? 'eye-slash' : 'eye'"
|
||||
color="#a7b1c7"
|
||||
:size="16"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="link" @tap="goForget">忘记密码</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="btn"
|
||||
:class="{ disabled: submitting }"
|
||||
@tap="handleLogin"
|
||||
>
|
||||
<text>{{ submitting ? '登录中...' : '登 录' }}</text>
|
||||
</view>
|
||||
<view class="row-extra">
|
||||
<view class="remember" @tap="rememberMe = !rememberMe">
|
||||
<view class="checkbox" :class="{ on: rememberMe }" />
|
||||
<text class="remember-text">记住账号</text>
|
||||
</view>
|
||||
<text class="link" @tap="goForget">忘记密码</text>
|
||||
</view>
|
||||
|
||||
<view class="back-row">
|
||||
<text class="tip-text">还没有账号?</text>
|
||||
<text class="link" @tap="goRegister">立即注册</text>
|
||||
</view>
|
||||
<view
|
||||
class="btn"
|
||||
:class="{ disabled: submitting }"
|
||||
@tap="handleLogin"
|
||||
>
|
||||
<text>{{ submitting ? '登录中...' : '登 录' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 登录页不提供注册入口:账号由企业管理员在后台统一开通 -->
|
||||
<view class="back-row">
|
||||
<text class="tip-text">没有账号?请联系企业管理员开通</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 未勾选协议提示:两个 Tab 面板共用 -->
|
||||
<view v-if="!agreed && showAgreementTip" class="agree-tip">
|
||||
<FaIcon name="circle-info" color="#f79009" :size="12" />
|
||||
<text class="agree-tip-text">请先阅读并勾选同意《用户协议》和《隐私政策》</text>
|
||||
</view>
|
||||
</block>
|
||||
<!-- ============ 选择企业(一人多企业) ============ -->
|
||||
<block v-else>
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">请选择企业</text>
|
||||
<text class="panel-sub">该账号已加入多家企业,请选择要进入的空间</text>
|
||||
</view>
|
||||
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
<text class="error-text">{{ errorMsg }}</text>
|
||||
</view>
|
||||
|
||||
<view class="tenant-list">
|
||||
<view
|
||||
v-for="item in tenants"
|
||||
:key="item.tid"
|
||||
class="tenant-item"
|
||||
:class="{ disabled: submitting }"
|
||||
@tap="chooseTenant(item)"
|
||||
>
|
||||
<view class="tenant-avatar">
|
||||
<FaIcon name="building" color="#2563eb" :size="18" />
|
||||
</view>
|
||||
<view class="tenant-info">
|
||||
<text class="tenant-name">{{ item.tenant_name || `企业${item.tid}` }}</text>
|
||||
<text class="tenant-meta">{{ item.name ? `${item.name} · ` : '' }}企业ID {{ item.tid }}</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="14" />
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- ============ 协议(企业选择视图无需) ============ -->
|
||||
<block v-if="step !== 'tenant'">
|
||||
<view class="agreement" @tap="toggleAgree">
|
||||
<view class="agree-dot" :class="{ on: agreed }" />
|
||||
<text class="agree-text">
|
||||
登录即表示同意
|
||||
<text class="agree-link" @tap.stop="showAgreement">《用户协议》</text>
|
||||
和
|
||||
<text class="agree-link" @tap.stop="showAgreement">《隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 未勾选协议提示 -->
|
||||
<view v-if="!agreed && showAgreementTip" class="agree-tip">
|
||||
<FaIcon name="circle-info" color="#f79009" :size="12" />
|
||||
<text class="agree-tip-text">请先阅读并勾选同意《用户协议》和《隐私政策》</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="agreement" @tap="toggleAgree">
|
||||
<view class="agree-dot" :class="{ on: agreed }" />
|
||||
<text class="agree-text">
|
||||
登录即表示同意
|
||||
<text class="agree-link" @tap.stop="openLegal('user-agreement', '用户协议')">《用户协议》</text>
|
||||
和
|
||||
<text class="agree-link" @tap.stop="openLegal('privacy-policy', '隐私政策')">《隐私政策》</text>
|
||||
</text>
|
||||
<view class="foot-tip">
|
||||
<FaIcon name="shield-halved" color="#94a3b8" :size="12" />
|
||||
<text class="foot-tip-text">全程加密传输 · 账号安全可控</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -189,9 +223,25 @@ import {
|
||||
import { showGeetest4 } from '@/utils/geetest.js'
|
||||
import FaIcon from '@/components/FaIcon.vue'
|
||||
|
||||
const step = ref('password')
|
||||
/** 小程序端登录方式 Tab:wechat / account(其他端固定账号密码) */
|
||||
const activeTab = ref('wechat')
|
||||
/** 运行端检测:h5 / apk(app-plus) / mp-weixin,决定登录方式优先级 */
|
||||
const platform = ref('')
|
||||
// #ifdef H5
|
||||
platform.value = 'h5'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
platform.value = 'apk'
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
platform.value = 'mp-weixin'
|
||||
// #endif
|
||||
|
||||
/**
|
||||
* 视图状态:
|
||||
* main 微信一键登录主入口(小程序端默认视图)
|
||||
* account 账号密码登录(独立视图,由主视图弱化入口进入)
|
||||
* tenant 选择企业(一人多企业)
|
||||
*/
|
||||
const step = ref(platform.value === 'mp-weixin' ? 'main' : 'account')
|
||||
const account = ref('')
|
||||
const password = ref('')
|
||||
const showPassword = ref(false)
|
||||
@@ -207,36 +257,65 @@ const verifyCfg = ref({ needGeetest: false, captchaId: '' })
|
||||
/** 仅微信小程序端且服务端已开通时展示「一键登录」入口 */
|
||||
const showMiniLogin = ref(false)
|
||||
|
||||
/** 面板副标题:随 Tab 切换提示文案 */
|
||||
const panelSub = computed(() => {
|
||||
if (platform.value === 'mp-weixin' && showMiniLogin.value && activeTab.value === 'wechat') {
|
||||
return '微信授权,安全快捷地登录'
|
||||
}
|
||||
if (platform.value === 'mp-weixin' && showMiniLogin.value && activeTab.value === 'account') {
|
||||
return '使用已注册的账号继续'
|
||||
}
|
||||
return '请输入您的账号与密码以继续'
|
||||
/** 顶部导航标题 */
|
||||
const navTitle = computed(() => {
|
||||
if (step.value === 'tenant') return '选择企业'
|
||||
return '账号密码登录'
|
||||
})
|
||||
|
||||
/** 切换登录方式 Tab:清掉上一次残留的错误提示 */
|
||||
function switchTab(tab) {
|
||||
/**
|
||||
* 状态栏高度(px)。
|
||||
* 小程序端 env(safe-area-inset-top) 在无刘海的安卓机型返回 0,
|
||||
* 自绘导航会被状态栏压住,因此这里取系统信息里的真实状态栏高度。
|
||||
*/
|
||||
const statusBarHeight = ref(0)
|
||||
try {
|
||||
const info =
|
||||
typeof uni.getWindowInfo === 'function' ? uni.getWindowInfo() : uni.getSystemInfoSync()
|
||||
statusBarHeight.value = (info && info.statusBarHeight) || 0
|
||||
} catch (e) {
|
||||
statusBarHeight.value = 0
|
||||
}
|
||||
|
||||
/** 自绘导航的上内边距:状态栏高度(导航本体固定 88rpx) */
|
||||
const navPadTop = computed(() => `${statusBarHeight.value}px`)
|
||||
|
||||
/** 品牌区上内边距:主视图需让开状态栏,紧凑视图(账号/企业)由导航栏已占位 */
|
||||
const brandPadTop = computed(() => {
|
||||
if (step.value !== 'main') return '32rpx'
|
||||
return `${statusBarHeight.value + uni.upx2px(88)}px`
|
||||
})
|
||||
|
||||
/** 是否存在可返回的上级视图(账号密码视图仅在小程序端可退回主视图) */
|
||||
const canGoBack = computed(() => {
|
||||
if (step.value === 'tenant') return true
|
||||
if (step.value === 'account') return showMiniLogin.value
|
||||
return false
|
||||
})
|
||||
|
||||
/** 切换到账号密码登录视图 */
|
||||
function goAccount() {
|
||||
if (submitting.value) return
|
||||
if (activeTab.value === tab) return
|
||||
activeTab.value = tab
|
||||
step.value = 'account'
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
/** 运行端检测:h5 / apk(app-plus) / mp-weixin,决定登录方式优先级 */
|
||||
const platform = ref('')
|
||||
// #ifdef H5
|
||||
platform.value = 'h5'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
platform.value = 'apk'
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
platform.value = 'mp-weixin'
|
||||
// #endif
|
||||
/** 返回微信一键登录主视图 */
|
||||
function goMain() {
|
||||
if (submitting.value) return
|
||||
if (!showMiniLogin.value) return
|
||||
step.value = 'main'
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
/** 顶部导航返回 */
|
||||
function onNavBack() {
|
||||
if (step.value === 'tenant') {
|
||||
backToAccount()
|
||||
return
|
||||
}
|
||||
goMain()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (isLoggedIn()) {
|
||||
@@ -248,8 +327,6 @@ onMounted(async () => {
|
||||
if (remembered.rememberMe) {
|
||||
rememberMe.value = true
|
||||
account.value = remembered.account
|
||||
// 记住了账号,默认落在账号密码 Tab 更顺手
|
||||
activeTab.value = 'account'
|
||||
}
|
||||
|
||||
loadVerifyConfig()
|
||||
@@ -278,6 +355,10 @@ async function loadMiniLoginConfig() {
|
||||
} catch {
|
||||
showMiniLogin.value = false
|
||||
}
|
||||
// 服务端未开通一键登录:直接落到账号密码视图
|
||||
if (!showMiniLogin.value && step.value === 'main') {
|
||||
step.value = 'account'
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================== 登录主流程 ==================== */
|
||||
@@ -383,9 +464,10 @@ function chooseTenant(item) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 从「选择企业」退回账号密码视图 */
|
||||
function backToAccount() {
|
||||
clearAuthState()
|
||||
step.value = 'password'
|
||||
step.value = 'account'
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
@@ -509,13 +591,14 @@ function handleMiniError(err) {
|
||||
confirmText: '账号登录',
|
||||
confirmColor: '#2563eb',
|
||||
success: (res) => {
|
||||
if (res.confirm) switchTab('account')
|
||||
if (res.confirm) goAccount()
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (reason === 'not_configured') {
|
||||
showMiniLogin.value = false
|
||||
step.value = 'account'
|
||||
}
|
||||
showError(err)
|
||||
}
|
||||
@@ -538,11 +621,14 @@ function clearAuthState() {
|
||||
}
|
||||
|
||||
function showError(err) {
|
||||
errorMsg.value = (err && err.message) || '登录失败,请稍后重试'
|
||||
}
|
||||
|
||||
function goRegister() {
|
||||
uni.navigateTo({ url: '/pages/login/register' })
|
||||
const raw = (err && err.message) || ''
|
||||
// 微信未配置 request 合法域名:原始报错是英文,给出可操作的中文提示
|
||||
if (/url not in domain list/i.test(raw)) {
|
||||
errorMsg.value =
|
||||
'当前小程序未配置服务器域名,请在微信公众平台「开发管理 - 开发设置 - 服务器域名」中添加 api.yunzer.cn 为 request 合法域名'
|
||||
return
|
||||
}
|
||||
errorMsg.value = raw || '登录失败,请稍后重试'
|
||||
}
|
||||
|
||||
/** 勾选/取消用户协议:勾选后自动收起未勾选提示 */
|
||||
@@ -605,60 +691,123 @@ function goForget() {
|
||||
<style lang="scss" scoped>
|
||||
@import '@/src/styles/page-common.scss';
|
||||
|
||||
/* ---------- 页面骨架:浅蓝白渐变 ---------- */
|
||||
.login-page {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(145deg, #eaf6ff 0%, #f7fbff 48%, #dceeff 100%);
|
||||
padding: calc(env(safe-area-inset-top, 0px) + 24rpx) 32rpx calc(env(safe-area-inset-bottom, 0px) + 40rpx);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background: linear-gradient(180deg, #eef4ff 0%, #ffffff 38%, #f7f9fc 100%);
|
||||
padding: 0 32rpx calc(env(safe-area-inset-bottom, 0px) + 36rpx);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-page::before,
|
||||
.login-page::after {
|
||||
content: '';
|
||||
/* 主体(品牌 + 卡片):自动上下外边距实现垂直居中,内容超高时不裁切 */
|
||||
.login-body {
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
/* 背景光斑:纯装饰,径向渐变让边缘自然消隐 */
|
||||
.deco {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-page::before {
|
||||
width: 460rpx;
|
||||
height: 460rpx;
|
||||
top: -150rpx;
|
||||
right: -130rpx;
|
||||
background: rgba(111, 192, 255, 0.28);
|
||||
.deco-a {
|
||||
width: 560rpx;
|
||||
height: 560rpx;
|
||||
top: -260rpx;
|
||||
right: -240rpx;
|
||||
background: radial-gradient(circle, rgba(96, 165, 250, 0.26) 0%, rgba(96, 165, 250, 0) 70%);
|
||||
}
|
||||
|
||||
.login-page::after {
|
||||
width: 360rpx;
|
||||
height: 360rpx;
|
||||
bottom: 100rpx;
|
||||
left: -180rpx;
|
||||
background: rgba(151, 218, 255, 0.2);
|
||||
.deco-b {
|
||||
width: 520rpx;
|
||||
height: 520rpx;
|
||||
bottom: -260rpx;
|
||||
left: -240rpx;
|
||||
background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0) 70%);
|
||||
}
|
||||
|
||||
/* ---------- 顶部自绘导航 ---------- */
|
||||
.nav-bar {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
/* 高度不含状态栏内边距:padding-top 由脚本按真实状态栏高度注入 */
|
||||
box-sizing: content-box;
|
||||
height: 88rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-shrink: 0;
|
||||
|
||||
&.invisible {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-side {
|
||||
width: 64rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
/* ---------- 品牌区 ---------- */
|
||||
.brand {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: calc(env(safe-area-inset-top, 0px) + 56rpx);
|
||||
/* 上内边距由脚本按状态栏高度注入,这里给无脚本时的兜底值 */
|
||||
padding-top: 88rpx;
|
||||
padding-bottom: 48rpx;
|
||||
|
||||
&.compact {
|
||||
padding-bottom: 36rpx;
|
||||
|
||||
.brand-logo {
|
||||
width: 76rpx;
|
||||
height: 76rpx;
|
||||
border-radius: 22rpx;
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
margin-top: 16rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.brand-desc {
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.brand-logo {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 30rpx;
|
||||
background: linear-gradient(145deg, #79c8ff, #398fe7);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.88);
|
||||
box-shadow: 0 16rpx 36rpx rgba(57, 143, 231, 0.28), inset 0 1rpx 0 rgba(255, 255, 255, 0.48);
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 28rpx;
|
||||
background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
|
||||
box-shadow: 0 14rpx 30rpx rgba(37, 99, 235, 0.28);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -666,28 +815,27 @@ function goForget() {
|
||||
|
||||
.brand-name {
|
||||
margin-top: 22rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
font-size: 38rpx;
|
||||
font-weight: 600;
|
||||
letter-spacing: 2rpx;
|
||||
color: #173b67;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.brand-desc {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
letter-spacing: 1rpx;
|
||||
color: #7190af;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
/* ---------- 表单卡片 ---------- */
|
||||
.card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.92);
|
||||
border-radius: 34rpx;
|
||||
padding: 48rpx 36rpx 40rpx;
|
||||
box-shadow: 0 24rpx 70rpx rgba(74, 132, 184, 0.16), inset 0 1rpx 0 rgba(255, 255, 255, 0.9);
|
||||
z-index: 2;
|
||||
background: $color-card;
|
||||
border: 1rpx solid rgba(226, 232, 240, 0.9);
|
||||
border-radius: $radius-lg;
|
||||
padding: 44rpx 36rpx 32rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(15, 23, 42, 0.04), 0 18rpx 44rpx rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
@@ -723,6 +871,13 @@ function goForget() {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.loading-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 96rpx;
|
||||
}
|
||||
|
||||
.field {
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
@@ -739,9 +894,10 @@ function goForget() {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: rgba(248, 252, 255, 0.82);
|
||||
border: 1rpx solid #d8e9f7;
|
||||
border-radius: 18rpx;
|
||||
gap: 14rpx;
|
||||
background: #f8fafc;
|
||||
border: 1rpx solid $color-border;
|
||||
border-radius: $radius-md;
|
||||
padding: 0 20rpx;
|
||||
box-shadow: inset 0 2rpx 8rpx rgba(104, 158, 202, 0.05);
|
||||
}
|
||||
@@ -749,7 +905,7 @@ function goForget() {
|
||||
.field-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 88rpx;
|
||||
height: 92rpx;
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
}
|
||||
@@ -815,6 +971,7 @@ function goForget() {
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
/* 主按钮(账号密码登录) */
|
||||
.btn {
|
||||
height: 92rpx;
|
||||
border-radius: $radius-md;
|
||||
@@ -833,20 +990,23 @@ function goForget() {
|
||||
}
|
||||
}
|
||||
|
||||
/* 主 CTA:微信一键登录(品牌蓝,弱化微信绿以保持蓝白统一) */
|
||||
.btn-wechat {
|
||||
margin-top: 8rpx;
|
||||
margin-top: 0;
|
||||
height: 96rpx;
|
||||
border-radius: 20rpx;
|
||||
background: linear-gradient(110deg, #18b96b 0%, #09a95e 100%);
|
||||
background: linear-gradient(135deg, #2563eb 0%, #4f8ef7 100%);
|
||||
color: #ffffff;
|
||||
box-shadow: 0 14rpx 28rpx rgba(7, 193, 96, 0.2);
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
letter-spacing: 2rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
gap: 12rpx;
|
||||
border: none;
|
||||
padding: 0;
|
||||
box-shadow: 0 12rpx 26rpx rgba(37, 99, 235, 0.32);
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
@@ -857,83 +1017,13 @@ function goForget() {
|
||||
}
|
||||
}
|
||||
|
||||
/* 小程序备用登录入口,弱化账号密码路径 */
|
||||
.account-entry {
|
||||
margin: 36rpx auto 0;
|
||||
padding: 8rpx 20rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.account-entry-text {
|
||||
font-size: 24rpx;
|
||||
color: #7995ad;
|
||||
}
|
||||
|
||||
.account-entry-text {
|
||||
padding-bottom: 4rpx;
|
||||
border-bottom: 1rpx solid #c9dceb;
|
||||
}
|
||||
|
||||
.account-mode-label {
|
||||
margin: -14rpx 0 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.account-mode-back {
|
||||
font-size: 24rpx;
|
||||
color: #5688b7;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
/* 登录方式 Tab:微信登录 / 账号密码登录 */
|
||||
.login-tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 48rpx;
|
||||
margin-bottom: 36rpx;
|
||||
border-bottom: 1rpx solid $color-border;
|
||||
}
|
||||
|
||||
.login-tab {
|
||||
position: relative;
|
||||
padding: 0 4rpx 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-tab-text {
|
||||
font-size: 28rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.login-tab.on .login-tab-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.login-tab-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 0;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
background: #2563eb;
|
||||
transition: width 0.2s ease;
|
||||
}
|
||||
|
||||
.login-tab.on .login-tab-bar {
|
||||
width: 56rpx;
|
||||
.btn-wechat-text {
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.tip-row {
|
||||
margin-top: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -944,6 +1034,46 @@ function goForget() {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* 弱化入口:切换账号密码登录 */
|
||||
.alt-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
margin-top: 44rpx;
|
||||
}
|
||||
|
||||
.alt-line {
|
||||
width: 80rpx;
|
||||
height: 1rpx;
|
||||
background: $color-border;
|
||||
}
|
||||
|
||||
.alt-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* 弱化入口:切换账号密码登录 */
|
||||
.alt-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
margin-top: 44rpx;
|
||||
}
|
||||
|
||||
.alt-line {
|
||||
width: 80rpx;
|
||||
height: 1rpx;
|
||||
background: $color-border;
|
||||
}
|
||||
|
||||
.alt-text {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.back-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -954,7 +1084,7 @@ function goForget() {
|
||||
|
||||
.link {
|
||||
font-size: 26rpx;
|
||||
color: #2563eb;
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
/* ---------- 企业选择 ---------- */
|
||||
@@ -1023,8 +1153,8 @@ function goForget() {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12rpx;
|
||||
margin-top: 30rpx;
|
||||
padding: 0 8rpx;
|
||||
margin-top: 36rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
/* 协议勾选框:对号用 CSS 绘制(不依赖字体图标,任何端渲染一致) */
|
||||
@@ -1033,14 +1163,14 @@ function goForget() {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #bad3e8;
|
||||
background: rgba(255, 255, 255, 0.76);
|
||||
border: 2rpx solid #cbd5e1;
|
||||
background: $color-card;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2rpx;
|
||||
|
||||
&.on {
|
||||
background: #ffffff;
|
||||
border-color: #ffffff;
|
||||
background: $color-primary;
|
||||
border-color: $color-primary;
|
||||
}
|
||||
|
||||
/* 对号:两条边 + 旋转 45°,比图标字体更清晰 */
|
||||
@@ -1053,21 +1183,20 @@ function goForget() {
|
||||
height: 16rpx;
|
||||
margin-left: -5rpx;
|
||||
transform: translateY(-50%) rotate(45deg);
|
||||
border-right: 3rpx solid #1e3a8a;
|
||||
border-bottom: 3rpx solid #1e3a8a;
|
||||
border-right: 3rpx solid #ffffff;
|
||||
border-bottom: 3rpx solid #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.agree-text {
|
||||
flex: 1;
|
||||
font-size: 22rpx;
|
||||
color: #6e8da8;
|
||||
color: $color-text-secondary;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.agree-link {
|
||||
color: #347fbd;
|
||||
font-weight: 500;
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
/* 未勾选协议时的行内提示 */
|
||||
@@ -1078,13 +1207,29 @@ function goForget() {
|
||||
margin-top: 16rpx;
|
||||
padding: 12rpx 18rpx;
|
||||
border-radius: $radius-sm;
|
||||
background: rgba(247, 144, 9, 0.16);
|
||||
background: #fff7e6;
|
||||
border: 1rpx solid #ffe0a3;
|
||||
}
|
||||
|
||||
.agree-tip-text {
|
||||
font-size: 22rpx;
|
||||
color: #ad6400;
|
||||
color: #b45309;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
</style>
|
||||
/* ---------- 页脚 ---------- */
|
||||
.foot-tip {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.foot-tip-text {
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
</style>
|
||||
+95
-180
@@ -4,34 +4,17 @@
|
||||
<view class="head" :style="headPad">
|
||||
<view class="head-row">
|
||||
<view>
|
||||
<text class="head-title">工作空间</text>
|
||||
<text class="head-caption">选择一个应用,开始今天的工作</text>
|
||||
<text class="head-eyebrow">YUNZE WORKSPACE</text>
|
||||
<text class="head-title">工作台</text>
|
||||
</view>
|
||||
<view class="account-chip"><FaIcon name="user" color="#3478f6" :size="15" /><text>{{ user.account || '我的账号' }}</text></view>
|
||||
</view>
|
||||
<view class="tenant-switcher" :class="{ selectable: tenants.length > 1 }" @tap="openTenantPicker">
|
||||
<view class="tenant-mark"><FaIcon name="building" color="#3689d6" :size="17" /></view>
|
||||
<view class="tenant-current">
|
||||
<text class="tenant-label">当前公司</text>
|
||||
<text class="head-sub">{{ user.tenant || '云泽平台' }}</text>
|
||||
</view>
|
||||
<text v-if="user.account" class="tenant-account">{{ user.account }}</text>
|
||||
<FaIcon v-if="tenants.length > 1" name="chevron-right" color="#83a2be" :size="13" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="tenantPickerVisible" class="tenant-mask" @tap="closeTenantPicker">
|
||||
<view class="tenant-sheet" @tap.stop>
|
||||
<view class="sheet-head">
|
||||
<text class="sheet-title">切换公司</text>
|
||||
<text class="sheet-close" @tap="closeTenantPicker">完成</text>
|
||||
</view>
|
||||
<text class="sheet-sub">选择后将切换当前工作空间</text>
|
||||
<view v-for="item in tenants" :key="item.tid" class="tenant-option" :class="{ current: Number(item.tid) === currentTid, disabled: switchingTenant }" @tap="changeTenant(item)">
|
||||
<view class="tenant-option-icon"><FaIcon name="building" color="#398fe7" :size="16" /></view>
|
||||
<view class="tenant-option-info"><text class="tenant-option-name">{{ item.tenant_name || `企业${item.tid}` }}</text><text class="tenant-option-meta">{{ Number(item.tid) === currentTid ? '当前工作空间' : '切换到此公司' }}</text></view>
|
||||
<FaIcon v-if="Number(item.tid) === currentTid" name="circle-check" color="#398fe7" :size="18" />
|
||||
</view>
|
||||
<view class="tenant-switch" @tap="chooseTenant">
|
||||
<view class="tenant-mark"><FaIcon name="building" color="#ffffff" :size="19" /></view>
|
||||
<view class="tenant-copy"><text class="tenant-label">当前租户</text><text class="tenant-name">{{ user.tenant || '云泽平台' }}</text></view>
|
||||
<view class="tenant-action"><text>切换</text><FaIcon name="chevron-down" color="#3478f6" :size="12" /></view>
|
||||
</view>
|
||||
<text class="head-sub">选择一个业务系统,开始高效工作</text>
|
||||
</view>
|
||||
|
||||
<view class="body">
|
||||
@@ -78,7 +61,7 @@ import { mpHeadPad } from '@/utils/mpHead.js'
|
||||
|
||||
const headPad = mpHeadPad()
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn, getTenants, getTid, setAuthTokens, setTid, setTenantName } from '@/utils/auth.js'
|
||||
import { isLoggedIn, getTenants, getTid, setAuthTokens, setTid, setTenantName, getUser, setUser } from '@/utils/auth.js'
|
||||
import { switchTenant } from '@/api/auth.js'
|
||||
import { fetchHome } from '@/api/workspace.js'
|
||||
import { openMenu } from '@/utils/nav.js'
|
||||
@@ -106,9 +89,7 @@ const loadError = ref('')
|
||||
const user = ref({})
|
||||
const modules = ref([])
|
||||
const menus = ref([])
|
||||
const tenants = ref([])
|
||||
const currentTid = ref(0)
|
||||
const tenantPickerVisible = ref(false)
|
||||
const tenants = ref(getTenants())
|
||||
const switchingTenant = ref(false)
|
||||
|
||||
/** 叶子菜单(可直接跳转的功能页),已锁定的过滤掉 */
|
||||
@@ -146,7 +127,6 @@ const cards = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const enabledCount = computed(() => cards.value.filter((c) => !c.locked).length)
|
||||
|
||||
/* ==================== 数据加载 ==================== */
|
||||
|
||||
@@ -170,6 +150,41 @@ async function load(force = false) {
|
||||
|
||||
/* ==================== 交互 ==================== */
|
||||
|
||||
function chooseTenant() {
|
||||
const list = tenants.value
|
||||
if (list.length <= 1) { uni.showToast({ title: list.length ? '当前账号仅绑定一个租户' : '暂无可切换的租户', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (switchingTenant.value) return
|
||||
uni.showActionSheet({
|
||||
itemList: list.map((tenant) => tenant.tenant_name || `企业${tenant.tid}`),
|
||||
success: async ({ tapIndex }) => {
|
||||
const tenant = list[tapIndex]
|
||||
if (!tenant || String(tenant.tid) === String(getTid())) return
|
||||
switchingTenant.value = true
|
||||
uni.showLoading({ title: '正在切换...', mask: true })
|
||||
try {
|
||||
const res = await switchTenant({ tid: tenant.tid })
|
||||
if (!res || !res.tokens) throw new Error((res && res.msg) || '切换租户失败')
|
||||
setAuthTokens(res.tokens)
|
||||
setTid(tenant.tid)
|
||||
setTenantName(tenant.tenant_name || '')
|
||||
const profile = getUser() || {}
|
||||
const nextUser = { ...profile, tid: tenant.tid, tenant_name: tenant.tenant_name || '' }
|
||||
setUser(nextUser)
|
||||
user.value = { ...user.value, tenant: tenant.tenant_name || '', account: nextUser.account || user.value.account }
|
||||
await load(true)
|
||||
uni.showToast({ title: '已切换租户', icon: 'success' })
|
||||
} catch (e) {
|
||||
uni.showToast({ title: (e && e.message) || '切换失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
switchingTenant.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击子系统卡片 → 进入该子系统独立页面组(带自己的 tabbar)。
|
||||
* 未在 config/subsystems.js 注册的模块,降级为直接打开 Web 端该模块首页。
|
||||
@@ -258,89 +273,80 @@ onShow(() => {
|
||||
/* ============ 顶部信息(融入页面背景) ============ */
|
||||
.head {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 32rpx) $page-padding-x 12rpx;
|
||||
padding: calc(var(--status-bar-height, 44px) + 32rpx) $page-padding-x 28rpx;
|
||||
/* #ifdef MP-WEIXIN */
|
||||
/* 小程序端 --status-bar-height 固定 25px,需真实状态栏(env)+胶囊避让 */
|
||||
padding-top: calc(env(safe-area-inset-top, 25px) + 96rpx);
|
||||
/* #endif */
|
||||
background: $color-bg-page;
|
||||
background: linear-gradient(145deg, #eaf3ff 0%, #f5f9ff 58%, #ffffff 100%);
|
||||
border-bottom: 1rpx solid #e5efff;
|
||||
}
|
||||
|
||||
.head-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.head-title {
|
||||
font-size: 46rpx;
|
||||
.head-eyebrow {
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 18rpx;
|
||||
font-weight: 700;
|
||||
color: #193d61;
|
||||
letter-spacing: 3rpx;
|
||||
color: #6e9de5;
|
||||
}
|
||||
|
||||
.head-title {
|
||||
display: block;
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
color: #17345f;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.head-caption {
|
||||
display: block;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8aa2b8;
|
||||
}
|
||||
|
||||
.tenant-switcher {
|
||||
margin-top: 28rpx;
|
||||
padding: 20rpx 22rpx;
|
||||
.account-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.92);
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255, 255, 255, 0.78);
|
||||
box-shadow: 0 12rpx 32rpx rgba(81, 133, 176, 0.08);
|
||||
gap: 9rpx;
|
||||
padding: 12rpx 17rpx;
|
||||
border-radius: 30rpx;
|
||||
background: rgba(255,255,255,.85);
|
||||
color: #526b8d;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
&.selectable:active { background: #f4faff; }
|
||||
.tenant-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 28rpx;
|
||||
padding: 20rpx 22rpx;
|
||||
border: 1rpx solid #dceaff;
|
||||
border-radius: 18rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 8rpx 24rpx rgba(47, 110, 196, .08);
|
||||
}
|
||||
|
||||
.tenant-mark {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
flex-shrink: 0;
|
||||
border-radius: 20rpx;
|
||||
background: #eaf5ff;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(145deg, #69a5ff, #3478f6);
|
||||
}
|
||||
|
||||
.tenant-current {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tenant-label {
|
||||
display: block;
|
||||
margin-bottom: 5rpx;
|
||||
font-size: 20rpx;
|
||||
color: #94aabe;
|
||||
}
|
||||
.tenant-copy { flex: 1; min-width: 0; margin-left: 16rpx; }
|
||||
.tenant-label { display: block; font-size: 20rpx; color: #8a9bb3; }
|
||||
.tenant-name { display: block; margin-top: 5rpx; font-size: 27rpx; font-weight: 600; color: #203b62; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.tenant-action { display: flex; align-items: center; gap: 8rpx; color: #3478f6; font-size: 22rpx; font-weight: 600; }
|
||||
|
||||
.head-sub {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #294a68;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tenant-account {
|
||||
max-width: 180rpx;
|
||||
font-size: 21rpx;
|
||||
color: #8da3b7;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-top: 22rpx;
|
||||
font-size: 23rpx;
|
||||
color: #8295b0;
|
||||
}
|
||||
|
||||
/* ============ 内容区 ============ */
|
||||
@@ -349,101 +355,8 @@ onShow(() => {
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding: 8rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
.tenant-mask {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(18, 42, 68, 0.32);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.tenant-sheet {
|
||||
width: 100%;
|
||||
max-height: 72vh;
|
||||
overflow-y: auto;
|
||||
padding: 38rpx 32rpx calc(env(safe-area-inset-bottom, 0px) + 40rpx);
|
||||
box-sizing: border-box;
|
||||
border-radius: 36rpx 36rpx 0 0;
|
||||
background: linear-gradient(180deg, #f5faff 0%, #ffffff 24%);
|
||||
}
|
||||
|
||||
.sheet-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.sheet-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #203b56;
|
||||
}
|
||||
|
||||
.sheet-close {
|
||||
font-size: 25rpx;
|
||||
color: #398fe7;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.sheet-sub {
|
||||
display: block;
|
||||
margin: 8rpx 0 20rpx;
|
||||
font-size: 23rpx;
|
||||
color: #8aa0b4;
|
||||
}
|
||||
|
||||
.tenant-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
padding: 20rpx 16rpx;
|
||||
border-radius: 18rpx;
|
||||
border: 1rpx solid #edf3f8;
|
||||
margin-top: 12rpx;
|
||||
|
||||
&.current {
|
||||
background: #f2f8ff;
|
||||
border-color: #cfe5fa;
|
||||
}
|
||||
|
||||
&.disabled { opacity: 0.6; }
|
||||
}
|
||||
|
||||
.tenant-option-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #eaf5ff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tenant-option-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tenant-option-name,
|
||||
.tenant-option-meta { display: block; }
|
||||
|
||||
.tenant-option-name {
|
||||
font-size: 27rpx;
|
||||
font-weight: 500;
|
||||
color: #294763;
|
||||
}
|
||||
|
||||
.tenant-option-meta {
|
||||
margin-top: 5rpx;
|
||||
font-size: 22rpx;
|
||||
color: #91a5b8;
|
||||
padding: 20rpx $page-padding-x 0;
|
||||
background: #f5f8fd;
|
||||
}
|
||||
|
||||
/* ============ 失败提示 ============ */
|
||||
@@ -510,7 +423,9 @@ onShow(() => {
|
||||
|
||||
.portal-card {
|
||||
@include card;
|
||||
padding: 40rpx 16rpx 34rpx;
|
||||
padding: 34rpx 16rpx 30rpx;
|
||||
border: 1rpx solid #e6eef9;
|
||||
box-shadow: 0 6rpx 20rpx rgba(38, 86, 150, .045);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 平台信息 -->
|
||||
<view class="section-card">
|
||||
<view class="section-title">平台信息</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">平台名称 <text class="required">*</text></text>
|
||||
<u-input
|
||||
v-model="form.platform"
|
||||
placeholder="如:淘宝、企业微信"
|
||||
border="surround"
|
||||
maxlength="50"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">登录网址</text>
|
||||
<u-input
|
||||
v-model="form.url"
|
||||
placeholder="如:https://login.taobao.com"
|
||||
border="surround"
|
||||
maxlength="255"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">平台备注</text>
|
||||
<u-textarea
|
||||
v-model="form.remark"
|
||||
placeholder="选填,如:工作用账号"
|
||||
border="surround"
|
||||
maxlength="255"
|
||||
auto-height
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 挂载账号列表 -->
|
||||
<view class="section-card">
|
||||
<view class="section-head">
|
||||
<text class="section-title">挂载账号列表</text>
|
||||
<view class="add-acc-btn" @click="addAccount">
|
||||
<FaIcon name="plus" color="#2563eb" :size="13" />
|
||||
<text class="add-acc-text">添加账号</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-for="(acc, idx) in form.accounts" :key="idx" class="acc-block">
|
||||
<view class="acc-head">
|
||||
<text class="acc-index">账号 {{ idx + 1 }}</text>
|
||||
<view class="acc-del" @click="removeAccount(idx)">
|
||||
<FaIcon name="trash-can" color="#ef4444" :size="14" />
|
||||
<text class="acc-del-text">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">账号 / 用户名</text>
|
||||
<u-input
|
||||
v-model="acc.username"
|
||||
placeholder="登录账号或用户名"
|
||||
border="surround"
|
||||
maxlength="100"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">登录密码</text>
|
||||
<view class="gen-btn" @click="genPassword(idx)">
|
||||
<FaIcon name="rotate" color="#2563eb" :size="12" />
|
||||
<text class="gen-text">随机生成</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pwd-row">
|
||||
<u-input
|
||||
v-model="acc.password"
|
||||
:password="!shownPwd[idx]"
|
||||
placeholder="登录密码"
|
||||
border="surround"
|
||||
maxlength="50"
|
||||
/>
|
||||
<view class="pwd-eye" @click="shownPwd[idx] = !shownPwd[idx]">
|
||||
<FaIcon :name="shownPwd[idx] ? 'eye-slash' : 'eye'" color="#94a3b8" :size="16" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">注册信息</text>
|
||||
<u-textarea
|
||||
v-model="acc.registration_info"
|
||||
placeholder="选填,如:注册手机号、邮箱"
|
||||
border="surround"
|
||||
maxlength="255"
|
||||
auto-height
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">账号备注</text>
|
||||
<u-textarea
|
||||
v-model="acc.remark"
|
||||
placeholder="选填"
|
||||
border="surround"
|
||||
maxlength="255"
|
||||
auto-height
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!form.accounts.length" class="acc-empty">
|
||||
暂无账号,点击右上角「添加账号」
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 保存 -->
|
||||
<view class="footer">
|
||||
<u-button
|
||||
type="primary"
|
||||
text="保存"
|
||||
:loading="saving"
|
||||
:disabled="saving"
|
||||
shape="circle"
|
||||
@click="onSubmit"
|
||||
/>
|
||||
<u-button
|
||||
v-if="id"
|
||||
type="error"
|
||||
plain
|
||||
text="删除记录"
|
||||
shape="circle"
|
||||
@click="onDelete"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import {
|
||||
getPasswordStore,
|
||||
createPasswordStore,
|
||||
updatePasswordStore,
|
||||
deletePasswordStore
|
||||
} from '@/api/passwordStore.js'
|
||||
|
||||
const id = ref(0)
|
||||
const saving = ref(false)
|
||||
const shownPwd = ref({})
|
||||
|
||||
const form = reactive({
|
||||
platform: '',
|
||||
url: '',
|
||||
remark: '',
|
||||
accounts: []
|
||||
})
|
||||
|
||||
function blankAccount() {
|
||||
return { username: '', password: '', registration_info: '', remark: '' }
|
||||
}
|
||||
|
||||
function addAccount() {
|
||||
form.accounts.push(blankAccount())
|
||||
}
|
||||
|
||||
function removeAccount(idx) {
|
||||
form.accounts.splice(idx, 1)
|
||||
}
|
||||
|
||||
function genPassword(idx) {
|
||||
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789!@#$%^&*'
|
||||
let pwd = ''
|
||||
for (let i = 0; i < 16; i++) {
|
||||
pwd += chars.charAt(Math.floor(Math.random() * chars.length))
|
||||
}
|
||||
form.accounts[idx].password = pwd
|
||||
shownPwd.value[idx] = true
|
||||
uni.showToast({ title: '已生成随机密码', icon: 'none' })
|
||||
}
|
||||
|
||||
async function loadDetail() {
|
||||
uni.showLoading({ title: '加载中' })
|
||||
try {
|
||||
const data = await getPasswordStore(id.value)
|
||||
form.platform = data.platform
|
||||
form.url = data.url
|
||||
form.remark = data.remark
|
||||
form.accounts = data.accounts.length ? data.accounts : [blankAccount()]
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
function validate() {
|
||||
if (!form.platform.trim()) {
|
||||
uni.showToast({ title: '请输入平台名称', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
if (!validate()) return
|
||||
saving.value = true
|
||||
try {
|
||||
const payload = {
|
||||
platform: form.platform.trim(),
|
||||
url: form.url.trim(),
|
||||
remark: form.remark.trim(),
|
||||
accounts: form.accounts.filter(
|
||||
a => a.username || a.password || a.registration_info || a.remark
|
||||
)
|
||||
}
|
||||
if (id.value) {
|
||||
await updatePasswordStore(id.value, payload)
|
||||
} else {
|
||||
await createPasswordStore(payload)
|
||||
}
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onDelete() {
|
||||
uni.showModal({
|
||||
title: '删除记录',
|
||||
content: '确定删除该平台及其全部账号?',
|
||||
confirmText: '删除',
|
||||
confirmColor: '#ef4444',
|
||||
success: async res => {
|
||||
if (!res.confirm) return
|
||||
try {
|
||||
await deletePasswordStore(id.value)
|
||||
uni.showToast({ title: '已删除', icon: 'none' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
if (options.id) {
|
||||
id.value = Number(options.id)
|
||||
uni.setNavigationBarTitle({ title: '编辑账号' })
|
||||
loadDetail()
|
||||
} else {
|
||||
form.accounts.push(blankAccount())
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 24rpx 24rpx calc(60rpx + env(safe-area-inset-bottom));
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.section-card {
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.add-acc-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
}
|
||||
|
||||
.add-acc-text {
|
||||
font-size: 24rpx;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.field {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #475569;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.field-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.field-label-row .field-label {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.gen-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 6rpx 12rpx;
|
||||
}
|
||||
|
||||
.gen-text {
|
||||
font-size: 22rpx;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.pwd-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.pwd-row :deep(.u-input) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pwd-eye {
|
||||
padding: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.acc-block {
|
||||
margin-top: 24rpx;
|
||||
padding: 20rpx;
|
||||
background: #f8fafc;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.acc-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.acc-index {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.acc-del {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 6rpx 12rpx;
|
||||
}
|
||||
|
||||
.acc-del-text {
|
||||
font-size: 22rpx;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.acc-empty {
|
||||
padding: 32rpx 0;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,388 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部工具栏 -->
|
||||
<view class="toolbar">
|
||||
<u-search
|
||||
v-model="keyword"
|
||||
placeholder="搜索平台、网址、账号、备注"
|
||||
:show-action="false"
|
||||
bg-color="#eef2f7"
|
||||
shape="round"
|
||||
@input="onKeywordInput"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 统计 -->
|
||||
<view class="stats-row">
|
||||
<text class="stats-text">共 {{ total }} 条</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view v-if="loading" class="loading-wrap">
|
||||
<u-loading-icon mode="circle" size="36" color="#2563eb"></u-loading-icon>
|
||||
</view>
|
||||
|
||||
<!-- 空态 -->
|
||||
<u-empty
|
||||
v-else-if="!list.length"
|
||||
mode="data"
|
||||
text="还没有账号记录"
|
||||
margin-top="120"
|
||||
/>
|
||||
|
||||
<!-- 账号卡片列表 -->
|
||||
<view v-else class="store-list">
|
||||
<view v-for="store in list" :key="store.id" class="store-card">
|
||||
<!-- 平台头 -->
|
||||
<view class="store-head" @click="toggleExpand(store.id)">
|
||||
<view class="store-icon">
|
||||
<FaIcon name="key" color="#2563eb" :size="18" />
|
||||
</view>
|
||||
<view class="store-title-wrap">
|
||||
<view class="store-title">{{ store.platform || '未命名平台' }}</view>
|
||||
<view class="store-sub">
|
||||
<text v-if="store.url">{{ store.url }}</text>
|
||||
<text v-else class="sub-weak">未填写网址</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="store-count">
|
||||
<u-tag
|
||||
:text="store.accounts.length + ' 个账号'"
|
||||
plain
|
||||
size="mini"
|
||||
type="primary"
|
||||
/>
|
||||
</view>
|
||||
<FaIcon
|
||||
:name="expandedId === store.id ? 'chevron-up' : 'chevron-down'"
|
||||
color="#94a3b8"
|
||||
:size="14"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 平台备注 -->
|
||||
<view v-if="store.remark" class="store-remark">{{ store.remark }}</view>
|
||||
|
||||
<!-- 账号明细 -->
|
||||
<view v-if="expandedId === store.id" class="account-list">
|
||||
<view v-for="(acc, idx) in store.accounts" :key="idx" class="account-item">
|
||||
<view class="account-row">
|
||||
<text class="account-label">账号</text>
|
||||
<text class="account-value">{{ acc.username || '-' }}</text>
|
||||
<view class="copy-btn" @click.stop="copyText(acc.username)">
|
||||
<FaIcon name="copy" color="#2563eb" :size="14" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="account-row">
|
||||
<text class="account-label">密码</text>
|
||||
<text class="account-value">{{ shownPwd[accKey(store, idx)] ? (acc.password || '-') : '••••••••' }}</text>
|
||||
<view class="copy-btn" @click.stop="togglePwd(store, idx)">
|
||||
<FaIcon :name="shownPwd[accKey(store, idx)] ? 'eye-slash' : 'eye'" color="#94a3b8" :size="14" />
|
||||
</view>
|
||||
<view class="copy-btn" @click.stop="copyText(acc.password)">
|
||||
<FaIcon name="copy" color="#2563eb" :size="14" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="acc.registration_info" class="account-row">
|
||||
<text class="account-label">注册信息</text>
|
||||
<text class="account-value">{{ acc.registration_info }}</text>
|
||||
</view>
|
||||
<view v-if="acc.remark" class="account-row">
|
||||
<text class="account-label">备注</text>
|
||||
<text class="account-value">{{ acc.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!store.accounts.length" class="account-empty">该平台暂无账号</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作行 -->
|
||||
<view class="actions-row">
|
||||
<view class="action-btn" @click.stop="goEdit(store.id)">
|
||||
<FaIcon name="pen-to-square" color="#2563eb" :size="14" />
|
||||
<text class="action-text">编辑</text>
|
||||
</view>
|
||||
<view class="action-btn" @click.stop="onDelete(store)">
|
||||
<FaIcon name="trash-can" color="#ef4444" :size="14" />
|
||||
<text class="action-text danger">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 悬浮新增 -->
|
||||
<view class="fab" @click="goEdit()">
|
||||
<FaIcon name="plus" color="#ffffff" :size="24" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { fetchPasswordStores, deletePasswordStore } from '@/api/passwordStore.js'
|
||||
|
||||
const keyword = ref('')
|
||||
const list = ref([])
|
||||
const loading = ref(true)
|
||||
const expandedId = ref(0)
|
||||
const shownPwd = ref({})
|
||||
const total = ref(0)
|
||||
const inited = ref(false)
|
||||
|
||||
let debounceTimer = 0
|
||||
function onKeywordInput() {
|
||||
clearTimeout(debounceTimer)
|
||||
debounceTimer = setTimeout(loadList, 300)
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await fetchPasswordStores(keyword.value.trim())
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function toggleExpand(id) {
|
||||
expandedId.value = expandedId.value === id ? 0 : id
|
||||
}
|
||||
|
||||
function accKey(store, idx) {
|
||||
return `${store.id}_${idx}`
|
||||
}
|
||||
|
||||
function togglePwd(store, idx) {
|
||||
const key = accKey(store, idx)
|
||||
shownPwd.value = { ...shownPwd.value, [key]: !shownPwd.value[key] }
|
||||
}
|
||||
|
||||
function copyText(text) {
|
||||
if (!text) {
|
||||
uni.showToast({ title: '内容为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => uni.showToast({ title: '已复制', icon: 'none' })
|
||||
})
|
||||
}
|
||||
|
||||
function goEdit(id) {
|
||||
uni.navigateTo({
|
||||
url: id ? `/pages/tools/account/edit?id=${id}` : '/pages/tools/account/edit'
|
||||
})
|
||||
}
|
||||
|
||||
function onDelete(store) {
|
||||
uni.showModal({
|
||||
title: '删除记录',
|
||||
content: `确定删除「${store.platform || '未命名平台'}」及其全部账号?`,
|
||||
confirmText: '删除',
|
||||
confirmColor: '#ef4444',
|
||||
success: async res => {
|
||||
if (!res.confirm) return
|
||||
try {
|
||||
await deletePasswordStore(store.id)
|
||||
uni.showToast({ title: '已删除', icon: 'none' })
|
||||
loadList()
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(() => loadList())
|
||||
onShow(() => {
|
||||
// 从编辑页返回后刷新(首次进入由 onLoad 加载,避免重复请求)
|
||||
if (inited.value) loadList()
|
||||
inited.value = true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding-bottom: calc(180rpx + env(safe-area-inset-bottom));
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
padding: 20rpx 24rpx 8rpx;
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
padding: 8rpx 32rpx 12rpx;
|
||||
}
|
||||
|
||||
.stats-text {
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
padding: 120rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.store-list {
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.store-card {
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.store-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.store-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #eff6ff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.store-title-wrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.store-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.store-sub {
|
||||
margin-top: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: #475569;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.sub-weak {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.store-count {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.store-remark {
|
||||
margin-top: 16rpx;
|
||||
padding: 16rpx;
|
||||
background: #f8fafc;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #475569;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.account-list {
|
||||
margin-top: 16rpx;
|
||||
border-top: 1rpx solid #f1f5f9;
|
||||
}
|
||||
|
||||
.account-item {
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #f1f5f9;
|
||||
}
|
||||
|
||||
.account-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.account-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
min-height: 56rpx;
|
||||
}
|
||||
|
||||
.account-label {
|
||||
width: 120rpx;
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.account-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 26rpx;
|
||||
color: #0f172a;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
padding: 8rpx 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.account-empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.actions-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 32rpx;
|
||||
margin-top: 16rpx;
|
||||
padding-top: 16rpx;
|
||||
border-top: 1rpx solid #f1f5f9;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: 24rpx;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.action-text.danger {
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 40rpx;
|
||||
bottom: calc(80rpx + env(safe-area-inset-bottom));
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 52rpx;
|
||||
background: #2563eb;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 12rpx 32rpx rgba(37, 99, 235, 0.35);
|
||||
}
|
||||
|
||||
.fab:active {
|
||||
transform: scale(0.94);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,377 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="form-card">
|
||||
<view class="field">
|
||||
<text class="field-label">日程内容 <text class="required">*</text></text>
|
||||
<u-textarea
|
||||
v-model="form.content"
|
||||
placeholder="输入日程提醒内容"
|
||||
:maxlength="500"
|
||||
count
|
||||
height="140"
|
||||
border="none"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">日程时间 <text class="required">*</text></text>
|
||||
<view class="dt-row">
|
||||
<picker mode="date" :value="form.date" @change="onDateChange" class="dt-picker">
|
||||
<view class="picker-value">
|
||||
<text>{{ form.date || '选择日期' }}</text>
|
||||
<FaIcon name="calendar-days" color="#94a3b8" :size="15" />
|
||||
</view>
|
||||
</picker>
|
||||
<picker mode="time" :value="form.time" @change="onTimeChange" class="dt-picker">
|
||||
<view class="picker-value">
|
||||
<text>{{ form.time || '选择时间' }}</text>
|
||||
<FaIcon name="clock" color="#94a3b8" :size="15" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">提前提醒</text>
|
||||
<picker :range="minutesLabels" :value="minutesIndex" @change="onMinutesChange">
|
||||
<view class="picker-value">
|
||||
<text>{{ minutesLabels[minutesIndex] }}</text>
|
||||
<FaIcon name="bell" color="#94a3b8" :size="15" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">提醒渠道 <text class="required">*</text></text>
|
||||
<view class="channel-grid">
|
||||
<view
|
||||
v-for="opt in channelOptions"
|
||||
:key="opt.value"
|
||||
class="channel-chip"
|
||||
:class="{ active: form.remindChannels.includes(opt.value), disabled: opt.disabled }"
|
||||
@tap="toggleChannel(opt)"
|
||||
>
|
||||
<text>{{ opt.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="form-tip">可多选,至少选择一个提醒渠道</text>
|
||||
</view>
|
||||
|
||||
<template v-if="hasRepeatChannel">
|
||||
<view class="field">
|
||||
<text class="field-label">重复提醒间隔</text>
|
||||
<picker :range="repeatLabels" :value="repeatIndex" @change="onRepeatChange">
|
||||
<view class="picker-value">
|
||||
<text>{{ repeatLabels[repeatIndex] }}</text>
|
||||
<FaIcon name="rotate" color="#94a3b8" :size="15" />
|
||||
</view>
|
||||
</picker>
|
||||
<text class="form-tip">仅邮件 / Bark 渠道支持重复提醒</text>
|
||||
</view>
|
||||
|
||||
<view v-if="form.repeatIntervalMinutes > 0" class="field">
|
||||
<text class="field-label">最大发送次数</text>
|
||||
<picker :range="maxSendLabels" :value="maxSendIndex" @change="onMaxSendChange">
|
||||
<view class="picker-value">
|
||||
<text>{{ maxSendLabels[maxSendIndex] }}</text>
|
||||
<FaIcon name="clock" color="#94a3b8" :size="15" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<view class="footer">
|
||||
<u-button
|
||||
type="primary"
|
||||
color="#2563eb"
|
||||
shape="circle"
|
||||
:loading="saving"
|
||||
loading-text="保存中..."
|
||||
text="保存"
|
||||
@click="onSave"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import {
|
||||
getSchedule,
|
||||
createSchedule,
|
||||
updateSchedule,
|
||||
REMIND_CHANNEL_OPTIONS,
|
||||
REMIND_MINUTES_OPTIONS
|
||||
} from '@/api/schedule.js'
|
||||
import { formatDate, pad } from '@/utils/date.js'
|
||||
|
||||
const reminderId = ref('')
|
||||
const saving = ref(false)
|
||||
|
||||
// 渠道选择:Bark/APP 暂时隐藏,短信暂不可选
|
||||
const channelOptions = REMIND_CHANNEL_OPTIONS
|
||||
.filter(opt => opt.value !== 'bark' && opt.value !== 'app')
|
||||
.map(opt => ({ ...opt, disabled: opt.value === 'sms' }))
|
||||
const minutesLabels = REMIND_MINUTES_OPTIONS.map(item => item.label)
|
||||
|
||||
const REPEAT_OPTIONS = [
|
||||
{ label: '不重复', value: 0 },
|
||||
{ label: '每 10 分钟', value: 10 },
|
||||
{ label: '每 30 分钟', value: 30 },
|
||||
{ label: '每 1 小时', value: 60 },
|
||||
{ label: '每 6 小时', value: 360 },
|
||||
{ label: '每 1 天', value: 1440 }
|
||||
]
|
||||
const repeatLabels = REPEAT_OPTIONS.map(item => item.label)
|
||||
|
||||
const MAX_SEND_OPTIONS = [1, 2, 3, 5, 10]
|
||||
const maxSendLabels = MAX_SEND_OPTIONS.map(n => `${n} 次`)
|
||||
|
||||
const form = reactive({
|
||||
content: '',
|
||||
date: '',
|
||||
time: '',
|
||||
remindMinutes: 15,
|
||||
remindChannels: ['site'],
|
||||
repeatIntervalMinutes: 0,
|
||||
maxSendCount: 1
|
||||
})
|
||||
|
||||
const minutesIndex = computed(() => {
|
||||
const i = REMIND_MINUTES_OPTIONS.findIndex(item => item.value === form.remindMinutes)
|
||||
return i >= 0 ? i : 2
|
||||
})
|
||||
|
||||
const repeatIndex = computed(() => {
|
||||
const i = REPEAT_OPTIONS.findIndex(item => item.value === form.repeatIntervalMinutes)
|
||||
return i >= 0 ? i : 0
|
||||
})
|
||||
|
||||
const maxSendIndex = computed(() => {
|
||||
const i = MAX_SEND_OPTIONS.indexOf(form.maxSendCount)
|
||||
return i >= 0 ? i : 0
|
||||
})
|
||||
|
||||
const hasRepeatChannel = computed(() =>
|
||||
form.remindChannels.some(ch => ch === 'email' || ch === 'bark')
|
||||
)
|
||||
|
||||
onLoad(async (query) => {
|
||||
const now = new Date()
|
||||
form.date = formatDate(now)
|
||||
form.time = `${pad(now.getHours())}:${pad(now.getMinutes())}`
|
||||
|
||||
if (query?.id) {
|
||||
reminderId.value = query.id
|
||||
uni.setNavigationBarTitle({ title: '编辑日程提醒' })
|
||||
await loadReminder(query.id)
|
||||
} else {
|
||||
uni.setNavigationBarTitle({ title: '新增日程提醒' })
|
||||
}
|
||||
})
|
||||
|
||||
async function loadReminder(id) {
|
||||
try {
|
||||
const item = await getSchedule(id)
|
||||
if (!item) {
|
||||
uni.showToast({ title: '日程不存在', icon: 'none' })
|
||||
setTimeout(() => uni.navigateBack(), 800)
|
||||
return
|
||||
}
|
||||
form.content = item.content || ''
|
||||
if (item.datetime) {
|
||||
const d = new Date(item.datetime)
|
||||
form.date = formatDate(d)
|
||||
form.time = `${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||
}
|
||||
form.remindMinutes = item.remindMinutes ?? 15
|
||||
form.remindChannels = (item.remindChannels || [])
|
||||
.filter(ch => ch !== 'bark' && ch !== 'app')
|
||||
form.repeatIntervalMinutes = item.repeatIntervalMinutes ?? 0
|
||||
form.maxSendCount = item.maxSendCount ?? 1
|
||||
if (!form.remindChannels.length) form.remindChannels = ['site']
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
function onDateChange(e) {
|
||||
form.date = e.detail.value
|
||||
}
|
||||
|
||||
function onTimeChange(e) {
|
||||
form.time = e.detail.value
|
||||
}
|
||||
|
||||
function onMinutesChange(e) {
|
||||
form.remindMinutes = REMIND_MINUTES_OPTIONS[Number(e.detail.value)].value
|
||||
}
|
||||
|
||||
function onRepeatChange(e) {
|
||||
form.repeatIntervalMinutes = REPEAT_OPTIONS[Number(e.detail.value)].value
|
||||
}
|
||||
|
||||
function onMaxSendChange(e) {
|
||||
form.maxSendCount = MAX_SEND_OPTIONS[Number(e.detail.value)]
|
||||
}
|
||||
|
||||
function toggleChannel(opt) {
|
||||
if (opt.disabled) {
|
||||
uni.showToast({ title: '短信提醒暂不可用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const i = form.remindChannels.indexOf(opt.value)
|
||||
if (i >= 0) {
|
||||
form.remindChannels.splice(i, 1)
|
||||
} else {
|
||||
form.remindChannels.push(opt.value)
|
||||
}
|
||||
}
|
||||
|
||||
async function onSave() {
|
||||
if (saving.value) return
|
||||
if (!form.content.trim()) {
|
||||
uni.showToast({ title: '请输入日程内容', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.date || !form.time) {
|
||||
uni.showToast({ title: '请选择日程时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.remindChannels.length) {
|
||||
uni.showToast({ title: '请选择提醒渠道', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
saving.value = true
|
||||
const [y, m, d] = form.date.split('-').map(Number)
|
||||
const [hh, mm] = form.time.split(':').map(Number)
|
||||
const payload = {
|
||||
content: form.content.trim(),
|
||||
datetime: new Date(y, m - 1, d, hh, mm).getTime(),
|
||||
remindChannels: form.remindChannels.slice(),
|
||||
remindMinutes: form.remindMinutes,
|
||||
repeatIntervalMinutes: form.repeatIntervalMinutes,
|
||||
maxSendCount: form.maxSendCount
|
||||
}
|
||||
try {
|
||||
if (reminderId.value) {
|
||||
await updateSchedule(reminderId.value, payload)
|
||||
} else {
|
||||
await createSchedule(payload)
|
||||
}
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/src/styles/page-common.scss';
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: $color-bg-page;
|
||||
padding: 24rpx $page-padding-x;
|
||||
padding-bottom: calc(180rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.form-card {
|
||||
@include card;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.field {
|
||||
padding: 24rpx 28rpx;
|
||||
|
||||
& + & {
|
||||
border-top: 1rpx solid $color-divider;
|
||||
}
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.picker-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 72rpx;
|
||||
padding: 0 20rpx;
|
||||
background: $color-bg-page;
|
||||
border-radius: $radius-md;
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.dt-row {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.dt-picker {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.channel-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.channel-chip {
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 32rpx;
|
||||
background: $color-bg-page;
|
||||
border: 1rpx solid $color-border;
|
||||
font-size: 26rpx;
|
||||
color: $color-text;
|
||||
|
||||
&.active {
|
||||
background: rgba(37, 99, 235, 0.08);
|
||||
border-color: $color-primary;
|
||||
color: $color-primary;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.45;
|
||||
}
|
||||
}
|
||||
|
||||
.form-tip {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
padding: 20rpx $page-padding-x;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
background: $color-card;
|
||||
border-top: 1rpx solid $color-border;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
</style>
|
||||
@@ -14,20 +14,52 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 周历条 -->
|
||||
<view class="week-card">
|
||||
<view
|
||||
v-for="d in weekDays"
|
||||
:key="d.key"
|
||||
class="week-item"
|
||||
@tap="pickWeekDay(d)"
|
||||
>
|
||||
<text class="week-name">{{ d.name }}</text>
|
||||
<!-- 月历(可下拉展开) -->
|
||||
<view class="cal-card">
|
||||
<view class="cal-header">
|
||||
<view class="cal-nav" @tap="switchMonth(-1)">
|
||||
<FaIcon name="chevron-left" color="#94a3b8" :size="13" />
|
||||
</view>
|
||||
<text class="cal-title">{{ monthLabel }}</text>
|
||||
<view class="cal-nav" @tap="switchMonth(1)">
|
||||
<FaIcon name="chevron-right" color="#94a3b8" :size="13" />
|
||||
</view>
|
||||
<view class="cal-toggle" @tap="monthOpen = !monthOpen">
|
||||
<text class="cal-toggle-text">{{ monthOpen ? '收起' : '展开月历' }}</text>
|
||||
<FaIcon :name="monthOpen ? 'chevron-up' : 'chevron-down'" color="#2563eb" :size="12" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 周历条 -->
|
||||
<view class="week-strip">
|
||||
<view
|
||||
class="week-date"
|
||||
:class="{ today: d.isToday, selected: d.key === selectedKey }"
|
||||
>{{ d.day }}</view>
|
||||
<view class="week-dot" :class="{ show: d.count > 0 }" />
|
||||
v-for="d in weekDays"
|
||||
:key="d.key"
|
||||
class="week-item"
|
||||
@tap="pickWeekDay(d)"
|
||||
>
|
||||
<text class="week-name">{{ d.name }}</text>
|
||||
<view
|
||||
class="week-date"
|
||||
:class="{ today: d.isToday, selected: d.key === selectedKey }"
|
||||
>{{ d.day }}</view>
|
||||
<view class="week-dot" :class="{ show: d.count > 0 }" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 月历展开 -->
|
||||
<view v-if="monthOpen" class="month-grid">
|
||||
<text v-for="n in WEEK_LABELS" :key="'w' + n" class="month-weekname">周{{ n }}</text>
|
||||
<view
|
||||
v-for="cell in monthCells"
|
||||
:key="cell.key"
|
||||
class="month-day"
|
||||
:class="{ muted: !cell.inMonth, today: cell.isToday, selected: cell.selected }"
|
||||
@tap="pickMonthDay(cell)"
|
||||
>
|
||||
<view class="month-day-num"><text>{{ cell.day }}</text></view>
|
||||
<view class="week-dot" :class="{ show: cell.count > 0 }" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -48,7 +80,7 @@
|
||||
:text="range === 'week' ? '本周暂无日程提醒' : '当天暂无日程提醒'"
|
||||
/>
|
||||
<view v-else class="rem-list">
|
||||
<view v-for="item in shownItems" :key="item.id" class="rem-card" @tap="openDetail(item.id)">
|
||||
<view v-for="item in shownItems" :key="item.id" class="rem-card" @tap="openEdit(item.id)">
|
||||
<view class="rem-time">
|
||||
<text class="rem-day">{{ shortDayLabel(item.datetime) }}</text>
|
||||
<text class="rem-clock">{{ timeText(item.datetime) }}</text>
|
||||
@@ -68,11 +100,18 @@
|
||||
</view>
|
||||
|
||||
<view class="bottom-space" />
|
||||
|
||||
<!-- 新增按钮 -->
|
||||
<view class="fab" @tap="openCreate">
|
||||
<FaIcon name="plus" color="#ffffff" :size="20" />
|
||||
<text class="fab-text">新增</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { fetchSchedules, getRemindChannelLabel, getRemindMinutesLabel } from '@/api/schedule.js'
|
||||
import { pad, startOfDay, isToday } from '@/utils/date.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
@@ -99,6 +138,52 @@ function startOfWeek(base = new Date()) {
|
||||
const weekStart = computed(() => startOfWeek(selectedDate.value))
|
||||
const selectedKey = computed(() => dateKey(selectedDate.value))
|
||||
|
||||
/* ---------- 月历(可下拉展开) ---------- */
|
||||
const monthOpen = ref(false)
|
||||
const viewYear = ref(new Date().getFullYear())
|
||||
const viewMonth = ref(new Date().getMonth()) // 0-based
|
||||
|
||||
const monthLabel = computed(() => `${viewYear.value}年${viewMonth.value + 1}月`)
|
||||
|
||||
function switchMonth(step) {
|
||||
let y = viewYear.value
|
||||
let m = viewMonth.value + step
|
||||
if (m < 0) {
|
||||
m = 11
|
||||
y -= 1
|
||||
} else if (m > 11) {
|
||||
m = 0
|
||||
y += 1
|
||||
}
|
||||
viewYear.value = y
|
||||
viewMonth.value = m
|
||||
}
|
||||
|
||||
/** 月历格子:从包含 1 号的那周周一起,固定 6 行 × 7 列 */
|
||||
const monthCells = computed(() => {
|
||||
const first = new Date(viewYear.value, viewMonth.value, 1)
|
||||
const offset = (first.getDay() + 6) % 7
|
||||
const start = new Date(viewYear.value, viewMonth.value, 1 - offset)
|
||||
return Array.from({ length: 42 }, (_, i) => {
|
||||
const d = new Date(start.getFullYear(), start.getMonth(), start.getDate() + i)
|
||||
const key = dateKey(d)
|
||||
return {
|
||||
key,
|
||||
date: d,
|
||||
day: d.getDate(),
|
||||
inMonth: d.getMonth() === viewMonth.value && d.getFullYear() === viewYear.value,
|
||||
isToday: isToday(d),
|
||||
selected: key === selectedKey.value,
|
||||
count: (reminderMap.value[key] || []).length
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function pickMonthDay(cell) {
|
||||
selectedDate.value = startOfDay(cell.date)
|
||||
range.value = 'day'
|
||||
}
|
||||
|
||||
/** 只保留已设置提醒渠道的日程 */
|
||||
const reminders = computed(() =>
|
||||
schedules.value.filter((item) => item.remindChannels && item.remindChannels.length > 0)
|
||||
@@ -176,16 +261,24 @@ function remindLine(item) {
|
||||
|
||||
function pickWeekDay(d) {
|
||||
selectedDate.value = startOfDay(d.date)
|
||||
viewYear.value = d.date.getFullYear()
|
||||
viewMonth.value = d.date.getMonth()
|
||||
range.value = 'day'
|
||||
}
|
||||
|
||||
function showToday() {
|
||||
selectedDate.value = startOfDay(new Date())
|
||||
viewYear.value = selectedDate.value.getFullYear()
|
||||
viewMonth.value = selectedDate.value.getMonth()
|
||||
range.value = 'day'
|
||||
}
|
||||
|
||||
function openDetail(id) {
|
||||
uni.navigateTo({ url: `/pages/tools/schedule/detail?id=${id}` })
|
||||
function openEdit(id) {
|
||||
uni.navigateTo({ url: `/pages/tools/schedule/reminder-edit?id=${id}` })
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
uni.navigateTo({ url: '/pages/tools/schedule/reminder-edit' })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -196,6 +289,12 @@ onMounted(() => {
|
||||
loadReminders()
|
||||
})
|
||||
|
||||
// 新增/编辑返回后刷新列表
|
||||
onShow(() => {
|
||||
if (!isLoggedIn()) return
|
||||
if (schedules.value.length || !loading.value) loadReminders()
|
||||
})
|
||||
|
||||
async function loadReminders() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -271,16 +370,66 @@ async function loadReminders() {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* ---------- 周历条 ---------- */
|
||||
.week-card {
|
||||
display: flex;
|
||||
/* ---------- 月历(可下拉展开) ---------- */
|
||||
.cal-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx 8rpx 16rpx;
|
||||
padding: 12rpx 8rpx 16rpx;
|
||||
background: $color-card;
|
||||
border-radius: $radius-lg;
|
||||
box-shadow: $shadow-card;
|
||||
}
|
||||
|
||||
.cal-header {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
padding: 8rpx 16rpx 12rpx;
|
||||
}
|
||||
|
||||
.cal-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8rpx 12rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.cal-title {
|
||||
min-width: 170rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.cal-toggle {
|
||||
position: absolute;
|
||||
right: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 8rpx 12rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.cal-toggle-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
/* ---------- 周历条 ---------- */
|
||||
.week-strip {
|
||||
display: flex;
|
||||
padding: 8rpx 8rpx 4rpx;
|
||||
}
|
||||
|
||||
.week-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -327,6 +476,62 @@ async function loadReminders() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 月历网格 ---------- */
|
||||
.month-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 8rpx;
|
||||
padding: 8rpx 8rpx 0;
|
||||
border-top: 1rpx solid $color-divider;
|
||||
}
|
||||
|
||||
.month-weekname {
|
||||
width: calc(100% / 7);
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
.month-day {
|
||||
width: calc(100% / 7);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.month-day-num {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.month-day.today .month-day-num {
|
||||
color: $color-primary;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.month-day.selected .month-day-num {
|
||||
background: $color-primary;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.month-day.muted .month-day-num {
|
||||
color: #c4cbd6;
|
||||
}
|
||||
|
||||
.month-day:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* ---------- 我的日程 ---------- */
|
||||
.section-head {
|
||||
display: flex;
|
||||
@@ -438,4 +643,28 @@ async function loadReminders() {
|
||||
.bottom-space {
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
/* ---------- 新增按钮 ---------- */
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 32rpx;
|
||||
bottom: calc(48rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
padding: 22rpx 36rpx;
|
||||
border-radius: 44rpx;
|
||||
background: $color-primary;
|
||||
box-shadow: 0 12rpx 28rpx rgba(37, 99, 235, 0.36);
|
||||
|
||||
&:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
|
||||
.fab-text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
Generated
+8981
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
/* ================= 全局默认表格规范(确保全端、全组件均有明显边框与表头底色) ================= */
|
||||
table {
|
||||
.rich-table {
|
||||
display: table !important;
|
||||
border-collapse: collapse !important;
|
||||
border-spacing: 0 !important;
|
||||
@@ -14,13 +14,8 @@ table {
|
||||
table-layout: auto !important;
|
||||
box-sizing: border-box !important;
|
||||
|
||||
tbody {
|
||||
display: table-row-group !important;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: table-header-group !important;
|
||||
}
|
||||
.rich-table__body { display: table-row-group !important; }
|
||||
.rich-table__head { display: table-header-group !important; }
|
||||
|
||||
tr {
|
||||
display: table-row !important;
|
||||
|
||||
@@ -35,6 +35,8 @@ const NATIVE_RULES = [
|
||||
{ pattern: /\/apps\/erp\/finance\/payment/i, route: '/pages/erp/finance/fund' },
|
||||
{ pattern: /\/apps\/erp\/report/i, route: '/pages/erp/report/index' },
|
||||
{ pattern: /记事本|笔记|便签|notebook/i, route: '/pages/tools/notepad/index' },
|
||||
// 账号管理(密码库):记录个人各平台账号
|
||||
{ pattern: /账号管理|密码库|passwordStore|password-store/i, route: '/pages/tools/account/index' },
|
||||
// 「日程提醒」与「工作日程」是两个独立功能:提醒在前,命中"提醒"后即不再落到日历页
|
||||
{ pattern: /提醒|reminder/i, route: '/pages/tools/schedule/reminder' },
|
||||
// 自定义审批流(移动端):放在工作日程之前,避免「待办审批」「审批中心」被工作日程吞掉
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
const TABLE_STYLE = 'border-collapse: collapse; width: 100%; border: 1px solid #dcdfe6; margin: 12px 0; table-layout: auto;'
|
||||
const TABLE_CLASS = 'rich-table note-rich-editor-table'
|
||||
const TR_STYLE = 'border-bottom: 1px solid #ebeef5;'
|
||||
const TH_STYLE = 'border: 1px solid #dcdfe6; background-color: #f5f7fa; color: #303133; font-weight: 600; padding: 8px 12px; font-size: 14px; text-align: left; min-width: 44px; word-break: break-word;'
|
||||
const TD_STYLE = 'border: 1px solid #dcdfe6; background-color: #ffffff; color: #303133; padding: 8px 12px; font-size: 14px; vertical-align: top; word-break: break-word; min-width: 44px;'
|
||||
@@ -26,9 +27,22 @@ export function injectTableInlineStyles(html) {
|
||||
} else {
|
||||
cleanAttrs = ` style="${TABLE_STYLE}"` + cleanAttrs
|
||||
}
|
||||
if (/class\s*=\s*["']/i.test(cleanAttrs)) {
|
||||
cleanAttrs = cleanAttrs.replace(/class\s*=\s*["']([^"']*)["']/i, (m, value) => `class="${value} ${TABLE_CLASS}"`)
|
||||
} else {
|
||||
cleanAttrs = ` class="${TABLE_CLASS}"` + cleanAttrs
|
||||
}
|
||||
return `<table border="1" cellpadding="8" cellspacing="0"${cleanAttrs}>`
|
||||
})
|
||||
|
||||
// 使用 class 定位表体,避免小程序端不支持 tbody 标签选择器
|
||||
res = res.replace(/<tbody(\s+[^>]*)?>/gi, (match, attrs = '') => {
|
||||
if (/class\s*=\s*["']/i.test(attrs)) {
|
||||
return `<tbody${attrs.replace(/class\s*=\s*["']([^"']*)["']/i, (m, value) => `class="${value} rich-table__body"`)}>`
|
||||
}
|
||||
return `<tbody class="rich-table__body"${attrs}>`
|
||||
})
|
||||
|
||||
// 注入 tr 样式
|
||||
res = res.replace(/<tr(\s+[^>]*)?>/gi, (match, attrs = '') => {
|
||||
if (/style\s*=\s*["']/i.test(attrs)) {
|
||||
|
||||
Reference in new issue
Block a user