Browse Source

上传代码

yh
杨豪 3 years ago
parent
commit
49cf6f44e9
  1. 22
      api/knowledge.js
  2. 4
      assets/css/base.less
  3. 225
      components/luch-audio/luch-audio.vue
  4. 65
      components/luch-audio/readme.md
  5. 133
      components/wuc-tab/wuc-tab.vue
  6. 93
      pages.json
  7. 421
      pages/home/components/HotCommodity.vue
  8. 78
      pages/home/components/PromoteProduct.vue
  9. 435
      pages/home/index-copy.vue
  10. 525
      pages/home/index.vue
  11. 65
      pages/knowledge/components/secondMenu.vue
  12. 113
      pages/knowledge/detail.vue
  13. 214
      pages/knowledge/index.vue
  14. BIN
      static/60x60.png
  15. BIN
      static/api.png
  16. BIN
      static/apiHL.png
  17. BIN
      static/apiIndex.png
  18. BIN
      static/app-plus/location@3x.png
  19. BIN
      static/app-plus/uni@2x.png
  20. BIN
      static/article1.png
  21. BIN
      static/c1.png
  22. BIN
      static/c2.png
  23. BIN
      static/c3.png
  24. BIN
      static/c4.png
  25. BIN
      static/c5.png
  26. BIN
      static/c6.png
  27. BIN
      static/c7.png
  28. BIN
      static/c8.png
  29. BIN
      static/c9.png
  30. BIN
      static/compass.png
  31. BIN
      static/component.png
  32. BIN
      static/componentHL.png
  33. BIN
      static/componentIndex.png
  34. BIN
      static/date-icon.png
  35. BIN
      static/date-icon2.png
  36. BIN
      static/extui.png
  37. BIN
      static/extuiHL.png
  38. BIN
      static/extuiIndex.png
  39. BIN
      static/f-menu1.png
  40. BIN
      static/f-menu2.png
  41. BIN
      static/f-menu3.png
  42. BIN
      static/home-banner.png
  43. BIN
      static/img1.png
  44. BIN
      static/img2.png
  45. BIN
      static/live-logo.gif
  46. BIN
      static/location.png
  47. BIN
      static/logo.png
  48. BIN
      static/next.png
  49. BIN
      static/prev.png
  50. BIN
      static/qiuqian-bg.png
  51. BIN
      static/saoyisao-icon.png
  52. BIN
      static/shuijiao.jpg
  53. BIN
      static/suosou.png
  54. BIN
      static/tab1.png
  55. BIN
      static/tab2.png
  56. BIN
      static/tab3.png
  57. BIN
      static/tab4.png
  58. BIN
      static/tab5.png
  59. BIN
      static/uni.png

22
api/knowledge.js

@ -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);
}

4
assets/css/base.less

@ -32,6 +32,10 @@
padding: 0 0.3*100rpx; padding: 0 0.3*100rpx;
} }
/* layout */ /* layout */
.acea-row-nowrap {
display: flex;
/* 辅助类 */
}
.acea-row { .acea-row {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;

225
components/luch-audio/luch-audio.vue

File diff suppressed because one or more lines are too long

65
components/luch-audio/readme.md

@ -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%自适应布局;

133
components/wuc-tab/wuc-tab.vue

@ -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>

93
pages.json

@ -3,7 +3,7 @@
{ {
"path": "pages/Loading/index", "path": "pages/Loading/index",
"style": { "style": {
"navigationBarTitleText": "yshop商城" "navigationBarTitleText": "禪易精舍"
} }
}, },
{ {
@ -39,11 +39,21 @@
{ {
"path": "pages/home/index", "path": "pages/home/index",
"style": { "style": {
"navigationBarTitleText": "yshop商城", "navigationBarTitleText": "禪易"
"navigationBarTextStyle": "white",
"navigationStyle": "custom"
} }
}, },
{
"path": "pages/knowledge/index",
"style": {
"navigationBarTitleText": "文章"
}
},
{
"path": "pages/knowledge/detail",
"style": {
"navigationBarTitleText": "文章详情"
}
},
{ {
"path": "pages/shop/GoodSearch/index", "path": "pages/shop/GoodSearch/index",
"style": { "style": {
@ -432,14 +442,13 @@
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "Yshop", "navigationBarTitleText": "Yshop",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#fff",
"backgroundColor": "#F8F8F8", "backgroundColor": "#fff",
"navigationStyle": "default" "navigationStyle": "default"
}, },
"tabBar": { "tabBar": {
"color": "#282828", "color": "#666666",
"selectedColor": "#eb3729", "selectedColor": "#F99C10",
"borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"height": "50px", "height": "50px",
"fontSize": "10px", "fontSize": "10px",
@ -448,28 +457,52 @@
"list": [ "list": [
{ {
"pagePath": "pages/home/index", "pagePath": "pages/home/index",
"iconPath": "static/icon-home.png", "iconPath": "static/tab1.png",
"selectedIconPath": "static/icon-home-hot.png", "selectedIconPath": "static/tab1.png",
"text": "首页" "text": "禪易"
}, },
{ {
"pagePath": "pages/shop/GoodsClass/index", "pagePath": "pages/home/index",
"iconPath": "static/icon-class.png", "iconPath": "static/tab2.png",
"selectedIconPath": "static/icon-class-hot.png", "selectedIconPath": "static/tab2.png",
"text": "分类" "text": "学习"
}, },
{ {
"pagePath": "pages/shop/ShoppingCart/index", "pagePath": "pages/knowledge/index",
"iconPath": "static/icon-cart.png", "iconPath": "static/tab3.png",
"selectedIconPath": "static/icon-cart-hot.png", "selectedIconPath": "static/tab3.png",
"text": "购物车" "text": "文章"
}, },
{ {
"pagePath": "pages/user/User/index", "pagePath": "pages/shop/GoodsClass/index",
"iconPath": "static/icon-user.png", "iconPath": "static/tab4.png",
"selectedIconPath": "static/icon-user-hot.png", "selectedIconPath": "static/tab4.png",
"text": "我的" "text": "商城"
} },
{
"pagePath": "pages/user/User/index",
"iconPath": "static/tab5.png",
"selectedIconPath": "static/tab5.png",
"text": "我的"
}
// {
// "pagePath": "pages/shop/GoodsClass/index",
// "iconPath": "static/icon-class.png",
// "selectedIconPath": "static/icon-class-hot.png",
// "text": "分类"
// },
// {
// "pagePath": "pages/shop/ShoppingCart/index",
// "iconPath": "static/icon-cart.png",
// "selectedIconPath": "static/icon-cart-hot.png",
// "text": "购物车"
// },
// {
// "pagePath": "pages/user/User/index",
// "iconPath": "static/icon-user.png",
// "selectedIconPath": "static/icon-user-hot.png",
// "text": "我的"
// }
] ]
} }
} }

421
pages/home/components/HotCommodity.vue

@ -1,219 +1,220 @@
<template> <template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0"> <view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push({ path: '/pages/shop/HotNewGoods/index',query:{type:2} })"> <view class="title-box x-bc" @tap="$yrouter.push({ path: '/pages/shop/HotNewGoods/index',query:{type:2} })">
<text class="title">热门榜单</text> <text class="title">热门榜单</text>
<view class="group-people x-f"> <view class="group-people x-f">
<text class="tip">更多</text> <text class="tip">更多</text>
<text class="cuIcon-right"></text> <text class="cuIcon-right"></text>
</view> </view>
</view> </view>
<view class="goods-box swiper-box x-f"> <view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000"> <swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item"> <swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f"> <view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id"> <block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods" @tap="jump('/pages/shop/GoodsCon/index',{id:mgoods.id})"> <view class="min-goods" @tap="jump('/pages/shop/GoodsCon/index',{id:mgoods.id})">
<view class="img-box"> <view class="img-box">
<view class="tag">hot</view> <view class="tag">hot</view>
<image class="img" :src="mgoods.image" mode="widthFix"></image> <image class="img" :src="mgoods.image" mode="widthFix"></image>
</view> </view>
<view class="price-box"> <view class="price-box">
<view class="y-f"> <view class="y-f">
<text class="seckill-current">{{ mgoods.price }}</text> <text class="seckill-current">{{ mgoods.price }}</text>
<text class="original">销量{{ mgoods.sales }}{{mgoods.unitName}}</text> <text class="original">销量{{ mgoods.sales }}{{mgoods.unitName}}</text>
</view> </view>
</view> </view>
<view class="title"> <view class="title">
<slot name="titleText"></slot> <slot name="titleText"></slot>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="swiper-dots" v-if="goodsList.length > 1"> <view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length" <text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text> :key="index"></text>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import shActivityGoods from '@/components/sh-activity-goods.vue'; import shActivityGoods from '@/components/sh-activity-goods.vue';
export default { export default {
name: "HotCommodity", name: "HotCommodity",
components: { components: {
shActivityGoods shActivityGoods
}, },
data() { data() {
return { return {
goodsList: [], goodsList: [],
swiperCurrent: 0 swiperCurrent: 0
}; };
}, },
props: { props: {
detail: Array detail: Array
}, },
computed: {}, computed: {},
created() {}, created() {},
watch: { watch: {
detail(next) { detail(next) {
this.goodsList = this.sortData(next, 4); this.goodsList = this.sortData(next, 4);
} }
}, },
methods: { methods: {
swiperChange(e) { swiperChange(e) {
this.swiperCurrent = e.detail.current; this.swiperCurrent = e.detail.current;
}, },
// //
sortData(oArr, length) { sortData(oArr, length) {
let arr = []; let arr = [];
let minArr = []; let minArr = [];
oArr.forEach(c => { oArr.forEach(c => {
if (minArr.length === length) { if (minArr.length === length) {
minArr = []; minArr = [];
} }
if (minArr.length === 0) { if (minArr.length === 0) {
arr.push(minArr); arr.push(minArr);
} }
minArr.push(c); minArr.push(c);
}); });
return arr; return arr;
}, },
jump(path, query) { jump(path, query) {
this.$yrouter.push({ this.$yrouter.push({
path, path,
query, query,
}); });
}, },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.group-goods { .group-goods {
position: relative; position: relative;
z-index: 9; z-index: 9;
} }
.swiper-box, .swiper-box,
.carousel { .carousel {
width: 700rpx; width: 700rpx;
height: 240upx; height: 240upx;
position: relative; position: relative;
border-radius: 20rpx; border-radius: 20rpx;
.carousel-item { .carousel-item {
width: 100%; width: 100%;
height: 100%; height: 100%;
// padding: 0 28upx; // padding: 0 28upx;
overflow: hidden; overflow: hidden;
} }
.swiper-image { .swiper-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
// border-radius: 10upx; // border-radius: 10upx;
background: #ccc; background: #ccc;
} }
} }
.swiper-dots { .swiper-dots {
display: flex; display: flex;
position: absolute; position: absolute;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
bottom: 0rpx; bottom: 0rpx;
z-index: 66; z-index: 66;
.dot { .dot {
width: 45rpx; width: 45rpx;
height: 3rpx; height: 3rpx;
background: #eee; background: #eee;
border-radius: 50%; border-radius: 50%;
margin-right: 10rpx; margin-right: 10rpx;
} }
.dot-active { .dot-active {
width: 45rpx; width: 45rpx;
height: 3rpx; height: 3rpx;
background: #a8700d; background: #a8700d;
border-radius: 50%; border-radius: 50%;
margin-right: 10rpx; margin-right: 10rpx;
} }
} }
// + // +
.group-goods { .group-goods {
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
overflow: hidden; overflow: hidden;
.title-box { .title-box {
padding-bottom: 20rpx; padding-bottom: 20rpx;
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.group-people { .group-people {
.time-box { .time-box {
font-size: 26rpx; font-size: 26rpx;
color: #edbf62; color: #edbf62;
.count-text-box { .count-text-box {
width: 30rpx; width: 30rpx;
height: 34rpx; height: 34rpx;
background: #edbf62; background: #edbf62;
text-align: center; text-align: center;
line-height: 34rpx; line-height: 34rpx;
font-size: 24rpx; font-size: 24rpx;
border-radius: 6rpx; border-radius: 6rpx;
color: rgba(#fff, 0.9); color: rgba(#fff, 0.9);
margin: 0 8rpx; margin: 0 8rpx;
} }
} }
.head-box { .head-box {
.head-img { .head-img {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
border-radius: 50%; border-radius: 50%;
background: #ccc; background: #ccc;
} }
} }
.tip { .tip {
font-size: 28rpx; font-size: 28rpx;
padding-left: 30rpx; padding-left: 30rpx;
color: #666; color: #666;
} }
.cuIcon-right { .cuIcon-right {
font-size: 30rpx; font-size: 30rpx;
line-height: 28rpx; line-height: 28rpx;
color: #666; color: #666;
} }
} }
} }
.goods-box { .goods-box {
.goods-item { .goods-item {
margin-right: 22rpx; margin-right: 22rpx;
&:nth-child(4n) { &:nth-child(4n) {
margin-right: 0; margin-right: 0;
} }
} }
} }
.min-goods{
margin-right: 22rpx; .min-goods {
margin-right: 22rpx;
}
} }
}
</style> </style>

78
pages/home/components/PromoteProduct.vue

@ -1,43 +1,43 @@
<template> <template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0"> <view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push('/pages/shop/GoodsPromotion/index')"> <view class="title-box x-bc" @tap="$yrouter.push('/pages/shop/GoodsPromotion/index')">
<text class="title">促销单品</text> <text class="title">促销单品</text>
<view class="group-people x-f"> <view class="group-people x-f">
<text class="tip">更多</text> <text class="tip">更多</text>
<text class="cuIcon-right"></text> <text class="cuIcon-right"></text>
</view> </view>
</view> </view>
<view class="goods-box swiper-box x-f"> <view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000"> <swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item"> <swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f"> <view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id"> <block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods" <view class="min-goods"
@tap="$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } })"> @tap="$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } })">
<view class="img-box"> <view class="img-box">
<view class="tag">促销</view> <view class="tag">促销</view>
<image class="img" :src="mgoods.image" mode="widthFix"></image> <image class="img" :src="mgoods.image" mode="widthFix"></image>
</view> </view>
<view class="price-box"> <view class="price-box">
<view class="y-f"> <view class="y-f">
<text class="seckill-current">日常价{{ mgoods.price }}</text> <text class="seckill-current">日常价{{ mgoods.price }}</text>
<text class="original">仅剩{{ mgoods.stock }}{{ mgoods.unitName }}</text> <text class="original">仅剩{{ mgoods.stock }}{{ mgoods.unitName }}</text>
</view> </view>
</view> </view>
<view class="title"> <view class="title">
<slot name="titleText"></slot> <slot name="titleText"></slot>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="swiper-dots" v-if="goodsList.length > 1"> <view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length" <text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text> :key="index"></text>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>

435
pages/home/index-copy.vue

@ -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>

525
pages/home/index.vue

@ -1,52 +1,139 @@
<template> <template>
<view class="index"> <view class="index">
<view v-for="(item, index) in homeData" :key="index"> <view class="header header-search acea-row row-center-wrapper">
<view class="head_box" v-if="item.type == 'header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }"> <view @click="goGoodSearch()" class="search acea-row row-middle">
<cu-custom :isBack="true" :bgColor="bgcolor"> <text class="iconfont icon-xiazai5"></text>
<block slot="backText"> 搜索商品
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text> </view>
</block> <!-- #ifndef H5 -->
</cu-custom> <view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'">
</view> <image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" />
<view class="header header-search acea-row row-center-wrapper" v-if="item.type == 'search'" :style="{ background: bgcolor }"> </view>
<view @click="goGoodSearch()" class="search acea-row row-middle"> <!-- #endif -->
<text class="iconfont icon-xiazai5"></text> </view>
搜索商品 <view class="banner-box">
</view> <image src="../../static/home-banner.png" mode=""></image>
<!-- #ifndef H5 --> </view>
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'"> <!-- 每日一签 -->
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> <view class="today-fortune-content">
</view> <view class="today-fortune-box">
<!-- #endif --> <view class="top-box acea-row row-between-wrapper">
</view> <view class="title">今日·宜忌</view>
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> <view>2021年06月07日</view>
<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>
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> <view class="date-box acea-row row-middle">
<!-- 菜单 --> <view class="date-btn prev-btn"><image src="../../static/prev.png"></image></view>
<Menu :list="item.componentContent.menus"></Menu> <view class="time-box">四月二十四</view>
</view> <view class="date-btn next-btn"><image src="../../static/next.png"></image></view>
<!-- 滚动新闻 --> </view>
<!-- 广告 --> <view class="week-box">
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" /> <span class="week">星期一</span>
<!-- 热门榜单 --> <span>辛丑牛年 甲午月 丙戌日</span>
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity> </view>
<!-- 超值拼团 --> <view class="fortune-detail">
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" /> <view class="fortune-n acea-row-nowrap mt20">
<!-- 首发新品->秒杀 --> <view class="fortune-icon nice"></view>
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct> <view class="fortune">安机械 移徙 入宅 出行 祭祀 祈福 动土祭祀 祈福 动土</view>
<!-- 精品推荐 --> </view>
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended> <view class="fortune-b acea-row-nowrap mt20">
<!-- 促销单品 --> <view class="fortune-icon bad"></view>
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct> <view class="fortune">开市 伐木 作梁 作灶 </view>
<!-- 直播 --> </view>
<!-- #ifdef MP-WEIXIN --> </view>
<Live v-if="item.type == 'live'" :detail="live"></Live> <view class="qiuqian-box">
<!-- #endif --> <image class="qiuqian-bg" src="../../static/qiuqian-bg.png"></image>
<!-- 为您推荐 --> <view class="txt-box acea-row row-between-wrapper">
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> <view>今日还没有求签哦</view>
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window> <view class="qiuqin-btn">每日一签</view>
</view> </view>
</view> </view>
</view>
<view class="fortune-menu-box acea-row row-around">
<view class="fortune-menu-item acea-row row-middle ">
<image src="../../static/f-menu1.png" mode=""></image>
<text>周公解梦</text>
</view>
<view class="fortune-menu-item acea-row row-middle">
<image src="../../static/f-menu2.png" mode=""></image>
<text>周易八卦</text>
</view>
<view class="fortune-menu-item acea-row row-middle">
<image src="../../static/f-menu3.png" mode=""></image>
<text>八字财运</text>
</view>
</view>
</view>
<!-- 推荐课程 -->
<view class="recommend-box p30">
<view class="title-box acea-row row-between-wrapper">
<view class="title">今日推荐</view>
<view class="more">查看全部课程</view>
</view>
<view class="recommend-list-box acea-row">
<view class="recommend-item" v-for="item in 4" :key="index">
<view class="img-box"><image src="../../static/img2.png"></image></view>
<view class="course-content">
<view class="course-title line1">一代天骄·王者少年</view>
<view class="course-tips-box acea-row">
<view class="course-tip-item blue">国学</view>
<view class="course-tip-item yellow">商学院</view>
</view>
<view class="price">199</view>
<view class="course-address acea-row row-between-wrapper">
<view class="address">中国 武汉</view>
<view class="course-time">2021 5 31-6.3</view>
</view>
</view>
</view>
</view>
</view>
<!-- 学习榜 -->
<view class="study-list-box">
<view class="title-box acea-row row-between-wrapper">
<view class="title">学习榜单</view>
<view class="more">查看全部榜单</view>
</view>
<view class="study-list uni-padding-wrap uni-common-mt">
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="study-item scroll-view-item_H" v-for="(item,index) in 6" :key="index">
<view class="day-box acea-row row-middle">
<image src="../../static/date-icon.png" mode="" v-if="index%2 == 0"></image>
<image src="../../static/date-icon2.png" mode="" v-if="index%2 != 0"></image>
<text>20</text>
</view>
<view class="study-content">
<view class="study-title">连续11天打卡站桩</view>
<view class="study-time acea-row row-between-wrapper">
<view>5.28开始</view>
<view>280人已参与</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
<!-- 都在看 -->
<view class="readyarticle-box">
<view class="title-box acea-row row-between-wrapper">
<view class="title">大家都在看</view>
<view class="more">查看全部文章</view>
</view>
<view class="article-list">
<view class="article-item">
<image src="../../static/article1.png" mode=""></image>
<view class="article-content">
<view class="article-title line1">满愿手抄经礼盒中国的传家手礼盒中国的传家手礼盒中国的传家手抄</view>
<view class="article-desc line1">抱朴书院孕育自华夏优秀传统文书院孕育自华夏优秀传统书院孕育自华夏优秀传统化</view>
<view class="author-box acea-row">
<view class="author">商学院·</view>
<view class="time">2021.5.28</view>
</view>
</view>
</view>
</view>
</view>
<view class="no-more">没有更多内容了</view>
</view>
</template> </template>
<script> <script>
import { mapState, mapMutations, mapActions } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
@ -205,7 +292,6 @@ export default {
.catch(error => { .catch(error => {
this.homeData = JSON.parse(error.data.json) this.homeData = JSON.parse(error.data.json)
console.log(this.homeData) console.log(this.homeData)
console.log(222)
}) })
getHomeData().then(res => { getHomeData().then(res => {
that.logoUrl = res.data.logoUrl that.logoUrl = res.data.logoUrl
@ -339,24 +425,22 @@ export default {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.content_box { .content_box {
background: #f6f6f6; background: #F5F6F7;
} }
.index { .index {
background-color: #f6f6f6; background-color: #F5F6F7;
padding-bottom: 68rpx;
} }
.swiper-item { .swiper-item {
height: 100%; height: 100%;
} }
.fixed-header { .fixed-header {
position: fixed; position: fixed;
z-index: 99; z-index: 99;
// #ifdef H5 // #ifdef H5
top: 88rpx; top: 88rpx;
// #endif // #endif
// #ifndef H5 // #ifndef H5
top: 0; top: 0;
// #endif // #endif
@ -364,11 +448,332 @@ export default {
right: 0; right: 0;
background: #fff; background: #fff;
box-shadow: 0 0 20rpx -10rpx #aaa; box-shadow: 0 0 20rpx -10rpx #aaa;
& + .fixed-header-box { & + .fixed-header-box {
height: 98rpx; height: 98rpx;
} }
} }
.banner-box{
width: 100%;
height: 372rpx;
}
.today-fortune-content{
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
margin-bottom: 40rpx;
.today-fortune-box{
width: 100%;
background: #fff;
box-sizing: border-box;
padding: 30rpx 40rpx;
border-radius: 20rpx;
box-shadow: 0px 6px 14px 0px rgba(124,124,124,0.08);
font-size: 24rpx;
position: relative;
top: -24rpx;
}
.date-box{
font-size: 72rpx;
color: #EA533E;
margin-top: 38rpx;
.time-box{
margin: 0 24rpx;
}
.date-btn{
width: 84rpx;
height: 84rpx;
font-weight: bold;
line-height: 100rpx;
}
}
.week-box{
width: 100%;
color: #7C7C7C;
text-align: center;
border-bottom: 1px solid #ECECEC;
padding: 30rpx 0;
.week{
display: inline-block;
margin-right: 12rpx;
color: #222;
}
}
.fortune-detail{
font-size: 30rpx;
color: #222;
.fortune-n{
color:#EA533E;
}
.fortune-icon{
width: 44rpx;
height: 44rpx;
text-align: center;
line-height: 44rpx;
border-radius: 25px;
font-size: 28rpx;
color: #fff;
margin-right: 20rpx;
}
.fortune{
width:calc(100% - 70rpx)
}
.nice{
background: #EA533E;
}
.bad{
background: #8FB85B;
}
}
.qiuqian-box{
width: 100%;
height: 124rpx;
position: relative;
margin-top: 40rpx;
image{
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
}
.txt-box{
width: 100%;
height: 100%;
padding:0 28rpx;
box-sizing: border-box;
font-size: 30rpx;
color: #EA533E;
position: absolute;
z-index: 3;
}
.qiuqin-btn{
width: 194rpx;
height: 68rpx;
background: linear-gradient(180deg, #EA533E 0%, #E5270F 100%);
box-shadow: 0px 4rpx 6rpx 2rpx rgba(255,213,208,0.59);
border-radius: 34rpx;
font-size: 32rpx;
color: #fff;
text-align: center;
line-height: 68rpx;
}
}
.fortune-menu-box{
.fortune-menu-item{
width: 216rpx;
height: 88rpx;
border-radius: 6rpx;
background: #fff;
font-size: 28rpx;
color: #222;
image{
width: 60rpx;
height: 60rpx;
margin-right: 12rpx;
}
}
}
}
.p30{
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
margin-bottom: 40rpx;
}
.recommend-box{
.recommend-list-box{
width: 100%;
.recommend-item{
width: 334rpx;
background: #fff;
border-radius: 10rpx;
font-size: 28rpx;
color: #333;
margin: 20rpx 18rpx 20rpx 0;
image{
width: 334rpx;
height: 216rpx;
}
.course-content{
width: 100%;
box-sizing: border-box;
padding:0 20rpx 20rpx;
}
.course-title{
line-height: 40rpx;
}
.course-tips-box{
margin-top: 12rpx;
font-size: 24rpx;
color: #999;
.course-tip-item{
min-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;
margin-right: 20rpx;
}
.blue{
color: #6E85EB;
background: #EDEFF8;
border-color: #6E85EB;
}
.yellow{
color: #F99C10;
background: #FFEDCC;
border-color: #F99C10;
}
}
.price{
font-size: 32rpx;
color: #EA533E;
font-weight: 500;
margin: 16rpx 0;
}
.course-address{
font-size: 24rpx;
color: #999999;
}
}
.recommend-item:nth-child(2n){
margin-right: 0;
}
}
}
.study-list-box,.readyarticle-box{
margin-bottom: 40rpx;
.title-box{
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
}
}
.study-list{
width: 100%;
margin-top: 20rpx;
margin-bottom: 40rpx;
padding-left: 20rpx;
box-sizing: border-box;
.scroll-view_H{
white-space: nowrap;
width: 100%;
}
.study-item{
width: 334rpx;
height: 180rpx;
display: inline-block;
background: linear-gradient(143deg, #FDAF97 0%, #ED5E48 100%);
box-shadow: 0px 4rpx 8rpx 4rpx rgba(250,194,183,0.32);
border-radius: 10rpx;
margin-right: 20rpx;
.day-box{
color: #E73D21;
font-size: 48rpx;
line-height: 58rpx;
margin-left: 10rpx;
image{
width: 34rpx;
height: 34rpx;
margin-right: 10rpx;
}
}
.study-content{
width: calc(100% - 12rpx);
background: #fff;
font-size: 24rpx;
color: #999;
box-shadow: 0px 4rpx 8rpx 4rpx rgba(250,194,183,0.32);
border-radius: 10rpx;
margin: 2rpx auto;
padding:16rpx 10rpx 10rpx;
box-sizing: border-box;
.study-title{
font-size: 28rpx;
font-weight: 500;
color: #222222;
line-height: 40rpx;
margin-bottom: 12rpx;
}
}
}
.study-item:nth-child(2n){
background: linear-gradient(143deg, #C4DBFF 0%, #7FAAF2 100%);
.day-box{
color: #557AB3;
}
}
}
.readyarticle-box{
.article-list{
width: 100%;
margin-top: 20rpx;
.article-item{
width: 100%;
background: #fff;
padding: 20rpx;
box-sizing: border-box;
image{
width: 710rpx;
height: 266rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.article-title{
font-size: 36rpx;
font-weight: 500;
color: #333333;
line-height: 50rpx;
margin-bottom: 8rpx;
}
.article-desc{
font-size: 24rpx;
font-weight: 400;
color: #999999;
line-height: 40rpx;
margin-bottom: 30rpx;
text-indent: 1em;
}
.author-box{
font-size: 24rpx;
color: #999;
text-indent: 1em;
.author{
color: #EA533E;
margin-right: 12rpx;
}
}
}
}
}
.title-box{
color: #222;
.title{
font-size: 40rpx;
}
.more{
font-size: 24rpx;
color: #999;
}
}
image{
width: 100%;
height: 100%;
}
.no-more{
text-align: center;
color: #999;
font-size: 24rpx;
}
.head_box { .head_box {
width: 750rpx; width: 750rpx;
@ -397,17 +802,19 @@ export default {
.cu-bar { .cu-bar {
box-sizing: border-box; box-sizing: border-box;
.index .header { .index .header {
height: 64rpx; height: 64rpx;
// width: 100%;
// padding: 0 30rpx;
// box-sizing: border-box;
} }
} }
.header-search { .header-search {
transition: all linear 0.3s; transition: all linear 0.3s;
background: #fff;
color: #999999;
.search{
border: 2rpx solid #EA533E;
background-color: #fff;
}
} }
.cu-bar .action { .cu-bar .action {

65
pages/knowledge/components/secondMenu.vue

@ -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>

113
pages/knowledge/detail.vue

@ -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>

214
pages/knowledge/index.vue

@ -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>

BIN
static/60x60.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

BIN
static/api.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/apiHL.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/apiIndex.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/app-plus/location@3x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

BIN
static/app-plus/uni@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

BIN
static/article1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

BIN
static/c1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

BIN
static/c2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

BIN
static/c3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

BIN
static/c4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 B

BIN
static/c5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

BIN
static/c6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

BIN
static/c7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

BIN
static/c8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

BIN
static/c9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 565 B

BIN
static/compass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
static/component.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/componentHL.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/componentIndex.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/date-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
static/date-icon2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
static/extui.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

BIN
static/extuiHL.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

BIN
static/extuiIndex.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

BIN
static/f-menu1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/f-menu2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/f-menu3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
static/home-banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

BIN
static/img1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
static/img2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
static/live-logo.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

BIN
static/location.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

BIN
static/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/next.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/prev.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/qiuqian-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
static/saoyisao-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

BIN
static/shuijiao.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
static/suosou.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

BIN
static/tab1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
static/tab2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
static/tab3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/tab4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

BIN
static/tab5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
static/uni.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Loading…
Cancel
Save