课程价格重新写

This commit is contained in:
@fawn-nine
2024-06-25 17:06:30 +08:00
parent 8e58d4af88
commit 0374ef034a
9 changed files with 487 additions and 196 deletions

View File

@@ -24,7 +24,7 @@
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]

View File

@@ -39,8 +39,10 @@ let $http = new request({
// 'Content-Type': 'application/json;charset=UTF-8', // 'Content-Type': 'application/json;charset=UTF-8',
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
// 'project_token': base.projectToken, //项目token可删除 // 'project_token': base.projectToken, //项目token可删除
} },
}); // timeout:'360000'
});
// 添加获取七牛云token的方法 // 添加获取七牛云token的方法
$http.getQnToken = function(callback) { $http.getQnToken = function(callback) {
//该地址需要开发者自行配置(每个后台的接口风格都不一样) //该地址需要开发者自行配置(每个后台的接口风格都不一样)

View File

@@ -524,6 +524,13 @@
"navigationBarTitleText": "超V课程", "navigationBarTitleText": "超V课程",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/news/newsForwebview",
"style": {
"navigationBarTitleText": "webView预览页面",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -4,71 +4,73 @@
<public-module></public-module> <public-module></public-module>
<z-nav-bar title="课程价格"></z-nav-bar> <z-nav-bar title="课程价格"></z-nav-bar>
<view class="addVip"> <view class="addVip">
<u-alert <u-alert v-if="" style="
v-if=""
style="
width: 100%; width: 100%;
" " :title="goBuyTitle" type="warning" :show-icon="true">
:title="goBuyTitle" <template slot="rightSlot" slot-scope="slotProps">
type="warning" <text class="saveBtn vipBtn flexbox buyBtn" style="color: #fff;"
:show-icon="true" @click="onPageJump('/pages/mine/vip/index')">
> 开通VIP
<template slot="rightSlot" slot-scope="slotProps"> </text>
<text class="saveBtn vipBtn flexbox buyBtn" style="color: #fff;" @click="onPageJump('/pages/mine/vip/index')"> <view> </view>
开通VIP </template>
</text>
<view> </view>
</template>
</u-alert> </u-alert>
</view> </view>
<view class="container"> <!-- 新的 -->
<view class="" v-if="courseList.length > 0"> <uni-collapse accordion @change="collapseChange">
<uni-collapse accordion> <uni-collapse-item v-for="(item,index) in courseList" :key="index" :title="item.courseMedicine.title"
<uni-collapse-item v-for="(item,index) in courseList" :key="index" :title="item.courseMedicine.title" :thumb="item.courseMedicine.icon">
:thumb="item.courseMedicine.icon"> <view class="content" v-show="item.courseList.length > 1" style="padding:20rpx;">
<view class="content" v-if="item.courseList.length > 1"> <view :class="['courseItemleve1',userMsg.vip != 0 ? 'isVip' :'']"
<view :class="['courseItemleve1',userMsg.vip != 0 ? 'isVip' :'']" v-for="(item1, index1) in item.courseList" :key="index1" v-for="(item1, index1) in item.courseList" :key="index1"
@click="onPageJump('/pages/course/courseDetail',item1.id)" @click="onPageJump('/pages/course/courseDetail',item1.id)">
> <view class="vipSee" v-if="userMsg.vip != 0">
<view class="vipSee" v-if="userMsg.vip != 0"> <text>VIP畅学权益生效中</text>
<text>VIP畅学权益生效中</text>
</view>
<view :class="['text','courseItem','flexbox']"><u-icon name="pushpin" color="#2979ff"
size="24"></u-icon><text>{{item1.title}}</text>
</view>
<view class="" v-for="(item2, index2) in item1.courseCatalogueEntityList" :key="index2">
<view :class="['priceItem', item2.isBuy == 1 && userMsg.vip == 0 ? 'isBuy' : '']" >
<text class="text mname" v-if="item1.courseCatalogueEntityList.length > 1"
style="font-weight: bold; margin-right: 10rpx;">【{{item2.title}}】</text>
<view class="pbox flexbox">
<text class="text">半年:¥{{item2.halfFee}} 元</text><text class="text"
style="margin-left: 20rpx;">整年:¥{{item2.fee}} 元</text>
<text class="buybtns" @click.stop="goBuy(item2)" v-if="item2.isBuy == 0 && userMsg.vip == 0">立即购买</text>
</view>
<i class="haveBuy" v-if="item2.isBuy == 1 && userMsg.vip == 0">已购买</i>
</view>
</view>
<!-- <view class="buyBox" v-if="!item1.allBuy">
<view class="saveBtn buybtn flexbox" @click="goBuy('halfFee')">
<u-icon name="bag" color="#fff" size="24"></u-icon>
<text>立即购买</text>
</view>
</view> -->
</view>
</view> </view>
</uni-collapse-item> <view :class="['text','courseItem','flexbox']"><u-icon name="pushpin" color="#2979ff"
</uni-collapse> size="24"></u-icon><text>{{item1.title}}</text>
</view>
<u-divider v-if="status == 1" text="暂无数据"></u-divider> </view>
<u-divider v-if="status == 0" text="加载中..."></u-divider> <template v-if="item1.courseCatalogueEntityList && item1.courseCatalogueEntityList.length > 0">
</view>
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top> <view class="" v-for="(item2, index2) in item1.courseCatalogueEntityList" :key="index2">
<view :class="['priceItem', item2.isBuy == 1 && userMsg.vip == 0 ? 'isBuy' : '']">
<text class="text mname" v-if="item1.courseCatalogueEntityList.length > 1"
style="font-weight: bold; margin-right: 10rpx;">{{item2.title}}</text>
<view class="pbox flexbox">
<text class="text">半年{{item2.halfFee}} </text><text class="text"
style="margin-left: 20rpx;">整年{{item2.fee}} </text>
<text class="buybtns" @click.stop="goBuy(item2)"
v-if="item2.isBuy == 0 && userMsg.vip == 0">立即购买</text>
</view>
<i class="haveBuy" v-if="item2.isBuy == 1 && userMsg.vip == 0">已购买</i>
</view>
</view>
</template>
<!-- <view class="buyBox" v-if="!item1.allBuy">
<view class="saveBtn buybtn flexbox" @click="goBuy('halfFee')">
<u-icon name="bag" color="#fff" size="24"></u-icon>
<text>立即购买</text>
</view>
</view> -->
</view>
<view class="" style="text-align: center; margin-bottom: 20rpx;">
<text class="" v-if="item.subpage < item.pages" style="color: #55aaff; display: inline-block; font-size: 28rpx;"
@click="loadMoreCourse(item, index)">加载更多</text>
<text class="" v-else style="color: #55aaff; display: inline-block; font-size: 28rpx;"
>已全部加载完毕</text>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
<!-- -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
<z-navigation></z-navigation> <z-navigation></z-navigation>
<buy-pup v-if="pricespop" :proPriceList="proPriceList" @closePup="closePup" @oprate="oprate"></buy-pup> <buy-pup v-if="pricespop" :proPriceList="proPriceList" @closePup="closePup" @oprate="oprate"></buy-pup>
<!-- <music-play :playData="playData"></music-play> --> <!-- <music-play :playData="playData"></music-play> -->
@@ -87,9 +89,10 @@
data() { data() {
return { return {
playData: {}, playData: {},
goBuyTitle : "购买VIP,即可免费观看吴门医述所有课程", goBuyTitle: "购买VIP,即可免费观看吴门医述所有课程",
courseList: [], courseList: [],
status:0, courseList1: [], // 新的
status: 0,
scrollTop: 0, scrollTop: 0,
bgiStyle: { bgiStyle: {
background: '#fff' background: '#fff'
@@ -99,10 +102,10 @@
fontWeight: 'bold', fontWeight: 'bold',
color: '#258feb', color: '#258feb',
}, },
proPriceList:[], proPriceList: [],
pricespop:false, pricespop: false,
userMsg:{}, userMsg: {},
cartList:[] cartList: []
}; };
}, },
//第一次加载 //第一次加载
@@ -110,6 +113,8 @@
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
// console.log(e, '------') // console.log(e, '------')
this.getUserInfo()
this.getCoursePriceList1()
}, },
computed: { computed: {
...mapState(['userInfo']) ...mapState(['userInfo'])
@@ -118,12 +123,11 @@
onShow() { onShow() {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.getUserInfo() // this.getCoursePriceList()
this.getCoursePriceList()
}, },
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
}, },
onPullDownRefresh() { onPullDownRefresh() {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
@@ -134,19 +138,65 @@
}, },
//方法 //方法
methods: { methods: {
loadMoreCourse(val, i) {
console.log(val, 'val',i,'++++++++++++++++')
let _page = val.subpage
_page += 1
this.getSubCourse(this.courseList[i].medicineList, i, _page)
},
collapseChange(e) {
console.log('e', e)
if (e && this.courseList[e].medicineList.length > 0) {
if (this.courseList[e].courseList.length <= 0)
this.getSubCourse(this.courseList[e].medicineList, e,1)
}
},
// 获取子课程
getSubCourse(ids, index, page) {
console.log('ids------------------', index)
$http.request({
url: "medical/home/getMedicalCoursePriceIsBuy",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
page: page,
limit: 10,
"ids": ids
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.res.records.length > 0) {
let _list = res.res.records
// console.log(_list,'_list')
// this.courseList[index].courseList = _list
this.courseList[index].courseList = this.courseList[index].courseList.concat(_list)
this.courseList[index].subpage = res.res.current
this.courseList[index].pages = res.res.pages
console.log(this.courseList[index].courseList, 'this.courseList[index]')
}
}
}).catch(e => {
console.log(e, '报错')
})
},
// 获取购物车数据 // 获取购物车数据
addCart(val){ addCart(val) {
console.log(val) console.log(val)
if (val.productStock == 0) { if (val.productStock == 0) {
uni.showToast({ uni.showToast({
title: '商品库存不足', title: '商品库存不足',
icon: "none" icon: "none"
}); });
} else { } else {
console.log(this.userInfo, '222') console.log(this.userInfo, '222')
this.$http this.$http
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`) .post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then(res => { .then(res => {
// console.log( // console.log(
this.cartList = res.cartList this.cartList = res.cartList
this.isAddLink(val) this.isAddLink(val)
@@ -211,7 +261,7 @@
} }
}) })
} }
} else { } else {
// 购物车列表为空时直接加入购物车 // 购物车列表为空时直接加入购物车
$http.request({ $http.request({
@@ -231,38 +281,35 @@
}) })
} }
}, },
oprate(data){ oprate(data) {
console.log(data,'得到的内容') console.log(data, '得到的内容')
if(data.name == 'buy'){ if (data.name == 'buy') {
this.buy(data.item) this.buy(data.item)
} } else if (data.name == 'gouwuche') {
else if(data.name == 'gouwuche'){
this.addCart(data.item) this.addCart(data.item)
} }
}, },
buy(val){ buy(val) {
var mynavData = JSON.stringify({ var mynavData = JSON.stringify({
        goods: [ goods: [{
          { productImages: val.productImages,
            productImages: val.productImages, productId: val.productId,
            productId: val.productId, productName: val.productName,
            productName: val.productName, price: val.activityPrice && val.activityPrice != 0 ? val.activityPrice : val.price,
            price: val.activityPrice && val.activityPrice != 0 ? val.activityPrice:val.price, goodsType: val.goodsType,
            goodsType: val.goodsType, }, ],
          }, navTitle: this.options.navTitle,
        ], title: this.options.title,
        navTitle: this.options.navTitle, typeId: 0,
        title: this.options.title, }); // 这里转换成 字符串
        typeId: 0,
      }); // 这里转换成 字符串
      uni.navigateTo({
        url: `/pages/goods/order/index?data=${mynavData}`,
      });
},
onPageJump(path, id){
uni.navigateTo({ uni.navigateTo({
url:`${path}?id=${id}` url: `/pages/goods/order/index?data=${mynavData}`,
});
},
onPageJump(path, id) {
uni.navigateTo({
url: `${path}?id=${id}`
}) })
}, },
getUserInfo() { getUserInfo() {
@@ -271,15 +318,15 @@
this.$http this.$http
.post('book/user/info/' + this.userInfo.id) .post('book/user/info/' + this.userInfo.id)
.then(res => { .then(res => {
this.userMsg = res.user this.userMsg = res.user
}); });
// } // }
}, },
closePup(e){ closePup(e) {
this.pricespop = false this.pricespop = false
}, },
goBuy(val){ goBuy(val) {
console.log(val,'val') console.log(val, 'val')
$http.request({ $http.request({
url: "sociology/product/getProductListForCourse", url: "sociology/product/getProductListForCourse",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
@@ -294,54 +341,53 @@
if (res.code == 0) { if (res.code == 0) {
if (res.productList.length > 0) { if (res.productList.length > 0) {
this.proPriceList = res.productList this.proPriceList = res.productList
this.pricespop = true this.pricespop = true
// this.curProId = this.proPriceList[0].productId // this.curProId = this.proPriceList[0].productId
} else { } else {
this.proPriceList = [] this.proPriceList = []
uni.showToast({ uni.showToast({
title:'课程未绑定商品', title: '课程未绑定商品',
icon:'none' icon: 'none'
}) })
} }
} }
}).catch(e => { }).catch(e => {
console.log(e, '获取商品列表报错') console.log(e, '获取商品列表报错')
uni.showToast({ uni.showToast({
title:'获取商品失败', title: '获取商品失败',
icon:'none' icon: 'none'
}) })
}); });
}, },
getCoursePriceList() { getCoursePriceList1() {
this.$http this.$http
.post('medical/home/getMedicalCoursePrice') .post('medical/home/getMedicalCoursePrice')
.then(res => { .then(res => {
if (res.code == 0 && res.res.length > 0) { if (res.code == 0 && res.res.length > 0) {
let _list = res.res let _list = res.res
let _allBuy = false let _allBuy = false
_list.map(item => { _list.map(item => {
item.courseList.forEach(item2 => { item.courseList = []
let _number = 0 // item.courseList.forEach(item2 => {
item2.courseCatalogueEntityList.forEach(item3 => { // let _number = 0
if(item3.isBuy == 1){ // item2.courseCatalogueEntityList.forEach(item3 => {
_number++ // if(item3.isBuy == 1){
} // _number++
}) // }
if(_number == item2.courseCatalogueEntityList.length){ // })
_allBuy = true // if(_number == item2.courseCatalogueEntityList.length){
}else{ // _allBuy = true
_allBuy = false // }else{
} // _allBuy = false
item2.allBuy = _allBuy // }
}) // item2.allBuy = _allBuy
}) // })
this.courseList = res.res })
this.courseList = _list
this.status = 2 this.status = 2
} else { } else {
this.courseList = [] this.courseList = []
@@ -361,54 +407,78 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.isVip{position: relative; padding-top: 50rpx !important; border: 1px solid #6429db; box-sizing: border-box;}
.vipSee{ .isVip {
position: relative;
position: absolute; right:0; top:0; padding-top: 50rpx !important;
font-size: 24rpx; border: 1px solid #6429db;
background-image: linear-gradient(90deg, #6429db 0%, #0075ed 100%); box-sizing: border-box;
// @include theme("btn_bg");
color: #fff; padding: 10rpx; border-radius: 50rpx 0 0 50rpx;
} }
.vipSee {
position: absolute;
right: 0;
top: 0;
font-size: 24rpx;
background-image: linear-gradient(90deg, #6429db 0%, #0075ed 100%);
// @include theme("btn_bg");
color: #fff;
padding: 10rpx;
border-radius: 50rpx 0 0 50rpx;
}
.flexbox { .flexbox {
display: flex; display: flex;
} }
.buybtns{
@include theme("btn_bg"); border-radius: 30rpx; color: #fff; font-size: 28rpx; padding: 0 10rpx; margin-left: 10rpx; .buybtns {
@include theme("btn_bg");
border-radius: 30rpx;
color: #fff;
font-size: 28rpx;
padding: 0 10rpx;
margin-left: 10rpx;
} }
.addVip{
.saveBtn{ .addVip {
.saveBtn {
width: 150rpx; width: 150rpx;
} }
} }
.buyBox{
.saveBtn{ margin: 0 auto;} .buyBox {
.saveBtn {
margin: 0 auto;
}
} }
.saveBtn { .saveBtn {
width: 260rpx; width: 260rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@include theme("btn_bg"); @include theme("btn_bg");
height: 60rpx; height: 60rpx;
// width: 46%; // width: 46%;
overflow: hidden; overflow: hidden;
border-radius: 30rpx; border-radius: 30rpx;
text { text {
padding-left: 10rpx; padding-left: 10rpx;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
} }
} }
.courseItemleve1 { .courseItemleve1 {
padding: 20rpx; padding: 20rpx;
border-radius: 20rpx; border-radius: 20rpx;
// border: 1px solid #eee; // border: 1px solid #eee;
overflow: hidden; overflow: hidden;
margin-bottom: 30rpx; margin-bottom: 30rpx;
@include mshadow(10px,8); @include mshadow(10px, 8);
background: $containerColor; background: $containerColor;
} }
@@ -417,24 +487,57 @@
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-size: 28rpx; font-size: 28rpx;
// background-color: #82aee2; // background-color: #82aee2;
border-radius: 20rpx; padding:10rpx; border-radius: 20rpx;
padding: 10rpx;
border: 2px solid #82aee2; border: 2px solid #82aee2;
.pbox{
justify-content: center; .pbox {
width: 100%; text-align: center;} justify-content: center;
text{ width: 100%;
text-align: center;
}
text {
// color: #fff; // color: #fff;
} }
.mname{display: block; text-align: center; margin-bottom: 10rpx; color: #694bc6;}
.mname {
display: block;
text-align: center;
margin-bottom: 10rpx;
color: #694bc6;
}
} }
.priceItem.isBuy{position: relative; border-color:#b3b3b3; overflow: hidden; background-color: #f3f3f3;}
.isBuy{ .priceItem.isBuy {
.haveBuy{position: absolute; padding:2rpx 6rpx; border-radius:0 0 0 20rpx ; right: 0; top: 0; z-index: 1; background-color: #e1e1e1; font-style: normal; font-size: 24rpx;} position: relative;
.mname{color: inherit;} border-color: #b3b3b3;
overflow: hidden;
background-color: #f3f3f3;
} }
.isBuy {
.haveBuy {
position: absolute;
padding: 2rpx 6rpx;
border-radius: 0 0 0 20rpx;
right: 0;
top: 0;
z-index: 1;
background-color: #e1e1e1;
font-style: normal;
font-size: 24rpx;
}
.mname {
color: inherit;
}
}
.courseItem { .courseItem {
// background: #b9d4f2; // background: #b9d4f2;
font-weight: bold; border-bottom: 1px solid #e1e1e1; font-weight: bold;
border-bottom: 1px solid #e1e1e1;
// border-radius: 20rpx; // border-radius: 20rpx;
align-items: center; align-items: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
@@ -442,6 +545,7 @@
padding: 10rpx 10rpx; padding: 10rpx 10rpx;
width: 100%; width: 100%;
color: $themeColor; color: $themeColor;
.u-icon { .u-icon {
display: inline-block; display: inline-block;
} }
@@ -454,6 +558,7 @@
.container { .container {
background-color: $containerColor; background-color: $containerColor;
.content { .content {
padding: 0 20rpx; padding: 0 20rpx;
} }

View File

@@ -25,7 +25,7 @@
</view> </view>
</view> </view>
<view class="flexbox rightIcon" @click="showDrawer"> <view class="flexbox rightIcon" @click="showDrawer">
<u-icon name="grid" color="#2979ff" size="28" ></u-icon><text>按分类筛选</text> <u-icon name="grid" color="#2979ff" size="26" ></u-icon><text>按分类筛选</text>
</view> </view>
</view> </view>
<!-- <view class="containerBg"> --> <!-- <view class="containerBg"> -->
@@ -727,12 +727,12 @@
background-color: #ffe6db; color: #ff7446; background-color: #ffe6db; color: #ff7446;
} }
} }
.sectionTitle{ .sectionTitle{ margin: 20rpx 0;
justify-content: space-between; margin-bottom: 20rpx; margin-top: 20rpx; justify-content: space-between; margin-bottom: 20rpx; margin-top: 20rpx;
.rightIcon{color:#2979ff ; align-items: center;} .rightIcon{color:#2979ff ; align-items: center; font-size: 26rpx;}
} }
.selectCateText{ min-width:20rpx ; .selectCateText{ min-width:20rpx ; font-size: 26rpx;
.del{color: #ff7446; padding-left: 20rpx;} .del{color: #ff7446; padding-left: 20rpx;}
} }
.search{background-color: $containerColor; padding: 10rpx; } .search{background-color: $containerColor; padding: 10rpx; }
@@ -752,12 +752,12 @@
.blueBorder{border: 1px solid #2979ff !important;} .blueBorder{border: 1px solid #2979ff !important;}
.item { overflow: hidden; .item { overflow: hidden;
border: #fff 1px solid ; border: #fff 1px solid ;
.vipTag{position: absolute; padding:10rpx 80rpx; .vipTag{position: absolute; padding:10rpx 100rpx; font-size: 26rpx;
left: -60rpx; top: 10rpx; left: -100rpx; top: 20rpx;
transform: rotate(-30deg); transform: rotate(-45deg);
-o-transform: rotate(-30deg); -o-transform: rotate(-45deg);
-webkit-transform: rotate(-30deg); -webkit-transform: rotate(-45deg);
-moz-transform: rotate(-30deg); -moz-transform: rotate(-45deg);
z-index: 1; z-index: 1;
@include theme("btn_bg") ; @include theme("btn_bg") ;
color: #fff;} color: #fff;}

View File

@@ -192,7 +192,7 @@
this.getUserInfo() this.getUserInfo()
this.courseId = e.id this.courseId = e.id
// this.getCateList(this.courseId) // this.getCateList(this.courseId)
this.getData(e.id)
// this.getSayList() // this.getSayList()
}, },
onPullDownRefresh() { onPullDownRefresh() {
@@ -214,7 +214,7 @@
onShow() { onShow() {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.getData(this.courseId)
}, },
onReachBottom() { onReachBottom() {
console.log('触底'); console.log('触底');

View File

@@ -0,0 +1,157 @@
<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="新闻详情"></z-nav-bar>
<web-view :webview-styles="webviewStyles" :src="surl"></web-view>
<!-- <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: {},
newsObj: null,
news: {
content: '',
title: ''
},
source:'',
urlVisible:false,
surl:'',
type:null,
webviewStyles: {
progress: {
color: '#FF3333'
}
},
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.surl = e.url
console.log(e, '------')
// #ifdef APP-PLUS
const pages = getCurrentPages()
const page = pages[pages.length - 1];
const currentWebview = page.$getAppWebview()
currentWebview.setStyle({
titleNView: {
buttons: [{
float: 'right',
type: 'close',
onclick: function() {
uni.navigateBack({
delta: 1
});
}
}]
}
})
// #endif
},
computed: {
...mapState(['userInfo'])
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
if(this.type == 1 && this.surl != ''){
// this.surl = this.newsObj.url
this.urlVisible = true
this.news = {}
}else{
this.getData();
this.urlVisible = false
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
components: {
// musicPlay
},
//方法
methods: {
getData() {
var _url = "common/message/getMessageById"
if(this.source = 'taihuzhiguang'){ // 太湖之光
_url = "common/taihuWelfare/getTaihuWelfareArticleDetail"
$http.request({
url: `${_url}`,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: this.newsId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
this.news.content = res.result.content
this.news.title = res.result.title
}
}).catch(e => {
console.log(e, '获取新闻详情报错')
});
}else{
this.$http
.post(`${_url}?id=${this.newsId}`)
.then(res => {
if (res.code == 0) {
this.news.content = res.result.content
this.news.title = res.result.title
}
}).catch(e => {
console.log(e, '获取新闻详情报错')
});
}
},
formatRichText(html) { //控制图片大小
let newContent = html.replace(/<img[^>]*>/gi, function (match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function (match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
// newContent = newContent.replace(/<img[^>]*>/gi, function(match, capture) {
// match = match.replace(/<img[^>]*>/gi, "@click='1111'").replace(/<img[^>]*>/gi, "@click='1111'");
// return match;
// });
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
},
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.box {
background-color: #fff;
@include pleft_right(10px);
min-height: calc(100vh - 270rpx);
}
.title{font-size: 32rpx; font-weight: bold; display: block; text-align: center;}
.content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;}
</style>

View File

@@ -63,22 +63,15 @@
<text>正在学习</text> <text>正在学习</text>
</view> </view>
<view class="learn flexbox"> <view class="learn flexbox">
<view class="item"> <view class="item" v-for="(item, index) in learnList" :key="index" @click="onPageJump('/pages/course/myCourseLearn',item.id)">
<view class=""> <view class="img" style="overflow: hidden;">
<image src="../../static/video.jpg" mode="aspectFit"></image> <image v-if="item.image && item.image != ''" :src="item.image" mode="aspectFit"></image>
<image v-else src="/static/nobg.jpg" mode="widthFix"></image>
</view> </view>
<view class="txt555"> <view class="txt555">
生理试听生理试听生理试听生理试听生理试听生理试听生理试听生理试听 {{item.title}}
</view> </view>
</view> </view>
<view class="item">
<view class="">
<image src="../../static/video.jpg" mode="aspectFit"></image>
</view>
<view class="txt555">
生理试听
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -528,10 +521,16 @@
}, },
newsClick(item) { newsClick(item) {
console.log('item', item) console.log('item', item)
// if(item.type == 1){
// uni.navigateTo({
// url: `/pages/news/newsForwebview?newsId=${item.id}&url=${item.url}&type=${item.type}`
// })
// }else{
uni.navigateTo({ uni.navigateTo({
url: `/pages/news/news?newsId=${item.id}&url=${item.url}&type=${item.type}` url: `/pages/news/news?newsId=${item.id}&url=${item.url}&type=${item.type}`
}) })
// } // }
// }
}, },
openURL(url) { openURL(url) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
@@ -695,7 +694,7 @@
z-index: 1; z-index: 1;
.item { .item {
background: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .9);
margin-bottom: 20rpx; margin-bottom: 20rpx;
border: 1px solid #fff; border: 1px solid #fff;
align-items: center; align-items: center;
@@ -1001,11 +1000,15 @@
@include pleft_right(10px); @include pleft_right(10px);
@include mshadow(10px, 1); @include mshadow(10px, 1);
margin-bottom: 10px; margin-bottom: 10px;
.img{
width: 100%; height: 180rpx;
background-color: #f7f7f7;
display: flex; align-items: center;
}
.learn { .learn {
justify-content: space-between; justify-content: space-between;
margin-top: 20rpx; margin-top: 20rpx;
flex-wrap: wrap;
.item { .item {
width: 48%; width: 48%;

View File

@@ -1,10 +1,16 @@
<template> <template>
<view> <view>
<z-nav-bar backState="2000" title="购物车"></z-nav-bar> <z-nav-bar backState="2000" title="购物车">
<view class="curseSet" slot="right" @click="manaCart = !manaCart" style="margin-right: 10px;">
<text v-show="!manaCart">管理</text>
<text v-show="manaCart">完成</text>
</view>
</z-nav-bar>
</z-nav-bar>
<view class="shopCarContent"> <view class="shopCarContent">
<scroll-view scroll-y="true"> <scroll-view scroll-y="true">
<view class="cartItem" v-for="(item,index) in cartList" :key="index"> <view class="cartItem" v-for="(item,index) in cartList" :key="index">
<view class="select"> <view class="select" v-show="manaCart">
<checkbox :checked="item.checked" @click="checkboxGroupChange(index,item)" <checkbox :checked="item.checked" @click="checkboxGroupChange(index,item)"
class="round checkedItem" /> class="round checkedItem" />
</view> </view>
@@ -64,7 +70,8 @@
totalPrice: 0, // 总价 totalPrice: 0, // 总价
all: false, // 是否全选 all: false, // 是否全选
isCartDelShow: false, // 是否展示删除按钮 isCartDelShow: false, // 是否展示删除按钮
cartList: [] // 购物车列表 cartList: [], // 购物车列表
manaCart:false,
}; };
}, },
//第一次加载 //第一次加载
@@ -104,15 +111,24 @@
}, },
// 是否全选 // 是否全选
isSelectAll(e) { isSelectAll(e) {
console.log(e,'e')
if (this.cartList.length > 0) { if (this.cartList.length > 0) {
this.all = !this.all this.all = !this.all
this.cartList.forEach((item, index) => { this.cartList.forEach((item, index) => {
item.checked = this.all item.checked = this.all
}) })
// if(){
// this.cartList.forEach((item, index) => {
// item.checked = false
// })
// this.manaCart = false
// }
this.isCartDelShow = this.all this.isCartDelShow = this.all
this.total() this.total()
this.manaCart = this.all
} else { } else {
this.all = false this.all = false
} }
}, },
// 选中单独商品 // 选中单独商品
@@ -214,6 +230,7 @@
this.totalPrice = 0 this.totalPrice = 0
this.getCartList() this.getCartList()
uni.hideLoading() uni.hideLoading()
this.manaCart = false
}) })
} else { } else {
console.log('cancel') //点击取消之后执行的代码 console.log('cancel') //点击取消之后执行的代码