Compare commits
1 Commits
53d0cc6767
...
dev
Author | SHA1 | Date | |
---|---|---|---|
a1d21c67b8 |
2
app.json
2
app.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/personCenter/mine/mine",
|
||||
"pages/loginModule/pwdLogin/pwdLogin",
|
||||
"pages/personCenter/mine/mine",
|
||||
"pages/loginModule/agreement/agreement",
|
||||
"pages/loginModule/privacyPolicy/privacyPolicy",
|
||||
"pages/personCenter/subCommissionSetting/subCommissionSetting",
|
||||
|
@ -1,9 +1,40 @@
|
||||
import { baseUrl } from "../../../request";
|
||||
import { decodeBase64 } from "../../../utils/decodebase64";
|
||||
|
||||
// pages/course/courseDetail/courseDetail.js
|
||||
Page({
|
||||
data: {
|
||||
items: [null, null, null,null, null, null],
|
||||
chapterList: [null, null, null,null, null, null], // 章节目录
|
||||
activeTab: 'intro', // 默认选中“课程简介”
|
||||
activeIndex: null, // 默认没有任何标题被选中
|
||||
cid: 0, // 课程ID
|
||||
courseObj: '', // 课程对象
|
||||
richText: '', // 课程概述富文本
|
||||
},
|
||||
|
||||
// 获取课程详情
|
||||
getCourseDetail() {
|
||||
const cid = this.data.cid;
|
||||
wx.request({
|
||||
url: baseUrl + '/course/query/id',
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: cid
|
||||
},
|
||||
header: {
|
||||
Authorization :wx.getStorageSync('token'),
|
||||
},
|
||||
success : res => {
|
||||
console.log(res);
|
||||
if (res.data.code === 1) {
|
||||
this.setData({
|
||||
courseObj: res.data.data,
|
||||
chapterList: res.data.data.courseChapters,
|
||||
richText: decodeBase64(res.data.data.detail)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 切换选项卡 */
|
||||
@ -40,7 +71,13 @@ Page({
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {},
|
||||
onLoad(options) {
|
||||
console.log(options);
|
||||
this.setData({
|
||||
cid: options.id,
|
||||
})
|
||||
this.getCourseDetail()
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
|
@ -1,18 +1,8 @@
|
||||
<view class="flex-col page">
|
||||
<view class="flex-col">
|
||||
<!-- 背景 + 支付信息 -->
|
||||
<view class="flex-col justify-start section">
|
||||
<view class="flex-col section_2">
|
||||
<view class="flex-row items-baseline self-start no-wrap">
|
||||
<text class="shrink-0 font">券后支付</text>
|
||||
<text class="shrink-0 font_2 text text_2 mx-15">168元</text>
|
||||
<text class="flex-1 font">即可观看所有视频</text>
|
||||
</view>
|
||||
|
||||
<view class="mt-18 flex-col justify-start items-center self-center text-wrapper" bind:tap="gotoCourseOrder" data-id="{{ '1' }}">
|
||||
<text class="font_3 text_3">立即购买</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 背景图 -->
|
||||
<view class="flex-col section">
|
||||
<image class="background-image" src="https://img.picui.cn/free/2025/06/26/685cc80000461.png" />
|
||||
</view>
|
||||
|
||||
<!-- 选项卡 -->
|
||||
@ -27,15 +17,15 @@
|
||||
<view class="flex-col section_4">
|
||||
<view class="flex-row items-center group_4">
|
||||
<view class="shrink-0 group_5">
|
||||
<text class="text_6">168</text>
|
||||
<text class="text_6">{{ courseObj.originPrice }}</text>
|
||||
<text class="font_3 text_7">元券后价</text>
|
||||
</view>
|
||||
<view class="ml-4 flex-col justify-start items-start shrink-0 relative group_6">
|
||||
<text class="font_2 text text_8">268元</text>
|
||||
<text class="font_2 text text_8">{{ courseObj.discountPrice }}元</text>
|
||||
<view class="divider pos"></view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="group_4 text_9 mt-9">【早鸟42折】掌握CAD技能+++++++实战工作训练营</text>
|
||||
<text class="group_4 text_9 mt-9">{{ courseObj.name }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 课程概述(仅当 activeTab==='intro') -->
|
||||
@ -44,26 +34,26 @@
|
||||
<image class="image" src="./image/cal.png" />
|
||||
<text class="ml-6 font_2 text_10">课程概述</text>
|
||||
</view>
|
||||
<view class="section_6"></view>
|
||||
<rich-text class="section_6" nodes="{{richText}}"></rich-text>
|
||||
</view>
|
||||
|
||||
<!-- 课程目录(仅当 activeTab==='catalog') -->
|
||||
<view wx:if="{{activeTab==='catalog'}}" class="flex-col mt-35">
|
||||
<view class="flex-col section_7">
|
||||
<view class="flex-col list">
|
||||
<view class="flex-col list-item mt-15" wx:for="{{items}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||
<view class="flex-col justify-start self-end text-wrapper_2">
|
||||
<view class="flex-col list-item mt-15" wx:for="{{chapterList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||
<!-- <view class="flex-col justify-start self-end text-wrapper_2">
|
||||
<text class="font_4 text_11">全集试看</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="flex-row self-start group_8 mt-1">
|
||||
<text class="shrink-0 self-start font_5 text_12">{{ index + 1}}</text>
|
||||
<text class="ml-16 flex-1 font_2 {{activeIndex === index ? 'active-title' : ''}}" bindtap="selectCourse" data-index="{{index}}">
|
||||
推荐片:带你透视中国基层干部的生态图景推荐片:带你透视中国基层干部的生态图景
|
||||
{{ item.name }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="flex-row justify-between self-stretch group_9 mt-1">
|
||||
<text class="self-start font_6 text_13" style="margin-top: 10rpx;">视频课·27分59秒</text>
|
||||
<image class="image_2" src="./image/lock.png" />
|
||||
<!-- <text class="self-start font_6 text_13" style="margin-top: 10rpx;">视频课·27分59秒</text> -->
|
||||
<!-- <image class="image_2" src="./image/lock.png" /> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -20,7 +20,14 @@
|
||||
margin-left: 28.13rpx;
|
||||
}
|
||||
|
||||
/* 页面容器 */
|
||||
/* 背景图样式移至 WXML */
|
||||
.background-image {
|
||||
width: 100%;
|
||||
height: 300rpx; /* 给图片设置固定高度,或者你可以设置为100% */
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* 页面样式保持不变 */
|
||||
.page {
|
||||
background-color: #f6f7f9;
|
||||
width: 100%;
|
||||
@ -32,7 +39,6 @@
|
||||
|
||||
/* 背景图 */
|
||||
.section {
|
||||
background-image: url('https://ide.code.fun/api/image?token=6858ee4b4ae84d0012334127&name=1f211c9a259577e8af923158ce6e4ab6.png');
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
@ -152,10 +158,10 @@
|
||||
.section_6 {
|
||||
background-color: #ffffff00;
|
||||
height: 791.25rpx;
|
||||
border-left: solid 1.88rpx #000000;
|
||||
/* border-left: solid 1.88rpx #000000;
|
||||
border-right: solid 1.88rpx #000000;
|
||||
border-top: solid 1.88rpx #000000;
|
||||
border-bottom: solid 1.88rpx #000000;
|
||||
border-bottom: solid 1.88rpx #000000; */
|
||||
}
|
||||
|
||||
/* 目录列表 */
|
||||
@ -174,7 +180,7 @@
|
||||
}
|
||||
.list-item {
|
||||
padding-left: 37.5rpx;
|
||||
padding-bottom: 18.75rpx;
|
||||
padding-bottom: 25.75rpx;
|
||||
background-color: #f6f7f9;
|
||||
border-radius: 10.63rpx;
|
||||
}
|
||||
@ -209,6 +215,7 @@
|
||||
.text_12 {
|
||||
margin-top: 0; /* 垂直居中序号 */
|
||||
align-self: center !important;
|
||||
padding-top: 32rpx;
|
||||
}
|
||||
.font_2 {
|
||||
font-size: 26.25rpx;
|
||||
@ -223,6 +230,7 @@
|
||||
}
|
||||
.text_8 {
|
||||
color: #8c8c8c;
|
||||
width: 100rpx;
|
||||
}
|
||||
.text_2 {
|
||||
color: #ff8d1a;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { baseUrl } from "../../../request";
|
||||
const { globalImgUrl } = require("../../../request")
|
||||
|
||||
// pages/course/homepage/homepage.js
|
||||
Page({
|
||||
@ -31,10 +32,9 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
// 获取热门课程
|
||||
|
||||
getCourseList() {
|
||||
// 请求后端接口
|
||||
wx.request({
|
||||
url: baseUrl + '/course/query/hot', // ← 替换为真实接口
|
||||
@ -44,6 +44,7 @@ Page({
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.code === 1) {
|
||||
console.log('课程列表---->',res.data.data);
|
||||
// 将后端的 data 数组绑定到 items
|
||||
this.setData({
|
||||
courseList: res.data.data
|
||||
@ -64,6 +65,13 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.getCourseList()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
Reference in New Issue
Block a user