mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:53:27 +08:00
【新增】增加公告列表及公告详情页面,首页组件公告点击跳转列表展示。
This commit is contained in:
@@ -100,6 +100,13 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单接口信息
|
||||
@@ -190,6 +197,20 @@ module.exports = {
|
||||
goArticleDetail(id) {
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: id });
|
||||
},
|
||||
|
||||
/**
|
||||
* 公告接口
|
||||
*/
|
||||
|
||||
// 查看公告列表
|
||||
goNoticeList() {
|
||||
this.$u.route('/pages/notice/list/list')
|
||||
},
|
||||
// 查看公告详情
|
||||
goNoticeDetail(id) {
|
||||
this.$u.route('/pages/notice/details/details', { id: id });
|
||||
},
|
||||
|
||||
// 前往用户协议
|
||||
goUserAgreementPage() {
|
||||
var id = this.$store.state.config.userAgreementId;
|
||||
@@ -295,7 +316,7 @@ module.exports = {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工具函数
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white" v-if="count > 0">
|
||||
<u-notice-bar :text="model.text" mode="link"></u-notice-bar>
|
||||
<u-notice-bar :text="model.text" @click="goNoticeList()"></u-notice-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
},
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
@@ -19,7 +18,6 @@
|
||||
return {
|
||||
model: {
|
||||
text: "",
|
||||
url: "",
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -27,16 +25,7 @@
|
||||
var data = this.coreshopdata.parameters.list;
|
||||
if (data.length > 0) {
|
||||
this.model.text = data[0].title;
|
||||
this.model.url = '/pages/article/details/details?id=' + data[0].id + '&idType=2';
|
||||
};
|
||||
//for (var i = 0; i < data.length; i++) {
|
||||
// let moder = {
|
||||
// title: data[i].title,
|
||||
// url: '/pages/article/details/details?id=' + data[i].id + '&idType=2',
|
||||
// opentype: "navigate"
|
||||
// }
|
||||
// this.model.text.push(data[i].title);
|
||||
//}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
|
||||
@@ -94,6 +94,26 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/notice",
|
||||
"name": "notice",
|
||||
"pages": [
|
||||
{
|
||||
"path": "details/details",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "公告详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "list/list",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "公告列表"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/webview",
|
||||
"name": "webview",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
.article-title { font-size: 16px; color: #333; margin: 10px 0px; position: relative; text-align: center; }
|
||||
.article-time { margin-top: 5px; font-size: 11px; text-align: center; }
|
||||
|
||||
.u-content { margin-top: 10px; color: $u-content-color; font-size: 14px; line-height: 1.8; }
|
||||
.u-content p { color: $u-tips-color; }
|
||||
|
||||
.interlayer {
|
||||
video { width: 100%; }
|
||||
}
|
||||
107
CoreCms.Net.Uni-App/CoreShop/pages/notice/details/details.vue
Normal file
107
CoreCms.Net.Uni-App/CoreShop/pages/notice/details/details.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<!-- 页面主体 -->
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar :title="title" safeAreaInsetTop fixed placeholder>
|
||||
<view class="coreshop-navbar-left-slot" slot="left">
|
||||
<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
|
||||
<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
|
||||
<u-icon name="home" size="22" @click="goHome"></u-icon>
|
||||
</view>
|
||||
<view slot="right">
|
||||
</view>
|
||||
</u-navbar>
|
||||
|
||||
<view class="coreshop-bg-white coreshop-padding-10 coreshop-margin-10">
|
||||
<u--image width="100%" height="150px" v-if="info.coverImage" :src="info.coverImage && info.coverImage!='null' ? info.coverImage+'?x-oss-process=image/resize,m_lfit,h_320,w_240' : '/static/images/common/empty-banner.png'"></u--image>
|
||||
<view class="article-title">
|
||||
{{ info.title }}
|
||||
</view>
|
||||
<view class="article-time" v-if="info.createTime">{{ info.createTime }}</view>
|
||||
<u-line dashed></u-line>
|
||||
<view class="u-content">
|
||||
<u-parse :content="contentBody" :selectable="true"></u-parse>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
info: {},
|
||||
contentBody: '',
|
||||
shareUrl: '/pages/share/jump/jump',
|
||||
title: ''
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.id = e.id;
|
||||
this.noticeDetail();
|
||||
},
|
||||
methods: {
|
||||
noticeDetail() {
|
||||
let data = {
|
||||
id: this.id
|
||||
};
|
||||
this.$u.api.noticeInfo(data).then(res => {
|
||||
if (res.status) {
|
||||
this.info = res.data;
|
||||
this.contentBody = res.data.contentBody;
|
||||
this.title = this.info.title;
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取分享URL
|
||||
getShareUrl() {
|
||||
let data = {
|
||||
client: 2,
|
||||
url: "/pages/share/jump/jump",
|
||||
type: 1,
|
||||
page: 5,
|
||||
params: {
|
||||
noticeId: this.id,
|
||||
}
|
||||
};
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken && userToken != '') {
|
||||
data['token'] = userToken;
|
||||
}
|
||||
this.$u.api.share(data).then(res => {
|
||||
this.shareUrl = res.data
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
id: {
|
||||
handler() {
|
||||
this.getShareUrl();
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
//分享
|
||||
onShareAppMessage(res) {
|
||||
return {
|
||||
title: this.info.title,
|
||||
path: this.shareUrl
|
||||
}
|
||||
},
|
||||
onShareTimeline(res) {
|
||||
return {
|
||||
title: this.info.title,
|
||||
path: this.shareUrl
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "details.scss";
|
||||
</style>
|
||||
99
CoreCms.Net.Uni-App/CoreShop/pages/notice/list/list.vue
Normal file
99
CoreCms.Net.Uni-App/CoreShop/pages/notice/list/list.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar title="公告中心" safeAreaInsetTop fixed placeholder>
|
||||
<view class="coreshop-navbar-left-slot" slot="left">
|
||||
<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
|
||||
<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
|
||||
<u-icon name="home" size="22" @click="goHome"></u-icon>
|
||||
</view>
|
||||
<view slot="right">
|
||||
</view>
|
||||
</u-navbar>
|
||||
<block v-if="list.length > 0">
|
||||
<view class="coreshop-bg-white coreshop-margin-10">
|
||||
<view class="coreshop-flex coreshop-solid-bottom coreshop-justify-between coreshop-flex-nowrap coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-10 coreshop-padding-right-10" v-for="item in list" :key="item.id" @click="goNoticeDetail(item.id)">
|
||||
<view class="coreshop-flex coreshop-flex-nowrap">
|
||||
<u--image width="25px" height="25px" :src="item.coverImage" mode="aspectFill" :showLoading="true"></u--image>
|
||||
<view class="u-line-2 coreshop-padding-left-5 coreshop-font-14">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="coreshop-text-gray coreshop-text-right coreshop-justify-end">
|
||||
<u-icon name="arrow-right-double"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="0" margin-bottom="20" class="coreshop-padding-top-10" />
|
||||
</view>
|
||||
</block>
|
||||
<!-- 无数据时默认显示 -->
|
||||
<view class="coreshop-emptybox" v-else>
|
||||
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="暂无数据" mode="list"></u-empty>
|
||||
</view>
|
||||
<!-- 登录提示 -->
|
||||
<coreshop-login-modal></coreshop-login-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
list: [],
|
||||
status: 'loadmore',
|
||||
iconType: 'flower',
|
||||
loadText: {
|
||||
loadmore: '轻轻上拉',
|
||||
loading: '努力加载中',
|
||||
nomore: '实在没有了'
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.noticeList();
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.status === 'loadmore') {
|
||||
this.noticeList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
noticeList() {
|
||||
let data = {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
};
|
||||
this.status = 'loading';
|
||||
this.$u.api.notice(data).then(res => {
|
||||
if (res.status) {
|
||||
if (res.data.length > 0) {
|
||||
const _list = res.data;
|
||||
this.list = [...this.list, ..._list];
|
||||
if (res.data.count > this.list.length) {
|
||||
this.status = 'loadmore';
|
||||
this.page++;
|
||||
} else {
|
||||
// 数据已加载完毕
|
||||
this.status = 'nomore';
|
||||
}
|
||||
} else {
|
||||
// 数据已加载完毕
|
||||
this.status = 'nomore';
|
||||
}
|
||||
|
||||
} else {
|
||||
// 接口请求出错了
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user