Skip to content

Commit

Permalink
feat: dev copilot conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
rayhomie committed Jan 22, 2025
1 parent bbbe7a8 commit b52425a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
21 changes: 21 additions & 0 deletions copilot-demo/pages/Conversations/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,24 @@
onMenuItemTap="handleMenuItemTap"
/>
</ant-container>


<ant-container title="抽屉中展示">
<ant-button onTap="handleOpenHistory" inline size="small">历史记录</ant-button>
<ant-popup
className="history-popup"
visible="{{ visible }}"
height="{{ 250 }}"
width="{{ 250 }}"
position="left"
animation
onClose="handlePopupClose"
>
<ant-conversations
items="{{items}}"
menus="{{menus}}"
onItemTap="handleItemTap"
onMenuItemTap="handleMenuItemTap"
/>
</ant-popup>
</ant-container>
4 changes: 3 additions & 1 deletion copilot-demo/pages/Conversations/index.json5
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

"usingComponents": {
"ant-container": "../../../src/Container/index",
"ant-conversations": "../../../src/Conversations/index"
"ant-conversations": "../../../src/Conversations/index",
"ant-popup": "../../../src/Popup/index",
"ant-button": "../../../src/Button/index"
}
}
7 changes: 7 additions & 0 deletions copilot-demo/pages/Conversations/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.history-popup {
.ant-popup-transform-left {
/// #if ALIPAY
padding-top: 90px;
/// #endif
}
}
12 changes: 12 additions & 0 deletions copilot-demo/pages/Conversations/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Page({
data: {
visible: false,
items: [
{
key: '1',
Expand Down Expand Up @@ -85,4 +86,15 @@ Page({
});
/// #endif
},

handleOpenHistory() {
this.setData({
visible: true,
});
},
handlePopupClose() {
this.setData({
visible: false,
});
},
});
3 changes: 1 addition & 2 deletions copilot/Conversations/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
opacity: 0.6;
}
&-swipe-item {
height: 130 * @rpx;
line-height: 130 * @rpx;
height: 140 * @rpx;
/// #if WECHAT
.ant-swipe-action-movable {
// pointer-events: none;
Expand Down
10 changes: 2 additions & 8 deletions copilot/Conversations/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ interface MenuItem {
confirmText?: string;
}

/**
* @description 按钮,用户只需单击一下即可执行操作并做出选择。
* 常用于表单提交、界面跳转、模块引导点击。具体用法和小程序框架中 button 保持一致,在 button 基础上做了样式的封装。
* 封装后的按钮可改变按钮形态、增加 loading,以及内置了几种不同样式的按钮。
*/

export interface IPromptsProps extends IBaseProps {
export interface IConversationsProps extends IBaseProps {
/**
* @description 提示列表
* @default []
Expand All @@ -72,7 +66,7 @@ export interface IPromptsProps extends IBaseProps {
onMenuItemTap?: (item: MenuItem, index: number) => void;
}

export const ConversationsProps: Partial<IPromptsProps> = {
export const ConversationsProps: Partial<IConversationsProps> = {
className: '',
style: '',
items: [],
Expand Down

0 comments on commit b52425a

Please sign in to comment.