Commit 5ee3300f by 前端

入口

1 parent d1fb87c5
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 1; let index = 2;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
...@@ -380,55 +380,6 @@ Page({ ...@@ -380,55 +380,6 @@ Page({
this.initList(); this.initList();
// this.checkDailyRecport() // this.checkDailyRecport()
}, },
checkTask() {
return new Promise((resolve) => {
const { merchantId } = wx.$util.getUserInfo();
const time = wx.getStorageSync("aiTime");
if (time == new Date().format("yyyy-MM-dd")) {
resolve();
return;
}
wx.setStorageSync("aiTime", new Date().format("yyyy-MM-dd"));
const params = {
currentPage: 1,
sparringStatus: 0,
tryCount: 2,
taskState: 2,
pageSize: 1,
yqMerchantId: merchantId,
};
carLifeApi
.getSparringPage(params)
.then((res) => {
const { list = [] } = res.data;
if (list.length) {
if (wx.__HAS_NOTLOGIN_MODAL) return false;
this.addModalToQueue(
"对练任务提醒",
"您有未完成的对练任务,点击前往完成",
"前往完成",
true,
3,
(res) => {
if (res.confirm) {
const {
task: { aiType, promptOnOff },
staff: { id, tryCount },
} = list[0];
wx.$router.go(
`packageEquity.list?staffid=${id}&tryCount=${tryCount}&roleType=${aiType}&promptOnOff=${promptOnOff}`
);
}
}
);
}
resolve();
})
.catch(() => {
resolve();
});
});
},
checkStaffOrderStatus() { checkStaffOrderStatus() {
return new Promise((resolve) => { return new Promise((resolve) => {
let userInfo = wx.$util.getUserInfo(); let userInfo = wx.$util.getUserInfo();
...@@ -519,7 +470,6 @@ Page({ ...@@ -519,7 +470,6 @@ Page({
this.checkDailyRecport(), this.checkDailyRecport(),
this.checkDeliveryTarget(), this.checkDeliveryTarget(),
this.getMerchant4SMode(), this.getMerchant4SMode(),
this.checkTask(),
this.checkStaffOrderStatus(), this.checkStaffOrderStatus(),
]).then(() => { ]).then(() => {
this.showNextModal(); this.showNextModal();
...@@ -601,7 +551,6 @@ Page({ ...@@ -601,7 +551,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// this.checkTask()
wx.$eventbus.on("switch_tab", () => { wx.$eventbus.on("switch_tab", () => {
let e = { let e = {
detail: 3, detail: 3,
......
// packageEquity/pages/aiCheck/chat/chat.js // packageEquity/pages/aiCheck/chat/chat.js
import carLifeApi from '../../../carEquityApi' import carLifeApi from '../../../carEquityApi'
const VOICE = ['zhifeng_emo', 'zhibing_emo', 'zhimiao_emo', 'stanley', 'zhiyan_emo', 'rosa'] const VOICE = ['zhifeng_emo','stanley', 'zhibing_emo','rosa', 'zhimiao_emo', 'zhiyan_emo']
const productList = [{ const productList = [{
id: 1, id: 1,
name: "驻店延保", name: "驻店延保",
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</view> </view>
</view> </view>
</view> </view>
<audio-tts showSpeechPopup="{{showSpeechPopup}}" chatList="{{chatList}}" voice="{{voice}}" avatar="{{avatar}}" id="audioBox"></audio-tts></scroll-view> <audio-tts showSpeechPopup="{{showSpeechPopup}}" roleName="{{roleName}}" chatList="{{chatList}}" voice="{{voice}}" avatar="{{avatar}}" id="audioBox"></audio-tts></scroll-view>
</view> </view>
<view class="control-box" style="{{controlBoxStyle}}"> <view class="control-box" style="{{controlBoxStyle}}">
<view class="inspiration-btn {{popType == 'inspiration' ? 'active' : ''}}" bindtap="openPopup" data-type="inspiration"><gl-image class="icon" src="/aiCheck/{{popType == 'inspiration' ? 'inspiration-icon-white' : 'inspiration-icon'}}.png"></gl-image></view> <view class="inspiration-btn {{popType == 'inspiration' ? 'active' : ''}}" bindtap="openPopup" data-type="inspiration"><gl-image class="icon" src="/aiCheck/{{popType == 'inspiration' ? 'inspiration-icon-white' : 'inspiration-icon'}}.png"></gl-image></view>
......
...@@ -29,6 +29,7 @@ Component({ ...@@ -29,6 +29,7 @@ Component({
properties: { properties: {
avatar: String, avatar: String,
voice: String, voice: String,
roleName: String,
showSpeechPopup: { showSpeechPopup: {
type: Boolean, type: Boolean,
observer: function (n) { observer: function (n) {
...@@ -78,7 +79,7 @@ Component({ ...@@ -78,7 +79,7 @@ Component({
getVoiceConfig() { getVoiceConfig() {
aiApi aiApi
.getVoiceConfig({ .getVoiceConfig({
person_type: "独裁型" person_type: this.data.roleName
}).then(res => { }).then(res => {
const { const {
access_token, access_token,
...@@ -91,6 +92,66 @@ Component({ ...@@ -91,6 +92,66 @@ Component({
} = res } = res
}) })
}, },
HS_play(text) {
const {
uuid
} = wx.$util.getUserInfo();
const {
access_token,
app_id: appid,
voice_id: voice_type
} = this.data
_this = this;
const cluster = "volcano_mega";
wx.request({
url: 'https://openspeech.bytedance.com/api/v1/tts',
method: 'post',
data: {
app: {
appid,
token: access_token,
cluster,
voice_type,
},
user: {
uid: uuid
},
"audio": {
"voice_type": voice_type,
"encoding": "mp3",
"speed_ratio": 1.0,
"volume_ratio": 1.0,
"pitch_ratio": 1.0,
},
"request": {
"reqid": uuid,
"text": text,
"text_type": "plain",
"operation": "query",
"with_frontend": 1,
"frontend_type": "unitTson"
}
},
header: {
"Authorization": `Bearer;${access_token}`
},
success(response) {
const arrayBuffer = response.data.data
const audioPath = wx.env.USER_DATA_PATH + `/${Date.now()}.mp3`
const fs = wx.getFileSystemManager();
fs.writeFile({
filePath: audioPath,
data: arrayBuffer,
encoding: 'base64',
success(res) {
const audioContext = wx.createInnerAudioContext();
audioContext.src = audioPath;
audioContext.play();
},
})
}
})
},
getOssSignature() { getOssSignature() {
getSignature().then(res => { getSignature().then(res => {
this.data.ossOption = res this.data.ossOption = res
...@@ -297,7 +358,7 @@ Component({ ...@@ -297,7 +358,7 @@ Component({
file_link: url file_link: url
}).then(res => { }).then(res => {
const Sentences = res.Sentences const Sentences = res.Sentences
const Sentences_desc = this.getSentencesDetail(Sentences,this.data.list[i].content) const Sentences_desc = this.getSentencesDetail(Sentences, this.data.list[i].content)
this.setData({ this.setData({
['list[' + i + '].voiceUrl']: url, ['list[' + i + '].voiceUrl']: url,
['list[' + i + '].Sentences']: Sentences, ['list[' + i + '].Sentences']: Sentences,
...@@ -306,24 +367,24 @@ Component({ ...@@ -306,24 +367,24 @@ Component({
console.log(this.data.list) console.log(this.data.list)
}) })
}, },
getSentencesDetail(Sentences,redundantWords) { getSentencesDetail(Sentences, redundantWords) {
let totalSpeed = 0; let totalSpeed = 0;
let totalEmotionValue = 0; let totalEmotionValue = 0;
let SpeechRateAll = [] let SpeechRateAll = []
Sentences.forEach(i => { Sentences.forEach(i => {
totalSpeed += i.SpeechRate; totalSpeed += i.SpeechRate;
totalEmotionValue+= i.EmotionValue; totalEmotionValue += i.EmotionValue;
SpeechRateAll.push(i.SpeechRate) SpeechRateAll.push(i.SpeechRate)
}) })
const averageSpeed = totalSpeed / Sentences.length; const averageSpeed = totalSpeed / Sentences.length;
const averageEmotionValue = totalEmotionValue / Sentences.length const averageEmotionValue = totalEmotionValue / Sentences.length
const val_1 = SpeechRateValue[calculateStars(averageSpeed)] const val_1 = SpeechRateValue[calculateStars(averageSpeed)]
const val_2 = calculateIntonation(SpeechRateAll) const val_2 = calculateIntonation(SpeechRateAll)
console.log(calculateEmotion,averageEmotionValue) console.log(calculateEmotion, averageEmotionValue)
const val_3 = calculateEmotion(averageEmotionValue) const val_3 = calculateEmotion(averageEmotionValue)
const val_4 = this.getNum(redundantWords) const val_4 = this.getNum(redundantWords)
console.log(val_1,val_2,val_3,val_4) console.log(val_1, val_2, val_3, val_4)
return [val_1,val_2,val_3,val_4] return [val_1, val_2, val_3, val_4]
}, },
getNum(words) { getNum(words) {
// 构建一个正则表达式,匹配数组h中每个元素的叠词 // 构建一个正则表达式,匹配数组h中每个元素的叠词
...@@ -332,7 +393,7 @@ Component({ ...@@ -332,7 +393,7 @@ Component({
const wordNum = matches.reduce((cur, prev) => { const wordNum = matches.reduce((cur, prev) => {
return cur + (prev.length - 1) return cur + (prev.length - 1)
}, 0) }, 0)
return wordNum >0?wordNum:'无' return wordNum > 0 ? wordNum : '无'
}, },
getList(step, defenseIndex) { getList(step, defenseIndex) {
let { let {
......
...@@ -39,6 +39,7 @@ Component({ ...@@ -39,6 +39,7 @@ Component({
getNum() { getNum() {
// 构建一个正则表达式,匹配数组h中每个元素的叠词 // 构建一个正则表达式,匹配数组h中每个元素的叠词
const regex = new RegExp(`(${toneWords.map(str => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')).join('|')})\\1+`, 'g'); const regex = new RegExp(`(${toneWords.map(str => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')).join('|')})\\1+`, 'g');
console.log(this.data.detailInfo)
const { const {
fluency: { fluency: {
redundantWords redundantWords
......
...@@ -10,40 +10,31 @@ Page({ ...@@ -10,40 +10,31 @@ Page({
}, },
handleMark(e) { handleMark(e) {
const { const {
index item
} = e.target.dataset; } = e.target.dataset;
this.setData({ this.setData({
markIndex: index + 1 title: item.reportItem
})
this.setTitle(index)
},
setTitle(i) {
const {
markList
} = this.data
this.setData({
title: markList[i]
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
wx.$router.getData(({reportItem,currentItem}) =>{ wx.$router.getData(({
this.setTitle(0); reportItem,
currentItem
}) => {
console.log(currentItem)
// this.setTitle(0);
const { const {
markList markList
} = this.data } = this.data
let markListIndexMap = {}; // 使用 filter 方法代替 find 方法
markList.forEach((item, index) => { const reportItems = markList.map(item => reportItem.find(report => report.reportItem === item) || null);
markListIndexMap[item] = index; this.setData({
}); reportItems,
// 使用 sort 方法对 reportItem 进行排序 title: currentItem.reportItem
reportItem.sort((a, b) => {
return markListIndexMap[a.reportItem] - markListIndexMap[b.reportItem];
}); });
console.log(reportItem[0])
this.setData({reportItem})
}) })
}, },
......
...@@ -8,20 +8,22 @@ ...@@ -8,20 +8,22 @@
</view> </view>
</navigation-bar> </navigation-bar>
<view class="mark-box"> <view class="mark-box">
<view class="mark-item {{markIndex == (index+1)?'checked':''}}" data-index="{{index}}" bindtap="handleMark" <block wx:for="{{reportItems}}">
wx:for="{{markList}}">{{item}}</view> <view wx:if="{{item}}" class="mark-item {{title == item.reportItem?'checked':''}}" data-item="{{item}}"
bindtap="handleMark">{{item.reportItem}}</view>
</block>
</view> </view>
<view class="main-box"> <view class="main-box">
<!--销售技巧--> <!--销售技巧-->
<sale detailInfo="{{reportItem[0]}}" wx:if="{{markIndex==1}}"></sale> <sale detailInfo="{{reportItems[0]}}" wx:if="{{markList[0] == title && reportItems[0]}}"></sale>
<!--流利度--> <!--流利度-->
<fluent detailInfo="{{reportItem[1]}}" wx:if="{{markIndex==2}}"></fluent> <fluent detailInfo="{{reportItems[1]}}" wx:if="{{markList[1] == title && reportItems[1]}}"></fluent>
<!--语音表达--> <!--语音表达-->
<deliver detailInfo="{{reportItem[2]}}" wx:if="{{markIndex==3}}"></deliver> <deliver detailInfo="{{reportItems[2]}}" wx:if="{{markList[2] == title && reportItems[2]}}"></deliver>
<!--熟练度--> <!--熟练度-->
<skilled detailInfo="{{reportItem[3]}}" wx:if="{{markIndex==4}}"></skilled> <skilled detailInfo="{{reportItems[3]}}" wx:if="{{markList[3] == title && reportItems[3]}}"></skilled>
<!--服务态度--> <!--服务态度-->
<attitude detailInfo="{{reportItem[4]}}" wx:if="{{markIndex==5}}"></attitude> <attitude detailInfo="{{reportItems[4]}}" wx:if="{{markList[4] == title && reportItems[4]}}"></attitude>
</view> </view>
<view class="footer" id="footer"> <view class="footer" id="footer">
<view class="back-home" bindtap="backHome">返回首页</view> <view class="back-home" bindtap="backHome">返回首页</view>
......
...@@ -1046,12 +1046,12 @@ Component({ ...@@ -1046,12 +1046,12 @@ Component({
// default: true, // default: true,
// sortVal: 5 // sortVal: 5
// }); // });
const { aiPhone } = await setConfigInfo({}); // const { aiPhone } = await setConfigInfo({});
let index_d = menuList.findIndex((e) => e.menuText == "AI趣练"); let index_d = menuList.findIndex((e) => e.menuText == "AI趣练");
if (aiPhone.includes(phone) && index_d == -1) if (index_d == -1)
menuList.push({ menuList.push({
menuText: "AI趣练", menuText: "AI趣练",
icon: "ai_check", icon: "ai_chat",
path: "packageEquity.start", path: "packageEquity.start",
default: true, default: true,
sortVal: 5 sortVal: 5
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!