diff --git a/littleApp_child/app.js b/littleApp_child/app.js index 7cd11aa..2fd31d3 100644 --- a/littleApp_child/app.js +++ b/littleApp_child/app.js @@ -2,7 +2,7 @@ //聊天控件 let WebIM = wx.WebIM = require("./utils/WebIM.js").default; let disp = require("./utils/broadcast"); - +var plugin = requirePlugin("myPlugin"); App({ getRoomPage: function () { return this.getPage("pages/chatroom/chatroom") @@ -298,6 +298,8 @@ App({ console.log("onOnline:") } }) + + this.getINfoList() }, getUserInfo: function (cb) { var that = this @@ -330,6 +332,50 @@ App({ unrederMsg:[], hospital:{id:'',name:''} }, + getINfoList:function(){ + // console.log(userInfo.wxopenid,'userInfo'); + const res = wx.getAccountInfoSync(); + let height = 0 + wx.getSystemInfo({ + success: res => { + // console.log(res); + let isIOS = res.system.indexOf("iOS") > -1; + let navHeight = 0; + if (!isIOS) { + navHeight = 48; + } else { + navHeight = 44; + } + + } + }); + height = 48 + 44 + plugin.init({ + appid: "MWH8RhGZELAOcXT59HJNycPipQ9vvx", + openid: "organizeda52ac", + // appid: "P5Ot9PHJDechCYqDFAW1AiK6OtG3Ja", + textToSpeech: false, + guideList: [], + welcome: `您好,请问有什么能够帮助您的。您可以选择下方标签,进行相关问题查询`, + robotHeader:"https://dev-rp-api.healthbaby.com.cn/id_photo/20240620/20240623184438.png", + background: "#fff", + guideCardHeight: 50, + operateCardHeight: 130, + // navHeight: + navHeight: 0, + success: () => { + console.log('你好'); + // plugin.send({ + // query: "你好", + // success: res => { + // console.log(res); + // }, + // fail: error => {} + // }); + }, + fail: error => {} + }); + } }) function calcUnReadSpot(message){ let myName = wx.getStorageSync("hxName"); @@ -374,4 +420,5 @@ function getCurrentRoute(){ let pages = getCurrentPages(); let currentPage = pages[pages.length - 1]; return currentPage.route; -} \ No newline at end of file +} + diff --git a/littleApp_child/app.json b/littleApp_child/app.json index 76ef78d..8803107 100644 --- a/littleApp_child/app.json +++ b/littleApp_child/app.json @@ -58,7 +58,8 @@ "pages/serviceNotice/serviceNotice", "pages/eatAddress/eatAddress", "pages/messageNotification/messageNotification", - "pages/messageContent/messageContent" + "pages/messageContent/messageContent", + "pages/chatbotwidget/chatbotwidget" ] } ], @@ -71,5 +72,11 @@ "sitemapLocation": "sitemap.json", "useExtendedLib": { "weui": true + }, + "plugins": { + "myPlugin": { + "version": "1.4.2", + "provider": "wx8c631f7e9f2465e1" + } } } \ No newline at end of file diff --git a/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.js b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.js new file mode 100644 index 0000000..89f12e8 --- /dev/null +++ b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.js @@ -0,0 +1,49 @@ +//index.js +//获取应用实例 +const app = getApp() +var plugin = requirePlugin("myPlugin"); +var chat = plugin.getChatComponent(); + +Page({ + data: { + }, + onLoad: function () { + + wx.getSystemInfo({ + success: (res) => { + let isIOS = res.system.indexOf('iOS') > -1 + let navHeight = 0 + if (!isIOS) { + navHeight = 48 + } else { + navHeight = 44 + } + this.setData({ + status: res.statusBarHeight, + navHeight: navHeight, + statusBarHeight: res.statusBarHeight + navHeight + }) + } + }) + }, + getQueryCallback: function (e) { + + }, + goBackHome: function () { + wx.navigateBack({ + delta: 1 + }) + }, + back:function(e) { + this.goBackHome() + }, + chatOnFinish:function(e){ + var plugin = requirePlugin("myPlugin"); + var chat = plugin.getChatComponent(); + chat.clearChatRecord(); + chat.scrollToBottom(); + }, + onShareAppMessage:function(e) { + console.log(e,'2') + } +}) diff --git a/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.json b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.json new file mode 100644 index 0000000..fcea340 --- /dev/null +++ b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "chat": "plugin://myPlugin/chat" + }, + "navigationBarBackgroundColor": "#48C17B", + "navigationBarTextStyle": "white", + "navigationBarTitleText":"线上咨询" +} \ No newline at end of file diff --git a/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxml b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxml new file mode 100644 index 0000000..a898e78 --- /dev/null +++ b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxss b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxss new file mode 100644 index 0000000..fa2f86d --- /dev/null +++ b/littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxss @@ -0,0 +1,58 @@ +/* packageA/pages/chatbotwidget/chatbotwidget.wxss */ + +.nav { + position: relative; +} +.floatBtn { + z-index: 100; + position: absolute; + top: 50%; + margin-top: -50px; + right: 0; + width: 110px; + padding-left: 25px; + box-sizing: border-box; + display: flex; + align-items: center; + height:44px; + background:rgba(255,255,255,1); + box-shadow:0px 2px 5px 0px rgba(0,0,0,0.07); + border-radius:22px 0px 0px 22px; + border:1px solid rgba(232,232,232,1); +} +.correct{ + font-size:15px; + font-family:MicrosoftYaHeiUI; + font-weight:bold; + /* color:rgba(11,187,9,1); */ + color:rgba(96,98,102,1); + background-color: #ffffff; +} +.empty { + width:1px; + height:14px; + margin: 0 15px; + background-color: #E8E8E8; +} +.clear { + font-size:15px; + font-family:MicrosoftYaHeiUI; + font-weight:bold; + color:rgba(96,98,102,1); +} +.active { + color:rgba(11,187,9,1); +} +button::after { + border: none; +} +button { + padding: 0; + margin: 0; + background-color: #ffffff; +} +input{ + outline:none; + border:none; + list-style: none; +} diff --git a/littleApp_child/pages/home/home.js b/littleApp_child/pages/home/home.js index f49cdbc..e1332c5 100644 --- a/littleApp_child/pages/home/home.js +++ b/littleApp_child/pages/home/home.js @@ -136,9 +136,19 @@ Page({ babyId:_that.data.erid, },function (res) { if (res.data.data.length > 0 ) { - wx.navigateTo({ + wx.showLoading({ + title: '加载中...', + }); + + wx.navigateTo({ url: '/packageA/pages/messageNotification/messageNotification', - }) + success: function() { + wx.hideLoading(); + }, + fail: function() { + wx.hideLoading(); + } + }); } else { wx.showModal({ title: '提示', @@ -604,6 +614,7 @@ Page({ } networkUtil._post(api.getBabyBuildPidInfo,param,function(res){ wx.setStorageSync('erid',res.data.data.id) + // console.log('获取用户信息12122', res) self.getBabyMsgCountByIdNum(res.data.data.id) // self.setNotification(res.data.data.id) self.setData({ @@ -953,6 +964,11 @@ Page({ }) } }, + consultation1(){ + wx.navigateTo({ + url: '/packageA/pages/chatbotwidget/chatbotwidget', + }) + }, // 获取未读总数 getUnreaderMsgNum(){ var that = this diff --git a/littleApp_child/pages/home/home.wxml b/littleApp_child/pages/home/home.wxml index 68ba79e..eca79ff 100644 --- a/littleApp_child/pages/home/home.wxml +++ b/littleApp_child/pages/home/home.wxml @@ -75,7 +75,7 @@ 疾病护理咨询 --> - + 历史咨询记录 @@ -108,11 +108,17 @@ 眼保健记录 - + {{unTotleReadCount}} 专家咨询 + + + + 线上咨询 + + 身高体重曲线 diff --git a/littleApp_child/project.private.config.json b/littleApp_child/project.private.config.json index 0f394ce..2b1108d 100644 --- a/littleApp_child/project.private.config.json +++ b/littleApp_child/project.private.config.json @@ -2,7 +2,8 @@ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "littleApp_child", "setting": { - "compileHotReLoad": true + "compileHotReLoad": true, + "bigPackageSizeSupport": true }, "condition": { "miniprogram": {