13395952019 6 years ago
parent
commit
c65f1027c5
4 changed files with 120 additions and 0 deletions
  1. 56 0
      微信小程序/index.js
  2. 7 0
      微信小程序/index.json
  3. 35 0
      微信小程序/index.wxml
  4. 22 0
      微信小程序/index.wxss

+ 56 - 0
微信小程序/index.js

@@ -0,0 +1,56 @@
+//index.js
+//获取应用实例
+const app = getApp()
+
+Page({
+  data: {
+   
+  },
+ 
+  onLoad: function () {
+    var that=this;
+    wx.showLoading({
+      title: '正在加载中...',
+    })
+    //电影
+    wx.request({
+      url: 'https://m.douban.com/rexxar/api/v2/subject_collection/movie_showing/items?count=7',
+      success:function(res){
+        var movies = res.data.subject_collection_items;
+        that.setData({
+          movies:movies
+        })
+        // wx.hideLoading();
+      }
+    })
+
+    //电视剧
+    wx.request({
+      url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_hot/items?count=7',
+      success: function (res) {
+        var tvs = res.data.subject_collection_items;
+        that.setData({
+          tvs: tvs
+        })
+        wx.hideLoading();
+      }
+    })
+
+    //综艺
+    wx.request({
+      url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_variety_show/items?count=7',
+      success: function (res) {
+        var shows = res.data.subject_collection_items;
+        that.setData({
+          shows: shows
+        })
+        wx.hideLoading();
+      }
+    })
+  },
+  goBaidu:function(){
+    wx.navigateTo({
+      url: '/pages/comment/comment',
+    })
+  }
+})

+ 7 - 0
微信小程序/index.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "searchbar":"/components/searchbar/searchbar",
+    "stars": "/components/stars/stars",
+    "itemview":"/components/itemview/itemview"
+    }
+}

+ 35 - 0
微信小程序/index.wxml

@@ -0,0 +1,35 @@
+<!--index.wxml-->
+<searchbar isnagigator="{{true}}"></searchbar>
+
+<!--电影-->
+<view class='model-group'>
+  <view class='model-top'>
+    <view class='model-title'>电影</view>
+    <navigator class='model-more' url="/pages/list/list?type=movie">更多</navigator>
+  </view>
+  <scroll-view class='model-scroll-view' scroll-x="{{true}}">
+    <itemview wx:for="{{movies}}" wx:key="{{item.title}}" item="{{item}}" itemurl="/pages/detail/detail?type=movie&id={{item.id}}"></itemview>
+  </scroll-view>
+</view>
+
+<!--电视剧-->
+<view class='model-group'>
+  <view class='model-top'>
+    <view class='model-title'>电视剧</view>
+    <navigator class='model-more' url="/pages/list/list?type=tvs">更多</navigator>
+  </view>
+  <scroll-view class='model-scroll-view' scroll-x="{{true}}">
+    <itemview wx:for="{{tvs}}" wx:key="{{item.title}}" item="{{item}}" itemurl="/pages/detail/detail?type=tvs&id={{item.id}}"></itemview> 
+  </scroll-view>
+</view>
+
+<!--综艺-->
+<view class='model-group'>
+  <view class='model-top'>
+    <view class='model-title'>综艺</view>
+    <navigator class='model-more' url="/pages/list/list?type=shows">更多</navigator>
+  </view>
+  <scroll-view class='model-scroll-view' scroll-x="{{true}}">
+    <itemview wx:for="{{shows}}" wx:key="{{item.title}}" item="{{item}}" itemurl="/pages/detail/detail?type=shows&id={{item.id}}"></itemview>
+  </scroll-view>
+</view>

+ 22 - 0
微信小程序/index.wxss

@@ -0,0 +1,22 @@
+/**index.wxss**/
+.model-group{
+  padding: 40rpx;
+  background-color: #fff;
+}
+.model-group .model-top{
+  font-size: 36rpx;
+  display: flex;
+  justify-content: space-between;
+}
+.model-group .model-top .model-title{
+  color: #494949;
+}
+.model-group .model-top .model-more{
+  color: #41be57;
+}
+.model-scroll-view{
+  margin-top: 40rpx;
+  width: 100%;
+  height: 400rpx; 
+  white-space: nowrap;
+}