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