Commit 7f324864 by 王志慧

Merge branch 'SAAS+V4.42' of http://192.168.3.233:8090/saas_plus/dj-car-boutique…

…-work-wechat into SAAS+V4.42
2 parents 2f52dab9 f468b208
......@@ -36,24 +36,31 @@ Component({
methods: {
getDetail() {
const {
deliver: {
definition: {
star: definition_star,
x: definition_x,
y: definition_y
},
intonation: {
star: intonation_star,
x: intonation_x,
y: intonation_y
}
}
} = this.data.detailInfo
deliver
} = this.data.detailInfo,
definition = JSON.parse(deliver.definition || {}),
intonation = JSON.parse(deliver.intonation || {})
this.setData({
definition_star,
intonation_star,
definitionText: definitionList[definition_star - 1],
intonationText:intonationList[intonation_star - 1]
definition_star:definition.star,
intonation_star:intonation.star,
definitionText: definitionList[definition.star - 1],
intonationText:intonationList[intonation.star - 1],
definition_lineData: {
y: definition.y,
x: definition.x
},
definition_areaOptions: {
min: definition.min,
max: definition.max
},
intonation_lineData: {
y: intonation.y,
x: intonation.x
},
intonation_areaOptions: {
min: intonation.min,
max: intonation.max
},
})
},
}
......
{
"component": true,
"usingComponents": {
"emoji":"../emoji/emoji"
"emoji":"../emoji/emoji",
"line-chat": "../lineChat/lineChat"
}
}
\ No newline at end of file
......@@ -3,9 +3,11 @@
<view class="report-title">清晰度</view>
<emoji emojiList="{{emojiList}}" level="{{definition_star}}"></emoji>
<view class="report-content">{{definitionText}}</view>
<line-chat title="清晰度变化曲线" lineData="{{definition_lineData}}" areaOptions="{{definition_areaOptions}}" ></line-chat>
</view>
<view class="report-panel">
<view class="report-title">语调</view>
<emoji emojiList="{{controlList}}" level="{{intonation_star}}"></emoji>
<view class="report-content">{{intonationText}}</view>
<line-chat title="语调变化曲线" lineData="{{intonation_lineData}}" areaOptions="{{intonation_areaOptions}}" ></line-chat>
</view>
\ No newline at end of file
......@@ -13,64 +13,88 @@ Component({
detailInfo: {
type: Object,
observer: function (n) {
this.getNum()
this.getNum()
this.parseJson(n)
}
},
},
/**
* 组件的初始数据
*/
data: {
emojiList: speechEmoji,
level: 3,
star: 3,
content: '您的平均语速在150字/分钟,非常棒!这样能让听众更好的理解和接收你所传达的信息。',
speedList: ['您的语速极快,几乎听不出单词之间的停顿,可能会导致听众难以理解,尤其是在不熟悉的话题或复杂的讨论中。', '您的语速极慢,每个词之间有明显的停顿,通常用于强调某些信息或确保听众能够完全理解。', '您的语速较快,词汇之间的间隔较短,可能需要听众集中注意力才能跟上,但仍然可以保持清晰度。', '您的语速较慢,适合于清晰的沟通和教学,给听众足够的时间来消化和理解信息。', '您的语速适中,既不过快也不过慢,是大多数日常对话和正式演讲的理想速度,便于听众跟随和理解。'],
},
/**
* 组件的初始数据
*/
data: {
emojiList: speechEmoji,
level: 3,
star: 3,
content: '您的平均语速在150字/分钟,非常棒!这样能让听众更好的理解和接收你所传达的信息。',
speedList: ['您的语速极快,几乎听不出单词之间的停顿,可能会导致听众难以理解,尤其是在不熟悉的话题或复杂的讨论中。', '您的语速极慢,每个词之间有明显的停顿,通常用于强调某些信息或确保听众能够完全理解。', '您的语速较快,词汇之间的间隔较短,可能需要听众集中注意力才能跟上,但仍然可以保持清晰度。', '您的语速较慢,适合于清晰的沟通和教学,给听众足够的时间来消化和理解信息。', '您的语速适中,既不过快也不过慢,是大多数日常对话和正式演讲的理想速度,便于听众跟随和理解。'],
lineData: [],
areaOptions: {}
},
/**
* 组件的方法列表
*/
methods: {
getNum() {
// 构建一个正则表达式,匹配数组h中每个元素的叠词
const regex = new RegExp(`(${toneWords.map(str => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')).join('|')})\\1+`, 'g');
const {fluency:{redundantWords}} = this.data.detailInfo
let words = ''
try {
words = JSON.parse(redundantWords).content
} catch (error) {
/**
* 组件的方法列表
*/
methods: {
getNum() {
// 构建一个正则表达式,匹配数组h中每个元素的叠词
const regex = new RegExp(`(${toneWords.map(str => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')).join('|')})\\1+`, 'g');
const {
fluency: {
redundantWords
}
const matches = words.match(regex)||[];
let redundantWordsList = new Map()
matches.forEach((i) => {
const l = i.slice(0, 1);
console.log(l);
const v = redundantWordsList.get(l);
console.log(v);
if (v) {
redundantWordsList.set(l, v + (i.length - 1));
} else {
redundantWordsList.set(l, i.length - 1);
}
});
const positionX = [...redundantWordsList.keys()]
const positionY = [...redundantWordsList.values()];
const wordNum = positionY.reduce((cur,prev)=>{
return cur+prev
},0)
let star = 5 - Math.ceil(wordNum/2)
if(star < 1) {
star = 1
} = this.data.detailInfo
let words = ''
try {
words = JSON.parse(redundantWords).content
} catch (error) {}
const matches = words.match(regex) || [];
let redundantWordsList = new Map()
matches.forEach((i) => {
const l = i.slice(0, 1);
console.log(l);
const v = redundantWordsList.get(l);
console.log(v);
if (v) {
redundantWordsList.set(l, v + (i.length - 1));
} else {
redundantWordsList.set(l, i.length - 1);
}
});
const positionX = [...redundantWordsList.keys()]
const positionY = [...redundantWordsList.values()];
const wordNum = positionY.reduce((cur, prev) => {
return cur + prev
}, 0)
let star = 5 - Math.ceil(wordNum / 2)
if (star < 1) {
star = 1
}
this.setData({
positionX,
positionY,
wordNum,
star,
content: toneList[star - 1]
})
},
parseJson(n) {
console.log(n)
if (n.fluency) {
const speechSpeed = JSON.parse(n.fluency.speechSpeed || {})
console.log(speechSpeed)
this.setData({
positionX,
positionY,
wordNum,
star,
content:toneList[star - 1]
lineData: {
y: speechSpeed.y,
x: speechSpeed.x
},
areaOptions: {
min: speechSpeed.min,
max: speechSpeed.max
}
})
}
}
}
})
\ No newline at end of file
......@@ -3,7 +3,7 @@
<view class="report-title">语速</view>
<emoji emojiList="{{emojiList}}" level="{{level}}"></emoji>
<view class="report-content">{{content}}</view>
<line-chat title="语速变化曲线" lineData="{{detailInfo.fluency.speechSpeed}}" ></line-chat>
<line-chat title="语速变化曲线" lineData="{{lineData}}" areaOptions="{{areaOptions}}" ></line-chat>
</view>
<view class="report-panel">
<view class="report-title">冗余词</view>
......
......@@ -14,22 +14,30 @@ Component({
min: 2,
max: 4
}
},
maxYNum: {
type: Number,
value: 10
}
},
lifetimes: {
ready() {
const {
lineData,
maxYNum,
areaOptions
} = this.data
new DrawLineChart('#line', {
data: this.data.lineData.y,
areaData: this.data.areaOptions,
maxYNum:5
data: lineData.y,
areaData: areaOptions,
maxYNum
}, this)
}
},
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
......
......@@ -72,7 +72,7 @@ class DrawPieChart {
lineWidth,
arcRadius
} = this.arcInfo,
gapAngle = Math.PI / 300
gapAngle = data.length == 1 ? 0 : Math.PI / 300
let endAngle = startAngle + (Math.PI * 2 * (data[index] / totalSum)) - gapAngle;
this[_ctx_].beginPath()
......
......@@ -7,31 +7,6 @@ Page({
data: {
markList: ['销售技巧', '流利度', '语音表达', '熟练度', '服务态度'],
markIndex: 1,
detailInfo: {
deliver: {
definition: {
star: 4,
x: [1, 2, 3],
y: [1, 2, 3]
},
intonation: {
star: 5,
x: [1, 2, 3],
y: [1, 2, 3]
},
},
fluency: {
speechSpeed: {
star: 4,
x: [1, 2, 3],
y: [1, 2, 3]
},
redundantWords: {
star: 4,
content: "你好啊啊啊啊啊,额额额额额额额额额"
},
},
},
},
handleMark(e) {
const {
......@@ -54,21 +29,22 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setTitle(0);
const {
markList
} = this.data
const reportItem = wx.getStorageSync('reportItem');
let markListIndexMap = {};
markList.forEach((item, index) => {
markListIndexMap[item] = index;
});
// 使用 sort 方法对 reportItem 进行排序
reportItem.sort((a, b) => {
return markListIndexMap[a.reportItem] - markListIndexMap[b.reportItem];
});
console.log(reportItem[0])
this.setData({reportItem})
wx.$router.getData(reportItem =>{
this.setTitle(0);
const {
markList
} = this.data
let markListIndexMap = {};
markList.forEach((item, index) => {
markListIndexMap[item] = index;
});
// 使用 sort 方法对 reportItem 进行排序
reportItem.sort((a, b) => {
return markListIndexMap[a.reportItem] - markListIndexMap[b.reportItem];
});
console.log(reportItem[0])
this.setData({reportItem})
})
},
/**
......
......@@ -3,13 +3,46 @@ var wxCharts = require("../../../../utils/wxcharts");
import aiApi from "../../../aiApi";
import carLifeApi from "../../../carEquityApi";
var windowW = 0;
const XYList = [{
x: 200,
y: 62
},
{
x: 20,
y: 144
},
{
x: 406,
y: 32
},
{
x: 430,
y: 206
},
{
x: 26,
y: 364
},
{
x: 236,
y: 402
},
{
x: 486,
y: 404
},
{
x: 0,
y: 0
},
]
Page({
/**
* 页面的初始数据
*/
data: {
resultTab: [
{
resultTab: [{
id: 1,
name: "报告",
},
......@@ -22,17 +55,7 @@ Page({
tabId: "1",
sceneType: 1, // 场景值,根据场景显示头像
navBarHeight: 0,
footerHeight: 0,
circleList: [
{ name: "清晰度", depict: "xx" },
{ name: "语速", depict: "xx" },
{ name: "语调", depict: "xx" },
{ name: "销售技巧", depict: "xx" },
{ name: "冗余词", depict: "xx" },
{ name: "服务态度", depict: "xx" },
{ name: "熟练度", depict: "xx" },
{ name: "敏感词" },
],
footerHeight: 0
},
// 查看报告切换
handleRuselt(e) {
......@@ -66,7 +89,9 @@ Page({
}
},
again() {
const { id } = this.data;
const {
id
} = this.data;
if (id) {
wx.navigateTo({
url: `/packageEquity/pages/aiCheck/scene/scene`,
......@@ -82,7 +107,9 @@ Page({
wx.navigateBack({
delta: 1,
});
prevPage.setData({ tabIndex: 1 });
prevPage.setData({
tabIndex: 1
});
} else {
wx.navigateBack({
delta: 2,
......@@ -133,15 +160,6 @@ Page({
sparringLink,
sparringTaskId,
} = options;
const { circleList } = this.data;
this.setData({
circleList: this.generateNonOverlappingCoordinates(
circleList,
650,
616,
144
),
});
this.setData({
id,
roleType,
......@@ -150,7 +168,9 @@ Page({
});
this.getAvatar(roleType);
const chatList = wx.getStorageSync("chatList");
const { uuid } = wx.$util.getUserInfo();
const {
uuid
} = wx.$util.getUserInfo();
console.log(history_message);
if (history_message) {
this.setData({
......@@ -179,11 +199,20 @@ Page({
},
//提交数据
sparringCommit() {
const { taskStaffId } = this.data;
const {
taskStaffId
} = this.data;
const details = {
fluency: {
speechSpeed: { star: 4, x: [1, 2, 3], y: [1, 2, 3] },
redundantWords: { star: 4, content: "你好啊啊啊啊啊" },
speechSpeed: {
star: 4,
x: [1, 2, 3],
y: [1, 2, 3]
},
redundantWords: {
star: 4,
content: "你好啊啊啊啊啊"
},
},
deliver: {
definition: {
......@@ -245,20 +274,50 @@ Page({
id,
})
.then((res) => {
const { descriptionList, reportItem, sparringDuration, score } =
res.data || {};
wx.setStorageSync("reportItem", reportItem);
this.setData({ descriptionList, reportItem, sparringDuration, score });
let XYListCopy = [...XYList]
const {
descriptionList,
reportItem,
sparringDuration,
score
} = res.data || {};
this.setData({
descriptionList,
reportItem,
sparringDuration,
score
})
//延迟动画
setTimeout(() => {
wx.redirectTo({
url: "/packageEquity/pages/aiCheck/detail/detail",
});
}, 3000);
let list = descriptionList.map((desc) => {
const randomIndex = Math.floor(Math.random() * XYListCopy.length);
const selectedXYItem = XYListCopy[randomIndex];
XYListCopy.splice(randomIndex, 1);
return {
...desc,
...selectedXYItem,
className:'move-circle'
};
})
this.setData({
descriptionList: list
})
}, 500)
// setTimeout(() => {
// wx.$router.go("/packageEquity/pages/aiCheck/detail/detail", reportItem)
// }, 3000);
});
},
handleSave(list, sparringDuration) {
const { sparringTaskId, roleType, sparringLink } = this.data;
const { merchantId, uuid } = wx.$util.getUserInfo();
const {
sparringTaskId,
roleType,
sparringLink
} = this.data;
const {
merchantId,
uuid
} = wx.$util.getUserInfo();
const fluency = {
speechSpeed: JSON.stringify({
star: 4,
......@@ -335,35 +394,30 @@ Page({
onReady() {},
drawChart(data) {
// if (this.a) return;
this.a = new wxCharts(
{
canvasId: "radarCanvas",
type: "radar",
categories: ["", "", "", "", ""],
series: [
{
name: "评分",
data: [10, 16, 16, 10, 20],
// data: data,
eachSeries: {
color: "#556AF5",
},
},
],
width: 375 * windowW,
height: 200 * windowW,
legend: false,
dataabel: false,
extra: {
radar: {
max: 5,
},
this.a = new wxCharts({
canvasId: "radarCanvas",
type: "radar",
categories: ["", "", "", "", ""],
series: [{
name: "评分",
data: [10, 16, 16, 10, 20],
// data: data,
eachSeries: {
color: "#556AF5",
},
}, ],
width: 375 * windowW,
height: 200 * windowW,
legend: false,
dataabel: false,
extra: {
radar: {
max: 5,
},
},
{
dataPointShape: ["circle"],
}
);
}, {
dataPointShape: ["circle"],
});
},
/**
* 生命周期函数--监听页面显示
......@@ -371,58 +425,6 @@ Page({
onShow() {
this.drawChart();
},
generateNonOverlappingCoordinates(circleList, width, height, itemSize) {
const positions = [],
maxAttempts = 10000,
centerX = width / 2,
centerY = height / 2,
excludeZone = itemSize / 2,
maxItems = circleList.length;
for (let i = 0; i < maxItems; i++) {
let attempts = 0;
let x, y,left,top;
do {
x = Math.floor(Math.random() * (width - itemSize));
y = Math.floor(Math.random() * (height - itemSize));
left = x + itemSize
top = y + itemSize
attempts++;
} while (
!this.isPositionValid(x, y, itemSize, positions) ||
(left >= centerX - excludeZone && left <= centerX + excludeZone &&
top>= centerY - excludeZone && top <= centerY + excludeZone) &&
attempts < maxAttempts
);
if (attempts === maxAttempts) {
console.error(
`Failed to find a valid position for item ${i} after ${maxAttempts} attempts.`
);
break;
} else {
positions.push({ x, y });
}
}
return positions.map((pos, index) => ({
...circleList[index],
x: pos.x,
y: pos.y,
}));
},
isPositionValid(x, y, itemSize, existingPositions) {
for (const { x: existingX, y: existingY } of existingPositions) {
if (
x < existingX + itemSize &&
x + itemSize > existingX &&
y < existingY + itemSize &&
y + itemSize > existingY
) {
return false;
}
}
return true;
},
/**
* 生命周期函数--监听页面隐藏
*/
......@@ -447,4 +449,4 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage() {},
});
});
\ No newline at end of file
......@@ -330,22 +330,6 @@ page {
background-image: linear-gradient(90deg, #4D53FF 0%, #389AFF 100%);
}
.center {
width: 144rpx;
height: 144rpx;
background-image: linear-gradient(90deg, #4D53FF 0%, #389AFF 100%);
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 32rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 36rpx;
box-sizing: border-box;
border-radius: 100%;
text-align: center;
}
}
.circle-item {
......@@ -361,6 +345,10 @@ page {
justify-content: center;
border-radius: 100%;
flex-direction: column;
top: calc(50% - 72rpx);
left: calc(50% - 72rpx);
transition: all .25s;
.circle-title {
font-size: 28rpx;
}
......@@ -369,10 +357,43 @@ page {
font-weight: 500;
}
}
.center {
width: 144rpx;
height: 144rpx;
background-image: linear-gradient(90deg, #4D53FF 0%, #389AFF 100%);
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 32rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 36rpx;
box-sizing: border-box;
border-radius: 100%;
text-align: center;
z-index: 2;
}
.move-circle {
animation: move-circle 2s ease-in-out infinite;
}
.red {
color: #F04853;
}
@keyframes move-circle {
0%,
100% {
transform: scale(1) translateY(0);
}
50% {
transform: scale(1.01) translateY(-5rpx);
}
}
}
}
......
......@@ -68,13 +68,12 @@
</view>
</view>
<view class="circle-box">
<view class="circle-bg box-center">
<view class="center box-center">对练总结</view>
</view>
<block wx:for="{{circleList}}" wx:key="index">
<view class="circle-item {{item.depict?'':'red'}}" style="top:{{item.y + 'rpx'}};left:{{item.x + 'rpx'}}">
<view class="circle-title">{{item.name}}</view>
<view class="circle-depict">{{item.depict}}</view>
<view class="center box-center">对练总结</view>
<view class="circle-bg box-center"></view>
<block wx:for="{{descriptionList}}" wx:key="index">
<view class="circle-item {{item.dialogueItem != '敏感词'?'':'red'}} {{item.className}}" style="top:{{item.y + 'rpx'}};left:{{item.x + 'rpx'}}">
<view class="circle-title">{{item.dialogueItem}}</view>
<view class="circle-depict">{{item.description}}</view>
</view>
</block>
</view>
......
......@@ -148,6 +148,12 @@ class Router {
*/
go(route, events) {
// console.log(route);
if(route.startsWith('/')) return wx.navigateTo({
url: route,
success(res) {
if (events) res.eventChannel.emit('getData', events)
}
})
let { routerMapItem, query } = this.checkRouter(route, events)
// console.log(routerMapItem, query)
if (routerMapItem.isTab) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!