myCourse.vue
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<view>
<view class="list">
<view class="kcitem" v-for="n in list" :key="n.courseId" @click="goDetail(n)">
<image :src="config.baseUrl_api+n.coursePic" mode="aspectFill"></image>
<view class="info">
<view class="tt esp_2">{{n.courseName}}</view>
<!-- <view class="pp"><uni-icons type="chatboxes" size="12" />209w 学习</view> -->
<view class="text-warning">{{n.explains}}</view>
</view>
</view>
</view>
<view class="nodata" v-if="list.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import config from '@/config.js';
import {
ref,
getCurrentInstance
} from 'vue';
import * as api from '@/common/api.js';
const list = ref([])
onShow((option) => {
getList()
})
function getList(){
api.getMyCourses().then(res=>{
list.value = res.rows
})
}
function goDetail(item) {
let path = `/course/courseDetail?id=${item.courseId}`;
uni.navigateTo({
url: path
});
}
</script>
<style scoped lang="scss">
.list {
padding: 24rpx 0 0 24rpx;
overflow: hidden;
}
</style>