dever 5 years ago
parent
commit
4faf08b608
4 changed files with 39 additions and 55 deletions
  1. 1 2
      dever/config.js
  2. 18 18
      dever/core.js
  3. 4 3
      template/home/index.js
  4. 16 32
      template/home/index.wxml

+ 1 - 2
dever/config.js

@@ -4,7 +4,7 @@ var config =
     host : 
     {
         // 主域名
-        'main': 'http://192.168.33.10/sharepic/content/?l='
+        'main': 'http://192.168.33.10/sharepic/main/?l='
     },
 
     // 项目id
@@ -22,7 +22,6 @@ var config =
 
 //定义模拟数据
 var data = {};
-data['main.api.home'] = {};
 
 config.data = data;
 

+ 18 - 18
dever/core.js

@@ -125,8 +125,8 @@ var page =
   ,onLoad: function (options) {
     this.setConfig();
     this.stopPullDown();
-    if (this.hasOwnProperty('load')) {
-      this.load();
+    if (this.hasOwnProperty('oLoad')) {
+      this.oLoad(options);
     }
   }
 
@@ -134,8 +134,8 @@ var page =
    * 生命周期函数--监听页面初次渲染完成
    */
   ,onReady: function () {
-    if (this.hasOwnProperty('ready')) {
-      this.ready();
+    if (this.hasOwnProperty('oReady')) {
+      this.oReady();
     }
   }
 
@@ -143,8 +143,8 @@ var page =
    * 生命周期函数--监听页面显示
    */
   ,onShow: function () {
-    if (this.hasOwnProperty('show')) {
-      this.show();
+    if (this.hasOwnProperty('oShow')) {
+      this.oShow();
     }
   }
 
@@ -152,8 +152,8 @@ var page =
    * 生命周期函数--监听页面隐藏
    */
   ,onHide: function () {
-    if (this.hasOwnProperty('hide')) {
-      this.hide();
+    if (this.hasOwnProperty('oHide')) {
+      this.oHide();
     }
   }
 
@@ -161,8 +161,8 @@ var page =
    * 生命周期函数--监听页面卸载
    */
   ,onUnload: function () {
-    if (this.hasOwnProperty('unload')) {
-      this.unload();
+    if (this.hasOwnProperty('oUnload')) {
+      this.oUnload();
     }
   }
 
@@ -186,8 +186,8 @@ var page =
    * 用户点击右上角分享
    */
   ,onShareAppMessage: function () {
-    if (this.hasOwnProperty('share')) {
-      this.share();
+    if (this.hasOwnProperty('oShare')) {
+      this.oShare();
     }
   }
 
@@ -237,18 +237,18 @@ var page =
 var app =
 {
   onLaunch: function () {
-    if (this.hasOwnProperty('launch')) {
-      this.launch();
+    if (this.hasOwnProperty('oLaunch')) {
+      this.oLaunch();
     }
   },
   onShow: function () {
-    if (this.hasOwnProperty('show')) {
-      this.show();
+    if (this.hasOwnProperty('oShow')) {
+      this.oShow();
     }
   },
   onHide: function () {
-    if (this.hasOwnProperty('hide')) {
-      this.hide();
+    if (this.hasOwnProperty('oHide')) {
+      this.oHide();
     }
   },
   dever: dever,

+ 4 - 3
template/home/index.js

@@ -3,14 +3,15 @@ var config = getApp().page;
 /**
  * 页面加载
  */
-config.load = function()
+config.oLoad = function (options)
 {
   var self = this;
   var success = function(data, res)
   {
-      self.setList(self, data.product);
+    self.set('focus', data.push_focus);
+    self.set('news', data.news);
   };
-  //self.request('main.api.home', {}, {success: success});
+  self.request('main.content.home', {}, {success: success});
 };
 
 config.isCard = function(e)

+ 16 - 32
template/home/index.wxml

@@ -9,6 +9,12 @@
   </bar>
 </custom>
 
+
+<swiper class="card-swiper round-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500"  indicator-color="#8799a3" indicator-active-color="#0081ff">
+  <swiper-item wx:for="{{focus}}" wx:for-item="v" wx:for-index="k" wx:key class="{{cardCur==k?'cur':''}}">
+    <view class='bg-img shadow-blur' style="background-image:url({{v.pic}})"></view>
+  </swiper-item>
+</swiper>
 <bar class="solid-bottom">
   <view class='action'>
     <icon class='icon-titles text-orange ' /> 最新
@@ -17,36 +23,14 @@
     <switch class='sm' checked='{{isCard}}' bindchange='isCard'></switch>
   </view>
 </bar>
-<card class="case">
-  <item wx:for="{{1}}" wx:key class="shadow">
-    <view class='image'>
-      <image src="https://image.weilanwl.com/img/4x3-1.jpg" mode="widthFix"></image>
-      <tag class="bg-blue">福利</tag>
-      <bar class='bg-shadeBottom'>我和制服不得不说的那些事!</bar>
-    </view>
-    <list class="menu menu-avatar">
-      <item>
-        <avatar class="round lg" style="background-image:url(https://image.weilanwl.com/img/square-4.jpg);"></avatar>
-        <view class='content flex-sub'>
-          <view class='text-grey'>猪皮蛋</view>
-          <view class='text-gray text-sm flex justify-between'>
-            十天前
-            <view class="text-gray text-sm">
-              <icon class="icon-attentionfill" /> 10
-              <icon class="icon-appreciatefill" /> 20
-              <icon class="icon-messagefill" /> 30
-            </view>
-          </view>
-        </view>
-      </item>
-    </list>
-  </item>
 
-  <item wx:for="{{1}}" wx:key class="shadow">
+
+<card class="case">
+  <item wx:for="{{news}}" wx:for-item="v" wx:for-index="k" wx:key class="shadow">
     <view class='image'>
-      <image src="https://image.weilanwl.com/img/4x3-1.jpg" mode="widthFix"></image>
-      <tag class="bg-blue">福利</tag>
-      <bar class='bg-shadeBottom'>我和制服不得不说的那些事!</bar>
+      <image src="{{v.pic_cover}}" mode="widthFix"></image>
+      <tag class="bg-blue">{{v.cate_name}}</tag>
+      <bar class='bg-shadeBottom'>{{v.name}}</bar>
     </view>
     <list class="menu menu-avatar">
       <item>
@@ -54,11 +38,11 @@
         <view class='content flex-sub'>
           <view class='text-grey'>猪皮蛋</view>
           <view class='text-gray text-sm flex justify-between'>
-            十天前
+            {{v.pdate}}
             <view class="text-gray text-sm">
-              <icon class="icon-attentionfill" /> 10
-              <icon class="icon-appreciatefill" /> 20
-              <icon class="icon-messagefill" /> 30
+              <icon class="icon-attentionfill" /> {{v.num_view}}
+              <icon class="icon-appreciatefill" /> {{v.num_up}}
+              <icon class="icon-messagefill" /> {{v.num_comment}}
             </view>
           </view>
         </view>