scene.js
5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*
* @Description:
* @Author: huyue
* @Date: 2024-06-14 13:57:29
* @LastEditors: huyue
* @LastEditTime: 2024-10-22 15:33:21
*/
// packageEquity/pages/aiCheck/scene/scene.js
import carLifeApi from '../../../carEquityApi'
import {
setConfigInfo
} from "~/store/index";
Page({
/**
* 页面的初始数据
*/
data: {
show: false,
selectedIndex: 0,
customeTypeList: [],
navBarHeight: 0,
footerHeight: 0,
text: '好胜心强,容易固执已见,建议多以<span class="blue">肯定、迎合</span>的话进行对练!',
step: 'reception',
stepName: '接待',
linkChainList: [{
id: 1,
name: '接待',
iconUrl: 'icon-reception',
type: 'reception',
suggest: '此环节模拟交付专员把客户介绍给驻店专员,建议使用敬语,尊称客户,恭喜客户提车,主动向客户介绍工作环节并进行自我介绍!'
},
{
id: 2,
name: '车辆交付',
iconUrl: 'icon-car',
type: 'delivery',
suggest: '此环节模拟驻店专员已完成对于客户的接待,即将向客户介绍新车使用注意事项、保养要求和基础质保政策,建议在介绍过程中主动了解客户的用车周期,用车环境,给介绍延保产品时进行铺垫!'
},
{
id: 3,
name: '需求挖掘',
iconUrl: 'icon-demand',
type: 'defense',
suggest: '此环节模拟驻店专员已完成了新车使用、保养要求和基础质保政策的介绍,即将向客户介绍延保产品,此环节容易触发攻防,建议多以延保相对基础质保的优势,当天购买价格有优惠,大部分客户均选择购买等为主进行推荐!'
},
{
id: 4,
name: '促成交',
iconUrl: 'icon-dear',
type: 'referral',
suggest: '此环节模拟驻店专员已完成了延保产品的介绍,即将根据客户是否展示购买意愿进行话术演练,建议对明显展示不想购买意愿的客户使用逼单话术进行进一步沟通!'
}
],
key: Date.now()
},
// 设置音频
setAudio() {
this.aiAudio = wx.createInnerAudioContext({
useWebAudioImplement: true
})
// console.log(this.aiAudio)
},
selectCustomerType(e) {
this.setData({
selectedIndex: e.currentTarget.dataset.index
})
const {
isDemo
} = this.data
this.aiAudio.src = isDemo ? this.data.customeTypeList[e.currentTarget.dataset.index].roleVoiceHs : this.data.customeTypeList[e.currentTarget.dataset.index].roleVoice
const {
paused
} = this.aiAudio
console.log(paused)
this.aiAudio.play()
this.setData({
key: Date.now()
})
},
selectStepType(e) {
const {
name,
type
} = e.currentTarget.dataset
this.setData({
step: type,
stepName: name
})
},
// 头部返回上一级
back() {
wx.$router.back()
},
// 开始练习
startPractice() {
this.setData({
show: !this.data.show
})
},
jump() {
const {selectedIndex,customeTypeList,stepName, step, linkChainList,isDemo,entry} = this.data
const { roleType } = customeTypeList[selectedIndex]
const { suggest } = linkChainList.find(item => item.type == step)
console.log(roleType, stepName, suggest,isDemo)
wx.navigateTo({
url: `/packageEquity/pages/aiCheck/chat/chat?roleType=${roleType}&stage=${stepName}&suggest=${suggest}&isDemo=${isDemo}&entry=${entry}`
})
this.setData({
show: false
})
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
wx.createSelectorQuery().select('#footer').boundingClientRect(rect => {
this.setData({
footerHeight: rect.height
})
}).exec()
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
const {stage} = options;
if(stage) {
await 1
const {linkChainList} = this.data;
const findChain = linkChainList.find((link) => link.name == stage);
this.setData({
stepName: findChain.name,
step: findChain.type,
show:true,
entry:'other'
})
}
const {
aiPhone
} = await setConfigInfo({});
const {
phone
} = wx.$util.getUserInfo()
this.setData({
isDemo: aiPhone.includes(phone)
})
this.getRole()
},
getRole() {
carLifeApi.sparringRole({
currentPage: 1,
pageSize: 100,
}).then(res => {
const customeTypeList = res.data.list
customeTypeList.forEach(item => {
if (item.roleName.includes('客户'))
item.roleName = item.roleName.slice(0, -2)
})
this.setData({
customeTypeList
})
this.setAudio()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({
step: 'reception',
selectedIndex: 0
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})