四端上传

This commit is contained in:
tianmo committed 2026-09-29 15:25:40 +08:00
1 parent 25bbb5f9c8
commit c6e2cb4d5b
276 files changed
+17812 -3

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
// pages/kecheng/kecheng.js
const api = require('../../utils/api');
const store = require('../../utils/store');
const config = require('../../config/index');
const app = getApp();
Page({
data: {
staticBase: config.STATIC_BASE_URL,
hasCourse: false,
ownedCourses: [],
otherCourses: [],
tipsHtml: '',
},
onLoad() {
// 旧版本用 10ms 轮询最多 5 秒等登录数据,这里改为等初始化完成
app.ready().then(() => this.refresh());
},
onShow() {
if (store.isLoggedIn()) this.refresh();
},
refresh() {
this.loadTips();
api
.getEntitlements()
.then((list) => {
store.setEntitlements(list);
this.setData({ ownedCourses: list || [], hasCourse: (list || []).length > 0 });
})
.catch((err) => console.warn('[kecheng] 已购课程加载失败', err));
api
.getCourses()
.then((list) => {
this.setData({ otherCourses: (list || []).filter((c) => !c.owned) });
})
.catch((err) => console.warn('[kecheng] 课程列表加载失败', err));
},
loadTips() {
if (this.data.tipsHtml) return;
api
.getTips()
.then((tip) => this.setData({ tipsHtml: (tip && tip.content) || ' ' }))
.catch((err) => console.warn('[kecheng] 文案加载失败', err));
},
toMyCourse(e) {
wx.navigateTo({
url: '/pages/VideoDetails/VideoDetails?code=' + e.currentTarget.dataset.code,
});
},
toStoreCourse(e) {
wx.navigateTo({
url: '/pages/VideoDetails/VideoDetails?code=' + e.currentTarget.dataset.code,
});
},
onShareAppMessage() {
return { title: '叶雷讲数学', path: '/pages/index/index' };
},
});
+6
View File
@@ -0,0 +1,6 @@
{
"usingComponents": {
"Parser":"/Parser/index"
},
"navigationBarTitleText": "知识"
}
+37
View File
@@ -0,0 +1,37 @@
<scroll-view class="container" scroll-y enable-flex type="custom">
<block wx:if="{{!hasCourse}}">
<view style="width: 100%;height: 400rpx;">
<image style="margin-top: 30rpx; margin-left: 20rpx; height: 350rpx; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); width: 710rpx; border-radius: 20rpx; background-color: rgb(0, 255, 255);"
src="{{staticBase}}/Images/Banner/BGbanner.png" mode="aspectFill" />
</view>
<Parser html="{{tipsHtml}}" />
</block>
<block wx:if="{{hasCourse}}">
<view wx:for="{{ownedCourses}}" wx:for-item="item" wx:for-index="index" wx:key="courseId"
class="kecheng" bind:tap="toMyCourse" data-code="{{item.code}}">
<view class="kecheng_video_up">
<image class="kecheng_img" src="{{item.coverUrl}}" mode="aspectFit" />
</view>
<view class="kecheng_video_right">
<text class="kecheng_title">{{item.title}}</text>
<text class="kecheng_details">{{item.intro}}</text>
</view>
</view>
</block>
<block wx:if="{{otherCourses.length > 0}}">
<view wx:for="{{otherCourses}}" wx:for-item="item" wx:for-index="index" wx:key="code"
class="kecheng" bind:tap="toStoreCourse" data-code="{{item.code}}">
<view class="kecheng_video_up">
<image class="kecheng_img" src="{{item.coverUrl}}" mode="aspectFit" />
</view>
<view class="kecheng_video_right">
<text class="kecheng_title">{{item.title}}</text>
<text class="kecheng_details">{{item.intro}}</text>
</view>
<text style="position: absolute; right: 24rpx; bottom: 24rpx; font-size: 24rpx; color: #ff6b00;">未开通</text>
</view>
</block>
</scroll-view>
+49
View File
@@ -0,0 +1,49 @@
/* pages/kecheng/kecheng.wxss */
.container {
padding:0;
align-items:center;
flex-direction:column;
justify-content:space-between;
}
.kecheng {
width: 710rpx;
height: 275rpx;
border-radius: 20rpx;
overflow: hidden;
display: flex;
justify-content: left;
align-items: center;
margin: 6px 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.kecheng_video_up {
width: 400rpx;
height: 225rpx;
margin-left: 10rpx;
}
.kecheng_video_right {
margin-left: 5rpx;
width: 290rpx;
height: 225rpx;
overflow: hidden;
}
.kecheng_img {
background-color: #15457b;
width: 100%;
height: 100%;
border-radius: 15rpx;
}
.kecheng_title {
display: block;
font-size: 30rpx;
text-align: center;
}
.kecheng_details {
display: block;
font-size: 25rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}