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.

193 lines
4.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="container">
<image class="cbg" :src="base.imgHost('common_bg.png')"></image>
<view class="detail">
<view class="detail-name">
<text v-if="info.type">{{info.type_detail?info.type_detail.name+' | ':''}}</text>
{{info.name}}
</view>
<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>
<view class="detail-tips2">请长按扫码添加班主任进群及时了解详细信息</view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
course_id: '',
info: {},
}
},
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'
}
},
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() {},
methods: {
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
})
this.info = this.base.requestToForm(this.info, res)
let typeName = res.type_detail?res.type_detail.name+" | " :''
uni.setNavigationBarTitle({
title: typeName+res.name,
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;
}
}
}
}
</style>