Commit c7ec508d by 李伟康

commit 提交

1 parent e5e0a8c2
...@@ -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})
})
}, },
/** /**
......
...@@ -302,11 +302,9 @@ Page({ ...@@ -302,11 +302,9 @@ Page({
sparringDuration, sparringDuration,
score score
}); });
// setTimeout(() => { setTimeout(() => {
// wx.redirectTo({ wx.$router.go("/packageEquity/pages/aiCheck/detail/detail", reportItem)
// url: "/packageEquity/pages/aiCheck/detail/detail", }, 3000);
// });
// }, 3000);
}); });
}, },
handleSave(list, sparringDuration) { handleSave(list, sparringDuration) {
......
...@@ -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!