Commit 9bfdecc7 by 王树冬

fix taro

parent 287433d6
......@@ -6,6 +6,10 @@ const config = {
'750': 1/2,
'375': 1
},
// deviceRatio:{
// '750': 2,
// '375': 1
// },
sourceRoot: 'src',
outputRoot: 'dist',
plugins: {
......
......@@ -44,32 +44,32 @@ export function asyncAdd() {
// // .then(res => console.log(res.data))
// }
// }
// function articleList(data) {
// return { type: LIST, payload: data }
// }
function articleList(data) {
return { type: LIST, payload: data }
}
// export function list() {
// console.log('list')
// return (dispatch) => {
// // service.get('/v1/article/list')
// // .then((res) => {
// // dispatch(articleList(res.data.article))
// // })
export function list() {
console.log('list')
return (dispatch) => {
// service.get('/v1/article/list')
// .then((res) => {
// dispatch(articleList(res.data.article))
// })
// Taro.request({
// url: 'http://api.shudong.wang/v1/article/list',
// data: {
// foo: 'foo',
// bar: 10
// },
// header: {
// 'content-type': 'application/json'
// }
// }).then((res) => {
// dispatch(articleList(res.data.article))
// })
// }
// }
Taro.request({
url: 'http://api.shudong.wang/v1/article/list',
data: {
foo: 'foo',
bar: 10
},
header: {
'content-type': 'application/json'
}
}).then((res) => {
dispatch(articleList(res.data.article))
})
}
}
// export const list = createApiAction(LIST, params => Taro.request({
......
......@@ -66,7 +66,7 @@ class Index extends Component {
componentDidHide() { }
onShareAppMessage () {
onShareAppMessage() {
return {
title: '蜂窝煤',
path: '/pages/index/index',
......@@ -85,9 +85,10 @@ class Index extends Component {
console.log(this.props, 'onReachBottom')
this.props.getList(params)
}
render() {
render() {
return (
<View className='index'>
<View className='data'>数据列表</View>
<View className='news'>
{
this.props.list.map((item, index) => {
......@@ -106,7 +107,7 @@ render() {
</View>
</View >
)
}
}
}
export default Index
.data
font-size 20px
.news
font-size 15px
.item
......
......@@ -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) => {
return new Promise((resolve, reject) => {
......@@ -54,10 +52,6 @@ export const promiseImage = (url) => {
})
}
export const report = (name, filed) => {
wx.reportAnalytics(name, filed)
}
export const isChinese = (str) => {
if (escape(str).indexOf("%u") < 0) return false
return true
......
......@@ -11,7 +11,6 @@ export const logError = (name, action, info) => {
info = 'empty'
}
try {
let deviceInfo = wx.getSystemInfoSync()
var device = JSON.stringify(deviceInfo)
} catch (e) {
console.error('not support getSystemInfoSync api', err.message)
......@@ -25,17 +24,5 @@ export const logError = (name, action, info) => {
if (typeof info === 'object') {
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)
}
......@@ -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) => {
return new Promise(function (resolve, reject) {
resolve(url)
})
}
export const report = (name, filed) => {
wx.reportAnalytics(name, filed)
}
export const isChinese = (str) => {
if (escape(str).indexOf("%u") < 0) return false
return true
......@@ -84,16 +54,6 @@ export const getCurrentPageUrl = () => {
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 => {
const year = date.getFullYear()
const month = date.getMonth() + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment