Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(imagepreview): harmony adaptation #2791

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 96 additions & 8 deletions packages/nutui-taro-demo/src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,125 @@
const subPackages = [
{
"root": "base",
"pages": []
"pages": [
"pages/button/index",
"pages/cell/index",
"pages/configprovider/index",
"pages/icon/index",
"pages/image/index",
"pages/overlay/index"
]
},
{
"root": "layout",
"pages": []
"pages": [
"pages/divider/index",
"pages/grid/index",
"pages/layout/index",
"pages/safearea/index",
"pages/space/index",
"pages/sticky/index"
]
},
{
"root": "nav",
"pages": []
"pages": [
"pages/backtop/index",
"pages/elevator/index",
"pages/fixednav/index",
"pages/hoverbutton/index",
"pages/navbar/index",
"pages/sidenavbar/index",
"pages/tabbar/index",
"pages/tabs/index"
]
},
{
"root": "dentry",
"pages": []
"pages": [
"pages/address/index",
"pages/calendar/index",
"pages/calendarcard/index",
"pages/cascader/index",
"pages/checkbox/index",
"pages/datepicker/index",
"pages/form/index",
"pages/input/index",
"pages/inputnumber/index"
]
},
{
"root": "dataentry",
"pages": []
"pages": [
"pages/menu/index",
"pages/numberkeyboard/index",
"pages/picker/index",
"pages/radio/index",
"pages/range/index",
"pages/rate/index",
"pages/searchbar/index",
"pages/shortpassword/index",
"pages/signature/index",
"pages/switch/index",
"pages/textarea/index",
"pages/uploader/index"
]
},
{
"root": "feedback",
"pages": []
"pages": [
"pages/actionsheet/index",
"pages/badge/index",
"pages/dialog/index",
"pages/drag/index",
"pages/empty/index",
"pages/infiniteloading/index",
"pages/loading/index",
"pages/noticebar/index",
"pages/notify/index",
"pages/popover/index",
"pages/popup/index",
"pages/pulltorefresh/index",
"pages/resultpage/index",
"pages/skeleton/index",
"pages/swipe/index",
"pages/toast/index"
]
},
{
"root": "exhibition",
"pages": [
"pages/countdown/index"
"pages/animate/index",
"pages/animatingnumbers/index",
"pages/avatar/index",
"pages/circleprogress/index",
"pages/collapse/index",
"pages/countdown/index",
"pages/ellipsis/index",
"pages/imagepreview/index",
"pages/indicator/index",
"pages/pagination/index",
"pages/price/index",
"pages/progress/index",
"pages/steps/index",
"pages/swiper/index",
"pages/table/index",
"pages/tag/index",
"pages/tour/index",
"pages/video/index",
"pages/virtuallist/index"
]
},
{
"root": "business",
"pages": []
"pages": [
"pages/avatarcropper/index",
"pages/barrage/index",
"pages/card/index",
"pages/timeselect/index",
"pages/trendarrow/index",
"pages/watermark/index"
]
Comment on lines +5 to +123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

配置文件中的页面路径尚未实现

根据验证结果,当前 app.config.ts 中定义的子包结构和页面尚未在项目中实际创建:

  • 源码目录下只有基本的应用配置文件和一个 pages 目录
  • 未找到配置中定义的任何组件页面文件
  • 子包目录结构(如 base、layout、nav 等)也尚未创建

建议:

  • 创建配置文件中定义的所有子包目录结构
  • 实现对应的组件页面
  • 或者先将配置文件中未实现的页面路径注释掉,避免运行时报错
🔗 Analysis chain

子包结构清晰,但建议验证路径完整性

子包的组织结构按功能类别划分合理,便于维护和按需加载。不过建议验证所有页面路径的有效性,以确保没有遗漏或错误的路径。


Let me explain: The previous script failed because we were searching in the wrong directory. Since the file we're reviewing is in packages/nutui-taro-demo/src/app.config.ts, we should search for the page files under that directory structure. This new script will help us verify if the pages mentioned in the configuration actually exist in the codebase.


我们需要进一步验证目录结构和组件文件。由于配置文件中定义了多个子包和页面,但我们只找到了一个 index 页面,我们需要确认:

  1. 子包目录结构是否已创建
  2. 相关的组件文件是否存在(以基础组件为例进行搜索)

这将帮助我们理解当前的实现状态。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:验证所有页面路径是否存在对应的文件

# 检查每个子包中定义的页面是否都有对应的文件
for root in base layout nav dentry dataentry feedback exhibition business; do
  echo "检查 $root 包中的页面..."
  fd -t f "index\.(tsx|jsx)$" "$root/pages"
done

Length of output: 2151


Script:

#!/bin/bash
# 检查正确的路径结构
# 首先找到所有的页面文件
fd -t f "index\.(tsx|jsx)$" "packages/nutui-taro-demo/src"

Length of output: 109


Script:

#!/bin/bash
# 检查子包目录结构是否存在
ls -la packages/nutui-taro-demo/src/

# 检查是否有相关的组件文件
fd -t f -e tsx -e jsx "button|cell|icon|image|overlay" packages/nutui-taro-demo/src/

Length of output: 674

}
];

Expand Down
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@
"author": "vickyYE"
},
{
"version": "2.0.0",
"version": "3.0.0",
"name": "ImagePreview",
"type": "component",
"cName": "图片预览",
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo1 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [showPreview, setShowPreview] = useState(false)
Expand Down
17 changes: 9 additions & 8 deletions src/packages/imagepreview/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React, { useState } from 'react'
import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
import { ImagePreview, Cell, Image } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'

const Demo2 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [init, setInit] = useState(0)
Expand All @@ -22,16 +23,16 @@ const Demo2 = () => {
<>
<Cell style={{ position: 'relative' }}>
{images.map((image, index) => (
<span
<View
key={image.src}
onClick={() => {
setShowPreview(true)
setInit(index + 1)
}}
style={{ marginRight: '10px' }}
>
<img width="30px" height="30px" src={image.src} alt={image.src} />
</span>
<Image width={30} height={30} src={image.src} />
</View>
))}
</Cell>
<ImagePreview
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo3 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [showPreview, setShowPreview] = useState(false)
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo4 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [init, setInit] = useState<any>(1)
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo5 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [showPreview, setShowPreview] = useState(false)
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo6 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
index: 1,
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
index: 2,
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
index: 3,
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
index: 4,
},
]
Expand Down
8 changes: 4 additions & 4 deletions src/packages/imagepreview/demos/taro/demo7.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ImagePreview, Cell } from '@nutui/nutui-react-taro'
const Demo7 = () => {
const images = [
{
src: '//fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
src: 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg',
},
{
src: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
src: 'https://m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg',
},
]
const [showPreview, setShowPreview] = useState(false)
Expand Down
4 changes: 4 additions & 0 deletions src/packages/imagepreview/imagepreview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
background: transparent;
color: $white;

.nut-icon {
color: $white;
}

&.top-right {
top: 50px;
right: 20px;
Expand Down
Loading