You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
5.1 KiB

1 year ago
<template>
<view class="container">
<image class="cbg" :src="base.imgHost('common_bg.png')"></image>
<view class="detail">
1 year ago
<view class="detail-name">
<text v-if="info.type">{{info.type_detail?info.type_detail.name+' | ':''}}</text>
{{info.name}}
</view>
1 year ago
<view class="detail-time">课程日期{{info.start_date?info.start_date:''}}{{info.end_date?info.end_date:''}}
</view>
<view class="detail-tips">
<view>请及时扫码进群</view>
</view>
<view class="detail-code">
<image show-menu-by-longpress :src="info.qun_image?info.qun_image.url:''"></image>
</view>
1 year ago
<view class="detail-tips2">请长按扫码添加班主任进群及时了解详细信息</view>
<!-- 显示通讯录 -->
<view class="detail-btn" v-if="info.show_txl===1">
<view @click="toTxl">
<image class="course-btn" :src="base.imgHost('course-btn.png')"></image>
<text>通讯录</text>
</view>
</view>
1 year ago
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
course_id: '',
info: {},
}
},
1 year ago
// onShareAppMessage(res) {
// return {
// path: "/packages/course/freeDetail?id=" + this.course_id, //这是为了传参 onload(data){let id=data.id;}
// title: this.info.name,
// imageUrl: '/static/share.jpg'
// }
// },
// onShareTimeline() {
// return {
// path: "/packages/course/freeDetail?id=" + this.course_id, //这是为了传参 onload(data){let id=data.id;}
// title: this.info.name,
// imageUrl: '/static/share.jpg'
// }
// },
1 year ago
onLoad(options) {
this.course_id = options.id
let token = uni.getStorageSync('stbc1_lifeData') ? uni.getStorageSync('stbc1_lifeData').vuex_token : ''
if (this.base.isNull(token)) {
this.getToken()
} else {
this.getCourseDetail(this.course_id)
}
},
onHide() {},
1 year ago
methods: {
toTxl(){
uni.navigateTo({
url:'/packages/mycourse/courseTxl?id='+this.course_id+"&show_mobile="+this.info.show_mobile
})
},
1 year ago
async getToken() {
let that = this
await uni.login({
provider: 'weixin',
success: (res) => {
this.$u.api.login({
code: res.code
}).then(res1 => {
uni.setStorageSync("stbc1_lifeData", {
'vuex_token': res1.token
})
uni.request({
url: baseUrl + '/api/mobile/user/get-user-info',
header: {
Authorization: `Bearer ${res1.token}`
},
method: "GET",
success(res2) {
uni.setStorageSync("stbc1_lifeData", {
'vuex_token': res1.token,
"vuex_user": res2.data.user
})
that.getCourseDetail(that.course_id)
},
fail(err) {
console.log("err", err)
}
})
}).catch(err => {
console.log('login-error:', JSON.stringify(err))
})
},
fail: (res) => {
console.log("errtoken", JSON.stringify(res))
}
});
},
async getCourseDetail(id) {
const res = await this.$u.api.courseDetail({
course_id: id
})
1 year ago
this.info = this.base.requestToForm(this.info, res)
let typeName = res.type_detail?res.type_detail.name+" | " :''
1 year ago
uni.setNavigationBarTitle({
1 year ago
title: typeName+res.name,
1 year ago
success: function() {
console.log('标题设置成功');
},
fail: function(err) {
console.error('标题设置失败', err);
}
});
},
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100%;
height: 100vh;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
.detail {
width: 100%;
height: 100vh;
overflow: scroll;
// padding: 40rpx 80rpx;
position: relative;
padding: 115rpx 60rpx;
padding-bottom: 115rpx;
text-align: center;
&>view {
margin-bottom: 30rpx;
}
&-name {
font-size: 32rpx;
color: #333333;
}
&-time {
font-size: 24rpx;
color: #666666;
}
&-tips {
&>view {
padding: 10rpx 20rpx;
background-color: #fff;
color: #b08c6c;
font-size: 28rpx;
width: 260rpx;
border-radius: 30rpx;
margin: 0 auto;
box-shadow: 0 -1rpx 20rpx #bed2ec;
}
}
&-tips2{
color:#999;
font-size: 24rpx;
}
&-code {
width: 400rpx;
height: 400rpx;
padding: 20rpx;
background-color: #fff;
border-radius: 10rpx;
margin: 0 auto;
box-shadow: 0 -1rpx 20rpx #bed2ec;
image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
1 year ago
}
&-btn {
width: 100%;
height: 199rpx;
position: fixed;
left: 0;
bottom: 160rpx;
text-align: center;
&>view {
>image {
width: 580rpx;
height: 199rpx;
margin: 0 auto;
display: block;
}
>text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
font-size: 32rpx;
}
}
1 year ago
}
}
}
</style>