Merge branch 'xie'

This commit is contained in:
@fawn-nine
2024-06-25 13:27:37 +08:00
13 changed files with 473 additions and 63 deletions

View File

@@ -16,10 +16,10 @@
<u-icon name="bag" color="#fff" size="28"></u-icon>
<text>立即购买</text>
</view>
<!-- <view class="saveBtnss gouwuche flexbox" @click="oprate('gouwuche')">
<view class="saveBtnss gouwuche flexbox" @click="oprate('gouwuche')">
<uni-icons type="cart" size="28" style="color: #666;"></uni-icons>
<text>加入购物车</text>
</view> -->
</view>
</view>
</view>
</u-popup>

View File

@@ -510,6 +510,20 @@
"navigationBarTitleText": "医述详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/course/healthMarket",
"style": {
"navigationBarTitleText": "健康超市",
"enablePullDownRefresh": false
}
},
{
"path": "pages/course/vipCourse",
"style": {
"navigationBarTitleText": "超V课程",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {

View File

@@ -7,18 +7,14 @@
<u-alert
v-if=""
style="
position: fixed;
left: 0;
width: 100%;
z-index: 10;
"
:title="goBuyTitle"
type="warning"
:show-icon="true"
>
<template slot="rightSlot" slot-scope="slotProps">
<text class="saveBtn vipBtn flexbox buyBtn" style="color: #fff;">
<text class="saveBtn vipBtn flexbox buyBtn" style="color: #fff;" @click="onPageJump('/pages/mine/vip/index')">
开通VIP
</text>
<view> </view>
@@ -106,6 +102,7 @@
proPriceList:[],
pricespop:false,
userMsg:{},
cartList:[]
};
},
//第一次加载
@@ -137,14 +134,111 @@
},
//方法
methods: {
// 获取购物车数据
addCart(val){
console.log(val)
if (val.productStock == 0) {
uni.showToast({
title: '商品库存不足',
icon: "none"
});
} else {
console.log(this.userInfo, '222')
this.$http
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then(res => {
// console.log(
this.cartList = res.cartList
this.isAddLink(val)
})
}
},
// 加入到购物车
isAddLink(item) {
// 统计商品信息
let data = {
"userId": this.userInfo.id,
"productId": item.productId,
"productAmount": this.productAmount,
"price": item.price
}
// 判断列表是否为空
if (this.cartList.length > 0) {
let flag = ''
let shagnpin = {}
// 循环购物车列表
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item
shagnpin.productAmount += 1
return true
}
})
if (flag) {
// 已在购物车中添加
$http.request({
url: "book/ordercart/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: shagnpin,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
this.upoShow = false
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
} else {
// 加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
this.upoShow = false
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
} else {
// 购物车列表为空时直接加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
},
oprate(data){
console.log(data,'得到的内容')
if(data.name == 'buy'){
this.buy(data.item)
}
// else if(data.name == 'gouwuche'){
// this.addCart(data.item)
// }
else if(data.name == 'gouwuche'){
this.addCart(data.item)
}
},
buy(val){
var mynavData = JSON.stringify({

View File

@@ -0,0 +1,274 @@
<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle"></z-nav-bar>
<view class="learnBox box" >
<view class="proBoxItem flexbox" v-if="proList.length > 0">
<view class="item" v-for="(item, index) in proList" :key="index" @click="proClick(item)">
<view class="img flexbox">
<image :src="item.productImages" mode="widthFix"></image>
</view>
<text>{{item.productName}}</text>
</view>
</view>
<u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider>
</view>
<public-module></public-module>
<z-navigation></z-navigation>
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
var clear;
import {
mapState
} from 'vuex';
export default {
data() {
return {
playData: {},
tagId: null,
pageTitle: '',
proList: [],
status:0, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page:1,
flag:true, // 函数是否执行完
bgiStyle: {
background: '#fff'
},
scrollTop: 0,
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#258feb',
},
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.tagId = e.id
this.pageTitle = e.title
console.log(e, '传入分类id')
this.getData();
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
onReachBottom() {
if(this.status != 2 && this.flag){
this.page ++
this.getData()
}
console.log('触底加载',this.page)
},
computed: {
...mapState(['userInfo'])
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
},
components: {
musicPlay
},
//方法
methods: {
proClick(v) {
uni.navigateTo({
url: `/pages/goods/index/index?navTitle=${v.title}&title=${v.title}&id=${v.productId}`,
// url: `/pages/bookShop/commodityDetail?id=${item.productId}&title=${item.productName}`
});
},
// 跳转
onPageJump(url,thatId,title) {
uni.navigateTo({
url: `${url}?id=${thatId}&title=${title}`
});
},
getData() {
// if(!this.flag){
// console.log('正在执行,未完成')
// return
// }
this.status = 1
this.flag = false
$http.request({
url: "medical/labelAndMarket/getMarketShopProductList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"medicineMarketId": this.tagId,
"limit": 12,
"current": this.page,
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.result.records.length > 0) {
var list = res.result.records
this.proList = this.proList.concat(list)
if(res.result.pages > this.page){
this.status = 0
}else{
this.status = 2
}
} else if(this.page > 1){
this.status = 2 // 加载完成
}else{
this.status = 3 // 暂无数据
}
console.log('status',this.status)
}
this.flag = true
}).catch(e => {
console.log(e,'数据报错')
});
}
},
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.proBoxItem {
flex-wrap: wrap;
padding: 20rpx;
justify-content: space-between;
.item {
width: 48%;
overflow: hidden;
text {
display: block;
@include toe();
font-size: 26rpx;
padding: 20rpx 0;
}
.img {
height: 400rpx;
align-items: center;
overflow: hidden;
background-color: $imgBg ;
image {
width: 100%;
height: 80rpx;
}
}
}
}
.flexbox{display: flex; }
.imgcontainer {
background-color: $imgBg;
}
.box {
background-color: #fff;
@include pleft_right(10px);
min-height: calc(100vh - 270rpx);
}
.newBox {
.item {
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 20rpx;
@include ptop_bottm(10px);
@include pleft_right(10px);
@include mshadow(10px, 1) .imgcontainer {
display: block;
width: 110rpx;
margin-right: 20rpx;
// background-size: cover;
// background-position: center;
height: 200rpx;
flex-grow: 1;
// @include ptop_bottm(10px);
overflow: hidden;
// @include pleft_right(10px);
image {
width: 100%;
height: 200rpx;
}
}
.btn_box{ text-align: right;
text{
border-radius: 20rpx;
padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff;
}
}
.buyItems {
width: 60%;
}
.jianjie {
margin-top: 10rpx;
font-size: 24rpx;
@include bov();
color: #9c9c9c;
}
.txt555 {
font-size: 30rpx;
color: #000;
@include bov()
}
}
}
.learnBox {
background-color: #fff;
margin-top: 10px;
@include ptop_bottm(10px);
@include pleft_right(10px);
.learn { flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
.item {
width: 48%;margin-bottom: 16px;
overflow: hidden;
image {
width: 100%;
height: 200rpx;
}
.txt555 { display: block; text-align: center;
height: 40rpx; width: 100%;
line-height: 40rpx;
@include bov(1);
margin-top: 10rpx;
font-size: 24rpx;
}
}
}
}
</style>

View File

@@ -37,7 +37,9 @@
</view>
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" @click="onPageJump('/pages/course/myCourseLearn',item.id)">
<image :src="item.image" mode="aspectFit"></image>
<image v-if="item.image && item.image != ''" :src="item.image" mode="aspectFit"></image>
<!-- <image :src="item.image" mode="" @click="goDetail(item.productId)"></image> -->
<!-- <image v-else src="/static/nobg.jpg" mode="widthFix"></image> -->
</view>
<view class="buyItems">
<view class="txt555">
@@ -300,7 +302,7 @@
.then(res => {
// console.log(
this.cartList = res.cartList
// this.isAddLink(val)
this.isAddLink(val)
})
}
},
@@ -321,7 +323,7 @@
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item
shagnpin.productAmount = item.productAmount + 1
shagnpin.productAmount += 1
return true
}
})

View File

@@ -33,7 +33,7 @@
<view class="">{{item.title}}</view>
</view>
</view>
<view :class="['courseList',fold ? 'fold' : '', librayList[curIndex].isBuy == 1 ? '' : 'lock']" v-if="courseList.length > 0">
<view :class="['courseList',fold ? 'fold' : '', librayList[curIndex].isBuy == 1 || userMsg.vip != 0 ? '' : 'lock']" v-if="courseList.length > 0">
<!-- 目录是否已经购买 -->
<!-- 0:普通 1超级 2医学 3国学 -->
<view class="endBox" v-if="librayList[curIndex].isBuy == 1 && userMsg.vip == '0'">
@@ -43,16 +43,17 @@
<!-- <uni-tag type="warning" text="去学习"></uni-tag> -->
</view>
<view class="flexbox" v-else>
<text >课程观看有效期截止到{{librayList[curIndex].endTime}} </text><uni-tag type="primary" text="继续学习"></uni-tag>
<text >课程观看有效期截止到{{librayList[curIndex].endTime}} </text>
<!-- <uni-tag type="primary" text="继续学习" @click="onPageJump('')"></uni-tag> -->
</view>
</view>
</view>
<view class="item" v-for="(item, index) in courseList" :key="index" @click="gotoDetail(item, index)">
<text>{{item.title}}</text>
<uni-tag v-if="librayList[curIndex].isBuy == 1 && item.isLearned == 0" style="" :inverted="true" text="未学"
size="mini" type="primary" />
<uni-tag v-if="librayList[curIndex].isBuy == 1 && item.isLearned == 1" style="" :inverted="true" text="已学"
<uni-tag v-if="librayList[curIndex].isBuy == 1 && item.isLearned == 0" style="margin-left: 10rpx;" :inverted="true" text="未学"
size="mini" type="primary" />
<uni-tag v-if="librayList[curIndex].isBuy == 1 && item.isLearned == 1" style="margin-left: 10rpx;" :inverted="true" text="已学"
size="mini" type="success" />
</view>
<!-- <view class="showAll zhezhe" v-show="fold">
<view class="flexbox icon" @click="tozhankai()"><u-icon class="icon_item" name="arrow-left-double"

View File

@@ -35,7 +35,8 @@
<public-module></public-module>
<z-navigation></z-navigation>
<music-play :playData="playData"></music-play>
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</template>
@@ -56,6 +57,15 @@
status:0, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page:1,
flag:true, // 函数是否执行完
bgiStyle: {
background: '#fff'
},
scrollTop: 0,
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#258feb',
},
};
},
//第一次加载
@@ -67,8 +77,11 @@
console.log(e, '传入分类id')
this.getData();
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
onReachBottom() {
if(this.status != 2){
if(this.status != 2 && this.flag){
this.page ++
this.getData() }
console.log('触底加载',this.page)
@@ -95,10 +108,10 @@
});
},
getData() {
if(!this.flag){
console.log('正在执行,未完成')
return
}
// if(!this.flag){
// console.log('正在执行,未完成')
// return
// }
this.status = 1
this.flag = false
$http.request({

View File

@@ -2,7 +2,7 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle"></z-nav-bar>
<z-nav-bar title="超V专享课程"></z-nav-bar>
<view class="learnBox box" >
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id, item.title)">
@@ -102,10 +102,9 @@
this.status = 1
this.flag = false
$http.request({
url: "medical/home/getMarketCourseList",
url: "medical/course/getCourseByVip",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"id": this.tagId,
"limit": 12,
"page": this.page
},
@@ -115,10 +114,10 @@
})
.then(res => {
if (res.code == 0) {
if (res.courseList.records.length > 0) {
var list = res.courseList.records
if (res.data.records.length > 0) {
var list = res.data.records
this.courseList = this.courseList.concat(list)
if(res.courseList.pages > this.page){
if(res.data.pages > this.page){
this.status = 0
}else{
this.status = 2

View File

@@ -59,8 +59,10 @@
class="curriulum_title_box goods_item"
v-for="(v, i) in goodsDataList"
>
<image class="goods_item_img" :src="v.productImages" mode="aspectFit">
<image v-if="v.productImages && v.productImages != ''" class="goods_item_img" :src="v.productImages" mode="aspectFit">
</image>
<image v-else src="/static/nobg1.jpg" mode="widthFix" @click="goDetail(item.productId)"></image>
<view class="normal_box">
<view class="normal_box_top" style="justify-content: space-between">
<view class="curriulum_title">{{ v.productName }} </view>

View File

@@ -22,10 +22,10 @@
<image src="../../static/my_02.png" mode="aspectFit"></image>
<text>我的课程</text>
</div>
<!-- <div class="item flexbox" @click="onPageJump()">
<image src="../../static/my_03.png" mode="aspectFit"></image>
<div class="item flexbox" @click="onPageJump('/pages/course/vipCourse')">
<image src="../../static/my_06.png" mode="aspectFit"></image>
<text>超V专享</text>
</div> -->
</div>
<!-- <div class="item flexbox" @click="onPageJump()">
<image src="../../static/my_03.png" mode="aspectFit"></image>
<text>太湖讲堂</text>
@@ -55,25 +55,8 @@
</div>
</view>
</view></view>
<!-- 新闻播报 -->
<view class="fourBox " v-if="newsList.length > 0">
<view class="newsBox flexbox">
<view class="icon">
<u-icon name="volume-fill" color="#2979ff" size="26"></u-icon>
</view>
<view class="newscoll">
<swiper class="swiper" interval='5000' circular autoplay vertical indicator-dots="false">
<swiper-item class="item" v-for="(item, index) in newsList" :key="index"
@click="newsClick(item)">
<view class="swiper-item">{{item.title}}</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
<!-- 正在学习 -->
<!-- <view class="" style="padding:0 5px;">
<view class="" style="padding:0 5px;" v-if="learnList.length > 0">
<view class="learnBox" >
<view class="titleBox flexbox">
<image src="../../static/learing.png" mode="aspectFit"></image>
@@ -98,10 +81,10 @@
</view>
</view>
</view>
</view> -->
</view>
<!-- 健康超市 -->
<view class="supermarketBox" v-if="tjProList.length > 0">
<view class="hightLightTitleBox " @click="onPageJump()">
<view class="hightLightTitleBox " @click="onPageJump('/pages/course/healthMarket',2,'健康超市')">
<text>健康超市</text>
</view>
<view class="supermarket">
@@ -124,9 +107,9 @@
</view>
</view>
</view>
<!-- <view class="tips">
<view class="tips">
更多保健产品教学辅助器材及书籍点击<text>健康超市</text>图标进入
</view> -->
</view>
</view>
@@ -173,6 +156,24 @@
</view>
</view>
</view>
<!-- 新闻播报 -->
<view class="fourBox " v-if="newsList.length > 0">
<view class="newsBox flexbox">
<view class="icon">
<u-icon name="volume-fill" color="#2979ff" size="26"></u-icon>
</view>
<view class="newscoll">
<swiper class="swiper" interval='5000' circular autoplay vertical indicator-dots="false">
<swiper-item class="item" v-for="(item, index) in newsList" :key="index"
@click="newsClick(item)">
<view class="swiper-item">{{item.title}}</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
<!-- 精彩试听 -->
<view class="fourBox" v-if="tryListenList.length > 0">
<view class="learnBox">
<view class="titleBox flexbox">
@@ -1347,7 +1348,8 @@
color: #333;
margin-bottom: 0;
@include pleft_right(5px) .hn_cl_tit {
@include pleft_right(5px)
.hn_cl_tit {
display: block;
width: 100%;
background-color: #fff;
@@ -1356,6 +1358,7 @@
align-content: center;
justify-content: center;
margin-right: 8rpx;
border-bottom: 1px solid #fff;
// box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.3);
image {
@@ -1384,13 +1387,20 @@
.hn_cl_tit.active {
background-color: #e4eefa;
// position: relative;
text {
color: #3361a5;
font-weight: bold;
}
}
// .hn_cl_tit.active::after{
// display: block;
// transform: rotate(180deg);
// content: ''; position: absolute; bottom: -20rpx; left: calc(50% - 16rpx); z-index: 1;
// border-right: 20rpx solid transparent;
// border-left: 20rpx solid transparent;
// border-bottom: 20rpx solid #ffff;
// }
}

View File

@@ -9,7 +9,8 @@
class="round checkedItem" />
</view>
<view class="cartContent">
<image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
<image v-if="item.image && item.image != ''" :src="item.image" mode="" @click="goDetail(item.productId)"></image>
<image v-else src="/static/nobg1.jpg" mode="widthFix" @click="goDetail(item.productId)"></image>
<view class="itemCenter">
<view class="cartTitle" @click="goDetail(item.productId)">
<text>{{item.productName}}</text>

BIN
static/my_06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
static/nobg1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB