Skip to content

Commit

Permalink
jeewx-app-cms 1.1 | 小程序CMS发布
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Oct 9, 2018
1 parent 73c4d0c commit 7f23998
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 62 deletions.
1 change: 1 addition & 0 deletions .wepycache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\wepy.js":1526826186259,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy-async-function\\index.js":1526826230638,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\promise-polyfill\\promise.js":1526826232248,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\app.js":1526826186212,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\page.js":1526826186243,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\component.js":1526826186228,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\event.js":1526826186228,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\base.js":1526826186212,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\util.js":1526826186243,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\mixin.js":1526826186228,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy-async-function\\global.js":1526826230248,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\regenerator-runtime\\runtime.js":1526826231280,"D:\\workspace-wxapp\\jeewx-app-cms\\node_modules\\wepy\\lib\\native.js":1526826186243}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"wepy-compiler-babel": "^1.5.1",
"wepy-compiler-less": "^1.3.10",
"wepy-eslint": "^1.5.2",
"wepy-plugin-imagemin": "^1.5.3",
"wepy-plugin-uglifyjs": "^1.3.7"
}
}
2 changes: 1 addition & 1 deletion src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from '../utils/wxRequest';

let env = "-test" //-dev 或者 -test
const domain = 'https://app.jeewx.com/p3'
const domain = 'https://app.h5huodong.com'
//const domain = 'http://localhost/jeecg-p3-web'
//定义广告位全局变量,用于页面获取
const apiAdUpload = domain + '/upload/img/cms/'
Expand Down
8 changes: 4 additions & 4 deletions src/app.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default class extends wepy.app {
config = {
pages: [
'pages/index',
'pages/article',
'pages/theme',
'pages/articleList',
'pages/article',
'pages/contact'
],
window: {
Expand All @@ -36,8 +36,8 @@ export default class extends wepy.app {
backgroundColor: '#ffffff',
list: [{
pagePath: 'pages/index',
iconPath: 'img/icon_API.png',
selectedIconPath: 'img/icon_API_HL.png',
iconPath: 'img/home.png',
selectedIconPath: 'img/home_HL.png',
text: '主页'
}, {
pagePath: 'pages/theme',
Expand All @@ -47,7 +47,7 @@ export default class extends wepy.app {
}, {
pagePath: 'pages/contact',
iconPath: 'img/contact.png',
selectedIconPath: 'img/contact_selected.png',
selectedIconPath: 'img/contact_HL.png',
text: '联系我们'
}]
}
Expand Down
76 changes: 62 additions & 14 deletions src/components/tab.wpy
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<template lang="wxml">
<view class="tab">
<repeat for="{{menu}}" key="index" index="index" item="item">
<block wx:if="{{item.type=='coulmn'}}">
<view class="tab_item{{active == item.id ? ' active' : ''}}" @tap="changePage({{item.id}})"><text class="title">{{item.name}}</text></view>
</block>
<block wx:if="{{item.type=='link'}}">
<view class="tab_item{{active == item.id ? ' active' : ''}}" @tap="goToMenu({{item.href}})"><text class="title">{{item.name}}</text></view>
</block>
</repeat>
</view>
<view style="margin-top:8px;">
<repeat for="{{array}}" key="index" index="index" item="item">
<view class="news-item" @tap="toArticlesContent({{item.id}})">
<view class="news-item-left">
<view class="news-item-title"><text >{{item.title}}</text></view>
<view class="news-item-content"><text>{{item.summary}}</text></view>
<image class="news-image" style="width:73px;height:73px" mode="aspectFit" src="{{linkUpload}}{{item.imageHref}}"></image>
</view>
<view class="news-item-right">
<image class="news-image" style="width:73px;height:73px;" src="{{linkUpload}}{{item.imageHref}}"></image>
<view class="news-item-title"><text >{{item.title}}</text></view>
<view class="news-item-content"><text>{{item.summary}}</text></view>
</view>
</view>
</repeat>
Expand All @@ -34,17 +39,49 @@
data = {
array: [],
menu: [],
linkUpload: ''
linkUpload: '',
pageSize:6,
pageNo:1,
loadFlag:true
};

async loadArticle(){
var col_id = this.active;
var pageNumber = this.pageNo;
if(!this.loadFlag){
console.log('无数据');
}else{
const arrayJson = await api.getArticlesList({
query: {
columnId: col_id,
pageNumber: pageNumber
}
});
if (arrayJson.data.success == true) {
this.pageNo = this.pageNo + 1;
var queryArray = arrayJson.data.obj.list.results;
if(queryArray.length<=0){
this.loadFlag = false;
}
this.array = this.array.concat(queryArray);
} else {
tip.error(arrayJson.data.msg);
}
this.$apply();
}
};
methods = {
changePage: async function (columnId) {
this.active = columnId
this.active = columnId;
this.pageNo = 1;
this.loadFlag = true;
const arrayJson = await api.getArticlesList({
query: {
columnId: columnId
}
})
if (arrayJson.data.success == true) {
this.pageNo = 2;
this.array = arrayJson.data.obj.list.results
} else {
tip.error(arrayJson.data.msg)
Expand All @@ -55,7 +92,16 @@
wx.navigateTo({
url: 'article?articlesId=' + articlesId
});
}
},
goToMenu(url) {
console.log("url===" + url);
if (url.length == 0) {
return;
}
wepy.navigateTo({
url: url
})
}
};
events = {};

Expand All @@ -75,6 +121,7 @@
}
});
if (arrayJson.data.success == true) {
this.pageNo = this.pageNo + 1;
this.array = arrayJson.data.obj.list.results;
} else {
tip.error(arrayJson.data.msg);
Expand All @@ -93,18 +140,21 @@
background-color: #f7f7f7;
font-size: 14px;
white-space: nowrap;
display:flex;
.tab_item {
&.active {
color: #13b113;
height: 30px;
}
display: inline-block;
width: 20%;
display: flex;
width: 100%;
text-align: center;
}
.title {
padding-top: 10px;
display: block;
/* padding-top: 10px;
display: block; */
line-height:45px;
flex:1;
}
}

Expand Down Expand Up @@ -134,14 +184,12 @@
}

.news-item-right {
width: 80px;
height: 80px;
position: absolute;
overflow:hidden
}
.news-item-left {
width: 80px;
height: 80px;
margin-left: 175rpx;
float:left
}
.news-image {
width: 80px;
Expand Down
Binary file modified src/img/contact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/contact_HL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/home_HL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 22 additions & 3 deletions src/pages/article.wpy
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template lang="wxml">
<import src="../wxParse/wxParse.wxml"/>
<view class="art-header" style="display:display">
<view class="art-header" style="display:display;overflow-x:hidden;">
<image class="art-img" src="{{imageHref}}"></image>
<!--<view class="art-title">{{articles.title}}</view>-->
</view>
<view class="wxParse-p big_images">
<view class="wxParse-p big_images" style="overflow-x:hidden;">
<!--<rich-text class="art-content" nodes="{{articles.content}}" ></rich-text>-->
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>
Expand Down Expand Up @@ -33,7 +33,25 @@
detail: {},
imageHref :''
};
methods = {};
methods = {
onShareAppMessage(res){
var that = this;
if (res.from === 'button') {
console.log("来自页面内转发按钮");
console.log(res.target);
}
return {
title: that.detail.title,
path: 'pages/article?articlesId='+ that.articlesId,
success: function(res){
console.log("转发成功", res);
},
fail: function(res){
console.log("转发失败", res);
}
}
}
};

events = {};

Expand Down Expand Up @@ -67,6 +85,7 @@
console.log(that.imageHref);
console.log(that.domain);
WxParse.wxParse('article', 'html', that.detail.content, this);
that.$apply();
} else {
tip.error(articlesJson.data.msg);
}
Expand Down
95 changes: 60 additions & 35 deletions src/pages/articleList.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
<view class="news-item-container">
<repeat for="{{atricles}}" key="index" index="index" item="item">
<view class="news-item" @tap="toArticlesInfo({{item.id}})">
<view class="news-item-left"><text class="news-item-title">{{item.title}}</text></view>
<view class="news-item-right"><image class="news-image" src="{{domain + item.imageHref}}"></image></view>
<view class="news-item-left">
<image class="news-image" style="width:73px;height:73px;" src="{{domain + item.imageHref}}"></image>
</view>
<view class="news-item-right">
<view class="news-item-title"><text >{{item.title}}</text></view>
<view class="news-item-content"><text>{{item.summary}}</text></view>
</view>
</view>
</repeat>
</view>
Expand Down Expand Up @@ -115,41 +120,61 @@

<style lang="less">
.news-item-container {
background-color: #f2f2f2;
width: 100%;
padding-left: 8px;
padding-right: 8px;
}

.news-item {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-left: 8px;
padding-top: 8px;
padding-right: 8px;
padding-bottom: 8px;
margin-left: 8px;
margin-right: 8px;
margin-top: 8px;
background-color: #fff;
border: 1px solid #eaeaea;
border-bottom: 1px solid #d0d0d0;
border-radius: 5px;
}
background-color: #f2f2f2;
width: 100%;
padding-left: 8px;
padding-right: 8px;
}

.news-item-right {
width: 80px;
height: 80px;
}
.news-item {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-left: 8px;
padding-top: 8px;
padding-right: 8px;
padding-bottom: 8px;
margin-left: 8px;
margin-right: 8px;
margin-top: 8px;
background-color: #fff;
border: 1px solid #eaeaea;
border-bottom: 1px solid #d0d0d0;
border-radius: 5px;
position: relative;
}

.news-image {
width: 80px;
height: 80px;
}
.news-item-right {
overflow:hidden
}
.news-item-left {
width: 80px;
height: 80px;
float:left
}
.news-image {
width: 80px;
height: 80px;
}

.news-item-title {
font-size: 16px;
}
.news-item-title {
word-break:keep-all;
white-space:nowrap;
width: 500rpx;
height: 50rpx;
font-size:11pt;
overflow:hidden;
text-overflow:ellipsis;
}
.news-item-content {
font-size: 8pt;
width: 500rpx;
height:101rpx;
overflow:hidden;
text-overflow:ellipsis;
mergin-top:-30rpx;
color:#a9a9a9;
line-height:35rpx;
}

</style>
Loading

0 comments on commit 7f23998

Please sign in to comment.