diff --git a/bingchat/components/chatbox/index.js b/bingchat/components/chatbox/index.js index 720f143..b699ce3 100644 --- a/bingchat/components/chatbox/index.js +++ b/bingchat/components/chatbox/index.js @@ -42,6 +42,7 @@ Component({ receiveData: false, autoIncrConversation: 1, closeShareOnCopy: closeShareOnCopy, + showShare: false, }, methods: { initMessageHistory() { @@ -91,28 +92,17 @@ Component({ }) if (that.data.chatList[index]["type"] == "man" && !that.data.closeShareOnCopy) { setTimeout(() => { - wx.showModal({ - title: "提示", - content: "是否分享搜索内容?", - complete: (res) => { - if (res.confirm) { - wx.setStorage({ - key: "shareContent", - data: { - q: content, - validTime: new Date().getTime() + 300 * 1000 - }, - success: (res) => { - wx.showToast({ - title: "请点击右上角分享按钮", - icon: "none" - }) - } - }) - } + that.setData({ + showShare: true + }) + wx.setStorage({ + key: "shareContent", + data: { + q: content, + validTime: new Date().getTime() + 300 * 1000 } }) - }, 1500) + }, 1200) } } }) @@ -224,6 +214,16 @@ Component({ this.setData({ chatList: this.data.chatList }) + }, + onPopButtonClick: function (e) { + if (e.detail.t !== "confirm") { + wx.removeStorage({ + key: 'shareContent', + }) + } + this.setData({ + showShare: false + }) } }, }) diff --git a/bingchat/components/chatbox/index.json b/bingchat/components/chatbox/index.json index 2f83fff..9d9ffff 100644 --- a/bingchat/components/chatbox/index.json +++ b/bingchat/components/chatbox/index.json @@ -1,6 +1,7 @@ { "component": true, "usingComponents": { - "mp-html": "mp-html" + "mp-html": "mp-html", + "popup": "../popup/popup" } } \ No newline at end of file diff --git a/bingchat/components/chatbox/index.wxml b/bingchat/components/chatbox/index.wxml index 9b4b8f3..f79fb85 100644 --- a/bingchat/components/chatbox/index.wxml +++ b/bingchat/components/chatbox/index.wxml @@ -1,27 +1,34 @@ -输入问题开始和New Bing聊天吧~ - - - - - - {{item.dt}}{{item.num_in_conversation}} - {{item.originContent}} - - {{suggest}} + 输入问题开始和New Bing聊天吧~ + + + + + + {{item.dt}} + {{item.num_in_conversation}} + + + + {{item.originContent}} + + + + {{suggest}} + - - - - {{item.dt}} - {{item.originContent}} + + + {{item.dt}} + {{item.originContent}} + + - - - - - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/bingchat/components/chatbox/index.wxss b/bingchat/components/chatbox/index.wxss index 4d52e3f..e9a4a82 100644 --- a/bingchat/components/chatbox/index.wxss +++ b/bingchat/components/chatbox/index.wxss @@ -102,4 +102,4 @@ font-size: 18rpx; line-height: 2em; font-weight: bold; -} +} \ No newline at end of file diff --git a/bingchat/components/popup/popup.js b/bingchat/components/popup/popup.js new file mode 100644 index 0000000..460cd5c --- /dev/null +++ b/bingchat/components/popup/popup.js @@ -0,0 +1,45 @@ +// components/popup/popup.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + message: String, + openType: { + type: String, + value: "" + }, + title: { + type: String, + value: "提示" + }, + cancelText: { + type: String, + value: "取消" + }, + confirmText: { + type: String, + value: "确定" + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + closePop: function (e) { + this.triggerEvent( + "PopButtonClick", { + t: e.currentTarget.dataset.t, + }, {} + ) + }, + } +}) diff --git a/bingchat/components/popup/popup.json b/bingchat/components/popup/popup.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/bingchat/components/popup/popup.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/bingchat/components/popup/popup.wxml b/bingchat/components/popup/popup.wxml new file mode 100644 index 0000000..c387cbb --- /dev/null +++ b/bingchat/components/popup/popup.wxml @@ -0,0 +1,8 @@ + + {{title}} + {{message}} + + + + + \ No newline at end of file diff --git a/bingchat/components/popup/popup.wxss b/bingchat/components/popup/popup.wxss new file mode 100644 index 0000000..a656bb4 --- /dev/null +++ b/bingchat/components/popup/popup.wxss @@ -0,0 +1,49 @@ +.sharePop { + position: fixed; + left: 12%; + top: 25%; + width: 76%; + background-color: #f4f6f8; + text-align: center; + border-radius: 25rpx; + padding: 20rpx 30rpx 20rpx 30rpx; + box-sizing: border-box; + z-index: 10000; + border: 1rpx dashed; +} + +.bt { + background-color: #f4f6f8; + font-size: 32rpx; + cursor: pointer; +} + +.title { + font-size: 30rpx; + font-weight: 700; +} + +.message { + font-size: 30rpx; + margin-top: 15rpx; + color: #161823; + line-height: 1.6em; + max-height: 4.8em; + text-overflow: ellipsis; + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; +} + +.bt-wrap { + background-color: #f4f6f8; + display: flex; + flex-direction: row; + margin-top: 15rpx; +} + +.btn-click { + color: #ff502c; + font-weight: bold; +} \ No newline at end of file diff --git a/bingchat/pages/index/index.js b/bingchat/pages/index/index.js index 54ea34b..5a58db0 100644 --- a/bingchat/pages/index/index.js +++ b/bingchat/pages/index/index.js @@ -72,6 +72,8 @@ Page({ isOpen: false, }, useWebsocket: useWebsocket, + showSearchPop: false, + searchPopMessage: "", }, inputFocus(e) { if (inputPop()) { @@ -100,22 +102,28 @@ Page({ }) }) }, - onShow() { + getOptions: function () { var pages = getCurrentPages() var currentPage = pages[pages.length - 1] - var options = currentPage.options - var that = this + return currentPage.options + }, + onPopButtonClick: function (e) { + if (e.detail.t === "confirm") { + this.submitContent(e.currentTarget.dataset.q) + } + this.setData({ + showSearchPop: false, + q: "" + }) + }, + onShow() { + var options = this.getOptions() if (options && options["q"]) { var q = decodeURIComponent(options["q"]) - wx.showModal({ - title: "提示", - content: "即将搜索“" + q + "” ?", - success(res) { - if (res.confirm) { - options["q"] = null - that.submitContent(q) - } - } + this.setData({ + searchPopMessage: "即将搜索“" + q + "”", + showSearchPop: true, + q: q, }) } const cht = app.globalData.cht diff --git a/bingchat/pages/index/index.json b/bingchat/pages/index/index.json index d47f480..34da544 100644 --- a/bingchat/pages/index/index.json +++ b/bingchat/pages/index/index.json @@ -1,4 +1,5 @@ { "usingComponents": { - } -} + "popup": "../../components/popup/popup" + } +} \ No newline at end of file diff --git a/bingchat/pages/index/index.wxml b/bingchat/pages/index/index.wxml index 91f3593..c25cb77 100644 --- a/bingchat/pages/index/index.wxml +++ b/bingchat/pages/index/index.wxml @@ -2,4 +2,5 @@ 发送 - \ No newline at end of file + + \ No newline at end of file