├── APT流量币白皮书0102.pdf ├── ClickUtil.js ├── DXCaptchaView.js ├── DateUtil.js ├── Game.js ├── GameMain.js ├── ImageShow.js ├── InviteFriends.js ├── Login.js ├── Money ├── Apprentice.js ├── AuditTaskDetails.js ├── CountDownReact.js ├── DownLoadTaskDetails.js ├── FillCode.js ├── Home.js ├── Login.js ├── Market.js ├── Me.js ├── Money.js ├── Msg.js ├── Register.js └── Share.js ├── MyLoading.js ├── MyTask.js ├── README.md ├── RealName.js ├── Scanner.js ├── ToastUtils.js ├── UpLoadTask.js ├── UpLoadTask_top1.js ├── Vip.js └── fetch-polyfill.js /APT流量币白皮书0102.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aptdeveloper/adpaytoken/2b51c402551b7a0ca934e24b6864b883b45df68d/APT流量币白皮书0102.pdf -------------------------------------------------------------------------------- /ClickUtil.js: -------------------------------------------------------------------------------- 1 | 2 | const minClickDelayTime = 2000; 3 | 4 | let lastClickTime = 0; 5 | 6 | const noDoubleClick = () => { 7 | 8 | const currentTime = new Date().getTime(); 9 | 10 | if (currentTime - lastClickTime > minClickDelayTime) { 11 | 12 | lastClickTime = currentTime; 13 | 14 | return true; 15 | 16 | } 17 | 18 | return false; 19 | 20 | }; 21 | 22 | 23 | const resetLastTime = () => { 24 | 25 | lastClickTime = 0; 26 | 27 | }; 28 | 29 | export default { noDoubleClick, resetLastTime }; -------------------------------------------------------------------------------- /DXCaptchaView.js: -------------------------------------------------------------------------------- 1 | 2 | // import React, { Component, PropTypes } from 'react'; 3 | // import { 4 | // View, 5 | // requireNativeComponent, 6 | // } from 'react-native'; 7 | 8 | 9 | // const RCTDXCaptchaView = requireNativeComponent('DXCaptchaView', { 10 | // propTypes: { 11 | // ...View.propTypes // 包含默认的View的属性 12 | // }, 13 | // }); 14 | 15 | // module.exports=RCTDXCaptchaView; 16 | 17 | import React from 'react'; 18 | import {requireNativeComponent,View} from 'react-native'; 19 | import PropTypes from 'prop-types'; 20 | 21 | var iface = { 22 | name: 'DXCaptchaView', 23 | 24 | propTypes: { 25 | appid: PropTypes.string, //appid:对应Android原生程序中的DXCaptchaView的init方法 26 | ...View.propTypes 27 | }, 28 | } 29 | 30 | module.exports = requireNativeComponent('DXCaptchaView', iface,{ 31 | nativeOnly:{ 32 | "testID": true, 33 | 'renderToHardwareTextureAndroid': true, 34 | 'accessibilityComponentType': true, 35 | 'accessibilityLabel': true, 36 | 'importantForAccessibility': true, 37 | 'accessibilityLiveRegion': true, 38 | 'onLayout':true, 39 | } 40 | }); -------------------------------------------------------------------------------- /DateUtil.js: -------------------------------------------------------------------------------- 1 | class DateUtil { 2 | /** 3 | * @param dateString 4 | * @return Date 5 | */ 6 | static parserDateString(dateString) { 7 | if (dateString) { 8 | let regEx = new RegExp("\\-", "gi"); 9 | let validDateStr = dateString.replace(regEx, "/"); 10 | let milliseconds = Date.parse(validDateStr); 11 | return new Date(milliseconds); 12 | 13 | } 14 | } 15 | 16 | static formatDate(timestamp, formater) { 17 | let date = new Date(); 18 | date.setTime(parseInt(timestamp)); 19 | formater = (formater != null) ? formater : 'yyyy-MM-dd hh:mm'; 20 | Date.prototype.Format = function (fmt) { 21 | var o = { 22 | "M+": this.getMonth() + 1, //月 23 | "d+": this.getDate(), //日 24 | "h+": this.getHours(), //小时 25 | "m+": this.getMinutes(), //分 26 | "s+": this.getSeconds(), //秒 27 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 28 | "S": this.getMilliseconds() //毫秒 29 | }; 30 | 31 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 32 | for (var k in o) { 33 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? 34 | (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 35 | } 36 | return fmt; 37 | } 38 | return date.Format(formater); 39 | } 40 | } 41 | export default DateUtil; -------------------------------------------------------------------------------- /Game.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | ActivityIndicator, 11 | DeviceEventEmitter 12 | } from 'react-native'; 13 | 14 | import { Actions } from 'react-native-router-flux' 15 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 16 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 17 | import ClickUtil from '../Utils/ClickUtil.js'; 18 | import local from '../Utils/StorageUtils.js'; 19 | import NetUtils from '../Utils/NetUtils.js' 20 | import { toastShort } from '../Utils/ToastUtils.js'; 21 | import WebView from 'react-native-webview' 22 | export default class Game extends Component { 23 | constructor(props) { 24 | super(props) 25 | this.state = { 26 | title: '', 27 | url: '', 28 | cookies: '' 29 | } 30 | } 31 | componentDidMount() { 32 | local.get("cookies").then(c => { 33 | this.setState({ cookies: c }) 34 | }).catch(e => { }) 35 | } 36 | 37 | render() { 38 | return 39 | Actions.pop()} underlayColor={'#fff'}> 40 | 41 | 42 | 幸运大转盘 43 | 44 | 45 | 46 | this.onNavigationStateChange(e)} 52 | // 提供api 给开发者使用 比如 goback() 53 | ref={webView => this.webView = webView} 54 | startInLoadingState={true} // 加载菊花 55 | /> 56 | 57 | } 58 | 59 | } 60 | const styles = StyleSheet.create({ 61 | container: { 62 | flex: 1, 63 | backgroundColor: '#fff' 64 | }, 65 | txt1: { 66 | fontSize: 34 * unitWidth, 67 | color: "#21262c", 68 | fontWeight: 'bold', 69 | alignSelf: 'center', 70 | textAlign: 'center', 71 | }, 72 | Image: { 73 | width: 24 * unitWidth, 74 | height: 41 * unitHeight, 75 | alignSelf: 'flex-end', 76 | marginLeft: 30 * unitWidth 77 | }, 78 | }); 79 | -------------------------------------------------------------------------------- /GameMain.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableOpacity, 10 | ActivityIndicator, 11 | DeviceEventEmitter, 12 | ScrollView 13 | } from 'react-native'; 14 | 15 | import { Actions } from 'react-native-router-flux' 16 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 17 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 18 | import ClickUtil from '../Utils/ClickUtil.js'; 19 | import local from '../Utils/StorageUtils.js'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | import { toastShort } from '../Utils/ToastUtils.js'; 22 | import WebView from 'react-native-webview' 23 | export default class GameMain extends Component { 24 | constructor(props) { 25 | super(props) 26 | this.state = { 27 | 28 | } 29 | } 30 | componentDidMount() { 31 | } 32 | 33 | render() { 34 | return 35 | 36 | 赏金 37 | 38 | 39 | 40 | Actions.game()}> 41 | 42 | 43 | 44 | 45 | 46 | } 47 | } 48 | const styles = StyleSheet.create({ 49 | container: { 50 | flex: 1, 51 | backgroundColor: '#fff' 52 | }, 53 | txt1: { 54 | fontSize: 34 * unitWidth, 55 | color: "#21262c", 56 | fontWeight: 'bold', 57 | alignSelf: 'center', 58 | textAlign: 'center', 59 | }, 60 | Image: { 61 | width: 24 * unitWidth, 62 | height: 41 * unitHeight, 63 | alignSelf: 'flex-end', 64 | marginLeft: 30 * unitWidth 65 | }, 66 | gamestyles: { 67 | backgroundColor: 'rgb(55,140,255)', 68 | marginLeft: 30 * unitWidth, 69 | marginRight: 30 * unitWidth, 70 | borderRadius: 10, 71 | height: 200 * unitHeight, 72 | justifyContent: 'center', 73 | marginTop: 30 * unitHeight 74 | }, 75 | gametext: { 76 | fontSize: 60 * unitWidth, 77 | marginLeft: 15 * unitWidth, 78 | color: '#fff', 79 | } 80 | }); 81 | -------------------------------------------------------------------------------- /ImageShow.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | StyleSheet, 4 | Text, 5 | View, 6 | Image, 7 | StatusBar, 8 | ImageBackground, 9 | TouchableOpacity, 10 | ScrollView, 11 | Modal, 12 | TouchableWithoutFeedback, 13 | DeviceEventEmitter, 14 | Platform, 15 | Linking 16 | } from 'react-native'; 17 | import { Actions } from 'react-native-router-flux' 18 | 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | 21 | import ImageViewer from 'react-native-image-zoom-viewer'; 22 | import CameraRoll from "@react-native-community/cameraroll"; 23 | import RNFS from 'react-native-fs'; 24 | export default class ImageShow extends Component { 25 | constructor(props) { 26 | super(props) 27 | let Obj = {}; 28 | let ImageObjArray = []; 29 | Obj.url = this.props.img; 30 | ImageObjArray.push(Obj) 31 | 32 | this.state = { 33 | images: ImageObjArray, 34 | imageIndex: 0, 35 | } 36 | 37 | } 38 | componentDidMount() { 39 | toastShort("点击图片退出/长按可保存") 40 | } 41 | 42 | render() { 43 | return 44 | { }} // 图片切换时触发 52 | onClick={() => { // 图片单击事件 53 | Actions.pop() 54 | }} 55 | onSave={(url) => { 56 | this.savePhoto(url) 57 | }} 58 | /> 59 | 60 | } 61 | savePhoto(url) { 62 | // if (Platform.OS == 'ios') { 63 | // let promise = CameraRoll.saveToCameraRoll(url); 64 | // promise.then(function (result) { 65 | // toastShort("已保存到系统相册") 66 | // }).catch(function (error) { 67 | // toastShort('保存失败'); 68 | // }); 69 | // } else { 70 | //保存图片 71 | DownloadImage(url).then((res) => { 72 | if (res.statusCode == 200) { 73 | this.close() 74 | toastShort('图片保存成功') 75 | } else { 76 | this.close() 77 | toastShort('图片保存失败') 78 | } 79 | }) 80 | .catch((error) => { 81 | this.close() 82 | toastShort('图片保存失败') 83 | // console.log(error) 84 | }) 85 | // } 86 | } 87 | 88 | } 89 | /** 90 | * 下载网页图片 91 | * @param uri 图片地址 92 | * @returns {*} 93 | */ 94 | export const DownloadImage = (uri) => { 95 | if (!uri) return null; 96 | return new Promise((resolve, reject) => { 97 | let timestamp = (new Date()).getTime();//获取当前时间错 98 | let random = String(((Math.random() * 1000000) | 0))//六位随机数 99 | let dirs = Platform.OS === 'ios' ? RNFS.LibraryDirectoryPath : RNFS.ExternalDirectoryPath; //外部文件,共享目录的绝对路径(仅限android) 100 | const downloadDest = `${dirs}/${timestamp + random}.jpg`; 101 | const formUrl = uri; 102 | const options = { 103 | fromUrl: formUrl, 104 | toFile: downloadDest, 105 | background: true, 106 | begin: (res) => { 107 | // console.log('begin', res); 108 | // console.log('contentLength:', res.contentLength / 1024 / 1024, 'M'); 109 | }, 110 | }; 111 | try { 112 | const ret = RNFS.downloadFile(options); 113 | ret.promise.then(res => { 114 | // console.log('success', res); 115 | // console.log('file://' + downloadDest) 116 | var promise = CameraRoll.saveToCameraRoll(downloadDest); 117 | promise.then(function (result) { 118 | toastShort('保存成功'); 119 | }).catch(function (error) { 120 | console.log('error', error); 121 | toastShort('保存失败'); 122 | }); 123 | resolve(res); 124 | }).catch(err => { 125 | reject(new Error(err)) 126 | }); 127 | } catch (e) { 128 | reject(new Error(e)) 129 | } 130 | 131 | }) 132 | 133 | } -------------------------------------------------------------------------------- /InviteFriends.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | StatusBar, 9 | ImageBackground, 10 | ScrollView, 11 | TouchableOpacity, 12 | Clipboard 13 | } from 'react-native'; 14 | import LinearGradient from 'react-native-linear-gradient'; 15 | import { Actions } from 'react-native-router-flux' 16 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 17 | import ClickUtil from '../Utils/ClickUtil.js'; 18 | import local from '../Utils/StorageUtils.js'; 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | export default class InviteFriends extends Component { 22 | constructor(props) { 23 | super(props) 24 | this.state = { 25 | data: [], 26 | code: '', 27 | inviteUsersMaster: [], 28 | inviteUsersMasterZU: [] 29 | 30 | } 31 | } 32 | componentDidMount() { 33 | local.get("invitationCode").then(res => { 34 | if (res) { 35 | this.setState({ code: res }) 36 | } 37 | }).catch(e => { 38 | }) 39 | this.InviteFriendsApi() 40 | } 41 | render() { 42 | 43 | return 44 | 45 | {/* heard */} 46 | 47 | 48 | 49 | 50 | 51 | 邀请好友 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 每邀请一位新用户,可获得10算力奖励,每日可邀请5位 61 | 62 | 63 | {/* 参加步骤 */} 64 | 65 | 66 | 67 | 参与步骤 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 邀请好友 80 | 好友下载APP,填写你的邀请码 81 | 奖励到账 82 | 83 | 我的邀请码 84 | 85 | {/* 邀请码 */} 86 | {this.state.code} 87 | 88 | {/* 邀请好友按钮 */} 89 | 90 | 94 | 复制邀请链接 95 | 96 | 100 | Actions.share({'code':this.state.code})}>生成邀请卡 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | {/* 邀请记录*/} 109 | 110 | 111 | 112 | 我的邀请记录 113 | 114 | 115 | 累计共 {this.state.data.numMaster + this.state.data.numMasterZU} 算力 116 | 累计共 {NetUtils.NumUtils(this.state.data.totalIncomeMaster + this.state.data.totalIncomeMasterZU)} APT 117 | 118 | 119 | 120 | 徒弟数 {this.state.inviteUsersMaster.length} 121 | 122 | 123 | 124 | 累计获得 125 | 126 | 127 | APT 128 | {NetUtils.NumUtils(this.state.data.totalIncomeMaster)} 129 | 130 | 131 | 算力 132 | {this.state.data.numMaster} 133 | 134 | 135 | 136 | 137 | 138 | {/* ************************* */} 139 | 140 | 141 | 徒孙数 {this.state.inviteUsersMasterZU.length} 142 | 143 | 144 | 145 | 累计获得 146 | 147 | 148 | APT 149 | {NetUtils.NumUtils(this.state.data.totalIncomeMasterZU)} 150 | 151 | 152 | 算力 153 | {this.state.data.numMasterZU} 154 | 155 | 156 | 157 | 158 | 159 | {/* 绳子 */} 160 | 161 | 162 | 163 | 164 | 165 | {/* 邀请规则 */} 166 | 167 | 168 | 169 | 邀请规则 170 | 171 | 172 | 1.每邀请一名有效好友,你就可以获得10算力奖励; 173 | 2.你邀请的有效好友,其邀请一名有效好友,即二级好友,你将获得5算力奖励; 174 | 3.系统会自动计算,只要达到有效用户条件,算力会自动发放到您的账号,请在APP里联系客服. 175 | 176 | {/* 绳子 */} 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | } 189 | gototalIncomeMaster(item) { 190 | if (ClickUtil.noDoubleClick()) { 191 | Actions.apprentice({ 'item': item }) 192 | } 193 | } 194 | gototalIncomeMasterZU(item) { 195 | if (ClickUtil.noDoubleClick()) { 196 | Actions.apprentice2({ 'item': item }) 197 | } 198 | } 199 | onBack() { 200 | Actions.pop() 201 | } 202 | 203 | } 204 | const styles = StyleSheet.create({ 205 | container: { 206 | flex: 1, 207 | 208 | }, 209 | viewstyles: { 210 | width: 250 * unitWidth, 211 | height: 160 * unitHeight, 212 | borderRadius: 10 * unitWidth, 213 | backgroundColor: "#c5e4ff", 214 | marginTop: 20 * unitHeight 215 | }, 216 | styles_v1: { 217 | marginLeft: 30 * unitWidth, 218 | marginTop: 85 * unitWidth, 219 | flexDirection: 'row', 220 | alignItems: 'center', 221 | justifyContent: 'space-between' 222 | }, 223 | styles_v2: { 224 | marginTop: 42 * unitHeight, 225 | width: 660 * unitWidth, 226 | height: 660 * unitWidth, 227 | marginLeft: 45 * unitWidth, 228 | marginRight: 45 * unitWidth, 229 | elevation: 6, 230 | shadowColor: "rgba(79, 118, 253, 0.53)", 231 | shadowOffset: { width: 0, height: 0 }, 232 | shadowOpacity: 1, 233 | shadowRadius: 20 * unitWidth, 234 | borderRadius: 20 * unitWidth, 235 | backgroundColor: '#fff', 236 | alignItems: 'center', 237 | }, 238 | styles_v3: { 239 | marginTop: 55 * unitWidth, 240 | flexDirection: 'row', 241 | height: 46 * unitWidth, 242 | alignItems: 'center' 243 | 244 | }, 245 | styles_v4: { 246 | marginTop: 21 * unitWidth, 247 | flexDirection: 'row', 248 | }, 249 | 250 | styles_v7: { 251 | marginLeft: 46 * unitWidth, 252 | marginTop: 43 * unitWidth, 253 | marginRight: 46 * unitWidth, 254 | flexDirection: 'row', 255 | justifyContent: 'space-between', 256 | alignContent: 'center' 257 | }, 258 | styles_v8: { 259 | marginTop: 68 * unitWidth, 260 | justifyContent: 'center', 261 | alignItems: 'center', 262 | // flexDirection: 'row' 263 | 264 | }, 265 | styles_v9: { 266 | marginTop: 30 * unitWidth, 267 | justifyContent: 'center', 268 | alignItems: 'center', 269 | flexDirection: 'row' 270 | 271 | }, 272 | backstyles: { 273 | width: 24 * unitWidth, 274 | height: 41 * unitWidth, 275 | }, 276 | textstyles: { 277 | fontSize: 34 * unitWidth, 278 | lineHeight: 50 * unitWidth, 279 | color: "#ffffff" 280 | }, 281 | img1: { 282 | width: 517 * unitWidth, 283 | height: 80 * unitWidth, 284 | marginTop: 54 * unitWidth, 285 | alignItems: 'center' 286 | }, 287 | img4: { 288 | marginTop: 49 * unitWidth, 289 | width: 270 * unitWidth, 290 | height: 80 * unitWidth, 291 | alignItems: 'center', 292 | justifyContent: 'center', 293 | borderRadius: 40 * unitWidth, 294 | shadowColor: "rgba(255, 162, 93, 0.55)", 295 | shadowOffset: { 296 | width: 0, 297 | height: 3.5 298 | }, 299 | shadowRadius: 5, 300 | shadowOpacity: 1, 301 | elevation: 1 302 | 303 | }, 304 | tex1: { 305 | fontSize: 26 * unitWidth, 306 | color: "#ffffff", 307 | }, 308 | tex2: { 309 | fontSize: 22 * unitWidth, 310 | lineHeight: 50 * unitWidth, 311 | color: "#2a2c31" 312 | }, 313 | tex3: { 314 | fontSize: 22 * unitWidth, 315 | lineHeight: 50 * unitWidth, 316 | color: "#2a2c31", 317 | marginLeft: 20 * unitWidth 318 | }, 319 | tex4: { 320 | fontSize: 22 * unitWidth, 321 | lineHeight: 50 * unitWidth, 322 | color: "#2a2c31", 323 | marginLeft: 20 * unitWidth 324 | }, 325 | tex5: { 326 | marginTop: 52 * unitWidth, 327 | fontSize: 26 * unitWidth, 328 | lineHeight: 50 * unitWidth, 329 | color: "#626970" 330 | }, 331 | tex6: { 332 | fontSize: 56 * unitWidth, 333 | color: "#33363b", 334 | fontWeight: 'bold' 335 | }, 336 | tex7: { 337 | fontSize: 30 * unitWidth, 338 | lineHeight: 50 * unitWidth, 339 | color: "#ffffff", 340 | textAlign: 'center' 341 | }, 342 | tex8: { 343 | width: 554 * unitWidth, 344 | marginTop: 40 * unitWidth, 345 | fontSize: 28 * unitWidth, 346 | color: "#7c8faf", 347 | marginLeft: 20 * unitWidth, 348 | marginRight: 10 * unitWidth, 349 | lineHeight: 36 * unitWidth, 350 | alignSelf: 'center' 351 | 352 | }, 353 | tex9: { 354 | width: 554 * unitWidth, 355 | fontSize: 28 * unitWidth, 356 | color: "#7c8faf", 357 | marginLeft: 20 * unitWidth, 358 | marginRight: 10 * unitWidth, 359 | lineHeight: 36 * unitWidth, 360 | 361 | }, 362 | tex10: { 363 | fontSize: 28 * unitWidth, 364 | lineHeight: 50 * unitWidth, 365 | color: "#2a2c31", 366 | fontWeight: 'bold' 367 | }, 368 | tex11: { 369 | fontSize: 28 * unitWidth, 370 | lineHeight: 50 * unitWidth, 371 | color: "#626970", 372 | fontWeight: 'bold' 373 | }, 374 | tex12: { 375 | fontSize: 26 * unitWidth, 376 | color: "#626970", 377 | textAlign: 'center', 378 | marginTop: 10 * unitHeight, 379 | }, 380 | tex13: { 381 | fontSize: 20 * unitWidth, 382 | color: "#347cdf", 383 | textAlign: 'center', 384 | marginTop: 18 * unitHeight 385 | }, 386 | tex14: { 387 | fontSize: 20 * unitWidth, 388 | color: "#347cdf", 389 | fontWeight: 'bold', 390 | textAlign: 'center', 391 | marginTop: 10 * unitHeight 392 | }, 393 | tex15: { 394 | fontSize: 20 * unitWidth, 395 | color: "#347cdf", 396 | textAlign: 'center' 397 | }, 398 | img2: { 399 | width: 750 * unitWidth, 400 | height: 471 * unitWidth 401 | }, 402 | img3: { 403 | width: 46 * unitWidth, 404 | height: 46 * unitWidth, 405 | }, 406 | notes_styles: { 407 | flexDirection: 'row', 408 | marginTop: 45 * unitWidth, 409 | alignItems: 'center' 410 | }, 411 | push_styles: { 412 | width: 46 * unitWidth, 413 | height: 26 * unitWidth, 414 | 415 | }, 416 | noets_text_styles: { 417 | fontSize: 28 * unitWidth, 418 | lineHeight: 50 * unitWidth, 419 | color: "#2a2c31", 420 | marginLeft: 20 * unitWidth, 421 | marginRight: 20 * unitWidth, 422 | fontWeight: 'bold' 423 | }, 424 | linestyles: { 425 | width: 165 * unitWidth, 426 | height: 3 * unitWidth, 427 | backgroundColor: "#ffd4a0", 428 | }, 429 | rope_styles: { 430 | flexDirection: 'row', 431 | width: 545 * unitWidth, 432 | height: 112 * unitWidth, 433 | marginRight: 47 * unitWidth, 434 | marginLeft: 47 * unitWidth, 435 | justifyContent: 'space-between', 436 | alignItems: 'center', 437 | position: 'absolute', 438 | marginTop: -75 * unitWidth 439 | } 440 | }); -------------------------------------------------------------------------------- /Login.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | DeviceEventEmitter, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | TouchableOpacity, 9 | TextInput, 10 | ActivityIndicator 11 | } from 'react-native'; 12 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 13 | import { Actions } from 'react-native-router-flux' 14 | import ClickUtil from '../Utils/ClickUtil.js'; 15 | import CommUtils from '../Utils/CommUtils.js'; 16 | import local from '../Utils/StorageUtils.js'; 17 | import CookieManager from 'react-native-cookies'; 18 | import { toastShort } from '../Utils/ToastUtils.js'; 19 | import DeviceInfo from 'react-native-device-info'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | import CountdownUtil from '../Utils/CountdownUtil.js'; 22 | 23 | export default class Login extends Component { 24 | constructor(props) { 25 | super(props) 26 | this.state = { 27 | phonetel: '', 28 | password: '', 29 | pwdLogin_flag: true, 30 | code: '', 31 | textcode: '发送验证码', 32 | textcode_flag: true, 33 | placeholder: '请输入密码', 34 | requset_flag: false, 35 | isloading: false, 36 | iscodeloading: false, 37 | keyboardType: '', 38 | 39 | } 40 | } 41 | componentWillUnmount() { 42 | CountdownUtil.stop() 43 | } 44 | render() { 45 | return 46 | 47 | 48 | 49 | 50 | 51 | {this.state.pwdLogin_flag ? 52 | ( 53 | 密码登录 54 | 验证码登录 55 | ) : 56 | ( 57 | 验证码登录 58 | 密码登录 59 | ) 60 | } 61 | 62 | 手机号/邮箱 63 | { 68 | this.setState({ 69 | phonetel: tel, 70 | }) 71 | }} /> 72 | {!this.state.pwdLogin_flag ? 73 | ( 74 | 75 | {this.state.iscodeloading ? : {this.state.textcode}} 80 | 81 | ) : () 82 | } 83 | 84 | 85 | {!this.state.pwdLogin_flag ? (验证码) : (密码)} 86 | {!this.state.pwdLogin_flag ? 87 | { 92 | this.setState({ 93 | password: pwd 94 | }) 95 | }} /> : 96 | { 101 | this.setState({ 102 | password: pwd 103 | }) 104 | }} />} 105 | 106 | 107 | 108 | 109 | {this.state.pwdLogin_flag ? ( 110 | 忘记密码? 111 | ) : ()} 112 | 113 | 114 | {this.state.isloading ? : null} 119 | 120 | 121 | 登录 122 | 123 | 124 | 125 | 126 | 注册 127 | 128 | 129 | 130 | } 131 | onCodeLogin() { 132 | this.setState({ 133 | pwdLogin_flag: false, 134 | }) 135 | } 136 | onpwdLogin() { 137 | this.setState({ 138 | pwdLogin_flag: true, 139 | }) 140 | } 141 | onCode() { 142 | if (ClickUtil.noDoubleClick()) { 143 | if (CommUtils.isTextEmpty(this.state.phonetel)) { 144 | return toastShort('手机号/邮箱不能为空') 145 | } else { 146 | if (CommUtils.isPhoneAvailable(this.state.phonetel) || CommUtils.isEmail(this.state.phonetel)) { 147 | if (!this.state.textcode_flag) { 148 | return; 149 | } 150 | this.setState({ 151 | textcode_flag: false 152 | }) 153 | this.CodeApi(this.state.phonetel) 154 | } else { 155 | return toastShort('请输入正确的手机号/邮箱') 156 | } 157 | } 158 | } 159 | } 160 | 161 | goback() { 162 | DeviceEventEmitter.emit('me', true) 163 | Actions.pop(); 164 | } 165 | goForget_Password() { 166 | Actions.forget_password(); 167 | } 168 | goRegister() { 169 | Actions.register(); 170 | } 171 | 172 | 173 | const styles = StyleSheet.create({ 174 | container: { 175 | flex: 1, 176 | paddingLeft: 61 * unitWidth, 177 | paddingRight: 55 * unitWidth, 178 | paddingTop: 51 * unitWidth, 179 | backgroundColor: '#fff' 180 | }, 181 | outimagestyles: { 182 | width: 48 * unitWidth, 183 | height: 48 * unitWidth, 184 | backgroundColor: "#e0e4e5", 185 | borderRadius: 16, 186 | justifyContent: 'center', 187 | 188 | }, 189 | outtextstyles: { 190 | color: '#fff', 191 | fontSize: 20 * unitWidth, 192 | alignItems: 'center', 193 | textAlign: 'center' 194 | }, 195 | login_V1: { 196 | marginTop: 64 * unitWidth, 197 | flexDirection: 'row', 198 | alignItems: 'center' 199 | }, 200 | logintextstyles: { 201 | fontSize: 44 * unitWidth, 202 | // lineHeight: 50 * unitWidth, 203 | color: "#21262c", 204 | // fontFamily: "PingFangTC-Semibold", 205 | }, 206 | logintextstyles1: { 207 | fontSize: 34 * unitWidth, 208 | // lineHeight: 50 * unitWidth, 209 | color: "#626970", 210 | // fontFamily: "PingFang-SC-Regular", 211 | marginLeft: 39 * unitWidth 212 | }, 213 | login_V2: { 214 | marginTop: 119 * unitWidth, 215 | }, 216 | phonetextstyles: { 217 | fontSize: 30 * unitWidth, 218 | lineHeight: 50 * unitWidth, 219 | // fontFamily: "PingFangTC", 220 | color: "#626970" 221 | }, 222 | phoneTextInputstyles: { 223 | fontSize: 40 * unitWidth, 224 | borderBottomWidth: 2 * unitWidth, 225 | borderColor: '#efefef' 226 | 227 | 228 | }, 229 | login_V3: { 230 | marginTop: 49 * unitWidth, 231 | }, 232 | login_V4: { 233 | marginTop: 24 * unitWidth, 234 | }, 235 | forgetpasswordstyles: { 236 | fontSize: 28 * unitWidth, 237 | lineHeight: 50 * unitWidth, 238 | color: "#626970", 239 | // fontFamily: "PingFangTC", 240 | textAlign: 'right' 241 | }, 242 | 243 | login_text: { 244 | color: "#ffffff", 245 | fontSize: 30 * unitWidth, 246 | lineHeight: 50 * unitWidth, 247 | // fontFamily: "PingFangTC-Semibold", 248 | textAlign: 'center' 249 | }, 250 | login_V6: { 251 | marginTop: 54 * unitWidth 252 | }, 253 | register_text: { 254 | // fontFamily: "PingFangTC-Semibold", 255 | color: "#21262c", 256 | fontSize: 32 * unitWidth, 257 | lineHeight: 50 * unitWidth, 258 | textAlign: 'center' 259 | }, 260 | backximgstyles: { 261 | width: 48 * unitWidth, 262 | height: 48 * unitWidth, 263 | alignItems: 'flex-end' 264 | }, 265 | verificationcodetextstyles: { 266 | lineHeight: 50 * unitWidth, 267 | fontSize: 26 * unitWidth, 268 | color: "#ffffff", 269 | // fontFamily: "PingFangTC", 270 | textAlign: 'center' 271 | }, 272 | 273 | }); -------------------------------------------------------------------------------- /Money/Apprentice.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | ActivityIndicator, 11 | DeviceEventEmitter 12 | } from 'react-native'; 13 | import { Actions } from 'react-native-router-flux' 14 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 15 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 16 | import ClickUtil from '../Utils/ClickUtil.js'; 17 | import local from '../Utils/StorageUtils.js'; 18 | import NetUtils from '../Utils/NetUtils.js' 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | export default class Apprentice extends Component { 21 | constructor(props) { 22 | super(props) 23 | this.state = { 24 | data: [], 25 | flag: true, 26 | isloading: false 27 | } 28 | } 29 | componentDidMount() { 30 | this.onMyTaskApi() 31 | } 32 | _renderItem = ({ item }) => ( 33 | 34 | 35 | 18848562323 36 | 37 | +10 算力 38 | +10 APT 39 | 40 | 41 | 42 | ) 43 | render() { 44 | return 45 | Actions.pop()} underlayColor='#fff'> 46 | 47 | 48 | 我的徒弟 49 | 50 | 51 | 52 | 53 | 54 | 总徒弟数 5 55 | {this.state.isloading ? : } 56 | index.toString()} 59 | renderItem={this._renderItem} 60 | /> 61 | 62 | 63 | 64 | } 65 | 66 | } 67 | const styles = StyleSheet.create({ 68 | container: { 69 | flex: 1, 70 | backgroundColor: '#fff' 71 | }, 72 | Text7: { 73 | fontSize: 30 * unitWidth, 74 | marginTop: 30 * unitHeight, 75 | marginLeft: 34 * unitWidth, 76 | fontFamily: "PingFangHeiTC-W8-Proportionl", 77 | color: "#626970" 78 | }, 79 | Text8: { 80 | fontSize: 30 * unitWidth, 81 | fontFamily: "PingFangHeiTC-W8-Proportionl", 82 | color: "rgb(53,126,220)" 83 | }, 84 | viewstyles1: { 85 | marginTop: 35 * unitHeight, 86 | backgroundColor: 'rgb(241,240,246)', 87 | flex: 1 88 | 89 | }, 90 | viewstyles2: { 91 | marginTop: 25 * unitHeight, 92 | width: 690 * unitWidth, 93 | height: 190 * unitWidth, 94 | backgroundColor: '#fff', 95 | borderRadius: 20 * unitWidth, 96 | alignSelf: 'center', 97 | flexDirection: 'row', 98 | marginBottom: 5 * unitHeight 99 | }, 100 | viewstyles3: { 101 | marginLeft: 20 * unitWidth, 102 | marginRight: 20 * unitWidth, 103 | marginTop: 35 * unitHeight 104 | 105 | }, 106 | viewstyles4: { 107 | marginLeft: 36 * unitWidth, 108 | marginTop: 30 * unitHeight, 109 | }, 110 | Image: { 111 | width: 24 * unitWidth, 112 | height: 41 * unitHeight, 113 | alignSelf: 'flex-end', 114 | marginLeft: 30 * unitWidth 115 | }, 116 | txt1: { 117 | fontSize: 34 * unitWidth, 118 | fontFamily: "PingFangTC-Semibold", 119 | color: "#21262c", 120 | fontWeight: 'bold', 121 | alignSelf: 'center', 122 | textAlign: 'center', 123 | }, 124 | Text2: { 125 | fontSize: 32 * unitWidth, 126 | fontFamily: "FZY4K--GBK1-0", 127 | color: "#2a2c31", 128 | fontWeight: 'bold' 129 | }, 130 | Text3: { 131 | fontSize: 30 * unitWidth, 132 | fontFamily: "PingFangTC-Semibold", 133 | color: "#ff121d", 134 | marginLeft: 7 * unitWidth 135 | }, 136 | Text4: { 137 | fontSize: 24 * unitWidth, 138 | fontFamily: "PingFangTC", 139 | color: "#33363b", 140 | textAlign: 'center', 141 | alignSelf: 'center' 142 | }, 143 | Text5: { 144 | marginTop: 24 * unitHeight, 145 | fontSize: 30 * unitWidth, 146 | fontFamily: "PingFangHeiTC-W8-Proportionl", 147 | color: "#ff121d", 148 | fontWeight: 'bold' 149 | }, 150 | Text6: { 151 | textAlign: 'center', 152 | alignSelf: 'center', 153 | position: 'absolute', 154 | right: 0, 155 | marginRight: 32 * unitWidth, 156 | fontSize: 26 * unitWidth, 157 | fontFamily: "PingFangHeiTC-W8-Proportionl", 158 | color: "#70df3a", 159 | fontWeight: 'bold' 160 | } 161 | }); -------------------------------------------------------------------------------- /Money/AuditTaskDetails.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | StatusBar, 10 | ScrollView, 11 | ImageBackground, 12 | TouchableHighlight 13 | } from 'react-native'; 14 | import LinearGradient from 'react-native-linear-gradient'; 15 | import { Actions } from 'react-native-router-flux' 16 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 17 | import ClickUtil from '../Utils/ClickUtil.js'; 18 | import local from '../Utils/StorageUtils.js'; 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | import CountDown from '../../CountDownReact.js' 22 | export default class AuditTaskDetails extends Component { 23 | constructor(props) { 24 | super(props) 25 | const item = this.props.item; 26 | this.state = { 27 | item: item, 28 | data: [], 29 | } 30 | 31 | } 32 | _renderItem = ({ item }) => ( 33 | 34 | {item.sortId}.{item.detailsMsg} 35 | 36 | 37 | ) 38 | 39 | componentDidMount() { 40 | 41 | } 42 | render() { 43 | return 44 | 45 | 46 | Actions.pop()} underlayColor='#fff'> 47 | 48 | 49 | 任务详情 50 | 51 | 52 | 53 | 54 | 55 | 56 | {this.state.item.taskName} 57 | 下载APP获得100算力奖励 58 | 59 | 60 | {this.state.item.rewardType == 1?(奖励 {NetUtils.NumUtils(this.state.item.reward)}): 61 | (奖励 {this.state.item.reward})} 62 | 63 | 64 | 65 | 66 | 任务详情 67 | {this.state.item.createTime} 68 | index.toString()} 72 | renderItem={this._renderItem} 73 | /> 74 | 75 | 76 | 77 | 78 | 79 | 80 | 立即申请 81 | 82 | 立即提交 83 | 84 | 85 | 86 | } 87 | 88 | 89 | } 90 | const styles = StyleSheet.create({ 91 | container: { 92 | flex: 1, 93 | backgroundColor: '#fff' 94 | }, 95 | Imagestyles1: { 96 | width: "33.3%", 97 | height: 326 * unitHeight 98 | }, 99 | viewstyles1: { 100 | width: 690 * unitWidth, 101 | height: 180 * unitHeight, 102 | alignSelf: 'center', 103 | marginTop: 25 * unitHeight, 104 | borderRadius: 20 * unitWidth, 105 | flexDirection: 'row' 106 | }, 107 | viewstyles2: { 108 | width: 150 * unitWidth, 109 | height: 60 * unitHeight, 110 | marginLeft: 50 * unitWidth, 111 | backgroundColor: "#ffffff", 112 | borderRadius: 30 * unitWidth, 113 | alignSelf: 'center', 114 | shadowColor: "rgba(30, 62, 176, 0.27)", 115 | shadowOffset: { 116 | width: 0, 117 | height: 4 118 | }, 119 | shadowRadius: 9, 120 | shadowOpacity: 1, 121 | elevation: 1, 122 | justifyContent: 'center' 123 | 124 | }, 125 | viewstyles6: { 126 | width: "100%", 127 | height: 110 * unitHeight, 128 | flexDirection: 'row', 129 | justifyContent: 'center', 130 | alignItems: 'center', 131 | backgroundColor: "#3b98ff", 132 | position: 'absolute', 133 | bottom: 0 134 | }, 135 | viewstyles8: { 136 | width: 374 * unitWidth, 137 | height: 110 * unitHeight, 138 | justifyContent: 'center', 139 | 140 | // backgroundColor: "#3b98ff", 141 | shadowColor: "rgba(0, 0, 0, 0.15)", 142 | shadowOffset: { 143 | width: 0, 144 | height: 0 145 | }, 146 | shadowRadius: 8, 147 | shadowOpacity: 1, 148 | position: 'absolute', 149 | bottom: 0 150 | }, 151 | viewstyles7: { 152 | 153 | }, 154 | viewstyles4: { 155 | marginTop: 40 * unitHeight, 156 | marginLeft: 32 * unitWidth, 157 | flexDirection: 'row' 158 | }, 159 | viewstyles3: { 160 | flex: 1, 161 | marginTop: 25 * unitHeight, 162 | height: 1162 * unitHeight, 163 | width: 690 * unitWidth, 164 | backgroundColor: "#ffffff", 165 | alignSelf: 'center', 166 | borderRadius: 20 * unitWidth, 167 | marginBottom: 110 * unitHeight, 168 | 169 | }, 170 | viewstyles5: { 171 | marginLeft: 32 * unitWidth, 172 | marginRight: 32 * unitWidth, 173 | marginTop: 52 * unitHeight, 174 | flexDirection: 'row', 175 | justifyContent: 'space-between', 176 | }, 177 | Image: { 178 | width: 24 * unitWidth, 179 | height: 41 * unitHeight, 180 | alignSelf: 'flex-end', 181 | marginLeft: 30 * unitWidth 182 | }, 183 | Imagestyles: { 184 | width: 80 * unitWidth, 185 | height: 80 * unitHeight, 186 | marginLeft: 38 * unitWidth, 187 | marginTop: 48 * unitHeight 188 | }, 189 | txt1: { 190 | fontSize: 34 * unitWidth, 191 | fontFamily: "PingFangTC-Semibold", 192 | color: "#21262c", 193 | fontWeight: 'bold', 194 | alignSelf: 'center', 195 | textAlign: 'center', 196 | }, 197 | txt2: { 198 | fontSize: 32 * unitWidth, 199 | fontFamily: "FZY4K--GBK1-0", 200 | color: "#ffffff" 201 | }, 202 | txt3: { 203 | fontSize: 26 * unitWidth, 204 | fontFamily: "PingFangTC", 205 | color: "#ffffff", 206 | marginTop: 20 * unitHeight 207 | }, 208 | txt4: { 209 | fontSize: 24 * unitWidth, 210 | fontFamily: "PingFangTC-Semibold", 211 | color: "#3e5bc5", 212 | fontWeight: 'bold', 213 | textAlign: 'center' 214 | }, 215 | txt5: { 216 | marginTop: 40 * unitHeight, 217 | marginLeft: 32 * unitWidth, 218 | fontSize: 30 * unitWidth, 219 | fontFamily: "PingFangTC-Semibold", 220 | color: "#21262c", 221 | fontWeight: 'bold' 222 | }, 223 | txt6: { 224 | marginTop: 19 * unitHeight, 225 | marginLeft: 32 * unitWidth, 226 | fontSize: 26 * unitWidth, 227 | fontFamily: "OpenSans", 228 | color: "#838b97" 229 | }, 230 | txt7: { 231 | marginLeft: 32 * unitWidth, 232 | marginRight: 32 * unitWidth, 233 | marginTop: 29 * unitHeight, 234 | fontSize: 26 * unitWidth, 235 | fontFamily: "PingFangTC", 236 | color: "#21262c" 237 | }, 238 | txt8: { 239 | fontSize: 32 * unitWidth, 240 | fontFamily: "FZY4K--GBK1-0", 241 | color: "#ffffff", 242 | textAlign: 'center' 243 | } 244 | }); -------------------------------------------------------------------------------- /Money/CountDownReact.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | } from 'react'; 4 | 5 | import { 6 | StyleSheet, 7 | View, 8 | Text, 9 | Image, 10 | } from 'react-native'; 11 | import PropTypes from 'prop-types'; // ES6 12 | import { unitWidth, unitHeight } from './AdapterUtil.js'; 13 | const styles = StyleSheet.create({ 14 | cardItemTimeRemainTxt: { 15 | fontSize: 2 * unitWidth, 16 | color: "#ff2d41", 17 | textAlign: 'center', 18 | alignSelf: 'center', 19 | }, 20 | text: { 21 | fontSize: 2 * unitWidth, 22 | color: "#ff2d41", 23 | marginLeft: 7, 24 | textAlign: 'center', 25 | alignSelf: 'center', 26 | 27 | }, 28 | container: { 29 | flexDirection: 'row', 30 | justifyContent: 'center', 31 | alignSelf: 'center', 32 | alignItems: 'center' 33 | }, 34 | defaultTime: { 35 | paddingHorizontal: 3, 36 | backgroundColor: '#ff2d41', 37 | fontSize: 2 * unitWidth, 38 | color: "#ff2d41", 39 | marginHorizontal: 3, 40 | borderRadius: 2, 41 | textAlign: 'center', 42 | alignSelf: 'center', 43 | }, 44 | defaultColon: { 45 | fontSize: 2 * unitWidth, color: "#ff2d41" 46 | }, 47 | txt11: { 48 | fontSize: 22 * unitWidth, 49 | fontFamily: "PingFangTC", 50 | color: "#ff2d41", 51 | textAlign: 'center' 52 | }, 53 | }); 54 | 55 | class CountDown extends Component { 56 | static displayName = 'Simple countDown'; 57 | static propTypes = { 58 | date: PropTypes.string, 59 | days: PropTypes.objectOf(PropTypes.string), 60 | hours: PropTypes.string, 61 | mins: PropTypes.string, 62 | segs: PropTypes.string, 63 | onEnd: PropTypes.func, 64 | 65 | // containerStyle: View.propTypes.style, 66 | // daysStyle: View.propTypes.style, 67 | // hoursStyle: View.propTypes.style, 68 | // minsStyle: View.propTypes.style, 69 | // secsStyle: View.propTypes.style, 70 | // firstColonStyle: View.propTypes.style, 71 | // secondColonStyle: View.propTypes.style, 72 | 73 | }; 74 | static defaultProps = { 75 | date: new Date(), 76 | days: { 77 | plural: '天', 78 | singular: '天', 79 | }, 80 | hours: ':', 81 | mins: ':', 82 | segs: ':', 83 | onEnd: () => { }, 84 | 85 | containerStyle: styles.container,//container 的style 86 | daysStyle: styles.defaultTime, 87 | hoursStyle: styles.defaultTime, 88 | minsStyle: styles.defaultTime, 89 | secsStyle: styles.defaultTime, 90 | firstColonStyle: styles.defaultColon, 91 | secondColonStyle: styles.defaultColon, 92 | 93 | }; 94 | state = { 95 | days: 0, 96 | hours: 0, 97 | min: 0, 98 | sec: 0, 99 | }; 100 | componentDidMount() { 101 | 102 | //console.log(this.props.date);//"2017-03-29T00:00:00+00:00" 103 | this.interval = setInterval(() => { 104 | const date = this.getDateData(this.props.date); 105 | // alert('dada'+JSON.stringify(date)) 106 | if (date) { 107 | this.setState(date); 108 | } else { 109 | this.stop(); 110 | this.props.onEnd(); 111 | } 112 | }, 1000); 113 | } 114 | componentWillMount() { 115 | const date = this.getDateData(this.props.date); 116 | if (date) { 117 | this.setState(date); 118 | } 119 | 120 | } 121 | componentWillUnmount() { 122 | this.stop(); 123 | } 124 | getDateData(endDate) { 125 | let diff = (Date.parse(new Date(endDate)) - (480 * 60 * 1000) - Date.parse(new Date)) / 1000; 126 | if (diff <= 0) { 127 | return false; 128 | } 129 | 130 | const timeLeft = { 131 | years: 0, 132 | days: 0, 133 | hours: 0, 134 | min: 0, 135 | sec: 0, 136 | millisec: 0, 137 | }; 138 | 139 | if (diff >= (365.25 * 86400)) { 140 | timeLeft.years = Math.floor(diff / (365.25 * 86400)); 141 | diff -= timeLeft.years * 365.25 * 86400; 142 | } 143 | if (diff >= 86400) { 144 | timeLeft.days = Math.floor(diff / 86400); 145 | diff -= timeLeft.days * 86400; 146 | } 147 | if (diff >= 3600) { 148 | timeLeft.hours = Math.floor(diff / 3600); 149 | diff -= timeLeft.hours * 3600; 150 | } 151 | if (diff >= 60) { 152 | timeLeft.min = Math.floor(diff / 60); 153 | diff -= timeLeft.min * 60; 154 | } 155 | timeLeft.sec = diff; 156 | return timeLeft; 157 | } 158 | render() { 159 | const countDown = this.state; 160 | let days; 161 | if (countDown.days === 1) { 162 | days = this.props.days.singular; 163 | } else { 164 | days = this.props.days.plural; 165 | } 166 | return ( 167 | // 168 | // { 169 | // ((countDown.days > 0) ? this.leadingZeros(countDown.days)+days:'') 170 | // +this.leadingZeros(countDown.hours) 171 | // +':'+this.leadingZeros(countDown.min) 172 | // +':'+this.leadingZeros(countDown.sec)} 173 | // 174 | // 175 | 176 | 倒计时 177 | {(countDown.days > 0) ? {this.leadingZeros(countDown.days) + days} : null} 178 | {this.leadingZeros(countDown.hours)} 179 | : 180 | {this.leadingZeros(countDown.min)} 181 | : 182 | {this.leadingZeros(countDown.sec)} 183 | 184 | 185 | 186 | ); 187 | } 188 | stop() { 189 | clearInterval(this.interval); 190 | } 191 | leadingZeros(num, length = null) { 192 | 193 | let length_ = length; 194 | let num_ = num; 195 | if (length_ === null) { 196 | length_ = 2; 197 | } 198 | num_ = String(num_); 199 | while (num_.length < length_) { 200 | num_ = '0' + num_; 201 | } 202 | return num_; 203 | } 204 | }; 205 | 206 | export default CountDown; -------------------------------------------------------------------------------- /Money/DownLoadTaskDetails.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | StatusBar, 10 | ScrollView, 11 | ImageBackground, 12 | TouchableHighlight 13 | } from 'react-native'; 14 | import LinearGradient from 'react-native-linear-gradient'; 15 | import { Actions } from 'react-native-router-flux' 16 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 17 | import ClickUtil from '../Utils/ClickUtil.js'; 18 | import local from '../Utils/StorageUtils.js'; 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | import CountDown from '../../CountDownReact.js' 22 | export default class DownLoadTaskDetails extends Component { 23 | constructor(props) { 24 | super(props) 25 | const item = this.props.item; 26 | this.state = { 27 | 28 | } 29 | } 30 | componentDidMount() { 31 | 32 | } 33 | render() { 34 | return 35 | 36 | 37 | 38 | Actions.pop()} underlayColor='#fff'> 39 | 40 | 41 | 任务详情 42 | 43 | 44 | 45 | 46 | 47 | 48 | {this.state.item.taskName} 49 | 下载APP获得100算力奖励 50 | 51 | 52 | 53 | {this.state.item.rewardType == 1?(奖励 {NetUtils.NumUtils(this.state.item.reward)}): 54 | (奖励 {this.state.item.reward})} 55 | 56 | 57 | 58 | 59 | 任务详情 60 | {this.state.item.createTime} 61 | {this.state.item.taskDetails} 62 | 63 | 64 | 产品介绍 65 | 66 | {this.state.item.products} 67 | 68 | 69 | 玩法攻略 70 | 71 | {this.state.item.products} 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 立即下载 84 | 85 | 86 | } 87 | 88 | } 89 | const styles = StyleSheet.create({ 90 | container: { 91 | flex: 1, 92 | backgroundColor: '#fff' 93 | }, 94 | Imagestyles1: { 95 | width: "33.3%", 96 | height: 326 * unitHeight 97 | }, 98 | viewstyles1: { 99 | width: 690 * unitWidth, 100 | height: 180 * unitHeight, 101 | alignSelf: 'center', 102 | marginTop: 25 * unitHeight, 103 | borderRadius: 20 * unitWidth, 104 | flexDirection: 'row' 105 | }, 106 | viewstyles2: { 107 | width: 150 * unitWidth, 108 | height: 60 * unitHeight, 109 | marginLeft: 50 * unitWidth, 110 | backgroundColor: "#ffffff", 111 | borderRadius: 30 * unitWidth, 112 | alignSelf: 'center', 113 | shadowColor: "rgba(30, 62, 176, 0.27)", 114 | shadowOffset: { 115 | width: 0, 116 | height: 4 117 | }, 118 | shadowRadius: 9, 119 | shadowOpacity: 1, 120 | elevation: 1, 121 | justifyContent: 'center' 122 | 123 | }, 124 | viewstyles6: { 125 | width: 750 * unitWidth, 126 | height: 110 * unitHeight, 127 | justifyContent: 'center', 128 | backgroundColor: "#3b98ff", 129 | shadowColor: "rgba(0, 0, 0, 0.15)", 130 | shadowOffset: { 131 | width: 0, 132 | height: 0 133 | }, 134 | shadowRadius: 8, 135 | shadowOpacity: 1, 136 | position: 'absolute', 137 | bottom: 0 138 | }, 139 | viewstyles4: { 140 | marginTop: 40 * unitHeight, 141 | marginLeft: 32 * unitWidth, 142 | flexDirection: 'row' 143 | }, 144 | viewstyles3: { 145 | flex: 1, 146 | marginTop: 25 * unitHeight, 147 | width: 690 * unitWidth, 148 | height: 1162 * unitHeight, 149 | backgroundColor: "#ffffff", 150 | alignSelf: 'center', 151 | borderRadius: 20 * unitWidth, 152 | marginBottom: 110 * unitHeight, 153 | 154 | }, 155 | viewstyles5: { 156 | marginLeft: 32 * unitWidth, 157 | marginRight: 32 * unitWidth, 158 | marginTop: 52 * unitHeight, 159 | flexDirection: 'row', 160 | justifyContent: 'space-between', 161 | }, 162 | Image: { 163 | width: 24 * unitWidth, 164 | height: 41 * unitHeight, 165 | alignSelf: 'flex-end', 166 | marginLeft: 30 * unitWidth 167 | }, 168 | Imagestyles: { 169 | width: 80 * unitWidth, 170 | height: 80 * unitHeight, 171 | marginLeft: 38 * unitWidth, 172 | marginTop: 48 * unitHeight 173 | }, 174 | txt1: { 175 | fontSize: 34 * unitWidth, 176 | fontFamily: "PingFangTC-Semibold", 177 | color: "#21262c", 178 | fontWeight: 'bold', 179 | alignSelf: 'center', 180 | textAlign: 'center', 181 | }, 182 | txt2: { 183 | fontSize: 32 * unitWidth, 184 | fontFamily: "FZY4K--GBK1-0", 185 | color: "#ffffff" 186 | }, 187 | txt3: { 188 | fontSize: 26 * unitWidth, 189 | fontFamily: "PingFangTC", 190 | color: "#ffffff", 191 | marginTop: 20 * unitHeight 192 | }, 193 | txt4: { 194 | fontSize: 24 * unitWidth, 195 | fontFamily: "PingFangTC-Semibold", 196 | color: "#3e5bc5", 197 | fontWeight: 'bold', 198 | textAlign: 'center' 199 | }, 200 | txt5: { 201 | marginTop: 40 * unitHeight, 202 | marginLeft: 32 * unitWidth, 203 | fontSize: 30 * unitWidth, 204 | fontFamily: "PingFangTC-Semibold", 205 | color: "#21262c", 206 | fontWeight: 'bold' 207 | }, 208 | txt6: { 209 | marginTop: 19 * unitHeight, 210 | marginLeft: 32 * unitWidth, 211 | fontSize: 26 * unitWidth, 212 | fontFamily: "OpenSans", 213 | color: "#838b97" 214 | }, 215 | txt7: { 216 | marginLeft: 32 * unitWidth, 217 | marginRight: 32 * unitWidth, 218 | marginTop: 29 * unitHeight, 219 | fontSize: 26 * unitWidth, 220 | fontFamily: "PingFangTC", 221 | color: "#21262c" 222 | }, 223 | txt8: { 224 | fontSize: 32 * unitWidth, 225 | fontFamily: "FZY4K--GBK1-0", 226 | color: "#ffffff", 227 | textAlign: 'center' 228 | } 229 | }); -------------------------------------------------------------------------------- /Money/FillCode.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | TouchableHighlight, 9 | TextInput 10 | } from 'react-native'; 11 | import LinearGradient from 'react-native-linear-gradient'; 12 | import { Actions } from 'react-native-router-flux' 13 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 14 | import local from '../Utils/StorageUtils.js'; 15 | import ClickUtil from '../Utils/ClickUtil.js'; 16 | import CommUtils from '../Utils/CommUtils.js'; 17 | import { toastShort } from '../Utils/ToastUtils.js'; 18 | import NetUtils from '../Utils/NetUtils.js' 19 | export default class FillCode extends Component { 20 | constructor(props) { 21 | super(props) 22 | this.state = { 23 | code: '' 24 | } 25 | } 26 | 27 | render() { 28 | return 29 | {/* heard */} 30 | Actions.pop()} underlayColor="#fff"> 31 | 32 | 33 | 34 | 35 | 填写邀请码 36 | 37 | 38 | 39 | 40 | 请填写师傅邀请码 41 | 42 | { 47 | this.setState({ 48 | code: x, 49 | }) 50 | }} /> 51 | 52 | 53 | 确定 54 | 55 | 56 | } 57 | } 58 | const styles = StyleSheet.create({ 59 | container: { 60 | flex: 1, 61 | backgroundColor: '#fff' 62 | }, 63 | styles_v1: { 64 | marginLeft: 30 * unitWidth, 65 | marginTop: 53 * unitWidth, 66 | flexDirection: 'row', 67 | alignItems: 'center', 68 | justifyContent: 'space-between', 69 | }, 70 | styles_v2: { 71 | marginTop: 56 * unitHeight, 72 | width: 631 * unitWidth, 73 | height: 81 * unitHeight, 74 | backgroundColor: "#3771ff", 75 | borderRadius: 40 * unitWidth, 76 | backgroundColor: "#3771ff", 77 | shadowColor: "rgba(86, 116, 255, 0.52)", 78 | shadowOffset: { 79 | width: 0, 80 | height: 2.5 81 | }, 82 | shadowRadius: 6.5, 83 | shadowOpacity: 1, 84 | elevation: 1, 85 | alignSelf: 'center', 86 | justifyContent: 'center' 87 | 88 | }, 89 | backstyles: { 90 | width: 24 * unitWidth, 91 | height: 41 * unitWidth, 92 | }, 93 | textstyles: { 94 | fontSize: 34 * unitWidth, 95 | lineHeight: 50 * unitWidth, 96 | fontFamily: "PingFangTC-Semibold", 97 | color: "#21262c", 98 | fontWeight: 'bold' 99 | }, 100 | txt1: { 101 | fontSize: 30 * unitWidth, 102 | fontFamily: "PingFangTC", 103 | color: "#626970", 104 | marginTop: 60 * unitHeight, 105 | marginLeft: 61 * unitWidth 106 | }, 107 | txt2: { 108 | fontSize: 32 * unitWidth, 109 | fontFamily: "PingFangTC-Semibold", 110 | color: "#ffffff", 111 | textAlign: 'center' 112 | }, 113 | Inputstyles: { 114 | marginTop: 40 * unitHeight, 115 | marginLeft: 61 * unitWidth, 116 | width: 630 * unitWidth, 117 | borderBottomWidth: 2 * unitWidth, 118 | borderColor: '#efefef', 119 | fontWeight: 'bold', 120 | // fontSize:44*unitWidth 121 | 122 | 123 | } 124 | }); -------------------------------------------------------------------------------- /Money/Home.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | Dimensions, 11 | TextInput, 12 | StatusBar, 13 | ScrollView 14 | } from 'react-native'; 15 | import Swiper from 'react-native-swiper'; 16 | import { Actions } from 'react-native-router-flux' 17 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 18 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 19 | import ClickUtil from '../Utils/ClickUtil.js'; 20 | import local from '../Utils/StorageUtils.js'; 21 | import NetUtils from '../Utils/NetUtils.js' 22 | import { toastShort } from '../Utils/ToastUtils.js'; 23 | export default class Home extends Component { 24 | constructor(props) { 25 | super(props); 26 | this.onMoneyHide = this.onMoneyHide.bind(this); 27 | this.state = { 28 | 29 | } 30 | } 31 | componentWillReceiveProps(nextProps) { 32 | 33 | 34 | } 35 | 36 | componentDidMount() { 37 | 38 | } 39 | // banner 40 | renderSwiper() { 41 | var itemArr = []; 42 | for (var i = 0; i < this.state.imagelist.length; i++) { 43 | let data = this.state.imagelist[i]; 44 | itemArr.push( 45 | 46 | 47 | 48 | ); 49 | } 50 | return itemArr; 51 | } 52 | //item 53 | _renderItem = ({ item }) => ( 54 | 55 | 56 | 57 | {item.rewardType == 1 ? ( 58 | {item.taskName} 59 | {NetUtils.NumUtils(item.reward)} 60 | APT 61 | ) : ( 62 | {item.taskName} 63 | {item.reward} 64 | 算力 65 | )} 66 | 67 | 点击视频查看奖励~ 68 | 69 | 已有 70 | {item.taskRewardumber} 71 | 人获得奖励 72 | 73 | 74 | 75 | 观看视频 >> 76 | 77 | 78 | 79 | 80 | 81 | ) 82 | render() { 83 | 84 | return 85 | 86 | 210 | 211 | } 212 | } 213 | 214 | const Styles = StyleSheet.create({ 215 | container: { 216 | flex: 1, 217 | paddingTop: 53 * unitWidth, 218 | backgroundColor: '#fff', 219 | 220 | }, 221 | home_v1: { 222 | flexDirection: "row", 223 | alignSelf: 'center', 224 | paddingRight: 28 * unitWidth, 225 | paddingLeft: 28 * unitWidth, 226 | }, 227 | home_v2: { 228 | flexDirection: "row", 229 | elevation: 1.5, 230 | shadowColor: 'rgba(228, 227, 236, 0.86)', 231 | shadowOffset: { width: 0, height: 0 }, 232 | shadowOpacity: 1, 233 | shadowRadius: 10 * unitWidth, 234 | height: 92 * unitWidth, 235 | width: 697 * unitWidth, 236 | borderRadius: 10 * unitWidth, 237 | alignItems: 'center', 238 | backgroundColor: '#fff', 239 | alignSelf: 'center' 240 | 241 | // borderColor:'black' 242 | }, 243 | home_v3: { 244 | flexDirection: "row", 245 | marginTop: 38 * unitWidth, 246 | paddingRight: 28 * unitWidth, 247 | paddingLeft: 28 * unitWidth, 248 | }, 249 | home_v4: { 250 | flexDirection: 'row', 251 | elevation: 1, 252 | shadowColor: "rgba(228, 227, 236, 0.86)", 253 | shadowOffset: { width: 0, height: 0 }, 254 | shadowOpacity: 1, 255 | shadowRadius: 20 * unitWidth, 256 | height: 261 * unitWidth, 257 | width: 697 * unitWidth, 258 | borderRadius: 20 * unitWidth, 259 | alignItems: 'center', 260 | backgroundColor: '#fff', 261 | marginBottom: 30 * unitWidth, 262 | alignSelf: 'center', 263 | marginTop: 10 * unitHeight 264 | 265 | }, 266 | wrapper: { 267 | height: 349 * unitWidth, 268 | width: 750 * unitWidth, 269 | }, 270 | paginationStyle: { 271 | bottom: 0, 272 | }, 273 | dotStyle: { 274 | width: 22, 275 | height: 3, 276 | backgroundColor: '#fff', 277 | opacity: 0.4, 278 | borderRadius: 0, 279 | }, 280 | activeDotStyle: { 281 | width: 22, 282 | height: 3, 283 | backgroundColor: '#fff', 284 | borderRadius: 0, 285 | }, 286 | bannerImg: { 287 | height: unitWidth * 320, 288 | width: unitWidth * 697, 289 | borderRadius: 8, 290 | resizeMode: 'contain', 291 | 292 | }, 293 | }); -------------------------------------------------------------------------------- /Money/Login.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | DeviceEventEmitter, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | TouchableOpacity, 9 | TextInput, 10 | ActivityIndicator 11 | } from 'react-native'; 12 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 13 | import { Actions } from 'react-native-router-flux' 14 | import ClickUtil from '../Utils/ClickUtil.js'; 15 | import CommUtils from '../Utils/CommUtils.js'; 16 | import local from '../Utils/StorageUtils.js'; 17 | import CookieManager from 'react-native-cookies'; 18 | import { toastShort } from '../Utils/ToastUtils.js'; 19 | import DeviceInfo from 'react-native-device-info'; 20 | import NetUtils from '../Utils/NetUtils.js' 21 | import CountdownUtil from '../Utils/CountdownUtil.js'; 22 | 23 | export default class Login extends Component { 24 | constructor(props) { 25 | super(props) 26 | this.state = { 27 | phonetel: '', 28 | password: '', 29 | pwdLogin_flag: true, 30 | code: '', 31 | textcode: '', 32 | textcode_flag: true, 33 | placeholder: '', 34 | requset_flag: false, 35 | isloading: false, 36 | iscodeloading: false, 37 | keyboardType: '', 38 | 39 | } 40 | } 41 | componentWillUnmount() { 42 | CountdownUtil.stop() 43 | } 44 | render() { 45 | return 46 | 47 | 48 | 49 | 50 | 51 | {this.state.pwdLogin_flag ? 52 | ( 53 | 密码登录 54 | 验证码登录 55 | ) : 56 | ( 57 | 验证码登录 58 | 密码登录 59 | ) 60 | } 61 | 62 | 手机号/邮箱 63 | { 68 | this.setState({ 69 | phonetel: tel, 70 | }) 71 | }} /> 72 | {!this.state.pwdLogin_flag ? 73 | ( 74 | 75 | {this.state.iscodeloading ? : {this.state.textcode}} 80 | 81 | ) : () 82 | } 83 | 84 | 85 | {!this.state.pwdLogin_flag ? (验证码) : (密码)} 86 | {!this.state.pwdLogin_flag ? 87 | { 92 | this.setState({ 93 | password: pwd 94 | }) 95 | }} /> : 96 | { 101 | this.setState({ 102 | password: pwd 103 | }) 104 | }} />} 105 | 106 | 107 | 108 | 109 | {this.state.pwdLogin_flag ? ( 110 | 忘记密码? 111 | ) : ()} 112 | 113 | 114 | {this.state.isloading ? : null} 119 | 120 | 121 | 登录 122 | 123 | 124 | 125 | 126 | 注册 127 | 128 | 129 | 130 | } 131 | } 132 | const styles = StyleSheet.create({ 133 | container: { 134 | flex: 1, 135 | paddingLeft: 61 * unitWidth, 136 | paddingRight: 55 * unitWidth, 137 | paddingTop: 51 * unitWidth, 138 | backgroundColor: '#fff' 139 | }, 140 | outimagestyles: { 141 | width: 48 * unitWidth, 142 | height: 48 * unitWidth, 143 | backgroundColor: "#e0e4e5", 144 | borderRadius: 16, 145 | justifyContent: 'center', 146 | 147 | }, 148 | outtextstyles: { 149 | color: '#fff', 150 | fontSize: 20 * unitWidth, 151 | alignItems: 'center', 152 | textAlign: 'center' 153 | }, 154 | login_V1: { 155 | marginTop: 64 * unitWidth, 156 | flexDirection: 'row', 157 | alignItems: 'center' 158 | }, 159 | logintextstyles: { 160 | fontSize: 44 * unitWidth, 161 | // lineHeight: 50 * unitWidth, 162 | color: "#21262c", 163 | fontFamily: "PingFangTC-Semibold", 164 | }, 165 | logintextstyles1: { 166 | fontSize: 34 * unitWidth, 167 | // lineHeight: 50 * unitWidth, 168 | color: "#626970", 169 | fontFamily: "PingFang-SC-Regular", 170 | marginLeft: 39 * unitWidth 171 | }, 172 | login_V2: { 173 | marginTop: 119 * unitWidth, 174 | }, 175 | phonetextstyles: { 176 | fontSize: 30 * unitWidth, 177 | lineHeight: 50 * unitWidth, 178 | fontFamily: "PingFangTC", 179 | color: "#626970" 180 | }, 181 | phoneTextInputstyles: { 182 | fontSize: 40 * unitWidth, 183 | borderBottomWidth: 2 * unitWidth, 184 | borderColor: '#efefef' 185 | 186 | 187 | }, 188 | login_V3: { 189 | marginTop: 49 * unitWidth, 190 | }, 191 | login_V4: { 192 | marginTop: 24 * unitWidth, 193 | }, 194 | forgetpasswordstyles: { 195 | fontSize: 28 * unitWidth, 196 | lineHeight: 50 * unitWidth, 197 | color: "#626970", 198 | fontFamily: "PingFangTC", 199 | textAlign: 'right' 200 | }, 201 | login_V5: { 202 | marginTop: 65 * unitWidth, 203 | width: 631 * unitWidth, 204 | height: 81 * unitWidth, 205 | backgroundColor: "#3771ff", 206 | alignSelf: 'center', 207 | justifyContent: 'center', 208 | borderRadius: 16, 209 | 210 | }, 211 | login_text: { 212 | color: "#ffffff", 213 | fontSize: 30 * unitWidth, 214 | lineHeight: 50 * unitWidth, 215 | fontFamily: "PingFangTC-Semibold", 216 | textAlign: 'center' 217 | }, 218 | login_V6: { 219 | marginTop: 54 * unitWidth 220 | }, 221 | register_text: { 222 | fontFamily: "PingFangTC-Semibold", 223 | color: "#21262c", 224 | fontSize: 32 * unitWidth, 225 | lineHeight: 50 * unitWidth, 226 | textAlign: 'center' 227 | }, 228 | backximgstyles: { 229 | width: 48 * unitWidth, 230 | height: 48 * unitWidth, 231 | alignItems: 'flex-end' 232 | }, 233 | verificationcodetextstyles: { 234 | lineHeight: 50 * unitWidth, 235 | fontSize: 26 * unitWidth, 236 | color: "#ffffff", 237 | fontFamily: "PingFangTC", 238 | textAlign: 'center' 239 | }, 240 | verificationcodestyles: { 241 | width: 200 * unitWidth, 242 | height: 60 * unitWidth, 243 | backgroundColor: "#3771ff", 244 | alignSelf: 'center', 245 | marginTop: 40 * unitWidth, 246 | justifyContent: 'center', 247 | borderRadius: 16, 248 | 249 | 250 | 251 | }, 252 | }); -------------------------------------------------------------------------------- /Money/Money.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | StatusBar, 10 | ScrollView, 11 | ImageBackground 12 | } from 'react-native'; 13 | import LinearGradient from 'react-native-linear-gradient'; 14 | //导入路由操作 15 | import { Actions } from 'react-native-router-flux' 16 | //导入适配 17 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 18 | //导入防止点击工具类 19 | import ClickUtil from '../Utils/ClickUtil.js'; 20 | import local from '../Utils/StorageUtils.js'; 21 | import { toastShort } from '../Utils/ToastUtils.js'; 22 | import NetUtils from '../Utils/NetUtils.js' 23 | import CountDown from '../../CountDownReact.js' 24 | export default class Money extends Component { 25 | constructor(props) { 26 | super(props) 27 | this.state = { 28 | flag: true 29 | } 30 | } 31 | _renderItem = ({ item: num }) => ( 32 | 33 | 34 | 第一期兑换 35 | 36 | {/* 倒计时 124:45:20 */} 37 | { this.setState({ 45 | flag:false 46 | })}} // 结束回调 47 | /> 48 | 49 | 50 | 51 | 52 | 53 | 1ETH = 100000 APT 54 | 兑换率 55 | 56 | 57 | 58 | 59 | 60 | 剩余 664520 61 | 10000000 62 | 63 | 64 | 65 | {this.state.flag ? ( 66 | 立即兑换 67 | ) : 68 | ( 69 | 立即兑换 70 | )} 71 | 72 | 73 | ) 74 | render() { 75 | return 76 | 77 | {/* 头部 */} 78 | 126 | 127 | } 128 | } 129 | const styles = StyleSheet.create({ 130 | container: { 131 | flex: 1, 132 | backgroundColor: '#fff' 133 | }, 134 | ImageBackgroundstyles: { 135 | width: null, 136 | height: 606 * unitWidth 137 | }, 138 | viewstyles1: { 139 | width: 690 * unitWidth, 140 | height: 645 * unitWidth, 141 | marginTop: 34 * unitWidth, 142 | alignSelf: 'center', 143 | backgroundColor: "#ffffff", 144 | borderRadius: 20 * unitWidth, 145 | shadowColor: "rgba(211, 228, 252, 0.86)", 146 | shadowOffset: { 147 | width: 0, 148 | height: 3 149 | }, 150 | shadowRadius: 5, 151 | shadowOpacity: 2, 152 | elevation: 3 153 | }, 154 | viewstyles2: { 155 | marginTop: 29 * unitWidth, 156 | width: 350 * unitWidth, 157 | height: 54 * unitWidth, 158 | borderRadius: 27 * unitWidth, 159 | backgroundColor: "#f3f5f9", 160 | alignSelf: 'center', 161 | justifyContent: 'center' 162 | }, 163 | viewstyles3: { 164 | flexDirection: 'row', 165 | justifyContent: 'center' 166 | }, 167 | viewstyles4: { 168 | marginTop: 30 * unitWidth, 169 | 170 | }, 171 | viewstyles5: { 172 | marginTop: 30 * unitWidth, 173 | }, 174 | viewstyles6: { 175 | width: 260 * unitWidth, 176 | height: 82 * unitWidth, 177 | marginTop: 34 * unitWidth, 178 | borderRadius: 5 * unitWidth, 179 | backgroundColor: "#e7ecf8", 180 | justifyContent: 'center' 181 | }, 182 | viewstyles7: { 183 | width: 260 * unitWidth, 184 | height: 82 * unitWidth, 185 | marginTop: 34 * unitWidth, 186 | borderRadius: 5 * unitWidth, 187 | backgroundColor: "rgb(55,113,255)", 188 | marginLeft: 39 * unitWidth, 189 | justifyContent: 'center' 190 | }, 191 | viewstyles8: { 192 | width: 690 * unitWidth, 193 | height: 435 * unitWidth, 194 | elevation: 2, 195 | borderRadius: 20 * unitWidth, 196 | backgroundColor: "#ffffff", 197 | shadowColor: "rgba(228, 227, 236, 0.86)", 198 | shadowOffset: { 199 | width: 0, 200 | height: 0 201 | }, 202 | shadowRadius: 20 * unitWidth, 203 | shadowOpacity: 1, 204 | alignSelf: 'center', 205 | marginBottom: 30 * unitWidth, 206 | marginTop: 10 * unitWidth 207 | 208 | }, 209 | viewstyles9: { 210 | flexDirection: 'row', 211 | marginLeft: 36 * unitWidth, 212 | marginTop: 37 * unitWidth 213 | }, 214 | viewstyles10: { 215 | borderRadius: 3 * unitWidth, 216 | backgroundColor: "#ffe8e8", 217 | width: 250 * unitWidth, 218 | height: 38 * unitWidth, 219 | alignSelf: 'center', 220 | marginLeft: 17 * unitWidth, 221 | justifyContent: "center" 222 | }, 223 | viewstyles11: { 224 | flexDirection: 'row', 225 | marginLeft: 36 * unitWidth, 226 | marginTop: 45 * unitWidth, 227 | }, 228 | viewstyles12: { 229 | marginTop: 50 * unitWidth, 230 | width: 550 * unitWidth, 231 | height: 72 * unitWidth, 232 | borderRadius: 34.5 * unitWidth, 233 | shadowColor: "rgba(86, 116, 255, 0.52)", 234 | shadowOffset: { 235 | width: 0, 236 | height: 2.5 237 | }, 238 | shadowRadius: 6.5, 239 | shadowOpacity: 1, 240 | alignSelf: 'center', 241 | justifyContent: 'center' 242 | }, 243 | txt1: { 244 | fontSize: 34 * unitWidth, 245 | fontFamily: "PingFangTC-Semibold", 246 | color: "#ffffff", 247 | marginTop: 50 * unitWidth, 248 | textAlign: 'center' 249 | }, 250 | txt2: { 251 | fontSize: 24 * unitWidth, 252 | fontFamily: "PingFangTC", 253 | color: "#626970", 254 | marginTop: 50 * unitWidth, 255 | textAlign: 'center' 256 | }, 257 | txt3: { 258 | fontSize: 60 * unitWidth, 259 | fontFamily: "Montserrat-Regular", 260 | color: "#34383d", 261 | marginTop: 27 * unitWidth, 262 | fontWeight: 'bold', 263 | textAlign: 'center' 264 | }, 265 | txt4: { 266 | fontSize: 26 * unitWidth, 267 | fontFamily: "PingFangTC", 268 | textAlign: 'center', 269 | color: "#195bfc" 270 | }, 271 | txt5: { 272 | fontSize: 26 * unitWidth, 273 | fontFamily: "PingFangTC", 274 | textAlign: 'center', 275 | color: "rgb(168,171,176)" 276 | }, 277 | txt6: { 278 | fontSize: 36 * unitWidth, 279 | fontFamily: "Montserrat-Regular", 280 | color: "#34383d", 281 | marginTop: 22 * unitWidth, 282 | textAlign: 'center' 283 | }, 284 | txt7: { 285 | fontSize: 30 * unitWidth, 286 | fontFamily: "PingFangTC", 287 | color: "#ffffff", 288 | textAlign: 'center' 289 | }, 290 | txt8: { 291 | fontSize: 30 * unitWidth, 292 | fontFamily: "PingFangTC", 293 | color: "#969dae", 294 | textAlign: 'center' 295 | }, 296 | txt9: { 297 | fontSize: 32 * unitWidth, 298 | fontFamily: "FZY4K--GBK1-0", 299 | color: "#2a2c31", 300 | fontWeight: 'bold', 301 | marginTop: 224 * unitWidth, 302 | marginLeft: 34 * unitWidth 303 | }, 304 | txt10: { 305 | fontSize: 32 * unitWidth, 306 | fontFamily: "FZY4K--GBK1-0", 307 | color: "#2a2c31", 308 | fontWeight: 'bold', 309 | }, 310 | txt11: { 311 | fontSize: 22 * unitWidth, 312 | fontFamily: "PingFangTC", 313 | color: "#ff2d41", 314 | textAlign: 'center' 315 | }, 316 | txt12: { 317 | fontSize: 36 * unitWidth, 318 | fontFamily: "FZY4K--GBK1-0", 319 | color: "#ff3e2a", 320 | fontWeight: 'bold' 321 | }, 322 | txt13: { 323 | fontSize: 33 * unitWidth, 324 | fontFamily: "Bebas", 325 | color: "#ff3e2a" 326 | }, 327 | txt14: { 328 | fontSize: 28 * unitWidth, 329 | fontFamily: "FZY4K--GBK1-0", 330 | color: "#ff3e2a" 331 | }, 332 | txt15: { 333 | fontSize: 24 * unitWidth, 334 | fontFamily: "PingFangTC", 335 | color: "#626970", 336 | marginTop: 18 * unitWidth 337 | }, 338 | txt16: { 339 | fontSize: 26 * unitWidth, 340 | fontFamily: "PingFangTC", 341 | color: "#34383d", 342 | marginTop: 18 * unitWidth, 343 | }, 344 | txt17: { 345 | fontSize: 34 * unitWidth, 346 | fontFamily: "Bebas", 347 | color: "#34383d", 348 | fontWeight: 'bold', 349 | }, 350 | txt18: { 351 | fontSize: 30 * unitWidth, 352 | fontFamily: "PingFangTC-Semibold", 353 | color: "#ffffff", 354 | textAlign: 'center' 355 | } 356 | }); -------------------------------------------------------------------------------- /Money/Msg.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | Dimensions, 11 | TextInput, 12 | StatusBar, 13 | ScrollView 14 | } from 'react-native'; 15 | 16 | import Swiper from 'react-native-swiper'; 17 | import { Actions } from 'react-native-router-flux' 18 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 19 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 20 | import ClickUtil from '../Utils/ClickUtil.js'; 21 | import local from '../Utils/StorageUtils.js'; 22 | import NetUtils from '../Utils/NetUtils.js' 23 | import { toastShort } from '../Utils/ToastUtils.js'; 24 | export default class Msg extends Component { 25 | constructor(props) { 26 | super(props) 27 | this.state = { 28 | data: [], 29 | flag: true 30 | } 31 | } 32 | componentDidMount() { 33 | this.onEmailApi() 34 | } 35 | _renderItem = ({ item }) => ( 36 | 37 | 39 | 40 | 41 | {item.emailTitle} 42 | {this.state.flag ? () : 43 | ()} 44 | 45 | {item.careateTime} 46 | 47 | {item.details} 48 | {item.publisher} 49 | 50 | 51 | ) 52 | render() { 53 | return 54 | 55 | Actions.pop()} underlayColor='#fff'> 56 | 57 | 58 | 系统消息 59 | 60 | 61 | 62 | 63 | index.toString()} 66 | renderItem={this._renderItem} 67 | /> 68 | 69 | 70 | } 71 | 72 | } 73 | const styles = StyleSheet.create({ 74 | container: { 75 | flex: 1, 76 | backgroundColor: '#fff' 77 | }, 78 | viewstyles1: { 79 | marginTop: 35 * unitHeight, 80 | backgroundColor: 'rgb(241,240,246)', 81 | flex: 1 82 | 83 | }, 84 | viewstyles2: { 85 | marginTop: 25 * unitHeight, 86 | width: 690 * unitWidth, 87 | height: 300 * unitWidth, 88 | backgroundColor: '#fff', 89 | borderRadius: 20 * unitWidth, 90 | alignSelf: 'center', 91 | flexDirection: 'row', 92 | marginBottom: 5 * unitHeight 93 | }, 94 | viewstyles3: { 95 | marginLeft: 20 * unitWidth, 96 | marginRight: 20 * unitWidth, 97 | marginTop: 35 * unitHeight 98 | 99 | }, 100 | Image: { 101 | width: 24 * unitWidth, 102 | height: 41 * unitHeight, 103 | alignSelf: 'flex-end', 104 | marginLeft: 30 * unitWidth 105 | }, 106 | txt1: { 107 | fontSize: 34 * unitWidth, 108 | fontFamily: "PingFangTC-Semibold", 109 | color: "#21262c", 110 | fontWeight: 'bold', 111 | alignSelf: 'center', 112 | textAlign: 'center', 113 | }, 114 | Text2: { 115 | fontSize: 30 * unitWidth, 116 | fontFamily: "PingFangTC-Semibold", 117 | color: "#21262c", 118 | fontWeight: 'bold' 119 | }, 120 | Text3: { 121 | fontSize: 24 * unitWidth, 122 | fontFamily: "PingFangTC", 123 | color: "#8e8f94", 124 | marginLeft: 150 * unitWidth 125 | }, 126 | Text4: { 127 | width: 550 * unitWidth, 128 | marginTop: 28 * unitHeight, 129 | fontSize: 26 * unitWidth, 130 | fontFamily: "PingFangTC", 131 | color: "#8e8f94" 132 | }, 133 | Text5: { 134 | marginTop: 29 * unitHeight, 135 | fontSize: 26 * unitWidth, 136 | fontFamily: "PingFangTC", 137 | color: "#8e8f94" 138 | } 139 | }); 140 | -------------------------------------------------------------------------------- /Money/Register.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | StyleSheet, 4 | Text, 5 | View, 6 | Image, 7 | TouchableOpacity, 8 | TextInput, 9 | ActivityIndicator 10 | } from 'react-native'; 11 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 12 | import { Actions } from 'react-native-router-flux' 13 | import ClickUtil from '../Utils/ClickUtil.js'; 14 | import CommUtils from '../Utils/CommUtils.js'; 15 | import { toastShort } from '../Utils/ToastUtils.js'; 16 | import NetUtils from '../Utils/NetUtils.js'; 17 | import CountdownUtil from '../Utils/CountdownUtil.js'; 18 | export default class Register extends Component { 19 | constructor(props) { 20 | super(props) 21 | this.onimage = this.onimage.bind(this) 22 | this.state = { 23 | select_flag: "no", 24 | telPhone: '', 25 | pwd: '', 26 | code: '', 27 | textcode: '发送验证码', 28 | textcode_flag: true, 29 | isloading:false 30 | } 31 | } 32 | render() { 33 | return 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 注册 43 | 44 | 45 | 46 | 手机号/邮箱 47 | 48 | { 53 | this.setState({ 54 | telPhone: x 55 | }) 56 | }} /> 57 | 58 | 59 | {this.state.iscodeloading ? : {this.state.textcode}} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 验证码 71 | { 76 | this.setState({ 77 | code: x 78 | }) 79 | }} /> 80 | 81 | 82 | 密码 83 | { 88 | this.setState({ 89 | pwd: x 90 | }) 91 | }} /> 92 | 93 | 94 | 95 | 96 | {this.state.select_flag != 'no' ? 97 | () : 98 | ()} 99 | 100 | Actions.agreement()}> 101 | 我已阅读并同意隐私政策协议 113 | 114 | 115 | {this.state.isloading ? : null} 120 | 121 | 122 | 注册 123 | 124 | 125 | 126 | 127 | 登录 128 | 129 | 130 | 131 | } 132 | goback() { 133 | Actions.pop(); 134 | } 135 | onimage() { 136 | if (this.state.select_flag === 'no') { 137 | this.setState({ 138 | select_flag: 'yes' 139 | }); 140 | } else { 141 | this.setState({ 142 | select_flag: 'no' 143 | }); 144 | } 145 | 146 | 147 | } 148 | 149 | } 150 | const styles = StyleSheet.create({ 151 | container: { 152 | flex: 1, 153 | paddingTop: 51 * unitWidth, 154 | paddingLeft: 60 * unitWidth, 155 | paddingRight: 60 * unitWidth, 156 | backgroundColor: '#fff' 157 | }, 158 | login_V6: { 159 | marginTop: 54 * unitWidth 160 | }, 161 | register_text: { 162 | fontFamily: "PingFangTC-Semibold", 163 | color: "#21262c", 164 | fontSize: 32 * unitWidth, 165 | lineHeight: 50 * unitWidth, 166 | textAlign: 'center' 167 | }, 168 | backximgstyles: { 169 | width: 48 * unitWidth, 170 | height: 48 * unitWidth, 171 | alignItems: 'flex-end' 172 | }, 173 | Register_V1: { 174 | marginTop: 67 * unitWidth 175 | }, 176 | Register_V2: { 177 | marginTop: 25 * unitWidth, 178 | flexDirection: 'row', 179 | alignItems: 'center' 180 | }, 181 | registertextstyles: { 182 | color: "#21262c", 183 | fontSize: 44 * unitWidth, 184 | lineHeight: 50 * unitWidth, 185 | fontFamily: "PingFangTC-Semibold", 186 | }, 187 | Forget_Password_v3: { 188 | marginTop: 119 * unitWidth, 189 | }, 190 | phoneTextInputstyles: { 191 | fontSize: 40 * unitWidth, 192 | borderBottomWidth: 2 * unitWidth, 193 | borderColor: '#efefef', 194 | width: 630 * unitWidth 195 | 196 | }, 197 | phonetextstyles: { 198 | fontSize: 30 * unitWidth, 199 | lineHeight: 50 * unitWidth, 200 | fontFamily: "PingFangTC", 201 | color: "#626970" 202 | }, 203 | verificationcodestyles: { 204 | width: 200 * unitWidth, 205 | height: 60 * unitWidth, 206 | backgroundColor: "#3771ff", 207 | alignSelf: 'center', 208 | marginTop: 40 * unitWidth, 209 | justifyContent: 'center', 210 | borderRadius: 16, 211 | elevation: 1, 212 | shadowColor: 'rgba(86, 116, 255, 0.52)', 213 | shadowOffset: { width: 0, height: 0 }, 214 | shadowOpacity: 0, 215 | shadowRadius: 8, 216 | position: 'absolute', 217 | right: 0, 218 | 219 | 220 | }, 221 | verificationcodetextstyles: { 222 | lineHeight: 50 * unitWidth, 223 | fontSize: 26 * unitWidth, 224 | color: "#ffffff", 225 | fontFamily: "PingFangTC", 226 | textAlign: 'center' 227 | }, 228 | Forget_Password_v4: { 229 | marginTop: 49 * unitWidth, 230 | }, 231 | Forget_Password_v5: { 232 | marginTop: 49 * unitWidth, 233 | }, 234 | login_V5: { 235 | marginTop: 65 * unitWidth, 236 | width: 631 * unitWidth, 237 | height: 81 * unitWidth, 238 | backgroundColor: "#3771ff", 239 | alignSelf: 'center', 240 | justifyContent: 'center', 241 | borderRadius: 16, 242 | elevation: 1, 243 | shadowColor: 'rgba(86, 116, 255, 0.52)', 244 | shadowOffset: { width: 0, height: 0 }, 245 | shadowOpacity: 0, 246 | shadowRadius: 8, 247 | }, 248 | login_text: { 249 | color: "#ffffff", 250 | fontSize: 30 * unitWidth, 251 | lineHeight: 50 * unitWidth, 252 | fontFamily: "PingFangTC-Semibold", 253 | textAlign: 'center' 254 | }, 255 | }); -------------------------------------------------------------------------------- /Money/Share.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | ActivityIndicator, 11 | DeviceEventEmitter, 12 | ScrollView, 13 | ImageBackground, 14 | TouchableOpacity, 15 | Linking, 16 | } from 'react-native'; 17 | import CameraRoll from "@react-native-community/cameraroll"; 18 | import { Actions } from 'react-native-router-flux' 19 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 20 | import ClickUtil from '../Utils/ClickUtil.js'; 21 | import local from '../Utils/StorageUtils.js'; 22 | import NetUtils from '../Utils/NetUtils.js' 23 | import { toastShort } from '../Utils/ToastUtils.js'; 24 | import LinearGradient from 'react-native-linear-gradient'; 25 | import QRCode from 'react-native-qrcode-svg'; 26 | import { captureScreen, captureRef } from 'react-native-view-shot'; 27 | import RNFS from 'react-native-fs'; 28 | import RNFetchBlob from 'rn-fetch-blob'; 29 | export default class Share extends Component { 30 | constructor(props) { 31 | super(props) 32 | this.mainViewRef = React.createRef(); 33 | this.state = { 34 | urlcode: NetUtils.Url() + 'InviteUser/getinviteHTML?code=' + this.props.code 35 | } 36 | } 37 | componentDidMount() { 38 | 39 | } 40 | componentWillUnmount() { 41 | RNScreenshotcatchUtil.stopListener() 42 | } 43 | render() { 44 | return 45 | 46 | {/* heard */} 47 | Actions.pop()} underlayColor="rgb(55,163,255)"> 48 | 49 | 50 | 51 | 52 | 53 | 54 | 分享海报 55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 67 | 68 | 保存图片 69 | 70 | 71 | 保存图片并分享至好友 72 | 73 | 74 | 75 | 76 | 微信好友 77 | 78 | 79 | 80 | 81 | 82 | 朋友圈 83 | 84 | 85 | 86 | 87 | 88 | QQ 89 | 90 | 91 | 92 | 93 | 94 | } 95 | 96 | } 97 | 98 | const styles = StyleSheet.create({ 99 | container: { 100 | flex: 1, 101 | }, 102 | styles_v1: { 103 | marginLeft: 30 * unitWidth, 104 | marginTop: 60 * unitWidth, 105 | flexDirection: 'row', 106 | alignItems: 'center', 107 | justifyContent: 'space-between' 108 | }, 109 | styles_v2: { 110 | width: 615 * unitWidth, 111 | height: 1020 * unitHeight, 112 | alignSelf: 'center', 113 | marginTop: 57 * unitHeight, 114 | 115 | }, 116 | styles_v3: { 117 | marginTop: 51 * unitHeight, 118 | backgroundColor: '#fff', 119 | alignSelf: 'center', 120 | width: 360 * unitWidth, 121 | height: 70 * unitHeight, 122 | borderRadius: 35 * unitWidth, 123 | shadowColor: "rgba(86, 116, 255, 0.52)", 124 | shadowOffset: { 125 | width: 0, 126 | height: 2.5 127 | }, 128 | shadowRadius: 35 * unitWidth, 129 | shadowOpacity: 1, 130 | elevation: 1, 131 | justifyContent: 'center' 132 | }, 133 | styles_v4: { 134 | width: 400 * unitWidth, 135 | flexDirection: 'row', 136 | alignSelf: 'center', 137 | marginBottom: 65 * unitHeight, 138 | marginTop: 40 * unitHeight, 139 | justifyContent: 'space-between' 140 | 141 | }, 142 | textstyles: { 143 | fontSize: 34 * unitWidth, 144 | lineHeight: 50 * unitWidth, 145 | fontFamily: "PingFangTC-Semibold", 146 | color: "#ffffff" 147 | }, 148 | backstyles: { 149 | width: 24 * unitWidth, 150 | height: 41 * unitWidth, 151 | }, 152 | txt: { 153 | fontSize: 28 * unitWidth, 154 | fontFamily: "PingFangTC-Semibold", 155 | color: "#357edc", 156 | textAlign: 'center', 157 | fontWeight: 'bold' 158 | }, 159 | txt1: { 160 | fontFamily: "PingFangTC", 161 | fontSize: 26 * unitWidth, 162 | color: "#ffffff", 163 | marginTop: 45 * unitHeight, 164 | textAlign: 'center' 165 | }, 166 | Imagestyles: { 167 | width: 80 * unitWidth, 168 | height: 80 * unitWidth, 169 | }, 170 | txt2: { 171 | fontSize: 17 * unitWidth, 172 | fontFamily: "MicrosoftYaHei", 173 | color: "#ffffff", 174 | marginTop: 20 * unitHeight, 175 | textAlign: 'center' 176 | } 177 | }); -------------------------------------------------------------------------------- /MyLoading.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import React from "react"; 4 | import { ActivityIndicator, StyleSheet, Text, View, Dimensions } from "react-native"; 5 | 6 | let width = Dimensions.get('window').width; 7 | let height = Dimensions.get('window').height; 8 | export default class MyLoading extends React.Component { 9 | constructor(props) { 10 | super(props); 11 | this.minShowingTime = 200; 12 | this.state = { 13 | isLoading: false, 14 | setIsLoading: (isLoading) => { 15 | if (isLoading != this.state.isLoading) { 16 | let curTimeLong = new Date().getTime(); 17 | if (isLoading) { 18 | this.startTime = curTimeLong; 19 | this.setState({ 20 | isLoading 21 | }); 22 | } else { 23 | let hasShowingTimeLong = curTimeLong - this.startTime; 24 | if (hasShowingTimeLong < this.minShowingTime) { 25 | setTimeout(() => { 26 | this.setState({ 27 | isLoading 28 | }); 29 | }, this.minShowingTime - hasShowingTimeLong); 30 | 31 | } else { 32 | this.setState({ 33 | isLoading 34 | }); 35 | } 36 | } 37 | 38 | } 39 | }, 40 | }; 41 | } 42 | 43 | showLoading = () => { 44 | this.state.setIsLoading(true); 45 | }; 46 | dismissLoading = () => { 47 | this.state.setIsLoading(false); 48 | 49 | }; 50 | 51 | render() { 52 | if (!this.state.isLoading) { 53 | return null; 54 | } 55 | return ( 56 | 64 | 65 | 66 | 请稍后... 67 | 68 | 69 | ) 70 | } 71 | } 72 | 73 | const styles = StyleSheet.create({ 74 | loading: { 75 | backgroundColor: '#10101099', 76 | height: 80, 77 | width: 100, 78 | borderRadius: 10, 79 | justifyContent: 'center', 80 | alignItems: 'center', 81 | position: 'absolute', 82 | top: (height - 80) / 2, 83 | left: (width - 100) / 2, 84 | }, 85 | 86 | loadingTitle: { 87 | marginTop: 10, 88 | fontSize: 14, 89 | color: 'white' 90 | } 91 | }); 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /MyTask.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | ActivityIndicator, 11 | DeviceEventEmitter 12 | } from 'react-native'; 13 | import { Actions } from 'react-native-router-flux' 14 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 15 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 16 | import ClickUtil from '../Utils/ClickUtil.js'; 17 | import local from '../Utils/StorageUtils.js'; 18 | import NetUtils from '../Utils/NetUtils.js' 19 | import { toastShort } from '../Utils/ToastUtils.js'; 20 | export default class MyTask extends Component { 21 | constructor(props) { 22 | super(props) 23 | this.state = { 24 | data: [], 25 | flag: true, 26 | isloading: true 27 | } 28 | } 29 | componentDidMount() { 30 | this.onMyTaskApi() 31 | } 32 | 33 | _renderItem = ({ item }) => ( 34 | 35 | 36 | {item.taskName} {item.rewardType == 1 ? +{NetUtils.NumUtils(item.reward)} APT : +{item.reward} 算力} 37 | {item.taskSynopsis}~ 38 | 39 | {this._type(item)} 40 | 41 | ) 42 | 43 | _type(item) { 44 | if (item.completionStatus == 0) { 45 | return (未完成) 46 | } else if (item.completionStatus == 1) { 47 | return (已完成) 48 | } else if (item.completionStatus == 2) { 49 | return (审核中) 50 | } else if (item.completionStatus == 3) { 51 | return (已超时) 52 | } else if (item.completionStatus == 4) { 53 | return (审核未通过) 54 | } else if (item.completionStatus == 5) { 55 | return (已放弃任务) 56 | } 57 | } 58 | render() { 59 | return 60 | Actions.pop()} underlayColor='#fff'> 61 | 62 | 63 | 我的任务 64 | 65 | 66 | 67 | 68 | 69 | {this.state.isloading ? : } 70 | index.toString()} 73 | renderItem={this._renderItem} 74 | /> 75 | 76 | 77 | 78 | } 79 | 80 | } 81 | const styles = StyleSheet.create({ 82 | container: { 83 | flex: 1, 84 | backgroundColor: '#fff' 85 | }, 86 | viewstyles1: { 87 | marginTop: 35 * unitHeight, 88 | backgroundColor: 'rgb(241,240,246)', 89 | flex: 1 90 | 91 | }, 92 | viewstyles2: { 93 | marginTop: 25 * unitHeight, 94 | width: 690 * unitWidth, 95 | height: 190 * unitWidth, 96 | backgroundColor: '#fff', 97 | borderRadius: 20 * unitWidth, 98 | alignSelf: 'center', 99 | flexDirection: 'row', 100 | marginBottom: 5 * unitHeight 101 | }, 102 | viewstyles3: { 103 | marginLeft: 20 * unitWidth, 104 | marginRight: 20 * unitWidth, 105 | marginTop: 35 * unitHeight 106 | 107 | }, 108 | viewstyles4: { 109 | marginLeft: 36 * unitWidth, 110 | marginTop: 30 * unitHeight, 111 | }, 112 | Image: { 113 | width: 24 * unitWidth, 114 | height: 41 * unitHeight, 115 | alignSelf: 'flex-end', 116 | marginLeft: 30 * unitWidth 117 | }, 118 | txt1: { 119 | fontSize: 34 * unitWidth, 120 | // fontFamily: "PingFangTC-Semibold", 121 | color: "#21262c", 122 | fontWeight: 'bold', 123 | alignSelf: 'center', 124 | textAlign: 'center', 125 | }, 126 | Text2: { 127 | fontSize: 32 * unitWidth, 128 | // fontFamily: "FZY4K--GBK1-0", 129 | color: "#2a2c31", 130 | fontWeight: 'bold' 131 | }, 132 | Text3: { 133 | fontSize: 30 * unitWidth, 134 | // fontFamily: "PingFangTC-Semibold", 135 | color: "#ff121d", 136 | marginLeft: 7 * unitWidth 137 | }, 138 | Text4: { 139 | fontSize: 24 * unitWidth, 140 | // fontFamily: "PingFangTC", 141 | color: "#33363b", 142 | textAlign: 'center', 143 | alignSelf: 'center' 144 | }, 145 | Text5: { 146 | marginTop: 24 * unitHeight, 147 | fontSize: 26 * unitWidth, 148 | // fontFamily: "PingFang-SC-Regular", 149 | color: "#626970" 150 | }, 151 | Text6: { 152 | textAlign: 'center', 153 | alignSelf: 'center', 154 | position: 'absolute', 155 | right: 0, 156 | marginRight: 32 * unitWidth, 157 | fontSize: 26 * unitWidth, 158 | // fontFamily: "PingFangHeiTC-W8-Proportionl", 159 | color: "#70df3a", 160 | fontWeight: 'bold' 161 | } 162 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | APT支付通证团队成员来自美国、中国、欧洲等,目前拥有几十个区块链技术专利和MHT技术(Matching Hedge Technology 匹配对冲技 术)。综合运用了2-of-2 多重签名、锁定时间交易、交易构成广播等技术, 可以实现区块链资产零手续费、快速转向对方, 有效解决现有区块 链的传输低效问题。以及解决传统的 跨境支付中,面临着手续费过高、结算周期长、到帐速度慢、转账额度限制、资金冻结等风险。 在应用落 地方面全球商家可以一键便利接入APT支付通证提供的SDK到自己的app中,就可以接受全世界用户跨国款,实现即时、安全、零手续费到帐。 同时APT支付通证还可以应用到广告投放推广、旅游、线上商城,全球旅游公司可以通过万国支付平台进行旅游资源整合、产品供应商入驻商城、 跨境购物等。 2 | -------------------------------------------------------------------------------- /RealName.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableHighlight, 10 | ActivityIndicator, 11 | DeviceEventEmitter 12 | } from 'react-native'; 13 | 14 | import { Actions } from 'react-native-router-flux' 15 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 16 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 17 | import ClickUtil from '../Utils/ClickUtil.js'; 18 | import local from '../Utils/StorageUtils.js'; 19 | import NetUtils from '../Utils/NetUtils.js' 20 | import { toastShort } from '../Utils/ToastUtils.js'; 21 | import WebView from 'react-native-webview' 22 | export default class RealName extends Component { 23 | constructor(props) { 24 | super(props) 25 | this.state = { 26 | title: '', 27 | url: '', 28 | cookies: '' 29 | } 30 | } 31 | componentDidMount() { 32 | local.get("cookies").then(c => { 33 | this.setState({ cookies: c }) 34 | }).catch(e => { }) 35 | } 36 | 37 | render() { 38 | return 39 | Actions.pop()} underlayColor={'#fff'}> 40 | 41 | 42 | 实名认证 43 | 44 | 45 | 46 | this.webView = webView} 52 | startInLoadingState={true} 53 | /> 54 | 55 | } 56 | onMessage = (event) => { 57 | if (event.nativeEvent.data == 'ok') { 58 | Actions.pop() 59 | } 60 | } 61 | } 62 | const styles = StyleSheet.create({ 63 | container: { 64 | flex: 1, 65 | backgroundColor: '#fff' 66 | }, 67 | txt1: { 68 | fontSize: 34 * unitWidth, 69 | color: "#21262c", 70 | fontWeight: 'bold', 71 | alignSelf: 'center', 72 | textAlign: 'center', 73 | }, 74 | Image: { 75 | width: 24 * unitWidth, 76 | height: 41 * unitHeight, 77 | alignSelf: 'flex-end', 78 | marginLeft: 30 * unitWidth 79 | }, 80 | }); 81 | -------------------------------------------------------------------------------- /Scanner.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Platform, StyleSheet, Text, View, TouchableOpacity, DeviceEventEmitter, Image } from 'react-native'; 3 | import { QRscanner } from 'react-native-qr-scanner'; 4 | import { Actions } from 'react-native-router-flux'; 5 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 6 | export default class Scanner extends Component { 7 | constructor(props) { 8 | super(props); 9 | this.state = { 10 | flashMode: false, 11 | zoom: Platform.OS == 'ios' ? 0 : 0.2 12 | }; 13 | } 14 | render() { 15 | return ( 16 | 17 | 18 | 19 | ); 20 | } 21 | bottomView = () => { 22 | return ( 23 | 24 | this.setState({ flashMode: !this.state.flashMode })}> 25 | 点我开启/关闭手电筒 26 | 27 | Actions.pop()}> 28 | 点击退出 29 | 30 | 31 | ); 32 | } 33 | onRead = (res) => { 34 | console.warn(res) 35 | DeviceEventEmitter.emit('scannerdata', res.data) 36 | Actions.pop() 37 | } 38 | } 39 | const styles = StyleSheet.create({ 40 | container: { 41 | flex: 1, 42 | backgroundColor: '#000' 43 | } 44 | }); -------------------------------------------------------------------------------- /ToastUtils.js: -------------------------------------------------------------------------------- 1 | import Toast from 'react-native-root-toast'; 2 | 3 | let toast; 4 | 5 | 6 | export const toastShort = (content) => { 7 | if (toast !== undefined) { 8 | Toast.hide(toast); 9 | } 10 | toast = Toast.show(content.toString(), { 11 | duration: Toast.durations.SHORT, 12 | position: Toast.positions.CENTER, 13 | shadow: true, 14 | animation: true, 15 | hideOnPress: true, 16 | delay: 0 17 | }); 18 | }; 19 | 20 | 21 | 22 | 23 | export const toastLong = (content, toasttype) => { 24 | if (toast !== undefined) { 25 | Toast.hide(toast); 26 | } 27 | if (toasttype == 'bottom') { 28 | toasttype = Toast.positions.BOTTOM 29 | } else { 30 | toasttype = Toast.positions.CENTER 31 | } 32 | toast = Toast.show(content.toString(), { 33 | duration: Toast.durations.LONG, 34 | position: toasttype, 35 | shadow: true, 36 | animation: true, 37 | hideOnPress: true, 38 | delay: 0 39 | }); 40 | }; -------------------------------------------------------------------------------- /UpLoadTask.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | StyleSheet, 4 | Text, 5 | View, 6 | Image, 7 | FlatList, 8 | Dimensions, 9 | StatusBar, 10 | TouchableOpacity, 11 | Modal, 12 | ActivityIndicator 13 | } from 'react-native'; 14 | import { Actions } from 'react-native-router-flux' 15 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 16 | import local from '../Utils/StorageUtils.js'; 17 | import NetUtils from '../Utils/NetUtils.js' 18 | import { toastShort } from '../Utils/ToastUtils.js'; 19 | import LinearGradient from 'react-native-linear-gradient'; 20 | import { ScrollView } from 'react-native-gesture-handler'; 21 | var widths = Dimensions.get('window').width 22 | 23 | export default class UpLoadTask extends Component { 24 | constructor(props) { 25 | super(props) 26 | this.state = { 27 | canShow: false, 28 | invitationRules: "", 29 | data: [], 30 | flag_state: false, 31 | isloading: false 32 | } 33 | } 34 | componentDidMount() { 35 | this.getThirdTaskRegulation() 36 | this.listOwnThirdTask() 37 | } 38 | 39 | render() { 40 | return 42 | 131 | } 132 | 133 | _renderItem = ({ item }) => ( 134 | 135 | 136 | 137 | {this._state_view_type(item)} 138 | 139 | {/* 状态信息 */} 140 | 141 | {item.taskName} 142 | 143 | {this._state_type(item)} 144 | 145 | 146 | 147 | 完成数量 148 | {item.getTaskRewardUserNum == "" || item.getTaskRewardUserNum == null ? 0 : item.getTaskRewardUserNum}/{item.taskNum} 149 | 150 | 151 | 152 | {/* 状态操作/暂停/下架 */} 153 | {item.taskStatus == 0 || item.taskStatus == 1 || item.taskStatus == 4 ? null : 154 | 155 | 156 | 157 | 158 | 159 | 160 | {item.taskStatus == 2 ? 161 | 162 | 163 | 164 | 暂停 165 | 166 | : 167 | 168 | 169 | 170 | 恢复 171 | 172 | } 173 | 174 | 175 | 176 | 177 | 178 | 179 | 下架 180 | 181 | 182 | 183 | } 184 | 185 | ) 186 | 187 | /** 188 | * 0:审核中 189 | * 1:审核被拒 190 | * 2:审核通过,上架中 191 | * 3:暂停,用户不能继续领取任务;任务暂时下架,但是可以通过恢复按钮恢复 192 | * 4:已下架,任务完全结束,无法恢复,进行一次结算,退回用户任务费用。退回规则 193 | * @param {*} item 194 | */ 195 | _state_view_type(item) { 196 | if (item.taskStatus == 2) { 197 | return () 198 | } else if (item.taskStatus == 3) { 199 | return () 200 | } else if (item.taskStatus == 0) { 201 | return () 202 | } else if (item.taskStatus == 1) { 203 | return () 204 | } else if (item.taskStatus == 4) { 205 | return () 206 | } 207 | } 208 | /** 209 | * 0:审核中 210 | * 1:审核被拒 211 | * 2:审核通过,上架中 212 | * 3:暂停,用户不能继续领取任务;任务暂时下架,但是可以通过恢复按钮恢复 213 | * 4:已下架,任务完全结束,无法恢复,进行一次结算,退回用户任务费用。退回规则 214 | * @param {*} item 215 | */ 216 | _state_type(item) { 217 | if (item.taskStatus == 2) { 218 | return ( 219 | 上架中 220 | ) 221 | } else if (item.taskStatus == 3) { 222 | return ( 223 | 已暂停 224 | ) 225 | } else if (item.taskStatus == 0) { 226 | return ( 227 | 审核中 228 | ) 229 | } else if (item.taskStatus == 1) { 230 | return ( 231 | 已拒绝 232 | ) 233 | } else if (item.taskStatus == 4) { 234 | return ( 235 | 已下架 236 | ) 237 | } 238 | } 239 | 240 | onRequestClose() { 241 | this.setState({ canShow: false }); 242 | } 243 | 244 | 245 | 246 | 247 | } 248 | const styles = StyleSheet.create({ 249 | container: { 250 | flex: 1 251 | }, 252 | state_txt: { 253 | fontSize: 24 * unitWidth, 254 | color: "#777c8f", 255 | marginLeft: 11 * unitWidth 256 | }, 257 | state_img: { 258 | width: 33 * unitWidth, 259 | height: 33 * unitWidth, 260 | alignSelf: 'center' 261 | }, 262 | state_stylse: { 263 | width: 139 * unitWidth, 264 | height: 50 * unitHeight, 265 | borderRadius: 25 * unitWidth, 266 | backgroundColor: "#ebf2f2", 267 | flexDirection: 'row', 268 | justifyContent: 'center', 269 | alignItems: 'center' 270 | }, 271 | line_styles: { 272 | width: 2 * unitWidth, 273 | height: 110 * unitHeight, 274 | alignItems: 'center', 275 | borderRadius: 1 * unitWidth, 276 | backgroundColor: "#edf2f6", 277 | }, 278 | item_txt: { 279 | fontSize: 26 * unitWidth, 280 | color: "#374163" 281 | }, 282 | task_state_stylse: { 283 | width: 110 * unitWidth, 284 | height: 35 * unitHeight, 285 | borderRadius: 17 * unitWidth, 286 | backgroundColor: "#30d87f", 287 | justifyContent: 'center', 288 | alignItems: 'center', 289 | textAlign: 'center', 290 | marginTop: 10 * unitHeight 291 | }, 292 | view_stylse2: { 293 | height: 180 * unitHeight, 294 | borderTopLeftRadius: 10 * unitWidth, 295 | borderBottomLeftRadius: 10 * unitWidth, 296 | backgroundColor: "#30d87f", 297 | width: 10 * unitWidth, 298 | 299 | }, 300 | list_item_stylse: { 301 | width: 690 * unitWidth, 302 | height: 188 * unitHeight, 303 | borderRadius: 20 * unitWidth, 304 | backgroundColor: "#ffffff", 305 | marginTop: 20 * unitHeight, 306 | alignSelf: 'center', 307 | alignItems: 'center', 308 | flexDirection: 'row', 309 | }, 310 | upload_task_txt2: { 311 | fontSize: 26 * unitWidth, 312 | fontWeight: "bold", 313 | color: "#374163", 314 | marginLeft: 19 * unitWidth 315 | }, 316 | view_stylse: { 317 | width: 6 * unitWidth, 318 | height: 19 * unitHeight, 319 | borderRadius: 3 * unitWidth, 320 | backgroundColor: "#549cec", 321 | marginLeft: 33 * unitWidth 322 | }, 323 | upload_task_icon_styles: { 324 | width: 70 * unitWidth, 325 | height: 70 * unitWidth, 326 | marginRight: 38 * unitWidth 327 | }, 328 | upload_task_txt: { 329 | fontSize: 34 * unitWidth, 330 | fontWeight: 'bold', 331 | color: "#374163", 332 | marginLeft: 17 * unitWidth 333 | }, 334 | task_img_styles: { 335 | width: 33 * unitWidth, 336 | height: 43 * unitWidth, 337 | marginLeft: 34 * unitWidth 338 | }, 339 | uploadtasked_styles: { 340 | backgroundColor: "rgb(243,245,249)", 341 | marginTop: 200 * unitWidth, 342 | flex: 1 343 | }, 344 | uploadtask_styles: { 345 | width: 690 * unitWidth, 346 | height: 135 * unitHeight, 347 | borderRadius: 25 * unitWidth, 348 | backgroundColor: "#ffffff", 349 | shadowColor: "rgba(213, 221, 232, 0.86)", 350 | shadowOffset: { 351 | width: 0, 352 | height: 3.5 353 | }, 354 | shadowRadius: 10.5, 355 | shadowOpacity: 1, 356 | alignSelf: 'center', 357 | alignItems: 'center', 358 | flexDirection: 'row', 359 | position: 'absolute', 360 | top: 200 * unitHeight, 361 | }, 362 | tex8: { 363 | width: 554 * unitWidth, 364 | marginTop: 40 * unitWidth, 365 | fontSize: 28 * unitWidth, 366 | color: "#7c8faf", 367 | marginLeft: 20 * unitWidth, 368 | marginRight: 10 * unitWidth, 369 | lineHeight: 50 * unitWidth, 370 | alignSelf: 'center' 371 | 372 | }, 373 | rule_sure_styles: { 374 | alignSelf: 'center', 375 | justifyContent: 'center', 376 | width: 400 * unitWidth, 377 | height: 70 * unitWidth, 378 | borderRadius: 35 * unitWidth, 379 | shadowColor: "rgba(86, 116, 255, 0.52)", 380 | shadowOffset: { 381 | width: -0.9, 382 | height: 2.4 383 | }, 384 | shadowRadius: 6.5, 385 | shadowOpacity: 1, 386 | marginTop: 50 * unitHeight, 387 | marginBottom: 57 * unitHeight 388 | }, 389 | rule_text: { 390 | color: "#2a2c31", 391 | fontSize: 32 * unitWidth, 392 | fontWeight: 'bold', 393 | textAlign: 'center', 394 | marginTop: 45 * unitHeight 395 | }, 396 | rule_styles: { 397 | alignSelf: 'center', 398 | height: 750 * unitHeight, 399 | borderRadius: 20 * unitWidth, 400 | backgroundColor: "#ffffff", 401 | shadowColor: "rgba(30, 64, 129, 0.2)", 402 | shadowOffset: { 403 | width: 0, 404 | height: 0 405 | }, 406 | shadowRadius: 23, 407 | shadowOpacity: 1 408 | }, 409 | modalLayer: { 410 | backgroundColor: 'rgba(0, 0, 0, 0.45)', 411 | flex: 1, 412 | justifyContent: 'center', 413 | }, 414 | txt1: { 415 | fontSize: 34 * unitWidth, 416 | color: "#fff", 417 | fontWeight: 'bold', 418 | alignSelf: 'center', 419 | textAlign: 'center', 420 | }, 421 | Image: { 422 | width: 40 * unitWidth, 423 | height: 40 * unitWidth, 424 | alignSelf: 'flex-end', 425 | }, 426 | Image1: { 427 | width: 21 * unitWidth, 428 | height: 41 * unitWidth, 429 | alignSelf: 'flex-start', 430 | }, 431 | }) -------------------------------------------------------------------------------- /UpLoadTask_top1.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | StyleSheet, Text, View, Image, FlatList, Dimensions, StatusBar, 4 | TouchableOpacity, Modal, TextInput, ScrollView, ActivityIndicator 5 | } from 'react-native'; 6 | import { Actions } from 'react-native-router-flux' 7 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 8 | import local from '../Utils/StorageUtils.js'; 9 | import NetUtils from '../Utils/NetUtils.js' 10 | import { toastShort } from '../Utils/ToastUtils.js'; 11 | import LinearGradient from 'react-native-linear-gradient'; 12 | import ImagePicker from 'react-native-image-crop-picker'; 13 | var widths = Dimensions.get('window').width 14 | 15 | export default class UpLoadTask_top1 extends Component { 16 | constructor(props) { 17 | super(props) 18 | this.state = { 19 | //任务名 20 | taskName: '', 21 | //产品名 22 | productName: '', 23 | //产品简介 24 | productDesc: '', 25 | //用户需要上传的图片张数 26 | uploadImgNum: '', 27 | canShow: false, 28 | //用户是否上传文本 0 不上传 1 上传 29 | userTextFlag: "请选择(必填)", 30 | //app logo 31 | appPicUrl: '', 32 | cookies: '', 33 | isloadinged: false 34 | } 35 | } 36 | componentDidMount() { 37 | local.get('cookies').then((res) => this.setState({ cookies: res })) 38 | } 39 | render() { 40 | return 41 | Actions.pop()}> 42 | 43 | 44 | 上传任务 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {/* 任务名称 */} 54 | 55 | 56 | 任务名称 57 | 58 | { 64 | this.setState({ taskName: x }) 65 | local.set('taskName', x) 66 | }} 67 | /> 68 | {/* 产品名称 */} 69 | 70 | 71 | 产品名称 72 | 73 | 74 | { 80 | this.setState({ productName: x }) 81 | local.set('productName', x) 82 | }} 83 | /> 84 | 85 | 86 | {/* 产品简介 */} 87 | 88 | 89 | 90 | 产品简介 91 | 92 | { 98 | this.setState({ productDesc: x }) 99 | local.set('productDesc', x) 100 | }} 101 | /> 102 | 103 | {/* 上传app图片 */} 104 | 105 | 106 | 上传APP图片 107 | 108 | 109 | 110 | {this.state.appPicUrl != '' ? 111 | : 112 | 113 | {this.state.isloadinged ? : 114 | } 115 | 上传图片 116 | } 117 | 118 | 119 | {/* 用户上传图片数 */} 120 | 121 | 122 | 用户上传图片数 123 | 124 | { 131 | this.setState({ uploadImgNum: x }) 132 | local.set('uploadImgNum', x) 133 | }} 134 | /> 135 | 136 | 137 | {/* 用户是否需要上传文本 */} 138 | 139 | 140 | 用户是否需要上传文本(例如:用户手机号/邮箱/微信号等相关任务证明) 141 | 142 | this.setState({ canShow: true })}> 143 | 147 | {this.state.userTextFlag} 148 | 152 | 153 | 161 | 162 | 163 | 164 | 165 | 166 | {/* 下一步按钮 */} 167 | 168 | 169 | 下一步 170 | 171 | 172 | 173 | 179 | 180 | 181 | 182 | 选择是否需要 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | } 200 | //关闭弹窗 201 | onRequestClose() { 202 | this.setState({ canShow: false }); 203 | } 204 | // 选择是否需要文本 205 | onSelected_yes() { 206 | this.setState({ 207 | canShow: false, 208 | userTextFlag: "是" 209 | }) 210 | local.set('userTextFlag', 1) 211 | } 212 | // 选择是否需要文本 213 | onSelected_no() { 214 | this.setState({ 215 | canShow: false, 216 | userTextFlag: "否" 217 | }) 218 | local.set('userTextFlag', 0) 219 | } 220 | //选择本地图片 221 | onUpdateimg() { 222 | let that = this; 223 | ImagePicker.openPicker({ 224 | width: 500 * unitWidth, 225 | height: 800 * unitHeight, 226 | cropping: false 227 | }).then(image => { 228 | this.uploadPic(image.path) 229 | }); 230 | } 231 | next_task() { 232 | if (this.state.taskName.trim() == '') { 233 | return toastShort('请填写任务名称!') 234 | } 235 | if (this.state.productName.trim() == '') { 236 | return toastShort('请填写产品名称!') 237 | } 238 | if (this.state.productDesc.trim() == '') { 239 | return toastShort('请填写产品简介!') 240 | } 241 | if (this.state.appPicUrl.trim() == '') { 242 | return toastShort('请上传产品logo图片!') 243 | } 244 | if (this.state.uploadImgNum.trim() == '') { 245 | return toastShort('请填写用户需要上传的图片张数!') 246 | } 247 | if (this.state.userTextFlag == "请选择(必填)") { 248 | return toastShort('请选择是否需要收集用户相关信息!') 249 | } 250 | Actions.upLoadTask_top2() 251 | } 252 | 253 | } 254 | const styles = StyleSheet.create({ 255 | container: { 256 | flex: 1, 257 | backgroundColor: '#fff' 258 | }, 259 | bt_img: { 260 | width: 20 * unitWidth, 261 | height: 20 * unitWidth, 262 | alignItems: 'center', 263 | marginLeft: 41 * unitWidth, 264 | }, 265 | bnt_stylse: { 266 | width: 400 * unitWidth, 267 | height: 84 * unitWidth, 268 | borderRadius: 42 * unitWidth, 269 | borderWidth: 2 * unitWidth, 270 | borderColor: 'rgb(82,112,253)', 271 | justifyContent: "center", 272 | alignItems: "center", 273 | alignSelf: 'center', 274 | marginTop: 30 * unitHeight 275 | }, 276 | select_styles: { 277 | fontSize: 30 * unitWidth, 278 | fontWeight: 'bold', 279 | }, 280 | rule_text: { 281 | color: "#2a2c31", 282 | fontSize: 32 * unitWidth, 283 | fontWeight: 'bold', 284 | textAlign: 'center', 285 | marginTop: 45 * unitHeight 286 | }, 287 | rule_styles: { 288 | alignSelf: 'center', 289 | width: 600 * unitWidth, 290 | borderRadius: 20 * unitWidth, 291 | backgroundColor: "#ffffff", 292 | shadowColor: "rgba(30, 64, 129, 0.2)", 293 | shadowOffset: { 294 | width: 0, 295 | height: 0 296 | }, 297 | shadowRadius: 23, 298 | shadowOpacity: 1 299 | }, 300 | modalLayer: { 301 | backgroundColor: 'rgba(0, 0, 0, 0.45)', 302 | flex: 1, 303 | justifyContent: 'center', 304 | }, 305 | next_styles: { 306 | width: 600 * unitWidth, 307 | height: 84 * unitWidth, 308 | alignSelf: 'center', 309 | justifyContent: 'center', 310 | alignItems: 'center', 311 | backgroundColor: 'rgb(82,112,253)', 312 | marginTop: 56 * unitHeight, 313 | borderRadius: 42 * unitWidth, 314 | shadowColor: "rgba(86, 116, 255, 0.52)", 315 | shadowOffset: { 316 | width: 0, 317 | height: 2.5 318 | }, 319 | shadowRadius: 6.5, 320 | shadowOpacity: 1, 321 | marginBottom: 58 * unitHeight 322 | }, 323 | upload_txt_styles: { 324 | fontSize: 26 * unitWidth, 325 | color: "#838b97", 326 | marginTop: 10 * unitHeight 327 | }, 328 | img_styles: { 329 | width: 50 * unitWidth, 330 | height: 39 * unitWidth, 331 | alignSelf: 'center', 332 | }, 333 | uploadimg_styles: { 334 | width: 160 * unitWidth, 335 | height: 160 * unitWidth, 336 | borderRadius: 10 * unitWidth, 337 | backgroundColor: "#e7ecf6", 338 | borderStyle: "solid", 339 | borderWidth: 1 * unitWidth, 340 | borderColor: "#aeaeae", 341 | marginLeft: 42 * unitWidth, 342 | marginTop: 24 * unitHeight, 343 | alignItems: 'center', 344 | justifyContent: 'center' 345 | }, 346 | TextInput_styles: { 347 | width: 600 * unitWidth, 348 | marginLeft: 41 * unitWidth, 349 | marginTop: 20 * unitHeight, 350 | borderBottomWidth: 2 * unitWidth, 351 | borderColor: '#efefef', 352 | fontSize: 26 * unitWidth, 353 | lineHeight: 36 * unitHeight, 354 | fontWeight: 'bold', 355 | color: '#7c8faf', 356 | fontWeight: 'bold' 357 | 358 | }, 359 | task_top_txt: { 360 | fontSize: 28 * unitWidth, 361 | color: "#2a2c31", 362 | fontWeight: 'bold', 363 | marginLeft: 10 * unitWidth, 364 | marginRight: 40 * unitWidth 365 | }, 366 | top1_task_img: { 367 | marginTop: 48 * unitHeight, 368 | width: 534 * unitWidth, 369 | height: 92 * unitWidth, 370 | alignSelf: 'center' 371 | 372 | }, 373 | top1_task_styles: { 374 | marginTop: 30 * unitHeight, 375 | width: 690 * unitWidth, 376 | alignSelf: 'center', 377 | backgroundColor: '#ffffff', 378 | borderRadius: 20 * unitWidth, 379 | }, 380 | top1_styles: { 381 | backgroundColor: 'rgb(241,240,246)', 382 | marginTop: 30 * unitHeight, 383 | flex: 1 384 | }, 385 | Image: { 386 | width: 24 * unitWidth, 387 | height: 41 * unitHeight, 388 | alignSelf: 'flex-end', 389 | marginLeft: 30 * unitWidth 390 | }, 391 | txt1: { 392 | fontSize: 34 * unitWidth, 393 | color: "#21262c", 394 | fontWeight: 'bold', 395 | alignSelf: 'center', 396 | textAlign: 'center', 397 | }, 398 | 399 | }) -------------------------------------------------------------------------------- /Vip.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Image, 8 | FlatList, 9 | TouchableOpacity, 10 | ActivityIndicator, 11 | DeviceEventEmitter, 12 | ScrollView, 13 | Modal 14 | } from 'react-native'; 15 | 16 | import { Actions } from 'react-native-router-flux' 17 | import { MarqueeHorizontal, MarqueeVertical } from 'react-native-marquee-ab'; 18 | import { unitWidth, unitHeight } from '../../AdapterUtil.js'; 19 | import ClickUtil from '../Utils/ClickUtil.js'; 20 | import local from '../Utils/StorageUtils.js'; 21 | import NetUtils from '../Utils/NetUtils.js' 22 | import { toastShort } from '../Utils/ToastUtils.js'; 23 | import LinearGradient from 'react-native-linear-gradient'; 24 | import Language from '../Language/Language.js'; 25 | export default class Vip extends Component { 26 | constructor(props) { 27 | super(props) 28 | this.state = { 29 | usdt: '', 30 | isvip: 0, 31 | isloading: false, 32 | canShow: false, 33 | islogin: false 34 | } 35 | } 36 | 37 | 38 | render() { 39 | return 40 | 41 | 42 | 43 | 44 | 45 | VIP会员 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | VIP会员 56 | 57 | {this.state.isvip != 0 ? 58 | 59 | VIP等级{this.state.isvip} 60 | : 61 | 62 | 63 | 成为会员 64 | 65 | 66 | } 67 | 68 | 用户充值{this.state.usdt} USDT即可成为永久VIP会员,享受多 69 | 项专属权益,解锁更多价值收益 70 | 71 | 72 | 73 | 74 | 75 | {/* 3大特权内容 */} 76 | 77 | 78 | VIP会员六大特权 79 | 80 | {/* VIP会员六大特权 */} 81 | 82 | 83 | 84 | VIP用户享有“专属流量任务”完成权限,任务完成后将获得更高额度的奖励 85 | 86 | 87 | 88 | 89 | 90 | 91 | VIP除获取常规流量任务奖励外,还可额外获得VIP算力加成 92 | 93 | 94 | 95 | 96 | 97 | 98 | VIP好友邀请提成范围为2级。每邀请一名 99 | VIP徒弟,VIP师父可获VIP充值金20%的等 100 | 值APT。VIP徒弟招收到VIP徒孙后,VIP师 101 | 父将再获VIP充值金10%的等值APT 102 | 103 | 104 | 105 | 106 | 107 | 108 | 在VIP师徒、孙关系中,师父可获取徒弟、徒孙完成VIP专属流量任务的奖励提成 109 | 110 | 111 | 112 | 113 | 114 | 115 | 在APT提币方面,VIP用户提币2 APT起,普通用户100 APT起提 116 | 117 | 118 | 119 | 120 | 121 | 122 | VIP用户每邀请一位VIP徒弟,可获得价值4 USDT的大转盘体验券 123 | 124 | 125 | 126 | {/* 重要说明 */} 127 | 128 | 重要说明 129 | 130 | 1、普通用户无法参与VIP专属流量任务。 131 | 2、VIP好友邀请提成的具体数量以VIP徒弟或VIP徒孙充值当时的相关行情(A网数据)为准。此外,如受邀用户没有成为VIP,则无法获取该奖励。 132 | 3、VIP师徒、孙关系是指三者皆为VIP用户,普通用户无法享受VIP相关权益。此外,专属流量任务的奖励提成比例与现行任务分成情况一致。 133 | 4、APT提币手续费率维持现状。 134 | 5、大转盘体验券将根据VIP徒弟充值当时APT/USDT的行情进行折算,并以四舍五入法按整数单位发放。 135 | 136 | 137 | {this.state.isvip != 0 ? null : 138 | 139 | 140 | VIP尊享会员 141 | {this.state.usdt} USDT 142 | 143 | 144 | 145 | 成为会员 146 | 147 | 148 | 149 | } 150 | 156 | 157 | 158 | 是否花费 {this.state.usdt} USDT成为VIP? 165 | 166 | this.onRequestClose()}> 167 | 168 | 取 消 169 | 170 | 171 | 172 | 173 | {this.state.isloading ? : 174 | 立即开通 175 | } 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | } 184 | 185 | } 186 | const styles = StyleSheet.create({ 187 | container: { 188 | flex: 1, 189 | backgroundColor: 'rgb(255,255,255)' 190 | }, 191 | txt6: { 192 | fontSize: 28 * unitWidth, 193 | lineHeight: 42 * unitHeight, 194 | color: "#e0a765", 195 | width: 549 * unitWidth, 196 | }, 197 | rule_styles: { 198 | width: 626 * unitWidth, 199 | flex: 1, 200 | alignSelf: 'center', 201 | justifyContent: 'center', 202 | alignItems: 'center', 203 | marginTop: 37 * unitHeight, 204 | marginBottom: 45 * unitHeight, 205 | borderRadius: 20 * unitWidth 206 | }, 207 | eixt: { 208 | width: 218 * unitWidth, 209 | height: 68 * unitHeight, 210 | borderRadius: 24 * unitWidth, 211 | backgroundColor: "#626970", 212 | shadowColor: "rgba(30, 62, 176, 0.27)", 213 | shadowOffset: { 214 | width: 0, 215 | height: 4 216 | }, 217 | shadowRadius: 9, 218 | shadowOpacity: 1, 219 | justifyContent: 'center' 220 | }, 221 | vip_modal: { 222 | width: 600 * unitWidth, 223 | height: 352 * unitHeight, 224 | borderRadius: 20 * unitWidth, 225 | backgroundColor: "rgb(222,188,154)", 226 | shadowColor: "rgba(30, 64, 129, 0.2)", 227 | shadowOffset: { 228 | width: 0, 229 | height: 0 230 | }, 231 | shadowRadius: 23, 232 | shadowOpacity: 1, 233 | alignSelf: 'center' 234 | }, 235 | modalLayer: { 236 | backgroundColor: 'rgba(0, 0, 0, 0.45)', 237 | flex: 1, 238 | justifyContent: 'center', 239 | }, 240 | vip_bg8: { 241 | width: 256 * unitWidth, 242 | height: 100 * unitHeight, 243 | backgroundColor: "rgb(218,186,158)", 244 | borderBottomRightRadius: 60 * unitHeight, 245 | borderTopRightRadius: 60 * unitHeight, 246 | justifyContent: 'center', 247 | alignItems: 'center' 248 | }, 249 | vip_bg7: { 250 | flexDirection: 'row', 251 | width: 424 * unitWidth, 252 | height: 100 * unitHeight, 253 | backgroundColor: "#2b2726", 254 | borderBottomLeftRadius: 60 * unitWidth, 255 | borderTopLeftRadius: 60 * unitWidth, 256 | justifyContent: 'center', 257 | alignItems: 'center' 258 | }, 259 | vip_text2: { 260 | color: "#363636", 261 | fontSize: 28 * unitWidth, 262 | marginLeft: 14 * unitWidth, 263 | width: 492 * unitWidth, 264 | marginTop: 39 * unitHeight, 265 | marginBottom: 39 * unitHeight, 266 | lineHeight: 30 * unitHeight 267 | }, 268 | vip_text3: { 269 | color: "#363636", 270 | fontSize: 28 * unitWidth, 271 | marginLeft: 14 * unitWidth, 272 | width: 492 * unitWidth, 273 | lineHeight: 42 * unitHeight 274 | }, 275 | vip_img2: { 276 | width: 30 * unitWidth, 277 | height: 30 * unitWidth, 278 | marginLeft: 42 * unitWidth, 279 | marginTop: 45 * unitHeight 280 | }, 281 | vip_bg6: { 282 | width: 626 * unitWidth, 283 | flex: 1, 284 | flexDirection: 'row', 285 | alignSelf: 'center', 286 | marginTop: 21 * unitHeight, 287 | }, 288 | vip_bg5: { 289 | backgroundColor: 'rgb(237,194,162)', 290 | borderRadius: 5 * unitWidth, 291 | height: 40 * unitHeight, 292 | padding: 10 * unitWidth, 293 | flex: 1, 294 | position: 'absolute', 295 | top: -20 * unitWidth, 296 | marginLeft: 31 * unitWidth, 297 | justifyContent: 'center', 298 | alignItems: 'center', 299 | }, 300 | vip_bg4: { 301 | width: 680 * unitWidth, 302 | flex: 1, 303 | borderRadius: 10 * unitWidth, 304 | backgroundColor: "#ffff", 305 | shadowColor: "rgba(184, 173, 165, 0.22)", 306 | shadowOffset: { 307 | width: 0, 308 | height: 0 309 | }, 310 | shadowRadius: 16, 311 | shadowOpacity: 1, 312 | elevation: 4, 313 | alignSelf: 'center', 314 | marginTop: 120 * unitHeight, 315 | marginBottom: 27 * unitHeight 316 | }, 317 | vip_txt: { 318 | color: "#a06240", 319 | fontSize: 26 * unitWidth 320 | }, 321 | vip_img: { 322 | width: 118 * unitWidth, 323 | height: 118 * unitWidth 324 | }, 325 | vip_bg3: { 326 | width: 185 * unitWidth, 327 | height: 58 * unitHeight, 328 | borderRadius: 34 * unitWidth, 329 | backgroundColor: "#282626", 330 | shadowColor: "rgba(213, 161, 108, 0.92)", 331 | shadowOffset: { 332 | width: 0, 333 | height: 0 334 | }, 335 | shadowRadius: 8, 336 | shadowOpacity: 1, 337 | alignSelf: 'center', 338 | marginLeft: 30 * unitWidth, 339 | marginRight: 30 * unitWidth, 340 | justifyContent: 'center', 341 | }, 342 | vip: { 343 | flexDirection: 'row', 344 | width: 690 * unitWidth, 345 | height: 230 * unitHeight, 346 | borderRadius: 30 * unitWidth, 347 | shadowColor: "rgba(225, 194, 161, 0.46)", 348 | shadowOffset: { 349 | width: 0, 350 | height: 2 351 | }, 352 | shadowRadius: 6.5, 353 | shadowOpacity: 1, 354 | alignSelf: 'center', 355 | backgroundColor: 'rgb(222,188,154)', 356 | position: 'absolute', 357 | top: 194 * unitHeight 358 | }, 359 | txt11: { 360 | textAlign: 'center', 361 | fontSize: 36 * unitWidth, 362 | color: '#fff' 363 | }, 364 | chongzhi: { 365 | width: 550 * unitWidth, 366 | height: 72 * unitHeight, 367 | borderRadius: 25 * unitWidth, 368 | shadowColor: "rgba(86, 116, 255, 0.52)", 369 | shadowOffset: { 370 | width: 0, 371 | height: 2.5 372 | }, 373 | shadowRadius: 6.5, 374 | shadowOpacity: 1, 375 | alignSelf: 'center', 376 | backgroundColor: 'rgb(55,113,255)', 377 | marginTop: 90 * unitHeight, 378 | justifyContent: 'center', 379 | marginBottom: 80 * unitHeight 380 | }, 381 | vip_text: { 382 | fontSize: 30 * unitWidth, 383 | color: '#000', 384 | marginRight: 20 * unitWidth, 385 | marginLeft: 20 * unitWidth 386 | }, 387 | vip_bg2: { 388 | width: 345 * 2 * unitWidth, 389 | height: 80 * 2 * unitHeight, 390 | borderRadius: 12 * unitWidth, 391 | backgroundColor: "#f0f0f0", 392 | alignSelf: 'center', 393 | marginTop: 20 * unitHeight, 394 | justifyContent: 'center', 395 | // alignItems: 'center', 396 | 397 | }, 398 | vip_bg: { 399 | width: 345 * 2 * unitWidth, 400 | height: 80 * 2 * unitHeight, 401 | borderRadius: 12 * unitWidth, 402 | backgroundColor: "#f0f0f0", 403 | alignSelf: 'center', 404 | marginTop: 40 * unitHeight, 405 | justifyContent: 'center', 406 | alignItems: 'center' 407 | }, 408 | viewstyles1: { 409 | marginTop: 35 * unitHeight, 410 | backgroundColor: 'rgb(241,240,246)', 411 | flex: 1 412 | 413 | }, 414 | viewstyles2: { 415 | flex: 1, 416 | marginTop: 25 * unitHeight, 417 | width: 690 * unitWidth, 418 | // height: 300 * unitWidth, 419 | backgroundColor: '#fff', 420 | borderRadius: 20 * unitWidth, 421 | alignSelf: 'center', 422 | flexDirection: 'row', 423 | marginBottom: 5 * unitHeight, 424 | }, 425 | viewstyles3: { 426 | marginLeft: 20 * unitWidth, 427 | marginRight: 20 * unitWidth, 428 | marginTop: 35 * unitHeight 429 | 430 | }, 431 | Image: { 432 | width: 24 * unitWidth, 433 | height: 41 * unitHeight, 434 | alignSelf: 'flex-end', 435 | marginLeft: 30 * unitWidth 436 | }, 437 | txt1: { 438 | fontSize: 34 * unitWidth, 439 | // fontFamily: "PingFangTC-Semibold", 440 | color: "#fff", 441 | fontWeight: 'bold', 442 | alignSelf: 'center', 443 | textAlign: 'center', 444 | }, 445 | Text2: { 446 | fontSize: 30 * unitWidth, 447 | // fontFamily: "PingFangTC-Semibold", 448 | color: "#21262c", 449 | fontWeight: 'bold' 450 | }, 451 | Text3: { 452 | fontSize: 24 * unitWidth, 453 | // fontFamily: "PingFangTC", 454 | color: "#8e8f94", 455 | marginLeft: 100 * unitWidth 456 | }, 457 | Text4: { 458 | width: 550 * unitWidth, 459 | marginTop: 28 * unitHeight, 460 | fontSize: 26 * unitWidth, 461 | // fontFamily: "PingFangTC", 462 | color: "#8e8f94" 463 | }, 464 | Text5: { 465 | 466 | fontSize: 26 * unitWidth, 467 | // fontFamily: "PingFangTC", 468 | color: "#8e8f94", 469 | marginBottom: 30 * unitHeight 470 | } 471 | }); 472 | -------------------------------------------------------------------------------- /fetch-polyfill.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | 5 | var self = this || global; 6 | 7 | 8 | 9 | // Polyfill from https://github.com/github/fetch/blob/v1.1.1/fetch.js#L8-L21 10 | 11 | var support = { 12 | 13 | searchParams: 'URLSearchParams' in self, 14 | 15 | iterable: 'Symbol' in self && 'iterator' in Symbol, 16 | 17 | blob: 'FileReader' in self && 'Blob' in self && (function () { 18 | 19 | try { 20 | 21 | new Blob() 22 | 23 | return true 24 | 25 | } catch (e) { 26 | 27 | return false 28 | 29 | } 30 | 31 | })(), 32 | 33 | formData: 'FormData' in self, 34 | 35 | arrayBuffer: 'ArrayBuffer' in self 36 | 37 | } 38 | 39 | 40 | 41 | // Polyfill from https://github.com/github/fetch/blob/v1.1.1/fetch.js#L364-L375 42 | 43 | function parseHeaders(rawHeaders) { 44 | 45 | var headers = new Headers() 46 | 47 | rawHeaders.split(/\r?\n/).forEach(function (line) { 48 | 49 | var parts = line.split(':') 50 | 51 | var key = parts.shift().trim() 52 | 53 | if (key) { 54 | 55 | var value = parts.join(':').trim() 56 | 57 | headers.append(key, value) 58 | 59 | } 60 | 61 | }); 62 | 63 | 64 | 65 | return headers; 66 | 67 | } 68 | 69 | 70 | 71 | // Polyfill from https://github.com/github/fetch/blob/v1.1.1/fetch.js#L424-L464 72 | 73 | export default function fetchPolyfill(input, init) { 74 | 75 | return new Promise(function (resolve, reject) { 76 | 77 | var request = new Request(input, init) 78 | 79 | var xhr = new XMLHttpRequest() 80 | 81 | 82 | 83 | /* @patch: timeout */ 84 | 85 | if (init && init.timeout) { 86 | 87 | xhr.timeout = init.timeout; 88 | 89 | } 90 | 91 | /* @endpatch */ 92 | 93 | 94 | 95 | xhr.onload = function () { 96 | 97 | var options = { 98 | 99 | status: xhr.status, 100 | 101 | statusText: xhr.statusText, 102 | 103 | headers: parseHeaders(xhr.getAllResponseHeaders() || '') 104 | 105 | } 106 | 107 | options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') 108 | 109 | var body = 'response' in xhr ? xhr.response : xhr.responseText 110 | 111 | resolve(new Response(body, options)) 112 | 113 | } 114 | 115 | 116 | 117 | xhr.onerror = function () { 118 | 119 | reject(new TypeError('Network request failed')) 120 | 121 | } 122 | 123 | 124 | 125 | xhr.ontimeout = function () { 126 | 127 | reject(new TypeError('Network request failed')) 128 | 129 | } 130 | 131 | 132 | 133 | xhr.open(request.method, request.url, true) 134 | 135 | 136 | 137 | if (request.credentials === 'include') { 138 | 139 | xhr.withCredentials = true 140 | 141 | } 142 | 143 | 144 | 145 | if ('responseType' in xhr && support.blob) { 146 | 147 | xhr.responseType = 'blob' 148 | 149 | } 150 | 151 | 152 | 153 | request.headers.forEach(function (value, name) { 154 | 155 | xhr.setRequestHeader(name, value) 156 | 157 | }) 158 | 159 | 160 | 161 | xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) 162 | 163 | }) 164 | 165 | } --------------------------------------------------------------------------------