29

GitHub - lishuaixingNewBee/gordanTv: 狗蛋TV是一个分享打动人心事物的微信小程序。g...

 5 years ago
source link: https://github.com/lishuaixingNewBee/gordanTv
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

狗蛋TV

68747470733a2f2f757365722d676f6c642d63646e2e786974752e696f2f323031382f352f31352f313633363232663532383535366233643f773d32393026683d32393026663d706e6726733d3130313735

狗蛋TV是基于微信小程序开发的一款App。gordanLee每天都会推荐一首歌、一篇文章、一段短视频,每天用十分钟的细碎时光,点燃内心的光明。目前分为音乐,短视频,影评三个模块。

banner.png

引导页

音乐页

短视频页

影评页

搜索页

以下所有 API 均由产品公司自身提供,本人皆从网络获取。获取与共享之行为或有侵犯产品权益的嫌疑。若被告知需停止共享与使用,本人会及时删除此页面与整个项目。请您暸解相关情况,并遵守产品协议。

为了方便大家学习和测试,我们提供了https的接口供大家使用,且用且珍惜。请在微信开发设置中加入request合法域名,或者在开发设置中勾选——不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书。

感谢与支持

    -   ONE一个api: https://api.gordantv.top (服务端做的接口转发,所以有些慢)
    -   豆瓣api: https://douban.uieee.com
    -   QQ音乐api: https://c.y.qq.com
    -   快视频api: https://api.adline.com.cn

项目介绍

狗蛋TV是基于微信小程序+ES6进行开发,能同时运行在Android、iOS环境下。涵盖了音乐、短视频、影评三个版块。

  • 开屏引导图
    1. 调用微信wx.onAccelerometerChange重力感应设备API,实现水波荡漾。
    2. 调用wx.getUserInfo获取用户头像。
  • 工具类
    1. 用Promise封装wx.request(),简化代码结构:
const $get = (url, data) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url,
      data,
      header: { 'Content-Type': 'json' },
      success: resolve,
      fail: reject
    })
  })
}
  1. 电影评分实现
const convertToStarsArray = (average) => {
  const LENGTH = 5;
  const CLS_ON = 'on'; // 全星
  const CLS_HALF = 'half'; // 半星
  const CLS_OFF = 'off'; // 无星
  let result = [];
  let score = Math.round(average) / 2;
  let hasDecimal = score % 1 !== 0
  let integer = Math.floor(score)
  for (let i = 0; i < integer; i++) {
    result.push(CLS_ON)
  }
  if (hasDecimal) {
    result.push(CLS_HALF)
  }
  while (result.length < LENGTH) {
    result.push(CLS_OFF)
  }
  return result;
}
  • 小程序内部组件实现上拉刷新,下拉加载
    方法一:scroll-view 组件
    方法二:onPullDownRefresh和onReachBottom方法实现小程序下拉加载和上拉刷新
  • 阅读模块

    1. 微信小程序使用wxParse解析html
    项目中遇到在微信小程序里需要显示音乐文章的内容,文章内容是通过接口读取的服
    务器中的富文本内容,是html格式的,小程序默认是不支持html格式的内容显示的,
    那我们需要显示html内容的时候,就可以通过wxParse来实现。
    

项目安装

    git clone [email protected]:lishuaixingNewBee/gordanTv.git

目录结构


|--- utils & Public Function              通用函数
|--- components & components Public View  components和template模板
|--- images & Img Resources               图片资源
|--- pages & View Dir                     页面

○ 更新记录


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK