@ -0,0 +1,22 @@
|
||||
import request from "@/utils/request"; |
||||
|
||||
/** |
||||
* 课程文章分类 |
||||
*/ |
||||
export function getCategory(data) { |
||||
return request.get("/api/CourseCategory", data); |
||||
} |
||||
|
||||
/** |
||||
* 通过分类查找文章列表 |
||||
*/ |
||||
export function getArticle(data) { |
||||
return request.get("/article/listByCategoryId", data); |
||||
} |
||||
|
||||
/** |
||||
* 获取文章详情 |
||||
*/ |
||||
export function getArticleDetails(data) { |
||||
return request.get("/article/details/"+data); |
||||
} |
@ -0,0 +1,65 @@
|
||||
**插件使用说明** |
||||
|
||||
- 基于 uni.createInnerAudioContext() 封装audio音频组件(样式同原生audio组件) |
||||
- 支持双向绑定 |
||||
- 支持自定义修改样式 |
||||
|
||||
|
||||
**Example** |
||||
--- |
||||
|
||||
``` javascript |
||||
<luch-audio src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/audio/music.mp3" :play.sync="audioPlay"></luch-audio> |
||||
|
||||
// 控制变量audioPlay ,如果true音频会播放,否则暂停 |
||||
``` |
||||
|
||||
**Attributes** |
||||
-- |
||||
|
||||
参数|说明|类型|可选值|默认值|required |
||||
--|:- |
||||
play|是否播放,双向绑定,需加 ` .sync `|Boolean| — | — |true |
||||
src|资源路径|String| — | — | — |
||||
poster|封面图片路径|String| — | — | — |
||||
name|音频名称|String| — | 未知音频 | — |
||||
author|作者名字|String| — | 未知作者 | — |
||||
autoplay|是否自动开始播放|Boolean| — | false | — |
||||
loop|是否循环播放|Boolean| — | false | — |
||||
obeyMuteSwitch|是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音|Boolean| — | true | — |
||||
|
||||
其他api 可在组件内 ` contextInit ` 函数初始化时自定义添加 |
||||
|
||||
**平台支持度** |
||||
-- |
||||
|
||||
5+App|H5|微信小程序|支付宝小程序|百度小程序|头条小程序 |
||||
--|:- |
||||
yes|yes|yes|no|yes|yes |
||||
|
||||
**注意:**以上平台支持度为uni-app 对` uni.createInnerAudioContext() ` api 的支持度,本组件的支持度本人只在微信小程序使用过,其他平台*未做测试* |
||||
|
||||
**使用** |
||||
-- |
||||
|
||||
下载后把该文件放至 components 文件夹或 特定平台组件 文件夹即可 |
||||
|
||||
**更新** |
||||
-- |
||||
|
||||
- v0.0.1 组件 |
||||
|
||||
**可扩展性** |
||||
-- |
||||
|
||||
api 增加参考 ` https://uniapp.dcloud.io/api/media/audio-context?id=createinneraudiocontext ` |
||||
<br> |
||||
组件内的播放暂停图标本人因为要发布组件,所以使用了base64,大家可自行替换; |
||||
<br> |
||||
实例获取可以通过ref 获取组件内的 ` innerAudioContext ` (未实验,只是估计 0.0) |
||||
|
||||
**说明** |
||||
-- |
||||
|
||||
切换src 或者切换页面都会销毁实例<br> |
||||
写本组件的原因就是原生audio组件无法修改宽度,导致某些情况下显示不全,本组件是100%自适应布局; |
@ -0,0 +1,133 @@
|
||||
<template> |
||||
<scroll-view class="wuc-tab" :class="tabClass" :style="tabStyle" scroll-with-animation scroll-x :scroll-left="scrollLeft"> |
||||
<div v-if="!textFlex"> |
||||
<div class="wuc-tab-item" :class="[item.id === tabCur ? selectClass + ' cur':'']" v-for="(item,index) in tabList" :key="index" :id="item.id" @tap="tabSelect(item,$event)"> |
||||
<text :class="item.icon"></text> |
||||
<span>{{item.categoryName}}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="flex text-center" v-if="textFlex"> |
||||
<div class="wuc-tab-item flex-sub" :class="item.id === tabCur ? selectClass + ' cur':''" v-for="(item,index) in tabList" :key="index" :id="index" @tap="tabSelect(item,$event)"> |
||||
<text :class="item.icon"></text> |
||||
<span>{{item.categoryName}}</span> |
||||
</div> |
||||
</div> |
||||
</scroll-view> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
name: 'wuc-tab', |
||||
data() { |
||||
return {}; |
||||
}, |
||||
props: { |
||||
tabList: { |
||||
type: Array, |
||||
default() { |
||||
return []; |
||||
} |
||||
}, |
||||
tabCur: { |
||||
type: Number, |
||||
default() { |
||||
return 0; |
||||
} |
||||
}, |
||||
tabClass: { |
||||
type: String, |
||||
default() { |
||||
return ''; |
||||
} |
||||
}, |
||||
tabStyle: { |
||||
type: String, |
||||
default() { |
||||
return ''; |
||||
} |
||||
}, |
||||
textFlex: { |
||||
type: Boolean, |
||||
default() { |
||||
return false; |
||||
} |
||||
}, |
||||
selectClass: { |
||||
type: String, |
||||
default() { |
||||
return 'text-blue'; |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
tabSelect(index, e) { |
||||
if (this.currentTab === index) return false; |
||||
this.$emit('update:tabCur', index); |
||||
this.$emit('change', index); |
||||
} |
||||
}, |
||||
computed: { |
||||
scrollLeft() { |
||||
return (this.tabCur - 1) * 60; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style> |
||||
div, |
||||
scroll-view, |
||||
swiper { |
||||
box-sizing: border-box; |
||||
} |
||||
.wuc-tab { |
||||
white-space: nowrap; |
||||
} |
||||
.wuc-tab-item { |
||||
height: 90upx; |
||||
display: inline-block; |
||||
line-height: 90upx; |
||||
margin: 0 10upx; |
||||
padding: 0 20upx; |
||||
} |
||||
|
||||
.wuc-tab-item.cur { |
||||
border-bottom: 4upx solid; |
||||
} |
||||
|
||||
.wuc-tab.fixed { |
||||
position: fixed; |
||||
width: 100%; |
||||
top: 0; |
||||
z-index: 1024; |
||||
box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); |
||||
} |
||||
|
||||
.flex { |
||||
display: flex; |
||||
} |
||||
.text-center { |
||||
text-align: center; |
||||
} |
||||
.flex-sub { |
||||
flex: 1; |
||||
} |
||||
.text-blue{ |
||||
color:#0081ff; |
||||
} |
||||
.text-white{ |
||||
color:#ffffff; |
||||
} |
||||
.bg-white{ |
||||
background-color: #ffffff; |
||||
} |
||||
.bg-blue{ |
||||
background-color: #0081ff; |
||||
} |
||||
.text-orange{ |
||||
color: #f37b1d |
||||
} |
||||
|
||||
.text-xl { |
||||
font-size: 36upx; |
||||
} |
||||
</style> |
@ -0,0 +1,435 @@
|
||||
<template> |
||||
<view class="index"> |
||||
<view class="header header-search acea-row row-center-wrapper"> |
||||
<view @click="goGoodSearch()" class="search acea-row row-middle"> |
||||
<text class="iconfont icon-xiazai5"></text> |
||||
搜索商品 |
||||
</view> |
||||
<!-- #ifndef H5 --> |
||||
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'"> |
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> |
||||
</view> |
||||
<!-- #endif --> |
||||
</view> |
||||
<view v-for="(item, index) in homeData" :key="index"> |
||||
<!-- <view class="head_box" v-if="item.type == 'header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }"> |
||||
<cu-custom :isBack="true" :bgColor="bgcolor"> |
||||
<block slot="backText"> |
||||
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text> |
||||
</block> |
||||
</cu-custom> |
||||
</view> --> |
||||
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> |
||||
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> |
||||
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> |
||||
<!-- 菜单 --> |
||||
<Menu :list="item.componentContent.menus"></Menu> |
||||
</view> |
||||
<!-- 滚动新闻 --> |
||||
<!-- 广告 --> |
||||
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" /> |
||||
<!-- 热门榜单 --> |
||||
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity> |
||||
<!-- 超值拼团 --> |
||||
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" /> |
||||
<!-- 首发新品->秒杀 --> |
||||
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct> |
||||
<!-- 精品推荐 --> |
||||
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended> |
||||
<!-- 促销单品 --> |
||||
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct> |
||||
<!-- 直播 --> |
||||
<!-- #ifdef MP-WEIXIN --> |
||||
<Live v-if="item.type == 'liveList'" :detail="liveList"></Live> |
||||
<!-- #endif --> |
||||
<!-- 为您推荐 --> |
||||
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> |
||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
import { mapState, mapMutations, mapActions } from 'vuex' |
||||
import GoodList from '@/components/GoodList' |
||||
import PromotionGood from '@/components/PromotionGood' |
||||
import CouponWindow from '@/components/CouponWindow' |
||||
import Menu from '@/components/Menu' |
||||
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar' |
||||
import Adv from '@/components/sh-adv' |
||||
import Groupon from '@/components/sh-groupon.vue' |
||||
|
||||
import Banner from './components/Banner' |
||||
import HotCommodity from './components/HotCommodity' |
||||
import FirstNewProduct from './components/FirstNewProduct' |
||||
import ProductsRecommended from './components/ProductsRecommended' |
||||
import Live from './components/Live' |
||||
|
||||
import { getHomeData, getShare, getCanvas } from '@/api/public' |
||||
import cookie from '@/utils/store/cookie' |
||||
import { isWeixin, handleUrlParam } from '@/utils/index' |
||||
|
||||
import { openShareAll } from '@/libs/wechat' |
||||
|
||||
const HAS_COUPON_WINDOW = 'has_coupon_window' |
||||
|
||||
export default { |
||||
name: 'Index', |
||||
components: { |
||||
// swiper, |
||||
// swiperSlide, |
||||
UniNoticeBar, |
||||
GoodList, |
||||
PromotionGood, |
||||
CouponWindow, |
||||
Menu, |
||||
Adv, |
||||
Groupon, |
||||
Banner, |
||||
HotCommodity, |
||||
FirstNewProduct, |
||||
ProductsRecommended, |
||||
Live, |
||||
}, |
||||
props: {}, |
||||
data: function() { |
||||
return { |
||||
homeData: [], |
||||
CustomBar: this.CustomBar, |
||||
StatusBar: this.StatusBar, |
||||
formatMenus: [], |
||||
categoryCurrent: 0, |
||||
menuNum: 4, |
||||
bgcolor: '', |
||||
bgColor: '', |
||||
swiperCurrent: 0, //轮播下标 |
||||
webviewId: 0, |
||||
showCoupon: false, |
||||
logoUrl: '', |
||||
banner: [], |
||||
menus: [], |
||||
combinationList: [], |
||||
roll: [], |
||||
activity: [], |
||||
activityOne: {}, |
||||
bastList: [], |
||||
firstList: [], |
||||
info: { |
||||
fastList: [], |
||||
bastBanner: [], |
||||
|
||||
bastList: [], |
||||
}, |
||||
likeInfo: [], |
||||
live: [], |
||||
lovely: [], |
||||
benefit: [], |
||||
couponList: [], |
||||
swiperOption: { |
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
clickable: true, |
||||
}, |
||||
autoplay: { |
||||
disableOnInteraction: false, |
||||
delay: 2000, |
||||
}, |
||||
loop: true, |
||||
speed: 1000, |
||||
observer: true, |
||||
observeParents: true, |
||||
}, |
||||
swiperRoll: { |
||||
direction: 'vertical', |
||||
autoplay: { |
||||
disableOnInteraction: false, |
||||
delay: 2000, |
||||
}, |
||||
loop: true, |
||||
speed: 1000, |
||||
observer: true, |
||||
observeParents: true, |
||||
}, |
||||
swiperScroll: { |
||||
freeMode: true, |
||||
freeModeMomentum: false, |
||||
slidesPerView: 'auto', |
||||
observer: true, |
||||
observeParents: true, |
||||
}, |
||||
swiperBoutique: { |
||||
pagination: { |
||||
el: '.swiper-pagination', |
||||
clickable: true, |
||||
}, |
||||
autoplay: { |
||||
disableOnInteraction: false, |
||||
delay: 2000, |
||||
}, |
||||
loop: true, |
||||
speed: 1000, |
||||
observer: true, |
||||
observeParents: true, |
||||
}, |
||||
swiperProducts: { |
||||
freeMode: true, |
||||
freeModeMomentum: false, |
||||
slidesPerView: 'auto', |
||||
observer: true, |
||||
observeParents: true, |
||||
}, |
||||
bgImage: '', |
||||
} |
||||
}, |
||||
computed: { |
||||
singNew() { |
||||
return this.roll.length > 0 ? this.roll[0] : '你还没添加通知哦!' |
||||
}, |
||||
customStyle() { |
||||
var bgImage = this.bgImage |
||||
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; |
||||
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}` |
||||
if (this.bgImage) { |
||||
style = `${style}background-image:url(${bgImage});` |
||||
} |
||||
return style |
||||
}, |
||||
}, |
||||
onLoad: function() { |
||||
this.getLocation() |
||||
let that = this |
||||
// uni.showLoading({ |
||||
// title: "加载中", |
||||
// }); |
||||
getCanvas() |
||||
.then(res => {}) |
||||
.catch(error => { |
||||
this.homeData = JSON.parse(error.data.json) |
||||
console.log(this.homeData) |
||||
}) |
||||
getHomeData().then(res => { |
||||
that.logoUrl = res.data.logoUrl |
||||
res.data.banner.map(item => (item.bgcolor = item.color || '')) |
||||
that.$set(that, 'info', res.data.info) |
||||
that.$set(that, 'firstList', res.data.firstList) |
||||
that.$set(that, 'bastList', res.data.bastList) |
||||
that.$set(that, 'likeInfo', res.data.likeInfo) |
||||
that.$set(that, 'live', res.data.liveList) |
||||
that.$set(that, 'lovely', res.data.lovely) |
||||
that.$set(that, 'benefit', res.data.benefit) |
||||
that.$set(that, 'couponList', res.data.couponList) |
||||
that.$set(that, 'combinationList', res.data.combinationList) |
||||
uni.hideLoading() |
||||
that.setOpenShare() |
||||
// that.doColorThief() |
||||
}) |
||||
}, |
||||
methods: { |
||||
...mapActions(['getLocation']), |
||||
onShareTimeline: function() { |
||||
return { |
||||
title: this.miniHomeRemark, |
||||
imageUrl: this.miniHomeImg, |
||||
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
||||
} |
||||
}, |
||||
onShareAppMessage: function() { |
||||
return { |
||||
title: this.miniHomeRemark, |
||||
imageUrl: this.miniHomeImg, |
||||
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
||||
} |
||||
}, |
||||
goRoll(item) { |
||||
if (item.uniapp_url) { |
||||
this.$yrouter.push(item.uniapp_url) |
||||
} |
||||
}, |
||||
goGoodSearch() { |
||||
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); |
||||
this.$yrouter.push('/pages/shop/GoodSearch/index') |
||||
}, |
||||
goWxappUrl(item) { |
||||
this.$yrouter.push(item.uniapp_url) |
||||
}, |
||||
goHotNewGoods(type) { |
||||
this.$yrouter.push({ |
||||
path: '/pages/shop/HotNewGoods/index', |
||||
query: { |
||||
type, |
||||
}, |
||||
}) |
||||
}, |
||||
goGoodsCon(item) { |
||||
this.$yrouter.push({ |
||||
path: '/pages/shop/GoodsCon/index', |
||||
query: { |
||||
id: item.id, |
||||
}, |
||||
}) |
||||
}, |
||||
goGoodsPromotion() { |
||||
this.$yrouter.push('/pages/shop/GoodsPromotion/index') |
||||
}, |
||||
setOpenShare: function() { |
||||
if (this.$deviceType == 'weixin') { |
||||
getShare().then(res => { |
||||
var data = res.data.data |
||||
var configAppMessage = { |
||||
desc: data.synopsis, |
||||
title: data.title, |
||||
link: location.href, |
||||
imgUrl: data.img, |
||||
} |
||||
openShareAll(configAppMessage) |
||||
}) |
||||
} |
||||
}, |
||||
startQr: function() { |
||||
uni.scanCode({ |
||||
success: res => { |
||||
let option = handleUrlParam(res.result) |
||||
switch (option.pageType) { |
||||
case 'good': |
||||
// 跳转商品详情 |
||||
this.$yrouter.push({ |
||||
path: '/pages/shop/GoodsCon/index', |
||||
query: { |
||||
q: res.result, |
||||
}, |
||||
}) |
||||
break |
||||
case 'group': |
||||
// 跳转团购 |
||||
this.$yrouter.push({ |
||||
path: '/pages/activity/GroupRule/index', |
||||
query: { |
||||
q: res.result, |
||||
}, |
||||
}) |
||||
break |
||||
case 'dargain': |
||||
// 跳转砍价 |
||||
this.$yrouter.push({ |
||||
path: '/pages/activity/DargainDetails/index', |
||||
query: { |
||||
q: res.result, |
||||
}, |
||||
}) |
||||
break |
||||
default: |
||||
// 跳转分销 |
||||
this.$yrouter.push({ |
||||
path: '/pages/Loading/index', |
||||
query: {}, |
||||
}) |
||||
break |
||||
} |
||||
}, |
||||
}) |
||||
}, |
||||
getbgcolor(e) { |
||||
this.bgcolor = e |
||||
}, |
||||
}, |
||||
created: async function() { |
||||
// await this.doColorThief(); |
||||
}, |
||||
} |
||||
</script> |
||||
<style scoped lang="less"> |
||||
.content_box { |
||||
background: #f3f3f3; |
||||
} |
||||
.index { |
||||
background-color: #f3f3f3; |
||||
} |
||||
.swiper-item { |
||||
height: 100%; |
||||
} |
||||
.fixed-header { |
||||
position: fixed; |
||||
z-index: 99; |
||||
// #ifdef H5 |
||||
top: 88rpx; |
||||
// #endif |
||||
|
||||
// #ifndef H5 |
||||
top: 0; |
||||
// #endif |
||||
left: 0; |
||||
right: 0; |
||||
background: #fff; |
||||
box-shadow: 0 0 20rpx -10rpx #aaa; |
||||
|
||||
& + .fixed-header-box { |
||||
height: 98rpx; |
||||
} |
||||
} |
||||
|
||||
.head_box { |
||||
width: 750rpx; |
||||
// background: #fff; |
||||
transition: all linear 0.3s; |
||||
|
||||
/deep/.cuIcon-back { |
||||
display: none; |
||||
} |
||||
|
||||
.nav-title { |
||||
font-size: 38rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: #fff; |
||||
} |
||||
} |
||||
|
||||
.cu-bar.fixed { |
||||
position: fixed; |
||||
width: 100%; |
||||
top: 0; |
||||
z-index: 1024; |
||||
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); |
||||
} |
||||
|
||||
.cu-bar { |
||||
box-sizing: border-box; |
||||
.index .header { |
||||
height: 64rpx; |
||||
} |
||||
} |
||||
|
||||
.header-search { |
||||
transition: all linear 0.3s; |
||||
background: #fff; |
||||
.search{ |
||||
border: 2rpx solid #EA533E; |
||||
background-color: #fff; |
||||
} |
||||
} |
||||
|
||||
.cu-bar .action { |
||||
display: -webkit-box; |
||||
display: -webkit-flex; |
||||
display: flex; |
||||
align-items: center; |
||||
height: 100%; |
||||
max-height: 100%; |
||||
|
||||
&:first-child { |
||||
margin-left: 15px; |
||||
font-size: 15px; |
||||
} |
||||
} |
||||
|
||||
.home_content_box { |
||||
margin-top: -20rpx; |
||||
} |
||||
|
||||
.head_box { |
||||
} |
||||
|
||||
.nav-title { |
||||
margin-left: 20rpx; |
||||
line-height: 40px; |
||||
} |
||||
</style> |
@ -0,0 +1,65 @@
|
||||
<template> |
||||
<view class="second-menu-box acea-row"> |
||||
<view |
||||
class="menu-item" |
||||
:class="[item.id === active ? 'menu-item-active':'']" |
||||
v-for="(item,index) in menuList" |
||||
:key="index" |
||||
@click="menuClick(index,item)">{{item.categoryName}}</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default{ |
||||
props:{ |
||||
menuList:{ |
||||
type:Array, |
||||
default:[] |
||||
}, |
||||
active:{ |
||||
type: Number, |
||||
default() { |
||||
return 0; |
||||
} |
||||
} |
||||
}, |
||||
data(){ |
||||
return { |
||||
|
||||
} |
||||
}, |
||||
created() { |
||||
// console.log(this.menuList) |
||||
}, |
||||
mounted() { |
||||
// console.log(this.menuList) |
||||
}, |
||||
methods:{ |
||||
menuClick(index,item){ |
||||
this.$emit('secondMenuClick',item) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="less"> |
||||
.second-menu-box{ |
||||
width: 100%; |
||||
margin-bottom: 40rpx; |
||||
.menu-item{ |
||||
min-width: 76rpx; |
||||
height: 62rpx; |
||||
box-sizing: border-box; |
||||
padding: 6rpx 20rpx; |
||||
font-size: 32rpx; |
||||
background: #F6F7F8; |
||||
border-radius: 14rpx; |
||||
color: #222; |
||||
margin-right: 24rpx; |
||||
} |
||||
.menu-item-active{ |
||||
color: #EB5744; |
||||
background: #FFEAE7; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,113 @@
|
||||
<template> |
||||
<view class="article-detail-index"> |
||||
<view class="article-title">{{detail.title}}</view> |
||||
<view class="author-box acea-row row-middle"> |
||||
<view class="charge-type">免费</view> |
||||
<view class="add-time">{{detail.addTime}}</view> |
||||
<view>·{{detail.author}}</view> |
||||
</view> |
||||
<view class="d-line"></view> |
||||
<view class="audio-box"> |
||||
<luchAudio :src="detail.audio" :play.sync="audioPlay"></luchAudio> |
||||
</view> |
||||
<view class="content-box"> |
||||
<rich-text :nodes="detail.content"></rich-text> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getArticleDetails } from '@/api/knowledge'; |
||||
import luchAudio from '@/components/luch-audio/luch-audio.vue'; |
||||
export default{ |
||||
components: { luchAudio }, |
||||
data(){ |
||||
return { |
||||
id:8, |
||||
current: { |
||||
poster: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/7fbf26a0-4f4a-11eb-b680-7980c8a877b8.png', |
||||
name: '致爱丽丝', |
||||
author: '暂无', |
||||
src: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3', |
||||
}, |
||||
audioAction: { |
||||
method: 'pause' |
||||
}, |
||||
detail:null, |
||||
audioPlay:true |
||||
} |
||||
}, |
||||
created() { |
||||
|
||||
getArticleDetails(this.id).then((res)=>{ |
||||
console.log(res) |
||||
if(res.success){ |
||||
this.detail = res.data |
||||
var music = null; |
||||
music = uni.createInnerAudioContext(); //创建播放器对象 |
||||
music.src= res.data.audio; //选择播放的音频 |
||||
music.play(); //执行播放 |
||||
} |
||||
}) |
||||
}, |
||||
mounted() { |
||||
// console.log(this.menuList) |
||||
}, |
||||
methods:{ |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
.article-detail-index{ |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
padding: 32rpx; |
||||
background: #fff; |
||||
.d-line{ |
||||
width: 100%; |
||||
position: absolute; |
||||
height: 1px; |
||||
background: #ECECEC; |
||||
top: 228rpx; |
||||
left: 0; |
||||
} |
||||
.article-title{ |
||||
font-size: 40rpx; |
||||
font-weight: 500; |
||||
color: #333333; |
||||
line-height: 56rpx; |
||||
} |
||||
.author-box{ |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
padding: 20rpx 0 30rpx; |
||||
// border-bottom: 1px solid #ECECEC; |
||||
.charge-type{ |
||||
min-width: 60rpx; |
||||
height: 34rpx; |
||||
line-height: 32rpx; |
||||
color: #6E85EB; |
||||
text-align: center; |
||||
background: #EDEFF8; |
||||
border-radius: 4rpx; |
||||
border: 1px solid #6E85EB; |
||||
padding: 0 6rpx; |
||||
font-size: 22rpx; |
||||
margin-right: 20rpx; |
||||
box-sizing: border-box; |
||||
} |
||||
} |
||||
.audio-box{ |
||||
margin: 30rpx 0 40rpx; |
||||
audio{ |
||||
width: 100%; |
||||
} |
||||
} |
||||
.content-box{ |
||||
width: 100%; |
||||
overflow: hidden; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,214 @@
|
||||
<template> |
||||
<view class="konwledge-index"> |
||||
<wuc-tab |
||||
:tab-list="tabList" |
||||
:tabCur.sync="TabCur" |
||||
@change="tabChange" |
||||
tab-class="text-center text-black bg-white" select-class="text-orange text-xl"> |
||||
</wuc-tab> |
||||
<view class="content-box"> |
||||
<view class="introduce-box acea-row"> |
||||
<view class="left-box"></view> |
||||
<view class="right-box"> |
||||
<view class="title-txt">国学介绍</view> |
||||
<view class="desc"> |
||||
<text>抱朴书院孕育自华夏优秀传统文化,以“博学致用抱朴含虚”为院训,以“弘扬国粹,利益社会”为动力。</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<SecondMenu |
||||
:menuList="secondMenu" |
||||
:active.sync="active" |
||||
@secondMenuClick="secondMenuClick"> |
||||
</SecondMenu> |
||||
<view class="knowledge-list"> |
||||
<view class="knowledge-item acea-row" v-for="item in articleList" @click="toDetail(item.id)"> |
||||
<view class="img-box"> |
||||
<image :src="item.imageInput" mode=""></image> |
||||
</view> |
||||
<view class="knowledge-info-box"> |
||||
<view class="title line1">{{item.title}}</view> |
||||
<view class="intro line2">{{item.synopsis}}</view> |
||||
<view class="type-box acea-row"> |
||||
<view class="tip blue">{{item.chargeType == 0 ? '免费' : item.articleCharge}}</view> |
||||
<view class="time">{{item.addTime}}</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import WucTab from '@/components/wuc-tab/wuc-tab.vue'; |
||||
import SecondMenu from './components/secondMenu.vue'; |
||||
import { getCategory,getArticle } from '@/api/knowledge'; |
||||
export default { |
||||
data() { |
||||
return { |
||||
TabCur: null, |
||||
tabList: [], |
||||
secondMenu:[], |
||||
active:null, |
||||
articleList:[] |
||||
} |
||||
}, |
||||
components: { WucTab,SecondMenu }, |
||||
onLoad() { |
||||
getCategory().then((res)=>{ |
||||
this.tabList = res.data |
||||
this.$set(this, 'tabList', res.data) |
||||
this.$set(this, 'secondMenu', res.data[0].categoryList) |
||||
this.$set(this, 'TabCur', res.data[0].id) |
||||
if(res.data[0].categoryList.length > 0){ |
||||
this.$set(this, 'active', res.data[0].categoryList[0].id) |
||||
} |
||||
}).then(()=>{ |
||||
this.getArticle() |
||||
}) |
||||
}, |
||||
methods: { |
||||
toDetail(id){ |
||||
this.$yrouter.push({ |
||||
path: '/pages/knowledge/detail', |
||||
query: { |
||||
id: id, |
||||
}, |
||||
}) |
||||
}, |
||||
getArticle(){ |
||||
var cid = null; |
||||
this.active == null ? cid = this.TabCur : cid = this.active |
||||
getArticle({cid:cid}).then((res)=>{ |
||||
if(res.success){ |
||||
this.articleList = res.data |
||||
} |
||||
}) |
||||
}, |
||||
tabChange(item) { |
||||
if(item.categoryList.length > 0){ |
||||
this.$set(this, 'active', item.categoryList[0].id) |
||||
} |
||||
this.secondMenu = item.categoryList; |
||||
this.TabCur = item.id; |
||||
this.getArticle() |
||||
}, |
||||
secondMenuClick(item){ |
||||
this.active = item.id; |
||||
this.getArticle() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="less"> |
||||
.konwledge-index{ |
||||
background: #fff; |
||||
min-height: 100%; |
||||
.content-box{ |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
padding: 0 24rpx; |
||||
} |
||||
.introduce-box{ |
||||
width: 100%; |
||||
height: 328rpx; |
||||
box-shadow: 0px 6rpx 14rpx 8rpx rgba(255,234,231,0.2); |
||||
border-radius: 8px; |
||||
overflow: hidden; |
||||
margin: 30rpx 0; |
||||
.left-box{ |
||||
width: 16rpx; |
||||
height: 100%; |
||||
background: #FAEFED; |
||||
} |
||||
.right-box{ |
||||
width: calc(100% - 16rpx); |
||||
padding: 30rpx 50rpx 0 24rpx; |
||||
font-size: 26rpx; |
||||
color: #999; |
||||
.title-txt{ |
||||
font-size: 36rpx; |
||||
font-weight: 500; |
||||
color: #3C464F; |
||||
line-height: 50rpx; |
||||
font-weight: 600; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
.desc{ |
||||
text-indent: 1em; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.knowledge-list{ |
||||
width: 100%; |
||||
.knowledge-item{ |
||||
border-bottom: 1px solid #ECECEC; |
||||
padding-bottom: 20rpx; |
||||
margin-bottom: 20rpx; |
||||
.img-box{ |
||||
width: 204rpx; |
||||
height: 200rpx; |
||||
margin-right: 30rpx; |
||||
image{ |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
} |
||||
.knowledge-info-box{ |
||||
width: calc(100% - 234rpx); |
||||
.title{ |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
font-size: 500; |
||||
line-height: 40rpx; |
||||
} |
||||
.intro{ |
||||
font-size: 28rpx; |
||||
color: #999999; |
||||
line-height: 40rpx; |
||||
margin: 8rpx 0 36rpx; |
||||
} |
||||
.type-box{ |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
.tip{ |
||||
width: 60rpx; |
||||
height: 34rpx; |
||||
line-height: 32rpx; |
||||
text-align: center; |
||||
background: #EDEFF8; |
||||
border-radius: 4rpx; |
||||
border: 1px solid #6E85EB; |
||||
padding: 0 6rpx; |
||||
font-size: 22rpx; |
||||
margin-right: 20rpx; |
||||
box-sizing: border-box; |
||||
} |
||||
.blue{ |
||||
color: #6E85EB; |
||||
background: #EDEFF8; |
||||
border-color: #6E85EB; |
||||
} |
||||
.yellow{ |
||||
color: #F99C10; |
||||
background: #FFEDCC; |
||||
border-color: #F99C10; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.text-black{ |
||||
font-size: 32rpx; |
||||
} |
||||
.text-orange{ |
||||
color: #EB5744; |
||||
font-size: 40rpx !important; |
||||
border-color: #EB5744; |
||||
} |
||||
|
||||
</style> |
Before Width: | Height: | Size: 774 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 344 KiB |
Before Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 472 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 865 B |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 336 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 945 B |
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.1 KiB |