【文章列表】

1. 功能实现
pull/1/MERGE
YunaiV 2023-06-26 23:47:06 +08:00
parent c23e1922a3
commit 72385f8ed8
6 changed files with 155 additions and 221 deletions

View File

@ -1,89 +0,0 @@
import request from "@/utils/request.js";
/**
* 统计数据
*/
export function getStatisticsInfo() {
return request.get("/admin/order/statistics", {}, { login: true });
}
/**
* 订单月统计
*/
export function getStatisticsMonth(where) {
return request.get("/admin/order/data", where, { login: true });
}
/**
* 订单月统计
*/
export function getAdminOrderList(where) {
return request.get("/admin/order/list", where, { login: true });
}
/**
* 订单改价
*/
export function setAdminOrderPrice(data) {
return request.post("/admin/order/price", data, { login: true });
}
/**
* 订单备注
*/
export function setAdminOrderRemark(data) {
return request.post("/admin/order/remark", data, { login: true });
}
/**
* 订单详情
*/
export function getAdminOrderDetail(orderId) {
return request.get("/admin/order/detail/" + orderId, {}, { login: true });
}
/**
* 订单发货信息获取
*/
export function getAdminOrderDelivery(orderId) {
return request.get(
"/admin/order/delivery/gain/" + orderId,
{},
{ login: true }
);
}
/**
* 订单发货保存
*/
export function setAdminOrderDelivery(data) {
return request.post("/admin/order/delivery/keep", data, { login: true });
}
/**
* 订单统计图
*/
export function getStatisticsTime(data) {
return request.get("/admin/order/time", data, { login: true });
}
/**
* 线下付款订单确认付款
*/
export function setOfflinePay(data) {
return request.post("/admin/order/offline", data, { login: true });
}
/**
* 订单确认退款
*/
export function setOrderRefund(data) {
return request.post("/admin/order/refund", data, { login: true });
}
/**
* 获取快递公司
* @returns {*}
*/
export function getLogistics() {
return request.get("/logistics", {}, { login: false });
}
/**
* 订单核销
* @returns {*}
*/
export function orderVerific(verify_code, is_confirm) {
return request.post("order/order_verific", { verify_code, is_confirm });
}

View File

@ -55,14 +55,6 @@ export function getUserCoupons(data){
return request.get('coupon/list',data)
}
/**
* 文章分类列表
*
*/
export function getArticleCategoryList(){
return request.get('article/category/list',{},{noAuth:true})
}
/**
* 文章列表
* @param int cid
@ -72,22 +64,6 @@ export function getArticleList(cid,data){
return request.get('article/list/' + cid, data,{noAuth:true})
}
/**
* 文章 热门列表
*
*/
export function getArticleHotList(){
return request.get('article/hot/list',{},{noAuth:true});
}
/**
* 文章 轮播列表
*
*/
export function getArticleBannerList(){
return request.get('article/banner/list',{},{noAuth:true})
}
/**
* 文章详情
* @param int id

22
api/promotion/article.js Normal file
View File

@ -0,0 +1,22 @@
import request from "@/utils/request.js";
// 获得文章分类列表
export function getArticleCategoryList() {
return request.get("app-api/promotion/article-category/list", {}, {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得文章列表
export function getArticleList(data) {
return request.get("app-api/promotion/article/list", data, {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得文章分页
export function getArticlePage(data) {
return request.get("app-api/promotion/article/page", data, {
noAuth: true // TODO 芋艿:后续要做调整
});
}

View File

@ -45,15 +45,16 @@
</block>
</swiper>
</view>
<!-- 新闻简报 -->
<view class='notice acea-row row-middle row-between' v-if="roll.length">
<view class="pic">
<image src="/static/images/xinjian.png"></image>
<image src="/static/images/xinjian.png" />
</view>
<text class='line'>|</text>
<view class='swipers'>
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500" vertical="true"
circular="true">
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500"
vertical="true" circular="true">
<block v-for="(item,index) in roll" :key='index'>
<swiper-item>
<navigator class='item' :url='item.url' hover-class='none'>
@ -63,8 +64,9 @@
</block>
</swiper>
</view>
<view class="iconfont icon-xiangyou"></view>
<view class="iconfont icon-xiangyou" />
</view>
<!-- menu -->
<view class='nav acea-row' v-if="menus.length">
<block v-for="(item,index) in menus" :key="index">

View File

@ -4,7 +4,7 @@
<view class='title'>{{articleInfo.title}}</view>
<view class='list acea-row row-middle'>
<view class='label'>{{articleInfo.author}}</view>
<view class='item'></text>{{articleInfo.createTime}}</view>
<view class='item'>{{articleInfo.createTime}}</view>
<view class='item'><text class='iconfont icon-liulan'></text>{{articleInfo.visit}}</view>
</view>
<view class='conters'>
@ -21,7 +21,9 @@
</view>
<view class="y_money">{{store_info.otPrice}}</view>
</view>
<navigator :url="'/pages/goods_details/index?id='+store_info.id" hover-class="none" class="label"><text class="span">查看商品</text></navigator>
<navigator :url="'/pages/goods_details/index?id='+store_info.id" hover-class="none" class="label">
<text class="span">查看商品</text>
</navigator>
</view>
<!-- #ifdef H5 -->
<button class="bnt bg-color" hover-class='none' @click="listenerActionSheet" v-if="this.$wechat.isWeixin()"></button>
@ -30,7 +32,7 @@
<button class="bnt bg-color" open-type="share" hover-class='none'>和好友一起分享</button>
<!-- #endif -->
</view>
<shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
<shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus" />
<home></home>
</view>
</template>
@ -64,39 +66,39 @@
productId: 0
};
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.hasOwnProperty('id')){
this.id = options.id;
}else{
// #ifndef H5
uni.navigateBack({delta: 1 });
// #endif
// #ifdef H5
history.back();
// #endif
}
},
onShow: function () {
this.getArticleOne();
},
/**
* 用户点击右上角分享
*/
// #ifdef MP
onShareAppMessage: function() {
return {
title: this.articleInfo.title,
imageUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput[0] : "",
desc: this.articleInfo.synopsis,
path: '/pages/news_details/index?id=' + this.id
};
},
// #endif
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.hasOwnProperty('id')) {
this.id = options.id;
} else{
// #ifndef H5
uni.navigateBack({delta: 1 });
// #endif
// #ifdef H5
history.back();
// #endif
}
},
onShow: function () {
this.getArticleOne();
},
/**
* 用户点击右上角分享
*/
// #ifdef MP
onShareAppMessage: function() {
return {
title: this.articleInfo.title,
imageUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput[0] : "",
desc: this.articleInfo.synopsis,
path: '/pages/news_details/index?id=' + this.id
};
},
// #endif
methods: {
getArticleOne:function(){
getArticleOne:function(){
let that = this;
getArticleDetails({id:that.id}).then(res=>{
uni.setNavigationBarTitle({
@ -109,7 +111,7 @@
}
that.content = res.data.content;
// #ifdef H5
if(this.$wechat.isWeixin()){
if (this.$wechat.isWeixin()) {
this.setShareInfo();
}
// #endif

View File

@ -1,75 +1,76 @@
<template>
<view>
<view class='newsList'>
<!-- Banner 文章 -->
<view class='swiper' v-if="imgUrls.length > 0">
<swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<navigator :url="'/pages/news_details/index?id='+item.id">
<image :src="item.imageInput" class="slide-image" />
<image :src="item.picUrl" class="slide-image" />
</navigator>
</swiper-item>
</block>
</swiper>
</view>
<view class='nav' v-if="navList.length > 0">
<!-- 文章分类 -->
<view class='nav' v-if="navList.length > 0">
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;">
<block v-for="(item,index) in navList" :key="index">
<view class='item borRadius14' :class='active==item.id?"on":""' @click='tabSelect(item.id, index)'>
<view class='item borRadius14' :class='active === item.id?"on":""' @click='tabSelect(item.id, index)'>
<view>{{item.name}}</view>
<view class='line bg-color' v-if="active==item.id"></view>
<view class='line bg-color' v-if="active === item.id"></view>
</view>
</block>
</scroll-view>
</view>
<view class='list'>
<!-- 文章分类 -->
<view class='list'>
<block v-for="(item,index) in articleList" :key="index">
<navigator :url='"/pages/news_details/index?id="+item.id' hover-class='none' class='item acea-row row-between-wrapper'>
<view class='text acea-row row-column-between'>
<view class='name line2'>{{item.title}}</view>
<view>{{item.createTime}}</view>
<view>{{ formatDate(item.createTime) }}</view>
</view>
<view class='pictrue'>
<image :src='item.imageInput'></image>
<image :src='item.picUrl'></image>
</view>
</navigator>
</block>
</view>
</view>
<view class='noCommodity' v-if="articleList.length == 0 && (page != 1 || active== 0)">
<view class='noCommodity' v-if="articleList.length === 0 && (page !== 1 || active === 0)">
<view class='pictrue'>
<image src='../../static/images/noNews.png'></image>
<image src='../../static/images/noNews.png' />
</view>
</view>
<home></home>
</view>
</template>
<script>
import {
getArticleCategoryList,
getArticleList,
getArticleHotList,
getArticleBannerList
} from '@/api/api.js';
import home from '@/components/home';
import * as ArticleApi from '@/api/promotion/article.js';
import dayjs from "@/plugin/dayjs/dayjs.min.js";
import home from '@/components/home';
export default {
components: {
home
},
data() {
return {
imgUrls: [],
articleList: [],
indicatorDots: false,
navList: [], //
active: 0, // 0
imgUrls: [], // Banner
circular: true,
autoplay: true,
interval: 3000,
duration: 500,
navList: [],
active: 0,
page: 1,
articleList: [], //
page: 1,
limit: 8,
status: false,
scrollLeft: 0
@ -87,69 +88,89 @@
this.articleList = [];
this.getCidArticle();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getCidArticle();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getCidArticle();
},
methods: {
/**
* 获得分类
*/
getArticleCate: function() {
ArticleApi.getArticleCategoryList().then(res => {
let list = res.data;
list.unshift({
id: 0,
name: '热门'
});
this.$set(this, 'navList', list);
});
},
/**
* 获得热门文章
*/
getArticleHot: function() {
let that = this;
getArticleHotList().then(res => {
that.$set(that, 'articleList', res.data.list);
ArticleApi.getArticleList({
recommendHot: true
}).then(res => {
this.$set(this, 'articleList', res.data);
});
},
/**
* 获得 Banner 文章
*/
getArticleBanner: function() {
let that = this;
getArticleBannerList().then(res => {
that.imgUrls = res.data.list;
ArticleApi.getArticleList({
recommendBanner: true
}).then(res => {
this.imgUrls = res.data;
});
},
/**
* 获得指定分类的文章列表
*/
getCidArticle: function() {
let that = this;
if (that.active == 0) return;
let limit = that.limit;
let page = that.page;
let articleList = that.articleList;
if (that.status) return;
getArticleList(that.active, {
page: page,
limit: limit
if (this.active === 0) {
return;
}
if (this.status) {
return;
}
ArticleApi.getArticlePage({
categoryId: this.active,
pageNo: this.page,
pageSize: this.limit
}).then(res => {
let articleListNew = [];
let len = res.data.list.length;
articleListNew = articleList.concat(res.data.list);
that.page++;
that.$set(that, 'articleList', articleListNew);
that.status = limit > len;
that.page = that.page;
let articleListNew = this.articleList.concat(res.data.list);
this.page++;
this.$set(this, 'articleList', articleListNew);
this.status = this.limit > res.data.list.length;
});
},
getArticleCate: function() {
let that = this;
getArticleCategoryList().then(res => {
let list = res.data.list;
list.unshift({id:0,name:'热门'});
that.$set(that, 'navList', list);
});
},
tabSelect(active,e) {
/**
* 分类切换重新加载文章列表
*/
tabSelect(active, e) {
this.active = active;
this.scrollLeft = e * 60;
// this.scrollLeft = (active - 1) * 50;
if (this.active == 0) this.getArticleHot();
else {
if (this.active === 0) {
this.getArticleHot();
} else {
this.$set(this, 'articleList', []);
this.page = 1;
this.status = false;
this.getCidArticle();
}
}
},
formatDate: function(date) {
return dayjs(date).format("YYYY-MM-DD");
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff !important;
@ -181,7 +202,7 @@
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
margin-left: 5rpx;
}
@ -197,11 +218,11 @@
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
margin-left: 5rpx;
}
.newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
margin-bottom: -15rpx;
}