Skip to content

Commit

Permalink
style: eslint 格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Honye committed Jan 6, 2020
1 parent 1d764b9 commit df00b49
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
3 changes: 1 addition & 2 deletions cloudfunctions/getCards/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const db = cloud.database()
/**
* 获取卡片列表
*/
getCards = async (event, context) => {
const getCards = async (event, context) => {
let cards = []
let message = 'success'
await db.collection('cards').get().then(({ data }) => {
Expand All @@ -21,7 +21,6 @@ getCards = async (event, context) => {
message = err.errMsg || err
})
for(let i = 0, length = cards.length; i < length; ++i) {
let likeCount = 0
await db.collection('cardRelations').where({
id: cards[i].id,
}).get().then(({ data }) => {
Expand Down
2 changes: 1 addition & 1 deletion miniprogram/pages/about/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Page({
if (res.status === 1)
wx.getBackgroundAudioManager().pause()
else if (res.status === 2)
this.initAudio(that.data.datas.bgm)
this.initAudio(this.data.datas.bgm)
else
wx.getBackgroundAudioManager().play()
},
Expand Down
8 changes: 5 additions & 3 deletions miniprogram/pages/common/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class Component {
const res = wx.getSystemInfoSync()
const SDKVersion = res.SDKVersion.split('.')
has = Number(SDKVersion[0]) > 1 || Number(SDKVersion[1]) >= 5
} catch (e) {}
} catch (e) {
// getSystemInfoSync happened error
}

return has
}
Expand Down Expand Up @@ -72,7 +74,7 @@ class Component {
// 筛选非函数类型,更改参数中函数的 this 指向
if (!this.isEmptyObject(data)) {
for (let key in data) {
if (data.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
if (typeof data[key] === `function`) {
data[key] = data[key].bind(this)
} else {
Expand All @@ -98,7 +100,7 @@ class Component {
// 筛选函数类型
if (!this.isEmptyObject(methods)) {
for (let key in methods) {
if (methods.hasOwnProperty(key) && typeof methods[key] === `function`) {
if (Object.prototype.hasOwnProperty.call(methods, key) && typeof methods[key] === `function`) {
this[key] = methods[key] = methods[key].bind(this)

// 将 methods 内的方法重命名并挂载到 page 上面,否则 template 内找不到事件
Expand Down
2 changes: 0 additions & 2 deletions miniprogram/pages/pArticle/pages/details/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import WxParse from '../../../common/wxParse/wxParse'
import { $markShare } from '../../../common/index'
import wxCloud from '../../../../utils/wxCloud'

const db = wx.cloud.database()

Page({

data: {
Expand Down
2 changes: 1 addition & 1 deletion miniprogram/pages/pMovie/pages/details/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Page({
directors = [],
casts = [],
trailers = [],
...details,
...details
} = res
const _casts = casts.map(item => item.name)
const directorList = directors.map(item => {
Expand Down
12 changes: 6 additions & 6 deletions miniprogram/pages/search/search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// pages/search/search.js
import { Douban, mtime } from './../../utils/apis.js'
import { /*Douban,*/ mtime } from './../../utils/apis.js'

const count = 20; // 每页加载数据数目
Page({
Expand Down Expand Up @@ -63,11 +63,11 @@ Page({
wx.showLoading({
title: 'loading...',
})
const body = {
q: inputVal,
start: count * pageNo,
count
}
// const body = {
// q: inputVal,
// start: count * pageNo,
// count
// }
mtime.searchMovie({
keyword: inputVal,
pageIndex: pageNo + 1,
Expand Down
2 changes: 0 additions & 2 deletions miniprogram/pages/tabs/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ Page({

/** 关于 */
toAbout() {
const { version, config } = app.globalData;
// if (version.versionCode <= config.newestVersion)
wx.navigateTo({
url: '/pages/about/index',
})
Expand Down

0 comments on commit df00b49

Please sign in to comment.