driverSchool/pagesA/courseDetail/index.vue

189 lines
5.1 KiB
Vue
Raw Normal View History

2025-03-15 17:32:23 +08:00
<template>
2025-04-17 10:01:13 +08:00
<view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="课程详情">
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers>
</view>
<scroll-view :style="{ height: scrollHeight + 'px' }" scroll-y="true" class="scroll-view">
<view class="group_3 flex-col">
<image style="width: 100%; height: 100%;" :src="imagesUrl + '/' + courseDetails.photo" />
</view>
<view class="group_4 flex-col">
<view class="section_2 flex-row justify-between">
<view class="text-wrapper_1">
<text class="text_3"></text>
<text class="text_4">{{ courseDetails.price ? courseDetails.price.toFixed(2) : '--' }}</text>
</view>
<!-- <text class="text_5">3000.00</text>-->
</view>
<text class="text_6">{{ courseDetails.name }}</text>
<view class="section_3 flex-row justify-between">
<view class="text-wrapper_2 flex-col">
<text class="text_7">{{ courseDetails.tittle }}</text>
</view>
<view class="text-wrapper_3 flex-col">
<text class="text_8">{{ courseDetails.type }}</text>
</view>
</view>
<text class="text_9">周一至周日&nbsp;08:00-18:00</text>
</view>
<view class="group_5 flex-col">
<view class="section_4 flex-row justify-between">
<view class="block_3 flex-col"></view>
<text class="text_10">课程介绍</text>
</view>
<view class="u-content" v-if="courseDetails.remark">
<u-parse :content="courseDetails.remark"></u-parse>
</view>
<view class="u-content" v-else>
<u-empty mode="list" text="该课程没有简介...">
</u-empty>
</view>
</view>
</scroll-view>
<view class="group_6 flex-row">
<view class="image-text_1 flex-col justify-between" @click="zxkf()">
<image class="label_2" referrerpolicy="no-referrer"
src="/static/lanhu_kechengxiangqing/FigmaDDSSlicePNG283b4603035848d5dcc7209d10653327.png" />
<text class="text-group_1">咨询客服</text>
</view>
<view class="text-wrapper_4 flex-col" @click="goRegisterNow()">
<text class="text_11">立即报名</text>
</view>
</view>
</view>
2025-03-15 17:32:23 +08:00
</template>
<script>
2025-04-17 10:01:13 +08:00
import request from "@/utils/request";
import config from "@/config.js"
import {
getLocalUserInfo,
getUserInfo,
getToken
} from "@/utils/auth";
import headers from "@/components/header/headers.vue";
2025-04-07 18:08:13 +08:00
2025-04-17 10:01:13 +08:00
export default {
components: {
headers
},
data() {
return {
courseId: undefined,
tenantId: undefined,
courseDetails: [],
driveSchoolPhone: [],
imagesUrl: config.imagesUrl,
userDetails: [],
scrollHeight: 0,
};
},
onLoad(options) {
this.courseId = options.courseId;
this.tenantId = options.tenantId;
this.getCourseDetails();
this.userDetails = getLocalUserInfo();
this.getServicePhone()
},
onReady() {
// 动态计算滚动区域高度
this.calculateScrollHeight();
},
methods: {
goBack() {
uni.navigateBack({
delta: 1
});
},
getCourseDetails() {
request({
url: '/app-api/dl-drive-school-course-small/get',
method: 'GET',
params: {
id: this.courseId,
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
this.courseDetails = res.data;
})
},
zxkf() {
uni.makePhoneCall({
phoneNumber: this.driveSchoolPhone.phone
});
},
getServicePhone() {
request({
url: '/app-api/dl-drive-school-course-small/getServicePhone',
method: 'GET',
params: {
tenantId: this.tenantId,
}
}).then(res => {
this.driveSchoolPhone = res.data
})
},
2025-03-27 15:49:36 +08:00
2025-04-17 10:01:13 +08:00
calculateScrollHeight() {
// 获取屏幕高度
const screenHeight = uni.getSystemInfoSync().windowHeight;
// 获取顶部区域高度
const topHeight = 166;
// 计算滚动区域高度
this.scrollHeight = screenHeight - topHeight;
},
goRegisterNow() {
console.log('token', getToken())
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
2025-04-12 17:52:46 +08:00
}
2025-05-12 17:13:46 +08:00
this.requestPushPermission()
2025-04-17 10:01:13 +08:00
uni.navigateTo({
url: `/pagesA/register/index?courseId=${this.courseDetails.id}&userId=${this.userDetails.id}&tenantId=${this.tenantId}`,
// url: '/pages/index/bmPage'
});
},
2025-05-12 17:13:46 +08:00
requestPushPermission() {
wx.requestSubscribeMessage({
tmplIds: ['CQpqLkmS2xk9Uz5J6tLoNuoaoHu_C7i6t7aCxtg_btc'],
success: (res) => {
if (res['CQpqLkmS2xk9Uz5J6tLoNuoaoHu_C7i6t7aCxtg_btc'] === 'accept') {
console.log('用户同意接收推送');
uni.setStorageSync('agreePush', true)
} else {
console.log('用户拒绝接收推送');
uni.setStorageSync('agreePush', false)
}
},
fail: (err) => {
console.log('请求授权失败', err);
}
})
},
2025-04-12 17:52:46 +08:00
}
2025-04-17 10:01:13 +08:00
};
2025-03-15 17:32:23 +08:00
</script>
<style lang='scss'>
2025-04-17 10:01:13 +08:00
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
.u-content {
margin-top: 20rpx;
padding: 10rpx;
}
2025-04-17 11:17:38 +08:00
</style>