Commit 48d485893a86e9490cc70c2c7320863badb1fcd6

Authored by vking
1 parent 7a1fc25d

chatbot

@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 "pages/reserve/index_yy", 13 "pages/reserve/index_yy",
14 "pages/me/index", 14 "pages/me/index",
15 "pages/me/concat", 15 "pages/me/concat",
  16 + "pages/me/chat",
16 "pages/me/setting", 17 "pages/me/setting",
17 "pages/me/list", 18 "pages/me/list",
18 "pages/reserve/search", 19 "pages/reserve/search",
@@ -156,6 +157,10 @@ @@ -156,6 +157,10 @@
156 "vktool": { 157 "vktool": {
157 "version": "2.1.9", 158 "version": "2.1.9",
158 "provider": "wxd3dc4206c76f14fc" 159 "provider": "wxd3dc4206c76f14fc"
  160 + },
  161 + "chatbot": {
  162 + "version": "1.2.8",
  163 + "provider": "wx8c631f7e9f2465e1"
159 } 164 }
160 }, 165 },
161 "navigateToMiniProgramAppIdList": [ 166 "navigateToMiniProgramAppIdList": [
  1 +// components/userinfo/chatbot.js
  2 +var plugin = requirePlugin("chatbot");
  3 +Component({
  4 + /**
  5 + * 组件的属性列表
  6 + */
  7 + properties: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 组件的初始数据
  13 + */
  14 + data: {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 组件的方法列表
  20 + */
  21 + methods: {
  22 + userinfo(e){
  23 + let wechat=e.detail
  24 + wechat.openid=wechat.openid||getApp().openid
  25 + console.log('userinfo',wechat)
  26 + plugin.init({
  27 + appid: "sjAZRgrwD86PlVtpMnW16LR1TYy9hi",
  28 + openid: wechat.openid, // 小程序的openid,必填项
  29 + success: () => {
  30 + wx.navigateTo({
  31 + url: '/pages/me/chat'
  32 + });
  33 + },
  34 + fail: (error) => {},
  35 + guideList: [],
  36 + textToSpeech: false, //默认为ture打开状态
  37 + background: "rgba(247,251,252,1)",
  38 + guideCardHeight: 40,
  39 + operateCardHeight: 60,
  40 + history: true,
  41 + navHeight: 0,
  42 + //robotHeader: "http://tulue-images.vking.wang/logo.png",
  43 + userHeader: wechat.avatarUrl,
  44 + userName: wechat.nickName,
  45 + hideMovableButton: false,
  46 + });
  47 + }
  48 + }
  49 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "userinfo": "/components/userinfo/userinfo"
  5 + }
  6 +}
  1 +<!--components/userinfo/chatbot.wxml-->
  2 +<userinfo binduserinfo="userinfo">
  3 + <slot></slot>
  4 +</userinfo>
  1 +/* components/userinfo/chatbot.wxss */
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 "userinfo": "/components/userinfo/userinfo", 7 "userinfo": "/components/userinfo/userinfo",
8 "manager": "/components/manager/manager", 8 "manager": "/components/manager/manager",
9 "nav":"/components/nav/nav", 9 "nav":"/components/nav/nav",
  10 + "chatbot":"/components/userinfo/chatbot",
10 "card":"/components/seller-card/seller-card", 11 "card":"/components/seller-card/seller-card",
11 "formids":"/components/formids/formids", 12 "formids":"/components/formids/formids",
12 "sb-tr":"/components/reserve/seller-box-transverse/seller-box", 13 "sb-tr":"/components/reserve/seller-box-transverse/seller-box",
@@ -87,8 +87,16 @@ @@ -87,8 +87,16 @@
87 <view class="icon"> 87 <view class="icon">
88 <icon type="warn" size="47" color="#999999"/> 88 <icon type="warn" size="47" color="#999999"/>
89 </view> 89 </view>
90 - <view class="title Medium" style="font-size: 36rpx;">抱歉!</view>  
91 - <view class="info Medium" style="font-size: 36rpx;color: #353535;">{{detail.cancel.desc=='订单长时间未处理,已过时段'?'餐厅生意繁忙,不能及时处理您的订单':'您相中的餐厅包间已经订满'}}</view> 90 + <view class="title Medium" style="font-size: 36rpx;margin-bottom: 42rpx;">包间已订满</view>
  91 + <view class="info" style="font-size: 30rpx;color: #353535; width: 100% ; text-align: left;height: auto;margin-bottom: 40rpx;">
  92 + <view>1、包间状态会实时更新,周到安排可帮忙抢订;</view>
  93 + <view>2、周到安排拥有全市包间资源,可为您推荐更多优质餐厅。</view>
  94 + </view>
  95 + <view class="flex-lr share-view-cookbook">
  96 + <chatbot class="share-but-view">
  97 + <view class="share-but flex-cc Medium">帮我<view class="qing"></view>订</view>
  98 + </chatbot>
  99 + </view>
92 </block> 100 </block>
93 </block> 101 </block>
94 </view> 102 </view>
@@ -335,4 +335,12 @@ @@ -335,4 +335,12 @@
335 text-align: center; 335 text-align: center;
336 336
337 margin-top: 60rpx; 337 margin-top: 60rpx;
  338 +}
  339 +.qing{
  340 + background-image: url("http://nosqn.colorcun.com/qiang2.png");
  341 + background-size: 100% 100%;
  342 + width: 48rpx;
  343 + height: 48rpx;
  344 + margin-right: 6rpx;
  345 + margin-left: 6rpx;
338 } 346 }
  1 +// miniprogram/pages/me/chat.js
  2 +var plugin = requirePlugin("chatbot");
  3 +Page({
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 + var chat = plugin.getChatComponent();
  16 + chat.setTextToSpeech(false);
  17 + //chat.editFoucs(true);
  18 + return;
  19 + chat.send('人工服务')
  20 + setTimeout(()=>{
  21 + chat.send('maomao de mao')
  22 + },300)
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面初次渲染完成
  27 + */
  28 + onReady: function () {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面显示
  34 + */
  35 + onShow: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面隐藏
  41 + */
  42 + onHide: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面卸载
  48 + */
  49 + onUnload: function () {
  50 +
  51 + },
  52 +
  53 +})
  1 +{
  2 + "usingComponents": {
  3 + "chat": "plugin://chatbot/chat",
  4 + "nav":"/components/nav/nav"
  5 + }
  6 +}
  1 +<!--miniprogram/pages/me/chat.wxml-->
  2 +<view style="height: 100vh;">
  3 + <nav hasHome>周到安排</nav>
  4 + <chat></chat>
  5 +</view>
  1 +/* miniprogram/pages/me/chat.wxss */
@@ -621,7 +621,7 @@ @@ -621,7 +621,7 @@
621 "id": 71, 621 "id": 71,
622 "name": "pages/reserve/detail", 622 "name": "pages/reserve/detail",
623 "pathName": "pages/reserve/detail", 623 "pathName": "pages/reserve/detail",
624 - "query": "id=1&_activeTab=reserve&_date=2020-02-16&_pnum=6", 624 + "query": "id=1&activeTab=reserve&_date=2020-02-16&_pnum=6",
625 "scene": null 625 "scene": null
626 }, 626 },
627 { 627 {