Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
taroMeeting
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
taroMeeting
Commits
9bfdecc7
Commit
9bfdecc7
authored
Sep 27, 2018
by
王树冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix taro
parent
287433d6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
106 deletions
+54
-106
index.js
config/index.js
+4
-0
counter.js
src/actions/counter.js
+24
-24
index.js
src/pages/index/index.js
+22
-21
index.styl
src/pages/index/index.styl
+2
-0
common.js
src/utils/common.js
+0
-6
error.js
src/utils/error.js
+2
-15
index.js
src/utils/index.js
+0
-40
No files found.
config/index.js
View file @
9bfdecc7
...
@@ -6,6 +6,10 @@ const config = {
...
@@ -6,6 +6,10 @@ const config = {
'750'
:
1
/
2
,
'750'
:
1
/
2
,
'375'
:
1
'375'
:
1
},
},
// deviceRatio:{
// '750': 2,
// '375': 1
// },
sourceRoot
:
'src'
,
sourceRoot
:
'src'
,
outputRoot
:
'dist'
,
outputRoot
:
'dist'
,
plugins
:
{
plugins
:
{
...
...
src/actions/counter.js
View file @
9bfdecc7
...
@@ -44,32 +44,32 @@ export function asyncAdd() {
...
@@ -44,32 +44,32 @@ export function asyncAdd() {
// // .then(res => console.log(res.data))
// // .then(res => console.log(res.data))
// }
// }
// }
// }
//
function articleList(data) {
function
articleList
(
data
)
{
//
return { type: LIST, payload: data }
return
{
type
:
LIST
,
payload
:
data
}
//
}
}
//
export function list() {
export
function
list
()
{
//
console.log('list')
console
.
log
(
'list'
)
//
return (dispatch) => {
return
(
dispatch
)
=>
{
//
// service.get('/v1/article/list')
// service.get('/v1/article/list')
//
// .then((res) => {
// .then((res) => {
//
// dispatch(articleList(res.data.article))
// dispatch(articleList(res.data.article))
//
// })
// })
//
Taro.request({
Taro
.
request
({
//
url: 'http://api.shudong.wang/v1/article/list',
url
:
'http://api.shudong.wang/v1/article/list'
,
//
data: {
data
:
{
//
foo: 'foo',
foo
:
'foo'
,
//
bar: 10
bar
:
10
//
},
},
//
header: {
header
:
{
//
'content-type': 'application/json'
'content-type'
:
'application/json'
//
}
}
//
}).then((res) => {
}).
then
((
res
)
=>
{
//
dispatch(articleList(res.data.article))
dispatch
(
articleList
(
res
.
data
.
article
))
//
})
})
//
}
}
//
}
}
// export const list = createApiAction(LIST, params => Taro.request({
// export const list = createApiAction(LIST, params => Taro.request({
...
...
src/pages/index/index.js
View file @
9bfdecc7
...
@@ -66,7 +66,7 @@ class Index extends Component {
...
@@ -66,7 +66,7 @@ class Index extends Component {
componentDidHide
()
{
}
componentDidHide
()
{
}
onShareAppMessage
()
{
onShareAppMessage
()
{
return
{
return
{
title
:
'蜂窝煤'
,
title
:
'蜂窝煤'
,
path
:
'/pages/index/index'
,
path
:
'/pages/index/index'
,
...
@@ -85,28 +85,29 @@ class Index extends Component {
...
@@ -85,28 +85,29 @@ class Index extends Component {
console
.
log
(
this
.
props
,
'onReachBottom'
)
console
.
log
(
this
.
props
,
'onReachBottom'
)
this
.
props
.
getList
(
params
)
this
.
props
.
getList
(
params
)
}
}
render
()
{
render
()
{
return
(
return
(
<
View
className
=
'index'
>
<
View
className
=
'index'
>
<
View
className
=
'news'
>
<
View
className
=
'data'
>
数据列表
<
/View
>
{
<
View
className
=
'news'
>
this
.
props
.
list
.
map
((
item
,
index
)
=>
{
{
return
<
View
className
=
'item'
key
=
{
index
}
>
this
.
props
.
list
.
map
((
item
,
index
)
=>
{
<
View
className
=
'info'
>
return
<
View
className
=
'item'
key
=
{
index
}
>
<
View
className
=
'title'
>
{
item
.
title
}
<
/View
>
<
View
className
=
'info'
>
<
View
className
=
'footer'
>
<
View
className
=
'title'
>
{
item
.
title
}
<
/View
>
<
View
className
=
'user'
>
{
item
.
username
}
<
/View
>
<
View
className
=
'footer'
>
<
View
className
=
'comment'
>
{
item
.
username
}
<
/View
>
<
View
className
=
'user'
>
{
item
.
username
}
<
/View
>
<
View
className
=
'comment'
>
{
item
.
username
}
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
className
=
'rightImage'
><
Image
calssName
=
'img'
src
=
{
item
.
image_url
}
/></
View
>
<
/View
>
<
/View
>
<
View
className
=
'rightImage'
><
Image
calssName
=
'img'
src
=
{
item
.
image_url
}
/></
View
>
})
<
/View
>
}
})
<
/View
>
}
<
/View
>
<
/View
>
)
<
/View
>
}
)
}
}
}
export
default
Index
export
default
Index
src/pages/index/index.styl
View file @
9bfdecc7
.data
font-size 20px
.news
.news
font-size 15px
font-size 15px
.item
.item
...
...
src/utils/common.js
View file @
9bfdecc7
...
@@ -23,8 +23,6 @@ export const promisify = (func, ctx) => {
...
@@ -23,8 +23,6 @@ export const promisify = (func, ctx) => {
};
};
};
};
export
const
getToken
=
wx
.
getStorageSync
(
'token'
)
export
const
hideToast
=
wx
.
hideToast
()
// 下载图片
// 下载图片
export
const
downLoadImg
=
(
imgurl
,
msg
)
=>
{
export
const
downLoadImg
=
(
imgurl
,
msg
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -54,10 +52,6 @@ export const promiseImage = (url) => {
...
@@ -54,10 +52,6 @@ export const promiseImage = (url) => {
})
})
}
}
export
const
report
=
(
name
,
filed
)
=>
{
wx
.
reportAnalytics
(
name
,
filed
)
}
export
const
isChinese
=
(
str
)
=>
{
export
const
isChinese
=
(
str
)
=>
{
if
(
escape
(
str
).
indexOf
(
"%u"
)
<
0
)
return
false
if
(
escape
(
str
).
indexOf
(
"%u"
)
<
0
)
return
false
return
true
return
true
...
...
src/utils/error.js
View file @
9bfdecc7
import
{
getCurrentPageUrl
,
formatTime
}
from
'./common'
import
{
getCurrentPageUrl
,
formatTime
}
from
'./common'
// var fundebug = require('../libs/fundebug.0.8.2.min.js');
// var fundebug = require('../libs/fundebug.0.8.2.min.js');
/**
/**
*
*
* @param {string} name 错误名字
* @param {string} name 错误名字
* @param {string} action 错误动作描述
* @param {string} action 错误动作描述
* @param {string} info 错误信息,通常是 fail 返回的
* @param {string} info 错误信息,通常是 fail 返回的
...
@@ -11,7 +11,6 @@ export const logError = (name, action, info) => {
...
@@ -11,7 +11,6 @@ export const logError = (name, action, info) => {
info
=
'empty'
info
=
'empty'
}
}
try
{
try
{
let
deviceInfo
=
wx
.
getSystemInfoSync
()
var
device
=
JSON
.
stringify
(
deviceInfo
)
var
device
=
JSON
.
stringify
(
deviceInfo
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
'not support getSystemInfoSync api'
,
err
.
message
)
console
.
error
(
'not support getSystemInfoSync api'
,
err
.
message
)
...
@@ -19,23 +18,11 @@ export const logError = (name, action, info) => {
...
@@ -19,23 +18,11 @@ export const logError = (name, action, info) => {
let
time
=
formatTime
(
new
Date
())
let
time
=
formatTime
(
new
Date
())
console
.
error
(
time
,
name
,
action
,
info
,
device
)
console
.
error
(
time
,
name
,
action
,
info
,
device
)
// if (typeof action !== 'object') {
// if (typeof action !== 'object') {
// fundebug.notify(name, action, info)
// fundebug.notify(name, action, info)
// }
// }
// fundebug.notifyError(info, { name, action, device, time })
// fundebug.notifyError(info, { name, action, device, time })
if
(
typeof
info
===
'object'
)
{
if
(
typeof
info
===
'object'
)
{
info
=
JSON
.
stringify
(
info
)
info
=
JSON
.
stringify
(
info
)
}
}
wx
.
reportAnalytics
(
'error'
,
{
page
:
getCurrentPageUrl
(),
device
:
device
,
time
:
time
,
content
:
info
,
event
:
action
})
}
export
const
reportError
=
(
data
)
=>
{
wx
.
reportAnalytics
(
name
,
filed
)
}
src/utils/index.js
View file @
9bfdecc7
...
@@ -23,41 +23,11 @@ export const promisify = (func, ctx) => {
...
@@ -23,41 +23,11 @@ export const promisify = (func, ctx) => {
};
};
};
};
export
const
getToken
=
wx
.
getStorageSync
(
'token'
)
export
const
hideToast
=
wx
.
hideToast
()
// 下载图片
export
const
downLoadImg
=
(
imgurl
,
msg
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
that
=
this
// util.showToast(msg + 'download...')
wx
.
downloadFile
({
url
:
imgurl
,
complete
:
function
(
res
)
{
console
.
log
(
res
)
if
(
res
.
statusCode
===
200
)
{
resolve
(
res
.
tempFilePath
)
}
else
{
console
.
log
(
'downloadstatusCode'
,
res
)
reject
(
new
Error
(
res
))
}
},
fail
:
function
(
res
)
{
console
.
log
(
'downloadFilefail'
,
res
)
}
})
})
}
export
const
promiseImage
=
(
url
)
=>
{
export
const
promiseImage
=
(
url
)
=>
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
(
url
)
resolve
(
url
)
})
})
}
}
export
const
report
=
(
name
,
filed
)
=>
{
wx
.
reportAnalytics
(
name
,
filed
)
}
export
const
isChinese
=
(
str
)
=>
{
export
const
isChinese
=
(
str
)
=>
{
if
(
escape
(
str
).
indexOf
(
"%u"
)
<
0
)
return
false
if
(
escape
(
str
).
indexOf
(
"%u"
)
<
0
)
return
false
return
true
return
true
...
@@ -84,16 +54,6 @@ export const getCurrentPageUrl = () => {
...
@@ -84,16 +54,6 @@ export const getCurrentPageUrl = () => {
return
url
return
url
}
}
export
const
getSysteminfo
=
()
=>
{
try
{
let
deviceInfo
=
wx
.
getSystemInfoSync
()
const
device
=
JSON
.
stringify
(
deviceInfo
)
}
catch
(
e
)
{
console
.
error
(
'not support getSystemInfoSync api'
,
err
.
message
)
}
return
device
}
export
const
formatTime
=
date
=>
{
export
const
formatTime
=
date
=>
{
const
year
=
date
.
getFullYear
()
const
year
=
date
.
getFullYear
()
const
month
=
date
.
getMonth
()
+
1
const
month
=
date
.
getMonth
()
+
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment