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 { DateRangePicker } from '@yz1311/react-native-wheel-picker'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
import { ScrollView, Text, View } from 'react-native'
|
||||
import Button from './Button'
|
||||
import Drawer from './Drawer'
|
||||
import Tab from './Tab'
|
||||
@@ -47,12 +47,10 @@ export default function DateMorePicker({
|
||||
showHeader={false}
|
||||
height="60%"
|
||||
>
|
||||
{/* 外层必须 flex:1 */}
|
||||
<View className="flex-1 p-3">
|
||||
{/* ===== 顶部固定区域 ===== */}
|
||||
<View
|
||||
className="gap-2"
|
||||
style={{ flexShrink: 0, height: 200 }}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
<View>
|
||||
<Text className="text-lg mb-1">快速选择</Text>
|
||||
@@ -82,22 +80,20 @@ export default function DateMorePicker({
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* ===== 中间:吃掉剩余高度 ===== */}
|
||||
<View style={{ flex: 1, justifyContent: 'center' }}>
|
||||
<ScrollView
|
||||
style={{ flex: 1 }}
|
||||
showsVerticalScrollIndicator={false}
|
||||
showsHorizontalScrollIndicator={false}
|
||||
>
|
||||
<DateRangePicker
|
||||
isModal={false}
|
||||
showHeader={false}
|
||||
pickerWrapperStyle={{
|
||||
height: 24,
|
||||
minHeight: 24,
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
{/* ===== 底部固定按钮 ===== */}
|
||||
<View
|
||||
className="flex-row gap-3 pt-2"
|
||||
style={{ flexShrink: 0, height: 100 }}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
<Button className="flex-1" variant="outline" onPress={handleClose}>
|
||||
取消
|
||||
|
||||
+86
-190
@@ -1,201 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>IM 列表</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
/* 全局设置 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>可编辑表格示例</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f7f7f7;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 顶部栏 */
|
||||
header {
|
||||
background-color: #fff;
|
||||
padding: 15px 20px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
color: #4a90e2;
|
||||
}
|
||||
|
||||
.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>
|
||||
padding: 20px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
input[type="text"], input[type="date"] {
|
||||
width: 90%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
button {
|
||||
margin-top: 10px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- 顶部栏 -->
|
||||
<header>
|
||||
<div class="header-content">
|
||||
<h1>IM 列表</h1>
|
||||
<input type="text" placeholder="搜索联系人或群组" class="search-bar">
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 联系人列表 -->
|
||||
<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>
|
||||
<h2>可编辑表格示例</h2>
|
||||
|
||||
<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">昨天</p>
|
||||
<div class="unread-count">0</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="editableTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- 生成 20 个列标题 -->
|
||||
<script>
|
||||
for(let i=1; i<=20; i++){
|
||||
document.write(`<th>列${i}</th>`);
|
||||
}
|
||||
</script>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 初始 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;
|
||||
}
|
||||
|
||||
<!-- 更多联系人项可以在此复制 -->
|
||||
</div>
|
||||
for(let r=1;r<=20;r++){
|
||||
document.write(createRow(r));
|
||||
}
|
||||
</script>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<div class="create-chat">
|
||||
<button>新建对话</button>
|
||||
</div>
|
||||
<button onclick="addRow()">新增行</button>
|
||||
|
||||
<script>
|
||||
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>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
Reference in new issue
Block a user