This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
4,926 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
package-lock.json* | ||
yarn.lock* | ||
yarn-error.log* | ||
yarn-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
demo | ||
node_modules | ||
app.js | ||
app.json | ||
package-lock.json | ||
project.config.json | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
App({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"pages":[ | ||
"demo/demo" | ||
], | ||
"window":{ | ||
"backgroundTextStyle":"light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "WeChat", | ||
"navigationBarTextStyle":"black" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict' | ||
|
||
const Fanfou = require('../src/index') | ||
|
||
Page({ | ||
data: { | ||
key: '2602578f6379ad3cc52b6269cb63d25c', | ||
secret: '4676969b8faae10064caa2f19c36d5c0', | ||
username: '', | ||
password: '' | ||
}, | ||
|
||
keyInput (e) { | ||
const {value: key} = e.detail | ||
this.setData({key}) | ||
}, | ||
|
||
secretInput (e) { | ||
const {value: secret} = e.detail | ||
this.setData({secret}) | ||
}, | ||
|
||
usernameInput (e) { | ||
const {value: username} = e.detail | ||
this.setData({username}) | ||
}, | ||
|
||
passwordInput (e) { | ||
const {value: password} = e.detail | ||
this.setData({password}) | ||
}, | ||
|
||
testTap () { | ||
const {key: consumerKey, secret: consumerSecret, username, password} = this.data | ||
const ff = new Fanfou({consumerKey, consumerSecret, username, password}) | ||
|
||
ff.xauth().then(res => { | ||
console.log('token:', res.oauthToken) | ||
console.log('secret:', res.oauthTokenSecret) | ||
}).catch(err => { | ||
console.log(err.message) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<view> | ||
<input placeholder="consumer key" bindinput="keyInput" value="{{key}}" /> | ||
<input placeholder="consumer secret" bindinpu="secretInput" value="{{secret}}" /> | ||
<input placeholder="username" bindinput="usernameInput" /> | ||
<input placeholder="password" bindinput="passwordInput" password /> | ||
<button bindtap="testTap">TEST</button> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
input { | ||
box-sizing: content-box; | ||
border: 1px solid #ccc; | ||
margin: 10px; | ||
padding: 10px; | ||
font-size: 14px; | ||
} | ||
|
||
button { | ||
box-sizing: content-box; | ||
border: 1px solid #ccc; | ||
margin: 10px; | ||
font-size: 14px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "fanfou-sdk-weapp", | ||
"version": "0.0.0", | ||
"description": "Fanfou SDK for WeApp", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "standard" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LitoMore/fanfou-sdk-weapp.git" | ||
}, | ||
"author": "LitoMore", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/LitoMore/fanfou-sdk-weapp/issues" | ||
}, | ||
"homepage": "https://github.com/LitoMore/fanfou-sdk-weapp#readme", | ||
"devDependencies": { | ||
"standard": "^11.0.1" | ||
}, | ||
"standard": { | ||
"global": [ | ||
"Page", | ||
"App", | ||
"wx" | ||
], | ||
"ignore": [ | ||
"src/modules" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"description": "config file", | ||
"packOptions": { | ||
"ignore": [] | ||
}, | ||
"setting": { | ||
"urlCheck": false, | ||
"es6": true, | ||
"postcss": false, | ||
"minified": false, | ||
"newFeature": true | ||
}, | ||
"compileType": "miniprogram", | ||
"libVersion": "2.0.0", | ||
"appid": "touristappid", | ||
"projectname": "fanfou-sdk-weapp", | ||
"condition": { | ||
"search": { | ||
"current": -1, | ||
"list": [] | ||
}, | ||
"conversation": { | ||
"current": -1, | ||
"list": [] | ||
}, | ||
"game": { | ||
"currentL": -1, | ||
"list": [] | ||
}, | ||
"miniprogram": { | ||
"current": -1, | ||
"list": [] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict' | ||
|
||
const timeago = require('./modules/timeago/index') | ||
const dateFormat = require('./modules/date-format/index') | ||
const User = require('./user') | ||
|
||
class DirectMessage { | ||
constructor (dm) { | ||
this.id = dm.id | ||
this.text = dm.text | ||
this.sender_id = dm.sender_id | ||
this.recipient_id = dm.recipient_id | ||
this.created_at = dm.created_at | ||
this.sender_screen_name = dm.sender_screen_name | ||
this.recipient_screen_name = dm.recipient_screen_name | ||
this.sender = new User(dm.sender) | ||
this.recipient = new User(dm.recipient) | ||
if (dm.in_reply_to) { | ||
this.in_reply_to = new DirectMessage(dm.in_reply_to) | ||
} | ||
|
||
this.time_ago = this._getTimeAgo() | ||
this.time_tag = this._getTimeTag() | ||
} | ||
|
||
_getTimeAgo () { | ||
return timeago().format(this.created_at, 'fanfou_weapp') | ||
} | ||
|
||
_getTimeTag () { | ||
const date = new Date() | ||
const create = new Date(this.created_at) | ||
const nowYear = dateFormat('yyyy', date) | ||
const createYear = dateFormat('yyyy', create) | ||
const nowDate = dateFormat('yyyyMMdd', date) | ||
const createDate = dateFormat('yyyyMMdd', create) | ||
|
||
if (nowDate === createDate) { | ||
return dateFormat('hh:mm', create) | ||
} | ||
if (nowYear === createYear) { | ||
return dateFormat('MM/dd hh:mm', create) | ||
} | ||
return dateFormat('yyyy/MM/dd hh:mm', create) | ||
} | ||
} | ||
|
||
module.exports = DirectMessage |
Oops, something went wrong.