Commit 8952b37a02ae604c671d1f6ded380d6c34755c75

Authored by 王润寒
1 parent 5d10d75811
Exists in dev_wjl and in 1 other branch dev-wrh

fleat:线上咨询开发完成

Showing 9 changed files with 210 additions and 8 deletions

littleApp_child/app.js View file @ 8952b37
... ... @@ -2,7 +2,7 @@
2 2 //聊天控件
3 3 let WebIM = wx.WebIM = require("./utils/WebIM.js").default;
4 4 let disp = require("./utils/broadcast");
5   -
  5 +var plugin = requirePlugin("myPlugin");
6 6 App({
7 7 getRoomPage: function () {
8 8 return this.getPage("pages/chatroom/chatroom")
... ... @@ -298,6 +298,8 @@
298 298 console.log("onOnline:")
299 299 }
300 300 })
  301 +
  302 + this.getINfoList()
301 303 },
302 304 getUserInfo: function (cb) {
303 305 var that = this
... ... @@ -330,6 +332,50 @@
330 332 unrederMsg:[],
331 333 hospital:{id:'',name:''}
332 334 },
  335 + getINfoList:function(){
  336 + // console.log(userInfo.wxopenid,'userInfo');
  337 + const res = wx.getAccountInfoSync();
  338 + let height = 0
  339 + wx.getSystemInfo({
  340 + success: res => {
  341 + // console.log(res);
  342 + let isIOS = res.system.indexOf("iOS") > -1;
  343 + let navHeight = 0;
  344 + if (!isIOS) {
  345 + navHeight = 48;
  346 + } else {
  347 + navHeight = 44;
  348 + }
  349 +
  350 + }
  351 + });
  352 + height = 48 + 44
  353 + plugin.init({
  354 + appid: "MWH8RhGZELAOcXT59HJNycPipQ9vvx",
  355 + openid: "organizeda52ac",
  356 + // appid: "P5Ot9PHJDechCYqDFAW1AiK6OtG3Ja",
  357 + textToSpeech: false,
  358 + guideList: [],
  359 + welcome: `您好,请问有什么能够帮助您的。您可以选择下方标签,进行相关问题查询`,
  360 + robotHeader:"https://dev-rp-api.healthbaby.com.cn/id_photo/20240620/20240623184438.png",
  361 + background: "#fff",
  362 + guideCardHeight: 50,
  363 + operateCardHeight: 130,
  364 + // navHeight:
  365 + navHeight: 0,
  366 + success: () => {
  367 + console.log('你好');
  368 + // plugin.send({
  369 + // query: "你好",
  370 + // success: res => {
  371 + // console.log(res);
  372 + // },
  373 + // fail: error => {}
  374 + // });
  375 + },
  376 + fail: error => {}
  377 + });
  378 + }
333 379 })
334 380 function calcUnReadSpot(message){
335 381 let myName = wx.getStorageSync("hxName");
littleApp_child/app.json View file @ 8952b37
... ... @@ -58,7 +58,8 @@
58 58 "pages/serviceNotice/serviceNotice",
59 59 "pages/eatAddress/eatAddress",
60 60 "pages/messageNotification/messageNotification",
61   - "pages/messageContent/messageContent"
  61 + "pages/messageContent/messageContent",
  62 + "pages/chatbotwidget/chatbotwidget"
62 63 ]
63 64 }
64 65 ],
... ... @@ -71,6 +72,12 @@
71 72 "sitemapLocation": "sitemap.json",
72 73 "useExtendedLib": {
73 74 "weui": true
  75 + },
  76 + "plugins": {
  77 + "myPlugin": {
  78 + "version": "1.4.2",
  79 + "provider": "wx8c631f7e9f2465e1"
  80 + }
74 81 }
75 82 }
littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.js View file @ 8952b37
  1 +//index.js
  2 +//获取应用实例
  3 +const app = getApp()
  4 +var plugin = requirePlugin("myPlugin");
  5 +var chat = plugin.getChatComponent();
  6 +
  7 +Page({
  8 + data: {
  9 + },
  10 + onLoad: function () {
  11 +
  12 + wx.getSystemInfo({
  13 + success: (res) => {
  14 + let isIOS = res.system.indexOf('iOS') > -1
  15 + let navHeight = 0
  16 + if (!isIOS) {
  17 + navHeight = 48
  18 + } else {
  19 + navHeight = 44
  20 + }
  21 + this.setData({
  22 + status: res.statusBarHeight,
  23 + navHeight: navHeight,
  24 + statusBarHeight: res.statusBarHeight + navHeight
  25 + })
  26 + }
  27 + })
  28 + },
  29 + getQueryCallback: function (e) {
  30 +
  31 + },
  32 + goBackHome: function () {
  33 + wx.navigateBack({
  34 + delta: 1
  35 + })
  36 + },
  37 + back:function(e) {
  38 + this.goBackHome()
  39 + },
  40 + chatOnFinish:function(e){
  41 + var plugin = requirePlugin("myPlugin");
  42 + var chat = plugin.getChatComponent();
  43 + chat.clearChatRecord();
  44 + chat.scrollToBottom();
  45 + },
  46 + onShareAppMessage:function(e) {
  47 + console.log(e,'2')
  48 + }
  49 +})
littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.json View file @ 8952b37
  1 +{
  2 + "usingComponents": {
  3 + "chat": "plugin://myPlugin/chat"
  4 + },
  5 + "navigationBarBackgroundColor": "#48C17B",
  6 + "navigationBarTextStyle": "white",
  7 + "navigationBarTitleText":"线上咨询"
  8 +}
littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxml View file @ 8952b37
  1 +<!--packageA/pages/chatbotwidget/chatbotwidget.wxml-->
  2 +<!-- <text>packageA/pages/chatbotwidget/chatbotwidget.wxml</text> -->
  3 +
  4 +<view style="height:100%;background-color: #fff;">
  5 + <chat
  6 + bind:chatOnFinish="chatOnFinish"
  7 + bind:openWebview="openWebview"
  8 + bind:openMiniProgram="openMiniProgram"
  9 + />
  10 +</view>
littleApp_child/packageA/pages/chatbotwidget/chatbotwidget.wxss View file @ 8952b37
  1 +/* packageA/pages/chatbotwidget/chatbotwidget.wxss */
  2 +
  3 +.nav {
  4 + position: relative;
  5 +}
  6 +.floatBtn {
  7 + z-index: 100;
  8 + position: absolute;
  9 + top: 50%;
  10 + margin-top: -50px;
  11 + right: 0;
  12 + width: 110px;
  13 + padding-left: 25px;
  14 + box-sizing: border-box;
  15 + display: flex;
  16 + align-items: center;
  17 + height:44px;
  18 + background:rgba(255,255,255,1);
  19 + box-shadow:0px 2px 5px 0px rgba(0,0,0,0.07);
  20 + border-radius:22px 0px 0px 22px;
  21 + border:1px solid rgba(232,232,232,1);
  22 +}
  23 +.correct{
  24 + font-size:15px;
  25 + font-family:MicrosoftYaHeiUI;
  26 + font-weight:bold;
  27 + /* color:rgba(11,187,9,1); */
  28 + color:rgba(96,98,102,1);
  29 + background-color: #ffffff;
  30 +}
  31 +.empty {
  32 + width:1px;
  33 + height:14px;
  34 + margin: 0 15px;
  35 + background-color: #E8E8E8;
  36 +}
  37 +.clear {
  38 + font-size:15px;
  39 + font-family:MicrosoftYaHeiUI;
  40 + font-weight:bold;
  41 + color:rgba(96,98,102,1);
  42 +}
  43 +.active {
  44 + color:rgba(11,187,9,1);
  45 +}
  46 +button::after {
  47 + border: none;
  48 +}
  49 +button {
  50 + padding: 0;
  51 + margin: 0;
  52 + background-color: #ffffff;
  53 +}
  54 +input{
  55 + outline:none;
  56 + border:none;
  57 + list-style: none;
  58 +}
littleApp_child/pages/home/home.js View file @ 8952b37
... ... @@ -136,9 +136,19 @@
136 136 babyId:_that.data.erid,
137 137 },function (res) {
138 138 if (res.data.data.length > 0 ) {
139   - wx.navigateTo({
  139 + wx.showLoading({
  140 + title: '加载中...',
  141 + });
  142 +
  143 + wx.navigateTo({
140 144 url: '/packageA/pages/messageNotification/messageNotification',
141   - })
  145 + success: function() {
  146 + wx.hideLoading();
  147 + },
  148 + fail: function() {
  149 + wx.hideLoading();
  150 + }
  151 + });
142 152 } else {
143 153 wx.showModal({
144 154 title: '提示',
... ... @@ -604,6 +614,7 @@
604 614 }
605 615 networkUtil._post(api.getBabyBuildPidInfo,param,function(res){
606 616 wx.setStorageSync('erid',res.data.data.id)
  617 + // console.log('获取用户信息12122', res)
607 618 self.getBabyMsgCountByIdNum(res.data.data.id)
608 619 // self.setNotification(res.data.data.id)
609 620 self.setData({
... ... @@ -952,6 +963,11 @@
952 963 }
953 964 })
954 965 }
  966 + },
  967 + consultation1(){
  968 + wx.navigateTo({
  969 + url: '/packageA/pages/chatbotwidget/chatbotwidget',
  970 + })
955 971 },
956 972 // 获取未读总数
957 973 getUnreaderMsgNum(){
littleApp_child/pages/home/home.wxml View file @ 8952b37
... ... @@ -75,7 +75,7 @@
75 75 <image src="../../source/yuyueyiyuan.png" style="{{item_small}}" class="foundation_item_small_image"></image>
76 76 <view class="foundation_item_small_text">疾病护理咨询</view>
77 77 </navigator> -->
78   - <navigator class="foundation_item_small" url="../consultationRecord/consultationRecord">
  78 + <navigator wx:if="{{userData.hospitalId != 666668}}" class="foundation_item_small" url="../consultationRecord/consultationRecord">
79 79 <image src="../../source/except.png" style="{{item_small}}" class="foundation_item_small_image"></image>
80 80 <view class="foundation_item_small_text">历史咨询记录</view>
81 81 </navigator>
82 82  
... ... @@ -108,11 +108,17 @@
108 108 <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image>
109 109 <view class="foundation_item_small_text">眼保健记录</view>
110 110 </navigator>
111   - <navigator class="foundation_item_small" bindtap="consultation">
  111 + <navigator wx:if="{{userData.hospitalId != 666668}}" class="foundation_item_small" bindtap="consultation">
112 112 <view class="unreadCount" wx:if="{{unTotleReadCount>0}}">{{unTotleReadCount}}</view>
113 113 <image src="../../source/icon_consult@2x.png" style="{{item_small}}" class="foundation_item_small_image"></image>
114 114 <view class="foundation_item_small_text">专家咨询</view>
115 115 </navigator>
  116 +
  117 + <navigator wx:if="{{userData.hospitalId == 666668}}" class="foundation_item_small" bindtap="consultation1">
  118 + <image src="../../source/icon_consult@2x.png" style="{{item_small}}" class="foundation_item_small_image"></image>
  119 + <view class="foundation_item_small_text">线上咨询</view>
  120 + </navigator>
  121 +
116 122 <navigator wx:if="{{userData.hospitalId !== 666668}}" class="foundation_item_small" bind:tap="goGraph">
117 123 <image src="../../source/graph.jpg" style="{{item_small}}" class="foundation_item_small_image"></image>
118 124 <view class="foundation_item_small_text">身高体重曲线</view>
littleApp_child/project.private.config.json View file @ 8952b37
... ... @@ -2,7 +2,8 @@
2 2 "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3 3 "projectname": "littleApp_child",
4 4 "setting": {
5   - "compileHotReLoad": true
  5 + "compileHotReLoad": true,
  6 + "bigPackageSizeSupport": true
6 7 },
7 8 "condition": {
8 9 "miniprogram": {