dever 2 years ago
parent
commit
9f80bc3da1

+ 3 - 1
lib/dever/components/publish.vue

@@ -156,8 +156,10 @@
 
 			.next-title {
 				width: 100%;
-				font-size: 36rpx;
+				/*font-size: 36rpx;*/
 				color: var(--mainColor);
+				text-align: left;
+				margin-left: 60rpx;
 			}
 
 			.font-red {

+ 7 - 0
main.js

@@ -57,6 +57,13 @@ Vue.prototype.Dever.setPostLoading(function(self) {
 }, function(self) {
 	self.btnFinish();
 	uni.hideLoading();
+});
+//自定义page的loading效果,设置全屏loading
+Vue.prototype.Dever.setPageLoading(function(self) {
+	self.vue.prototype.pageLoading = true;
+}, function(self) {
+	self.vue.prototype.pageLoading = false;
+	self.btnFinish();
 });
 
 //设置switchTab

+ 12 - 0
pages.json

@@ -32,6 +32,17 @@
 				}
 			}
 		},
+		{
+			"path": "pages/index/news_view",
+			"style": {
+				"app-plus": {
+					"titleNView": false,
+					"bounce": "none",
+					"navigationStyle": "custom",
+					"scrollIndicator":"none"
+				}
+			}
+		},
 		{
 			"path": "pages/index/my",
 			"style": {
@@ -46,6 +57,7 @@
 		{
 			"path": "pages/index/msg",
 			"style": {
+				"disableScroll" : true,
 				"app-plus": {
 					"titleNView": false,
 					"bounce": "none",

+ 4 - 1
pages/dream/view.vue

@@ -373,7 +373,10 @@ export default{
 }
 </script>
 <style>
-@import '@/static/dreamland/css/core.css';
+@import '@/static/dreamland/css/core.css';
+view {
+	box-sizing: border-box;
+}
 .container {
   position: absolute;
   height: 100%;

+ 2 - 2
pages/dream/view/cover.vue

@@ -1,6 +1,6 @@
 <template name="cover">
-	<view slot="gBody" class="grace-body">
-		
+	<view class="gui-padding">
+
 		<view class="grace-title grace-margin-top">
 			<text class="grace-title-icon grace-icons icon-article grace-blue"></text>
 			<text class="grace-title-text grace-black">{{item.parent_name}}</text>

+ 3 - 1
pages/dream/view/moment.vue

@@ -96,7 +96,9 @@
 </script>
 
 <style scoped>
-	
+view {
+	box-sizing: border-box;
+}
 .header {
 	width: 100%;
 	height: 100%;

+ 6 - 35
pages/dream/view/news.vue

@@ -1,25 +1,12 @@
 <template name="news">
-	<view slot="gBody" class="grace-body">
-		<!-- 标题 -->
-		<text :class="['grace-art-margin', 'grace-art-title', graceSkeleton  ? 'grace-skeletons' : '']">{{item.name}}</text>
-		<!-- 作者信息 -->
-		<view class="grace-art-margin grace-nowrap grace-flex-vcenter" v-if="info">
-			<view :class="['grace-art-author','grace-nowrap','grace-flex-vcenter', graceSkeleton ? 'grace-skeletons' : '']">
-				<image class="grace-art-author-face" :src="item.author.avatar" mode="widthFix"></image>
-				<text v-if="item.author.name" class="grace-art-author-name">{{item.author.name}}</text>
+	<gui-page>
+		<view slot="gBody" class="gui-margin">
+			<view class="gui-margin gui-margin-top" style="text-align: center;">
+				<text class="gui-h5 gui-color-gray gui-bold">{{item.name}}</text>
 			</view>
-			<text class="grace-art-btn grace-bg-green">+ 关注</text>
+			<dever-content :item="item.content_array" :pics="item.content_pic"></dever-content>
 		</view>
-		<!-- 其他基本信息 -->
-		<view :class="['grace-art-info-line','grace-art-margin','grace-space-between', graceSkeleton ? 'grace-skeletons' : '']"  v-if="info">
-			<text class="grace-art-info-line-text grace-icons icon-eye" v-if="item.num_view"><text style="margin-left:2px">{{item.num_view}}</text></text>
-			<text class="grace-art-info-line-text" v-if="item.date">发布于 : {{item.date}}</text>
-		</view>
-		<!-- 文章内容 -->
-		<view class="grace-art-contents">
-			<dever-content :item="item.content_array" :pics="item.content_pic" :skeleton="graceSkeleton"></dever-content>
-		</view>
-	</view>
+	</gui-page>
 </template>
 
 <script>
@@ -51,19 +38,3 @@ export default {
 	}
 }
 </script>
-
-<style>
-.grace-art-margin{margin-top:20rpx;}
-.grace-art-title{display:block; width:100%; font-size:38rpx; font-weight:bold; line-height:56rpx;}
-.grace-skeletons{background-color:#F8F8F8; border-radius:8rpx; height:60rpx;}
-.grace-skeletons-img{width:100%; background-color:#F8F8F8; height:300rpx; border-radius:8rpx;}
-.grace-art-author{width:700rpx; font-size:0;}
-.grace-art-author-face{width:66rpx; height:66rpx; border-radius:66rpx; margin-right:20rpx; flex-shrink:0;}
-.grace-art-author-name{display:block; line-height:80rpx; font-size:26rpx;}
-.grace-art-btn{width:120rpx; line-height:60rpx; text-align:center; border-radius:50rpx; font-size:26rpx; display:block; flex-shrink:0; margin-left:30rpx;}
-.grace-art-info-line{}
-.grace-art-info-line-text{font-size:22rpx; line-height:50rpx; color:#888888;}
-.grace-art-contents{padding:20rpx 0;}
-.grace-art-img{width:100%; margin:10rpx 0;}
-.grace-art-content{line-height:52rpx; font-size:28rpx;}
-</style>

+ 3 - 3
pages/dream/view/product.vue

@@ -109,7 +109,7 @@
 							</view>
 							<view class="grace-capsule margin" v-if="(item.goods.mode == 2 || item.goods.mode == 3) && mode == 2">
 								<text class="grace-capsule-icon grace-icon-br" style="background:#E76B61;">自提</text>
-								<picker @change="storeChange" :value="store_index" :range="store_data" v-if="store_state">
+								<picker @change="storeChange" :value="store_index" :range="store_data" v-if="store_state" style="z-index:10000">
 									<text class="picker grace-capsule-text grace-text-br" style="border-color:#E76B61; color:#E76B61;">
 										{{store_data[store_index]}}
 									</text>
@@ -571,7 +571,7 @@ export default {
 .grace-capsule-icon {
 	white-space: nowrap;
 	line-height: 34rpx;
-	height:54rpx;
+	/*height:54rpx;*/
 	text-overflow: ellipsis;
 	display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
 	-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
@@ -581,7 +581,7 @@ export default {
 .grace-capsule-text {
 	line-height : 34rpx;
 	overflow: hidden;
-	height:54rpx;
+	/*height:54rpx;*/
 	text-overflow: ellipsis;
     word-break: break-all;
 	display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/

+ 17 - 8
pages/index/list.vue

@@ -3,13 +3,19 @@
 	:footerSets="{height:150, zIndex:100, bg:'none'}" :isLoading="pageLoading">
 		<!-- 页面主体 -->
 		<view slot="gBody">
-			<view class="gui-flex gui-rows gui-justify-content-center gui-margin-top">
-				<view style="width:500rpx;">
-					<gui-segmented-control :items="cate" :current="0" borderRadius="50rpx" @change="menu"></gui-segmented-control>
+			<block v-if="state == 1">
+				<view class="gui-margin-top">
+					<gui-swiper :swiperItems="fetch.focus" 
+					:width="750" :height="330" @taped="taped"></gui-swiper>
+				</view>
+						
+				<view class="gui-flex gui-rows gui-justify-content-center gui-margin-top">
+					<view style="width:500rpx;">
+						<gui-segmented-control :items="cate" :current="0" borderRadius="50rpx" @change="menu"></gui-segmented-control>
+					</view>
 				</view>
-			</view>
 			
-			<block v-if="state == 1">
+			
 				<view class="gui-grids gui-flex gui-rows gui-wrap gui-margin-top gui-bg-gray menu">
 					<gui-switch-navigation :items="fetch.cate" :currentIndex="nav_index" @change="nav"  activeDirection="center" textAlign="center" :margins="20" paddings="30rpx" activeLineHeight="4rpx" lineHeights="72rpx" activeLineWidth="100rpx" activeLineBg="linear-gradient(to right, #008AFF,#008AFF)" ></gui-switch-navigation>
 				</view>
@@ -49,11 +55,11 @@ export default {
 	data() {
 		return {
 			foot_value : 2,
-			state : 0,
+			state : 2,
 			fetch : {
 				cate : [],
 				info : [],
-				hot : [],
+				focus : [],
 			},
 			cate : ["全部", "我的"],
 			cate_index: 0,//默认分类
@@ -77,7 +83,7 @@ export default {
 	},
 	//下拉加载
 	onReachBottom() {
-		this.getData(1, false);
+		this.getData(2, false);
 	},
 	
 	methods: {
@@ -117,6 +123,9 @@ export default {
 		nav : function(e) {
 			this.nav_index = e;
 			this.getData(1, e);
+		},
+		taped : function(e){
+			this.Dever.location(this.fetch.focus[e].link, 'webview', this.fetch.focus[e].name);
 		}
 	}
 };

+ 91 - 93
pages/index/msg.vue

@@ -1,118 +1,116 @@
 <template>
 	<gui-page :fullPage="true" :isLoading="pageLoading" ref="guiPage" :footerSets="{height:150, zIndex:100, bg:'none'}" :customFooter="true">
 		<view slot="gBody" class="gui-flex1">
-			<view class="gui-margin gui-margin-top">
-				<text class="gui-h5 gui-color-gray gui-bold">消息列表</text>
-			</view>
-			<view class="gui-margin-top">
-				<gui-slide-list :msgs="msgs" @itemTap="itemTap" :height="mainHeight" @btnTap="btnTap"></gui-slide-list>
+			<view>
+				<view class="gui-margin gui-margin-top">
+					<text class="gui-h5 gui-color-gray gui-bold">消息列表</text>
+				</view>
+				<view class="my-list" v-if="fetch.msg.length > 0">
+					<view class="gui-list-items" v-for="(v, k) in fetch.msg" :key="k" @click="view(v)">
+						<block v-if="v.type == 1">
+							<text class="gui-list-icon gui-icons gui-color-blue">&#xe666;</text>
+							<view class="gui-list-body gui-border-b">
+								<view class="gui-list-title">
+									<text class="gui-list-title-text gui-primary-color gui-list-one-line gui-ellipsis" 
+									style="width:320rpx; height:60rpx;">{{v.name}}</text>
+								</view>
+							</view>
+							<text class="gui-list-arrow-right gui-icons gui-color-gray-light">&#xe601;</text>
+						</block>
+						<block v-if="v.type > 1">
+							<view class="gui-list-image gui-relative">
+								<image class="gui-list-image" 
+								:src="v.avatar"></image>
+								<view class="gui-badge-point" style="display: none;"></view>
+							</view>
+							<view class="gui-list-body gui-border-b">
+								<view class="gui-list-title">
+									<text class="gui-list-title-text gui-primary-color">{{v.name}}</text>
+									<text class="gui-list-title-desc gui-color-gray">{{v.date}}</text>
+								</view>
+								<text class="gui-list-body-desc gui-color-gray">{{v.content}}</text>
+							</view>
+							<text class="gui-list-arrow-right gui-icons gui-color-gray-light">&#xe601;</text>
+						</block>
+					</view>
+				</view>
+				<gui-empty v-if="fetch.msg.length <= 0">
+					<view slot="img" class="gui-flex gui-rows gui-justify-content-center">
+						<image class="gui-empty-img" src="@/static/dreamland/img/kong.png"></image>
+					</view>
+					<text slot="text" 
+					class="gui-text-small gui-block-text gui-text-center gui-margin-top" style="color:#9DABFF;">您还没有消息</text>
+				</gui-empty>
+				
+				<gui-modal ref="alert" 
+						:title="title" :isTitle="true">
+					<view slot="content" class="gui-padding gui-bg-gray">
+						<text class="gui-block-text gui-text-center gui-text gui-color-gray" 
+						style="line-height:100rpx; padding:10rpx;">{{content}}</text>
+					</view>
+					<!-- 利用 flex 布局 可以放置多个自定义按钮哦  -->
+					<view slot="btns" class="gui-flex gui-rows gui-space-between">
+						<view class="modal-btns gui-flex1">
+							<text class="modal-btns gui-color-blue" @tap="close">确认</text>
+						</view>
+					</view>
+				</gui-modal>
 			</view>
 		</view>
 		<foot ref="foot" slot="gFooter" :value="foot_value"></foot>
 	</gui-page>
 </template>
-<script>
-// 模拟个 api 请求的数据
-var msgsFromApi = [
-	{
-		img       : 'https://cmsuse.oss-cn-beijing.aliyuncs.com/g5/15.png',
-		msgnumber : 8,
-		title     : "某某某",
-		time      : "30分钟前",
-		content   : "消息内容 ..."
-	},
-	{
-		img       : 'https://cmsuse.oss-cn-beijing.aliyuncs.com/g5/13.png',
-		msgnumber : 0,
-		title     : "某某某",
-		time      : "08/10/2020",
-		content   : "语音消息"
-	},
-	{
-		img       : 'https://cmsuse.oss-cn-beijing.aliyuncs.com/g5/11.png',
-		msgnumber : 12,
-		title     : "某某某",
-		time      : "昨天",
-		content   : "图片消息"
-	},
-	{
-		img       : 'https://cmsuse.oss-cn-beijing.aliyuncs.com/g5/12.png',
-		msgnumber : 1,
-		title     : "某某某",
-		time      : "08/08/2020",
-		content   : "系统消息"
-	}
-];
-var graceJS = require('@/lib/GraceUI5/js/grace.js');
+<script>
 import foot from '@/pages/index/foot.vue';
 export default {
 	data() {
 		return {
-			foot_value : 3,
-			msgs         : [],
-			// 核心区域高度 
-			mainHeight   : 200,
-			pageLoading  : true
+			foot_value : 3,
+			fetch : {
+				msg : [],
+			},
+			title : '',
+			content : '',
 		}
 	},
 	components:{
 		foot
 	},
-	onLoad:function(){
-		// 01. 获取页面主体高度
-		graceJS.getRefs('guiPage', this, 0, (ref)=>{
-			ref.getDomSize('guiPageBody', (e)=>{
-				// 消息主体高度 = 页面高度 - 其他页面元素高度
-				this.mainHeight  = e.height - uni.upx2px(120);
-				this.pageLoading = false;
-			});
-		});
-		
-		// 模拟 api 请求,因为请求数据里没有按钮信息我们利用js进行按钮补充
-		setTimeout(() => {
-			for(let i = 0; i < msgsFromApi.length; i++){
-				// 具体几个按钮及按钮文本根据项目需求来,格式 {name:按钮文本, bgColor:按钮背景色}
-				msgsFromApi[i].btns = [{'name':'标为已读', bgColor:'#323232'}, {'name':'删除消息', bgColor:'#FF0036'}];
-			}
-			this.msgs = msgsFromApi;
-		}, 500);
+	onLoad() {
+		this.getData(1);
+	},
+	onShow() {
+		this.$nextTick(function() {
+			this.$refs.foot.cur = this.foot_value;
+		});
+	},
+	// 重新加载
+	onPullDownRefresh: function() {
+		this.getData(1);
+	},
+	//下拉加载
+	onReachBottom() {
+		this.getData(2);
 	},
 	methods:{
-		btnTap : function(index, btnIndex){
-			console.log(index, btnIndex);
-			// 第一个按钮被点击 [ 标记已读 ]
-			if(btnIndex == 0){
-				if(this.msgs[index].btns[0].name == '标为已读'){
-					this.msgs[index].btns = [{'name':'标为未读', bgColor:'#888888'}, {'name':'删除消息', bgColor:'#FF0036'}];
-					this.msgs[index].msgnumber = 0;
-				}else{
-					this.msgs[index].btns = [{'name':'标为已读', bgColor:'#323232'}, {'name':'删除消息', bgColor:'#FF0036'}];
-					this.msgs[index].msgnumber = 1;
-				}
-				setTimeout(()=>{this.msgs.splice(index, 1, this.msgs[index]);}, 300);
-			}
-			// 第二个按钮被打开 [ 删除消息 ]
-			else if(btnIndex == 1){
-				uni.showModal({
-					title:"确定要删除吗?",
-					success: (e) => {
-						if(e.confirm){this.msgs.splice(index, 1);}
-					}
-				});
-			}
+		getData : function(page) {
+			var self = this;
+			var data = {};
+			data.id = -1;
+			this.Dever.page([page, 'msg'], this, 'app/collection/?l=api.msg', data);
+		},
+		view : function(v) {
+			this.title = v.name;
+			this.content = v.content;
+			this.$refs.alert.open();
+		},
+		close : function () {
+			this.$refs.alert.close();
 		},
-		// 列表本身被点击
-		itemTap : function (e) {
-			console.log(e);
-			uni.showToast({title:"索引"+e});
-		}
 	}
 }
 </script>
 <style>
-.gui-slide-list-img-wrap{width:80rpx; height:80rpx; margin-left:25rpx;} /* 列表图片外层样式 */
-.gui-slide-list-img{width:80rpx; height:80rpx; border-radius:6rpx;} /* 列表图片外层样式 */
-.gui-slide-list-point{border-radius:32rpx; height:32rpx; line-height:32rpx; padding:0 10rpx; font-size:20rpx;} /* 消息数标签样式 */
-.gui-slide-list-title-text{line-height:38rpx; height:38rpx; font-size:28rpx; color:#2B2E3D; overflow:hidden;} /* 消息标题样式 */
-.gui-slide-list-desc{line-height:32rpx; height:32rpx; font-size:22rpx; color:rgba(69, 90, 100, 0.3); overflow:hidden; margin-right:25rpx; margin-top:2px;} /* 消息描述样式 */
+.my-list{margin:30rpx 0; padding:0 30rpx;}
+.modal-btns{line-height:88rpx; font-size:26rpx; text-align:center; width:200rpx;}
 </style>

+ 12 - 9
pages/index/my.vue

@@ -2,8 +2,8 @@
 	<gui-page :customFooter="true" iphoneXButtomStyle="background:#F8F8F8"
 	:footerSets="{height:150, zIndex:100, bg:'none'}" :isLoading="pageLoading">
 		<view slot="gBody">
-			<view class="gui-margin-top-large gui-padding">
-				<text class="gui-h4 gui-bold gui-color-gray">个人中心</text>
+			<view class="gui-margin gui-margin-top">
+				<text class="gui-h5 gui-color-gray gui-bold">个人中心</text>
 			</view>
 			<view hover-class="gui-tap" @click="login" v-if="fetch.user.id <= 0">
 				<text class="gui-text-center gui-block-text gui-icons logoff gui-color-gray">&#xe629; 点此登录</text>
@@ -12,16 +12,19 @@
 				<view class="gui-list-items">
 					<view class="gui-list-image ucenter-face gui-relative">
 						<image class="gui-list-image ucenter-face-image" 
-						:src="fetch.user.avatar" mode="widthFix"></image>
+						:src="fetch.user.avatar" mode="widthFix"></image>
+						<text class="gui-bg-blue gui-badge-gender gui-color-white gui-icons" v-if="fetch.user.sex == 1">&#xe618;</text>
+						<text class="gui-bg-red gui-badge-gender gui-color-white gui-icons" v-if="fetch.user.sex == 2">&#xe619;</text>
+						<text class="gui-bg-green gui-badge-gender gui-color-white gui-icons" v-if="fetch.user.sex == 3">&#xe628;</text>
 					</view>
 					<view class="gui-list-body">
 						<view class="gui-list-title">
-							<text class="gui-list-title-text gui-primary-color">{{fetch.user.username}}
+							<view class="gui-list-title-text gui-primary-color">{{fetch.user.username}}
 							<text v-if="fetch.user.title">({{fetch.user.title}})</text>
-							</text>
+							</view>
 						</view>
-						<text class="gui-list-body-desc gui-color-gray gui-block-text"><view v-if="fetch.user.info">{{fetch.user.info}}</view>
-						<view v-if="!fetch.user.info">暂无签名</view></text>
+						<view class="gui-list-body-desc gui-color-gray gui-block-text"><view v-if="fetch.user.info">{{fetch.user.info}}</view>
+						<view v-if="!fetch.user.info">暂无签名</view></view>
 					</view>
 					<text class="gui-list-arrow-right gui-icons gui-color-gray">&#xe601;</text>
 				</view>
@@ -161,7 +164,7 @@ export default {
 			this.Dever.get(this, 'app/collection/?l=api.my', {id:-1});
 		},
 		login : function() {
-			this.Dever.location('user/login');
+			this.Dever.checkLogin();
 		},
 		
 		user : function() {
@@ -172,7 +175,7 @@ export default {
 			this.Dever.setToken('');
 			var self = this;
 			this.Dever.alert('已退出', 'none', function() {
-				self.Dever.location('index/index');
+				self.Dever.location('index/my');
 			});
 		},
 		goView : function(key, name) {

+ 74 - 58
pages/index/news.vue

@@ -1,12 +1,15 @@
 <template>
 <gui-page :fullPage="true" ref="guiPage" :customFooter="true" :isLoading="pageLoading" iphoneXButtomStyle="background:#F8F8F8" :footerSets="{height:150, zIndex:100, bg:'none'}">
-	<view slot="gBody" class="gui-flex1" style="background-color:#F8F8F8;">
+	<view slot="gBody" class="gui-flex1" style="background-color:#F8F8F8;">
+		<view class="gui-margin-top gui-bg-gray search-warp gui-border-box" style="display: none;">
+			<gui-search @inputting="inputting" @confirm="confirm"></gui-search>
+		</view>
 		<!-- 分类导航 -->
 		<view class="header gui-border-b gui-border-box gui-flex gui-columns gui-justify-content-center" 
 		id="myheader">
 			<gui-switch-navigation :size="150" 
 			 activeLineBg="linear-gradient(to right, #008AFF,#008AFF)"
-			:items="navItems" @change="navchange"></gui-switch-navigation>
+			:items="fetch.cate" @change="navchange"></gui-switch-navigation>
 		</view>
 		<!-- 滚动区域高度 = gBody - 自定义区域高度 -->
 		<scroll-view :scroll-y="true" :show-scrollbar="false" 
@@ -27,28 +30,24 @@
 </gui-page>
 </template>
 <script>
-var graceJs = require('@/lib/GraceUI5/js/grace.js');
-// 模拟 api 请求数据,格式见 article.js
-var artciles = require('@/lib/GraceUI5/demoData/article.js');
+var graceJs = require('@/lib/GraceUI5/js/grace.js');
 import foot from '@/pages/index/foot.vue';
 export default {
 	data() {
 		return {
-			foot_value : 1,
+			foot_value : 1,
+			fetch : {
+				cate : [],
+				info : [],
+			},
 			// 主体高度
 			mainHeight    : 200,
 			// 滚动区域滚动距离
 			scrollTop     : 0,
 			// 加载更多延迟
 			loadMoreTimer : null,
-			// 分类
-			navItems      : [
-				{id:1, name:'分类1'},{id:2, name:'分类2'},
-				{id:3, name:'分类3'},{id:4, name:'分类4'},
-				{id:5, name:'分类5'},{id:6, name:'分类6'}
-			],
 			// 当前展示的分类索引
-			currentIndex  : 0,
+			cate_index  : 0,
 			// 新闻列表数据, 分类切换重新获取第一页
 			newsList      : [],
 			// 页码
@@ -60,10 +59,11 @@ export default {
 	},
 	onShow() {
 		this.$nextTick(function() {
-			//this.$refs.foot.cur = this.foot_value;
+			this.$refs.foot.cur = this.foot_value;
 		});
 	},
-	onLoad:function(){
+	onLoad:function(){
+		this.getInfo();
 		// 01. 获取页面主体高度
 		graceJs.getRefs('guiPage', this, 0, (ref)=>{
 			ref.getDomSize('guiPageBody', (e)=>{
@@ -72,56 +72,59 @@ export default {
 					// 如果自定义区域有 margin 尺寸获取不到请加上这个值,可以利用 uni.upx2px() 转换
 					this.mainHeight  = e.height - e2.height;
 					// 第一次加载数据
-					this.getNews();
+					this.getData();
 				});
 			});
 		});
+	},
+	// 重新加载
+	onPullDownRefresh: function() {
+		this.getInfo();
 	},
 	methods : {
 		navchange:function(index){
 			// 刷新当前分类对应的数据
-			if(this.currentIndex != index){
+			if(this.cate_index != index){
 				this.page = 1;
-				this.currentIndex = index;
-				this.getNews();
+				this.cate_index = index;
+				this.getData(false);
 				// 重置加载组件状态
 				this.$refs.loadmorecom.stoploadmore();
 			}
+		},
+		getInfo : function() {
+			var self = this;
+			var data = {};
+			this.Dever.get(this, 'package/article/?l=api.cate', data);
 		},
 		// 新闻加载函数
 		// isReload 代表下拉刷新
-		getNews : function (isReload) {
-			if(this.page <= 1){ 
-				this.newsList    = [];
-				if(!isReload){this.pageLoading = true;}
-			}
-			// 真实情况 url 地址类似如下格式 :
-			// var url = 'http://您的api域名/**/**/?分类id='+this.navItems[this.currentIndex].id+'&页码='+this.page;
-			// 连接 api 获取新闻数据
-			// 模拟 api 加载数据
-			setTimeout(()=>{
-				// 对演示数据随机刷新模拟数据刷新
-				var demoArr       = graceJs.arrayShuffle(artciles.articleList);
-				if(this.page >= 2){
-					this.newsList = this.newsList.concat(demoArr);
-					// 加载完成后停止加载动画
-					this.$refs.loadmorecom.stoploadmore();
-					// 假定第3页加载了全部数据,通知组件不再加载更多
-					// 实际开发由接口返回值来决定
-					if(this.page >= 3){
-						this.$refs.loadmorecom.nomore();
-					}
-				}
-				// 第一页 有可能是第一次加载或者刷新
-				else{
-					this.newsList    = [];
-					this.newsList    = demoArr;
-					// 刷新
-					if(isReload){this.$refs.refreshcom.endReload();}
-					this.pageLoading = false;
-				}
-				this.page++;
-			}, 800);
+		getData : function (isReload) {
+			var self = this;
+			var data = {};
+			if (this.fetch.cate.length > 0) {
+				data.cate = this.fetch.cate[this.cate_index].id;
+			} else {
+				data.cate = 0;
+			}
+			
+			this.Dever.get(this, 'package/article/?l=api.getList', data, function(t) {
+				if(self.page >= 2){
+					if(t.info.length <= 0){
+						self.$refs.loadmorecom.nomore();
+					} else {
+						self.newsList = self.newsList.concat(t.info);
+						// 加载完成后停止加载动画
+						self.$refs.loadmorecom.stoploadmore();
+					}
+				} else{
+					self.newsList    = [];
+					self.newsList    = t.info;
+					// 刷新
+					if(isReload){self.$refs.refreshcom.endReload();}
+				}
+				self.page++;
+			});
 			
 		},
 		scroll : function(e){
@@ -143,7 +146,7 @@ export default {
 		// 刷新事件
 		reload : function(){
 			this.page = 1;
-			this.getNews(true);
+			this.getData(true);
 			// 刷新时重置加载组件状态
 			this.$refs.loadmorecom.stoploadmore();
 		},
@@ -157,20 +160,33 @@ export default {
 				if(status != 0){return null;}
 				this.$refs.loadmorecom.loading();
 				// 此处开启加载动画执行加载数据的函数
-				this.getNews();
+				this.getData(1);
 			}, 80);
 		},
 		// 新闻点击
 		newstap : function (e) {
 			// 获取新闻 id
-			var newsId = e;
-			console.log(newsId);
-			// 打开新闻详情页面
-			//uni.navigateTo()
+			var id = e;
+			this.Dever.location('index/news_view?id=' + id);
+		},
+		// 监听输入
+		inputting : function(e){
+			console.log(e);
+		},
+		// 监听提交
+		confirm : function (e) {
+			console.log(e);
+		},
+		// 监听点击
+		tapme:function(){
+			uni.showToast({
+				title:"被点了...."
+			});
 		}
 	}
 }
 </script>
 <style>
-.header{padding:15rpx 30rpx; height:100rpx;}
+.header{padding:15rpx 30rpx; height:100rpx;}
+.search-warp{width:750rpx; padding:15rpx 50rpx;}
 </style>

+ 47 - 0
pages/index/news_view.vue

@@ -0,0 +1,47 @@
+<template>
+	<gui-page :customHeader="true" :isLoading="pageLoading" :fullPage="true" :headerSets="{height:44, zIndex:100}" >
+		<view slot="gHeader">
+			<view class="gui-flex gui-nowrap gui-rows gui-align-items-center gui-padding">
+				<!-- 使用组件实现返回按钮及返回首页按钮 -->
+				<gui-header-leading :onlyBack="true"></gui-header-leading>
+				<!-- 导航文本此处也可以是其他自定义内容 -->
+				<text class="gui-h4 gui-ellipsis gui-text-center gui-header-content gui-primary-color">{{fetch.name}}</text>
+				<!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
+			</view>
+		</view>
+		<view slot="gBody" class="gui-margin">
+			<dever-content :item="fetch.content_array" :pics="fetch.content_pic"></dever-content>
+		</view>
+	</gui-page>
+</template>
+<script>
+import deverContent from '@/lib/dever/components/content.vue';
+export default {
+	data() {
+		return {
+			fetch : {
+				name : '',
+				content_array : [],
+				content_pic : [],
+			},
+			id : 0,
+		}
+	},
+	components:{
+		deverContent
+	},
+	onLoad : function(o) {
+		this.id = o.id;
+		this.getInfo();
+	},
+	methods: {
+		getInfo : function() {
+			var data = {};
+			data.id = this.id;
+			this.Dever.get(this, 'package/article/?l=api.getInfo', data);
+		},
+	}
+}
+</script>
+<style>
+</style>