Commit 8de0ea8d by kyle

我的分享对接

parent a8753ed2
......@@ -100,5 +100,9 @@ export default {
// 我的分享
userShareQuery(params){
return request(`${cffpURL}/share/userShareQuery`, "POST", params)
},
// 订单详情
userCourseInfo(params){
return request(`${cffpURL}/course/userCourseInfo`, "POST", params)
}
}
......@@ -8,8 +8,8 @@
<!-- tab内容 -->
<view class="tabContent">
<view class="learningRecordContainer" v-if="tabType===1">
<h3 class="noListTip">暂无学习记录!</h3>
<view class="learningRecordItem" v-for="item in userStudyList">
<h3 class="noListTip" v-if="!userStudyLists">暂无学习记录!</h3>
<view class="learningRecordItem" v-for="item in userStudyLists">
<view class="dateBox">{{item.studyTime}}</view>
<!-- 课程详情 -->
<view class="courseInfoContent" v-for="subItem in item.userStudyInfos" :key="subItem.fileId">
......@@ -28,7 +28,7 @@
<view>%</view>
</view>
<view class="dataBox">
<text>可观看截至:{{subItem.effectiveEndDate}}</text>
<text>可观看截至:{{dateFormat(subItem.effectiveEndDate)}}</text>
</view>
</view>
</view>
......@@ -44,35 +44,40 @@
<script>
import api from "@/api/api";
import dataHandling from "@/util/dataHandling";
export default {
data() {
return {
tabType:1,
userStudyList:[],
userId:null
userStudyLists:[],
userId:'1'
}
},
methods: {
switchTab(type){
this.tabType = type;
if(type===1){
}else{
}
},
userStudyList(){
api.userStudyList({userId:this.userId}).then(res=>{
if(res['success']){
this.userStudyList = res['data']['userStudyTimeInfos'];
this.userStudyLists = res['data']['userStudyTimeInfos'];
}
console.log(res)
})
},
switchTab(type){
this.tabType = type;
if(type===1){
this.userStudyList()
}else{
}
},
dateFormat(val){
return dataHandling.dateFormat(val);
}
},
onLoad() {
},
mounted() {
this.switchTab(1)
}
}
</script>
......
......@@ -2,13 +2,13 @@
<view class="container">
<view class="orderInfoContent">
<ul>
<li v-for="item in orderInfoList" :key="item.id">
<li v-for="item in orderInfoList.filter(item=>item.pageArea===1)" :key="item.id">
<text>{{item.name}}:</text>
<text :style="{color:item.color ? item.color : '#666'}">{{item.value}}</text>
</li>
</ul>
<ul>
<li v-for="item in orderStatusInfoList" :key="item.id">
<li v-for="item in orderInfoList.filter(item=>item.pageArea===2)" :key="item.id">
<text>{{item.name}}:</text>
<text :style="{color:item.color ? item.color : '#666'}">{{item.value}}</text>
</li>
......@@ -18,28 +18,54 @@
</template>
<script>
import api from "@/api/api";
export default {
data() {
return {
userId:'1',
orderId:'1',
orderInfoList:[
{id:1,name:'订单编号',value:'111111',type:'string'},
{id:2,name:'购买时间',value:'111111',type:'string'},
{id:3,name:'课程类型',value:'111111',type:'string'},
{id:4,name:'课程名称',value:'111111',type:'string'},
{id:5,name:'购买人',value:'111111',type:'string'},
{id:6,name:'课程讲师',value:'111111',type:'string'},
{id:7,name:'课程现价',value:'111111',type:'currency'},
{id:8,name:'积分抵扣',value:'111111',color:'#FA6900',type:'currency'},
{id:9,name:'实际支付',value:'111111',type:'currency'}
],
orderStatusInfoList:[
{id:1,name:'获得积分',value:'111111',type:'currency',color:'#F15A1F'},
{id:2,name:'积分来源',value:'111111',type:'string'},
{id:3,name:'课程状态',value:'111111',type:'string'},
{id:4,name:'观看截至',value:'111111',type:'string'},
{id:1,name:'订单编号',value:'111111',type:'string',alias:'orderNo',pageArea:1},
{id:2,name:'购买时间',value:'111111',type:'string',alias:'orderConfirmDate',pageArea:1},
{id:3,name:'课程类型',value:'111111',type:'string',alias:'courseClassify',pageArea:1},
{id:4,name:'课程名称',value:'111111',type:'string',alias:'fileTitle',pageArea:1},
{id:5,name:'购买人',value:'111111',type:'string',alias:'userName',pageArea:1},
{id:6,name:'课程讲师',value:'111111',type:'string',alias:'lecturerName',pageArea:1},
{id:7,name:'课程现价',value:'111111',type:'currency',alias:'orderPrice',pageArea:1},
{id:8,name:'积分抵扣',value:'111111',color:'#FA6900',type:'currency',alias:'integralExchange',pageArea:1},
{id:9,name:'实际支付',value:'111111',type:'currency',alias:'paymentAmount',pageArea:1},
{id:10,name:'获得积分',value:'111111',type:'currency',color:'#F15A1F',alias:'salesCommission',pageArea:2},
{id:11,name:'积分来源',value:'111111',type:'string',alias:'commissionSource',pageArea:2},
{id:12,name:'课程状态',value:'111111',type:'string',alias:'courseStatus',pageArea:2},
{id:13,name:'观看截至',value:'111111',type:'string',alias:'effectiveEndDate',pageArea:2}
]
};
},
methods:{
userCourseInfo(){
const param = {
userId:this.userId,
orderId:this.orderId
}
api.userCourseInfo(param).then(res=>{
if(res['success']){
const data = res['data']['orderDetail'];
Object.keys(data).map((key,item)=>{
this.orderInfoList.forEach(val=>{
if(val.alias == key){
val.value = data[key];
}
})
})
}
})
}
},
mounted() {
this.userCourseInfo()
}
}
</script>
......
......@@ -32,4 +32,13 @@ export default{
const s = Math.floor(value % 60) > 0 ? Math.floor(value % 60) : '00';
return h + ':' + m + ':' + s;
},
// 日期格式化
dateFormat(val:number){
if(val){
const date = new Date(val);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()
}else {
return val;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment