diff --git a/miniprogram/assets/shapes/circle.webp b/miniprogram/assets/shapes/circle.webp
new file mode 100644
index 0000000..8a82817
Binary files /dev/null and b/miniprogram/assets/shapes/circle.webp differ
diff --git a/miniprogram/assets/shapes/circle2.svg b/miniprogram/assets/shapes/circle2.svg
new file mode 100644
index 0000000..776548e
--- /dev/null
+++ b/miniprogram/assets/shapes/circle2.svg
@@ -0,0 +1,6 @@
+
diff --git a/miniprogram/assets/shapes/square.webp b/miniprogram/assets/shapes/square.webp
new file mode 100644
index 0000000..1a809d4
Binary files /dev/null and b/miniprogram/assets/shapes/square.webp differ
diff --git a/miniprogram/components/shape-card/shape-card copy.less b/miniprogram/components/shape-card/shape-card copy.less
new file mode 100644
index 0000000..9f139cd
--- /dev/null
+++ b/miniprogram/components/shape-card/shape-card copy.less
@@ -0,0 +1,57 @@
+.shape-card {
+ position: relative;
+ width: 300rpx;
+ height: 300rpx;
+ border-radius: 16rpx;
+ // background: #f5f5f5;
+ background: #ffffff;
+ border: 1rpx solid rgba(242, 242, 242, 1);
+ box-shadow: 0rpx 16rpx 24rpx rgba(184, 210, 188, 0.2);
+
+ .shape-card-img-wrapper {
+ padding: 16rpx;
+ width: 100%;
+ height: 200rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ box-sizing: border-box;
+
+ .shape-card-img {
+ width: 180rpx;
+ height: 180rpx;
+ }
+ }
+
+ .shape-card-footer {
+ margin-inline: 32rpx;
+ padding-block: 16rpx;
+ display: flex;
+ justify-content: start;
+ align-items: center;
+ border-top: 1rpx solid #CCCCCC;
+
+ .shape-card-footer-color {
+ width: 60rpx;
+ height: 60rpx;
+ border-radius: 50%;
+ border: 2rpx solid #141414;
+ margin-right: 34rpx;
+ }
+
+ .shape-card-footer-name {
+ font-size: 28rpx;
+ color: #141414;
+ }
+ }
+
+ .delete-icon {
+ position: absolute;
+ top: -18rpx;
+ right: -18rpx;
+
+ .delete-icon-inner {
+ color: rgba(255, 0, 0, 0.7);
+ }
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/components/shape-card/shape-card.json b/miniprogram/components/shape-card/shape-card.json
new file mode 100644
index 0000000..44daf20
--- /dev/null
+++ b/miniprogram/components/shape-card/shape-card.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "styleIsolation": "apply-shared",
+ "usingComponents": {
+ "van-icon": "@vant/weapp/icon/index"
+ }
+}
diff --git a/miniprogram/components/shape-card/shape-card.less b/miniprogram/components/shape-card/shape-card.less
new file mode 100644
index 0000000..70fd139
--- /dev/null
+++ b/miniprogram/components/shape-card/shape-card.less
@@ -0,0 +1,58 @@
+.shape-card {
+ position: relative;
+ width: 240rpx;
+ height: 240rpx;
+ border-radius: 16rpx;
+ // background: #f5f5f5;
+ background: #ffffff;
+ border: 1rpx solid rgba(242, 242, 242, 1);
+ box-shadow: 0rpx 16rpx 24rpx rgba(184, 210, 188, 0.2);
+
+ .shape-card-img-wrapper {
+ padding: 16rpx;
+ width: 100%;
+ height: 120rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ box-sizing: border-box;
+
+ .shape-card-img {
+ width: 120rpx;
+ height: 120rpx;
+ color: skyblue;
+ }
+ }
+
+ .shape-card-footer {
+ margin-inline: 32rpx;
+ padding-block: 16rpx;
+ display: flex;
+ justify-content: start;
+ align-items: center;
+ border-top: 1rpx solid #CCCCCC;
+
+ .shape-card-footer-color {
+ width: 60rpx;
+ height: 60rpx;
+ border-radius: 50%;
+ border: 2rpx solid #141414;
+ margin-right: 34rpx;
+ }
+
+ .shape-card-footer-name {
+ font-size: 28rpx;
+ color: #141414;
+ }
+ }
+
+ .delete-icon {
+ position: absolute;
+ top: -18rpx;
+ right: -18rpx;
+
+ .delete-icon-inner {
+ color: rgba(255, 0, 0, 0.7);
+ }
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/components/shape-card/shape-card.ts b/miniprogram/components/shape-card/shape-card.ts
new file mode 100644
index 0000000..1450f19
--- /dev/null
+++ b/miniprogram/components/shape-card/shape-card.ts
@@ -0,0 +1,36 @@
+Component({
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ key: {
+ type: Number,
+ value: 0,
+ },
+ img: {
+ type: String,
+ value: '',
+ },
+ name: {
+ type: String,
+ value: '',
+ },
+ color: {
+ type: String,
+ value: '',
+ },
+ },
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ onDelete() {
+ const { key } = this.data;
+ this.triggerEvent('onDelete', { key });
+ },
+ onColorTap() {
+ const { key, color } = this.data;
+ this.triggerEvent('onColorTap', { key, color });
+ },
+ },
+});
diff --git a/miniprogram/components/shape-card/shape-card.wxml b/miniprogram/components/shape-card/shape-card.wxml
new file mode 100644
index 0000000..f3e8cd7
--- /dev/null
+++ b/miniprogram/components/shape-card/shape-card.wxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram/constants/shapes.ts b/miniprogram/constants/shapes.ts
new file mode 100644
index 0000000..0bf16f6
--- /dev/null
+++ b/miniprogram/constants/shapes.ts
@@ -0,0 +1,58 @@
+const SHAPES = [
+ {
+ id: 'circle',
+ name: '圆形',
+ img: '/assets/shapes/circle.webp',
+ color: '#FF0000',
+ type: 'circle',
+ svg: '',
+ drawFunction: 'drawCircle',
+ },
+ {
+ id: 'square',
+ name: '正方形',
+ img: '/assets/shapes/square.webp',
+ color: '#0000FF',
+ type: 'rect',
+ svg: '',
+ drawFunction: 'drawSquare',
+ },
+ {
+ id: 'circle2',
+ name: '圆形',
+ img: '/assets/shapes/circle2.svg',
+ color: '#FF0000',
+ type: 'circle',
+ svg: '',
+ drawFunction: 'drawCircle',
+ },
+ {
+ id: 'square',
+ name: '正方形',
+ img: '/assets/shapes/square.webp',
+ color: '#0000FF',
+ type: 'rect',
+ svg: '',
+ drawFunction: 'drawSquare',
+ },
+ {
+ id: 'circle',
+ name: '圆形',
+ img: '/assets/shapes/circle.webp',
+ color: '#FF0000',
+ type: 'circle',
+ svg: '',
+ drawFunction: 'drawCircle',
+ },
+ {
+ id: 'square',
+ name: '正方形',
+ img: '/assets/shapes/square.webp',
+ color: '#0000FF',
+ type: 'rect',
+ svg: '',
+ drawFunction: 'drawSquare',
+ },
+];
+
+export { SHAPES };
\ No newline at end of file
diff --git a/miniprogram/pages/shape/index.json b/miniprogram/pages/shape/index.json
index 0539588..b19c868 100644
--- a/miniprogram/pages/shape/index.json
+++ b/miniprogram/pages/shape/index.json
@@ -8,6 +8,7 @@
"van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index",
"van-popup": "@vant/weapp/popup/index",
- "toy-button": "../../ui/button/button"
+ "toy-button": "../../ui/button/button",
+ "shape-card": "../../components/shape-card/shape-card"
}
}
diff --git a/miniprogram/pages/shape/index.less b/miniprogram/pages/shape/index.less
index 2e0eedf..2bcb134 100644
--- a/miniprogram/pages/shape/index.less
+++ b/miniprogram/pages/shape/index.less
@@ -12,7 +12,7 @@ page {
}
.wrapper {
- background-color: #ffffff;
+ background-color: #fff;
border-radius: 20rpx;
padding: 24rpx;
box-shadow: 0 3rpx 4rpx rgba(0, 0, 0, 0.15);
@@ -34,4 +34,16 @@ page {
flex-direction: row;
justify-content: space-between;
}
+
+ .shape-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 24rpx; // 卡片间距,可调整
+
+ shape-card {
+ width: calc(50% - 12rpx); // 两个一行,减去一半的gap
+ box-sizing: border-box;
+ margin-bottom: 24rpx;
+ }
+ }
}
\ No newline at end of file
diff --git a/miniprogram/pages/shape/index.ts b/miniprogram/pages/shape/index.ts
index 646a4ab..19eea84 100644
--- a/miniprogram/pages/shape/index.ts
+++ b/miniprogram/pages/shape/index.ts
@@ -1,11 +1,11 @@
+import { SHAPES } from '../../constants/shapes';
+
Page({
data: {
- shapeList: [],
+ shapeList: SHAPES,
},
onLoad() {
- this.setData({
- shapeList: [],
- });
+
},
});
\ No newline at end of file
diff --git a/miniprogram/pages/shape/index.wxml b/miniprogram/pages/shape/index.wxml
index c140015..cd73366 100644
--- a/miniprogram/pages/shape/index.wxml
+++ b/miniprogram/pages/shape/index.wxml
@@ -18,5 +18,18 @@
+
+
+
diff --git a/project.private.config.json b/project.private.config.json
index 09099c6..ef382e1 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -24,12 +24,19 @@
"miniprogram": {
"list": [
{
- "name": "测试图形绘制",
- "pathName": "demoPages/shapePrint/index",
+ "name": "pages/shape/index",
+ "pathName": "pages/shape/index",
"query": "",
"scene": null,
"launchMode": "default"
},
+ {
+ "name": "测试图形绘制",
+ "pathName": "demoPages/shapePrint/index",
+ "query": "",
+ "launchMode": "default",
+ "scene": null
+ },
{
"name": "debug页",
"pathName": "pages/debug/debug",