提交 c586f81b 编写于 作者: 杨广俊's avatar 杨广俊

排序问题

上级 46c6682f
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="tea-img" :style="'background:'+ item.bgColor"> <div class="tea-img" :style="'background:'+ item.bgColor">
<!-- <img :src="item.doctorAvatarImg"> --> <!-- <img :src="item.doctorAvatarImg"> -->
<img :src="item.doctorImg"> <img :src="item.doctorImg">
<span class="learn-p">{{item.totalNum | yLocalString}}人已学</span> <span class="learn-p">{{item.joinNum | yLocalString}}人已学</span>
<span class="learn-p-cnum">课程: 共{{item.resourceNum}}</span> <span class="learn-p-cnum">课程: 共{{item.resourceNum}}</span>
</div> </div>
<div class="tea-txt"> <div class="tea-txt">
......
...@@ -82,18 +82,18 @@ export function arraySort(originData, isUp = true, sortedField, converFun) { ...@@ -82,18 +82,18 @@ export function arraySort(originData, isUp = true, sortedField, converFun) {
sourceB = converFun(sourceB[sortedField]) sourceB = converFun(sourceB[sortedField])
} }
} }
if(!sourceA || !sourceB) { // if(!sourceA || !sourceB) {
sourceA = 0 // sourceA = 0
sourceB = 0 // sourceB = 0
} // }
if(isUp) { if(isUp) {
if(sourceA - 0 > sourceB - 0) { if((sourceA - 0) > (sourceB - 0)) {
swap = sortedData[j] swap = sortedData[j]
sortedData[j] = sortedData[j + 1] sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap sortedData[j + 1] = swap
} }
} else { } else {
if(sourceA - 0 < sourceB - 0) { if((sourceA - 0) < (sourceB - 0)) {
swap = sortedData[j] swap = sortedData[j]
sortedData[j] = sortedData[j + 1] sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap sortedData[j + 1] = swap
......
...@@ -137,6 +137,7 @@ export default { ...@@ -137,6 +137,7 @@ export default {
orderAction(orderName, isSortUp) { orderAction(orderName, isSortUp) {
let orderType = isSortUp ? -1 : 1; let orderType = isSortUp ? -1 : 1;
let orderData = this.oldParmDataDoctList.slice(); let orderData = this.oldParmDataDoctList.slice();
console.log('orderData1: ', orderName, orderData)
if (orderName === "doctorFirstNameChar") { if (orderName === "doctorFirstNameChar") {
orderData = arraySort(orderData, isSortUp, orderName, fieldValue => { orderData = arraySort(orderData, isSortUp, orderName, fieldValue => {
return fieldValue.charCodeAt(0); return fieldValue.charCodeAt(0);
...@@ -148,6 +149,7 @@ export default { ...@@ -148,6 +149,7 @@ export default {
} else { } else {
orderData = arraySort(orderData, isSortUp, orderName); orderData = arraySort(orderData, isSortUp, orderName);
} }
console.log('orderData2: ', orderName, orderData)
this.parmDataDoctList = orderData; this.parmDataDoctList = orderData;
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册