u
This commit is contained in:
1 parent
ba9ce9e81b
commit
2b76078a77
2 files changed
+95
-203
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import SegmentedControl from '@react-native-segmented-control/segmented-control'
|
import SegmentedControl from '@react-native-segmented-control/segmented-control'
|
||||||
import { DateRangePicker } from '@yz1311/react-native-wheel-picker'
|
import { DateRangePicker } from '@yz1311/react-native-wheel-picker'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { Text, View } from 'react-native'
|
import { ScrollView, Text, View } from 'react-native'
|
||||||
import Button from './Button'
|
import Button from './Button'
|
||||||
import Drawer from './Drawer'
|
import Drawer from './Drawer'
|
||||||
import Tab from './Tab'
|
import Tab from './Tab'
|
||||||
@@ -47,12 +47,10 @@ export default function DateMorePicker({
|
|||||||
showHeader={false}
|
showHeader={false}
|
||||||
height="60%"
|
height="60%"
|
||||||
>
|
>
|
||||||
{/* 外层必须 flex:1 */}
|
|
||||||
<View className="flex-1 p-3">
|
<View className="flex-1 p-3">
|
||||||
{/* ===== 顶部固定区域 ===== */}
|
|
||||||
<View
|
<View
|
||||||
className="gap-2"
|
className="gap-2"
|
||||||
style={{ flexShrink: 0, height: 200 }}
|
style={{ flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
<View>
|
<View>
|
||||||
<Text className="text-lg mb-1">快速选择</Text>
|
<Text className="text-lg mb-1">快速选择</Text>
|
||||||
@@ -82,22 +80,20 @@ export default function DateMorePicker({
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* ===== 中间:吃掉剩余高度 ===== */}
|
<ScrollView
|
||||||
<View style={{ flex: 1, justifyContent: 'center' }}>
|
style={{ flex: 1 }}
|
||||||
|
showsVerticalScrollIndicator={false}
|
||||||
|
showsHorizontalScrollIndicator={false}
|
||||||
|
>
|
||||||
<DateRangePicker
|
<DateRangePicker
|
||||||
isModal={false}
|
isModal={false}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
pickerWrapperStyle={{
|
|
||||||
height: 24,
|
|
||||||
minHeight: 24,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</ScrollView>
|
||||||
|
|
||||||
{/* ===== 底部固定按钮 ===== */}
|
|
||||||
<View
|
<View
|
||||||
className="flex-row gap-3 pt-2"
|
className="flex-row gap-3 pt-2"
|
||||||
style={{ flexShrink: 0, height: 100 }}
|
style={{ flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
<Button className="flex-1" variant="outline" onPress={handleClose}>
|
<Button className="flex-1" variant="outline" onPress={handleClose}>
|
||||||
取消
|
取消
|
||||||
|
|||||||
+86
-190
@@ -1,201 +1,97 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>IM 列表</title>
|
<title>可编辑表格示例</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<style>
|
||||||
<style>
|
body {
|
||||||
/* 全局设置 */
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #f7f7f7;
|
padding: 20px;
|
||||||
color: #333;
|
}
|
||||||
}
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
/* 顶部栏 */
|
width: 100%;
|
||||||
header {
|
table-layout: fixed;
|
||||||
background-color: #fff;
|
}
|
||||||
padding: 15px 20px;
|
th, td {
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
border: 1px solid #ccc;
|
||||||
position: sticky;
|
padding: 5px;
|
||||||
top: 0;
|
text-align: center;
|
||||||
z-index: 10;
|
}
|
||||||
}
|
input[type="text"], input[type="date"] {
|
||||||
|
width: 90%;
|
||||||
.header-content {
|
box-sizing: border-box;
|
||||||
display: flex;
|
}
|
||||||
justify-content: space-between;
|
input[type="checkbox"] {
|
||||||
align-items: center;
|
transform: scale(1.2);
|
||||||
}
|
}
|
||||||
|
button {
|
||||||
h1 {
|
margin-top: 10px;
|
||||||
font-size: 24px;
|
padding: 5px 10px;
|
||||||
color: #4a90e2;
|
}
|
||||||
}
|
</style>
|
||||||
|
|
||||||
.search-bar {
|
|
||||||
padding: 8px 12px;
|
|
||||||
width: 200px;
|
|
||||||
border-radius: 20px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
font-size: 14px;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 联系人列表 */
|
|
||||||
.contact-list {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-item {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #fff;
|
|
||||||
margin: 10px 20px;
|
|
||||||
padding: 12px;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-item:hover {
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 头像 */
|
|
||||||
.avatar img {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 联系人信息 */
|
|
||||||
.contact-info {
|
|
||||||
flex: 1;
|
|
||||||
margin-left: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-name {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.last-message {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #666;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 时间和未读消息数 */
|
|
||||||
.meta-info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-time {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.unread-count {
|
|
||||||
background-color: #f03e3e;
|
|
||||||
color: #fff;
|
|
||||||
padding: 4px 8px;
|
|
||||||
border-radius: 12px;
|
|
||||||
font-size: 12px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 底部创建聊天按钮 */
|
|
||||||
.create-chat {
|
|
||||||
position: fixed;
|
|
||||||
right: 20px;
|
|
||||||
bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-chat button {
|
|
||||||
background-color: #4a90e2;
|
|
||||||
color: #fff;
|
|
||||||
padding: 15px 25px;
|
|
||||||
border-radius: 50%;
|
|
||||||
font-size: 18px;
|
|
||||||
border: none;
|
|
||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-chat button:hover {
|
|
||||||
background-color: #357ab7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-chat button:active {
|
|
||||||
background-color: #2f6790;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- 顶部栏 -->
|
|
||||||
<header>
|
|
||||||
<div class="header-content">
|
|
||||||
<h1>IM 列表</h1>
|
|
||||||
<input type="text" placeholder="搜索联系人或群组" class="search-bar">
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- 联系人列表 -->
|
<h2>可编辑表格示例</h2>
|
||||||
<div class="contact-list">
|
|
||||||
<div class="contact-item">
|
|
||||||
<div class="avatar">
|
|
||||||
<img src="https://via.placeholder.com/40" alt="头像">
|
|
||||||
</div>
|
|
||||||
<div class="contact-info">
|
|
||||||
<p class="contact-name">张三</p>
|
|
||||||
<p class="last-message">你好,最近怎么样?</p>
|
|
||||||
</div>
|
|
||||||
<div class="meta-info">
|
|
||||||
<p class="message-time">2分钟前</p>
|
|
||||||
<div class="unread-count">3</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="contact-item">
|
<table id="editableTable">
|
||||||
<div class="avatar">
|
<thead>
|
||||||
<img src="https://via.placeholder.com/40" alt="头像">
|
<tr>
|
||||||
</div>
|
<!-- 生成 20 个列标题 -->
|
||||||
<div class="contact-info">
|
<script>
|
||||||
<p class="contact-name">李四</p>
|
for(let i=1; i<=20; i++){
|
||||||
<p class="last-message">好的,明天见!</p>
|
document.write(`<th>列${i}</th>`);
|
||||||
</div>
|
}
|
||||||
<div class="meta-info">
|
</script>
|
||||||
<p class="message-time">昨天</p>
|
</tr>
|
||||||
<div class="unread-count">0</div>
|
</thead>
|
||||||
</div>
|
<tbody>
|
||||||
</div>
|
<!-- 初始 20 行 -->
|
||||||
|
<script>
|
||||||
|
function createRow(rowIndex){
|
||||||
|
let row = '<tr>';
|
||||||
|
for(let i=1;i<=20;i++){
|
||||||
|
if(i % 3 === 1){ // 文本输入
|
||||||
|
row += `<td><input type="text" placeholder="文本${rowIndex}-${i}"></td>`;
|
||||||
|
} else if(i % 3 === 2){ // 日期选择
|
||||||
|
row += `<td><input type="date"></td>`;
|
||||||
|
} else { // 复选框
|
||||||
|
row += `<td><input type="checkbox"></td>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row += '</tr>';
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
<!-- 更多联系人项可以在此复制 -->
|
for(let r=1;r<=20;r++){
|
||||||
</div>
|
document.write(createRow(r));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<!-- 底部按钮 -->
|
<button onclick="addRow()">新增行</button>
|
||||||
<div class="create-chat">
|
|
||||||
<button>新建对话</button>
|
<script>
|
||||||
</div>
|
function addRow(){
|
||||||
|
const tbody = document.querySelector('#editableTable tbody');
|
||||||
|
const rowCount = tbody.rows.length + 1;
|
||||||
|
let newRow = '<tr>';
|
||||||
|
for(let i=1;i<=20;i++){
|
||||||
|
if(i % 3 === 1){
|
||||||
|
newRow += `<td><input type="text" placeholder="文本${rowCount}-${i}"></td>`;
|
||||||
|
} else if(i % 3 === 2){
|
||||||
|
newRow += `<td><input type="date"></td>`;
|
||||||
|
} else {
|
||||||
|
newRow += `<td><input type="checkbox"></td>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newRow += '</tr>';
|
||||||
|
tbody.insertAdjacentHTML('beforeend', newRow);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
</html>
|
||||||
</html>
|
|
||||||
Reference in new issue
Block a user