123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <template>
- <view class="container">
- <view class="top">
- <text class="title">
- <text class="title-brown-group">
- <text class="title-stroke">健康生活方式</text>
- <text class="title-fill">健康生活方式</text>
- </text>
- <text class="title-normal">大讲堂</text>
- </text>
- <image class="top-bg" :src="imgPath+'/app/commonCourse/famous1.png'"></image>
- <view class="txt">
- <view>让健康回归生活化,</view>
- <view>以健康的生活方式,</view>
- <view>改善健康困扰,重拾晚年幸福!</view>
- </view>
- </view>
- <view class="container-body">
- <image class="bg" :src="imgPath+'/app/commonCourse/bg-class.png'"></image>
- <view class="title-wrap">
- <text class="title-stroke">{{type==1?'健康大讲堂':'生活大讲堂'}}</text>
- <text class="title-fill">{{type==1?'健康大讲堂':'生活大讲堂'}}</text>
- </view>
- <view class="card-box" v-for="(item,index) in cardList" :key="index" @click="goLearn(item.courseId)">
- <view class="bar">
- <image :src="imgPath+'/app/commonCourse/bar.png'" mode="widthFix"></image>
- <view class="tit">{{item.courseName}}</view>
- </view>
- <view class="img-box">
- <view class="img">
- <image :src="item.imgUrl || imgPath+'/app/commonCourse/no-img.png'" mode="widthFix"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- courseList,
- courseListB
- } from '@/api/class.js'
- export default {
- data() {
- return {
- type:null,
- cardList: [],
- classListb:[]
- }
- },
- computed: {
- imgPath() {
- return this.$store.state.imgpath
- },
- },
- mounted() {
-
- },
- onLoad(option) {
- this.type=option.type
- if(this.type==1){
- this.getCourseList()
- }else{
- this.getCourseListb()
- }
- },
- methods: {
- getCourseListb() {
- //私域看课
- courseListB().then(res => {
- if (res.code == 200) {
- this.cardList = res.data
- } else {
- uni.hideLoading();
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- })
- },
- getCourseList() {
- courseList().then(res => {
- if (res.code == 200) {
- this.cardList = res.data
- } else {
- uni.hideLoading();
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- })
- },
- goLearn(id) {
- uni.navigateTo({
- url: '/pages_course/learn?courseId='+id+'&type='+this.type
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- background-color: #f6e5db;
- min-height: 100vh;
- .top {
- position: relative;
- z-index: 1;
- font-size: 78rpx;
- font-weight: 900;
- text-align: center;
- padding: 34rpx 0;
- .title {
- background: linear-gradient(to right, #333032, #5f3b32);
- -webkit-background-clip: text;
- background-clip: text;
- -webkit-text-fill-color: transparent;
- position: relative;
- z-index: 2;
- }
-
- /* 2. 双层渐变描边组合 */
- .title-brown-group {
- position: relative;
- display: inline-block;
- line-height: 1;
- }
-
- .title-stroke {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1;
- color: #fff;
- -webkit-text-stroke: 4rpx #fff;
- text-shadow: 2rpx 2rpx 4rpx rgba(183, 94, 52, 0.5);
- }
-
- .title-fill {
- position: relative;
- z-index: 2;
- color: transparent;
- background: linear-gradient(to bottom, #c47243, #b0592a);
- -webkit-background-clip: text;
- background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .top-bg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 0;
- }
- .txt {
- font-style: italic;
- text-align: left;
- color: #fff;
- font-size: 36rpx;
- font-weight: 500;
- position: absolute;
- left: 8%;
- top: 172rpx;
- text-shadow:
- 0 0 1rpx #b0663c,
- 1rpx 1rpx 10rpx rgba(183, 0, 3, 0.3);
- }
- }
- .container-body {
- margin-top: 250rpx;
- min-height: calc(100vh - 250rpx);
- padding: 50rpx 24rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- z-index: 1;
- .bg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- object-fit: cover;
- z-index: -1;
- }
- .title-wrap{
- position: relative;
- display: inline-block;
- font-size: 70rpx;
- font-weight: 900;
- line-height: 1; /* 防止上下空隙 */
- }
-
- /* 下层:白描边 + 投影 */
- .title-stroke{
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1;
- color: #fff; /* 描边色 */
- -webkit-text-stroke: 2rpx #fff;
- text-shadow: 2rpx 2rpx 4rpx rgba(183,94,52,.5);
- }
-
- /* 上层:干净渐变填充 */
- .title-fill{
- position: relative;
- z-index: 2;
- color: transparent;
- background: linear-gradient(to bottom, #c47243, #b0592a);
- -webkit-background-clip: text;
- background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .card-box {
- width: 100%;
- margin-top: 30rpx;
- .bar {
- position: relative;
- image {
- position: absolute;
- width: 100%;
- height: 100%;
- z-index: -1;
- }
- .tit {
- text-align: center;
- line-height: 90rpx;
- color: #fff;
- font-weight: 500;
- font-size: 36rpx;
- }
- }
- .img-box {
- margin-top: -8rpx;
- padding: 24rpx;
- background-color: #fff;
- border-radius: 0 0 20rpx 20rpx;
- .img {
- max-height: 380rpx;
- overflow: hidden;
- border-radius: 20rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- }
- }
- </style>
|