diff --git a/App.js b/App.js
index 058a2a4b..a7566730 100644
--- a/App.js
+++ b/App.js
@@ -27,10 +27,12 @@ import {init, Geolocation} from 'react-native-amap-geolocation';
import * as RootNavigation from '@/navigator/root-navigation';
import * as action from '@/redux/constants';
import {getChannels, getChannelPosts} from '@/api/home_api';
+import { BasePosthogKey} from "@/utils/config"
import JPush from 'jpush-react-native';
WeChat.registerApp('wx17b69998e914b8f0', 'https://app.meirixinxue.com/');
import JVerification from 'jverification-react-native';
-import { RootSiblingParent } from 'react-native-root-siblings';
+import {RootSiblingParent} from 'react-native-root-siblings';
+import CommentInput from '@/components/comment-input';
const queryString = require('query-string');
const codePushOptions = {
@@ -62,6 +64,18 @@ class App extends Component {
scale = 1.08;
}
+ Text.defaultProps = Object.assign({}, Text.defaultProps, {
+ allowFontScaling: false,
+ adjustsFontSizeToFit: true,
+ minimumFontScale: scale,
+ });
+ Text.defaultProps.sytle = {color: 'black'};
+ TextInput.defaultProps = Object.assign({}, TextInput.defaultProps, {
+ defaultProps: false,
+ allowFontScaling: false,
+ textBreakStrategy: 'simple',
+ });
+
this.loadSplashImg();
this.loadSettings();
this.checkPermission();
@@ -75,19 +89,7 @@ class App extends Component {
// this.saveToken(); //保存token
- // console.log('scale', scale);
- Text.defaultProps = Object.assign({}, Text.defaultProps, {
- allowFontScaling: false,
- adjustsFontSizeToFit: true,
- minimumFontScale: scale,
- });
- Text.defaultProps.sytle = {color: 'black'};
- TextInput.defaultProps = Object.assign({}, TextInput.defaultProps, {
- defaultProps: false,
- allowFontScaling: false,
- textBreakStrategy: 'simple',
- });
}
loadSplashImg = () => {
@@ -114,8 +116,8 @@ class App extends Component {
};
JVerification.init(initParams, result => {
console.log('JVerification init', result);
- })
- }
+ });
+ };
checkPermission = () => {
checkMultiple([PERMISSIONS.IOS.LOCATION_WHEN_IN_USE]).then(statuses => {
@@ -249,6 +251,8 @@ class App extends Component {
+
+
diff --git a/ReactotronConfig.js b/ReactotronConfig.js
new file mode 100644
index 00000000..2f94b19e
--- /dev/null
+++ b/ReactotronConfig.js
@@ -0,0 +1,8 @@
+import Reactotron from 'reactotron-react-native'
+import AsyncStorage from '@react-native-community/async-storage';
+
+Reactotron
+ .setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
+ .configure() // controls connection & communication settings
+ .useReactNative() // add all built-in react native plugins
+ .connect() // let's connect!
\ No newline at end of file
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 61d918d0..db7f0ee4 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -140,8 +140,8 @@ android {
vectorDrawables.useSupportLibrary = true
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 11
- versionName "0.0.25"
+ versionCode 13
+ versionName "0.0.27"
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
@@ -236,26 +236,29 @@ dependencies {
implementation project(':lottie-react-native')
compile project(':react-native-video')
- implementation "androidx.appcompat:appcompat:1.0.0"
+ //implementation "androidx.appcompat:appcompat:1.1.0"
implementation "com.squareup.okhttp3:okhttp:4.2.1"
implementation "com.squareup.okhttp3:logging-interceptor:4.2.1"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.2.1"
+ implementation "androidx.multidex:multidex:2.0.0"
+ implementation 'androidx.appcompat:appcompat:1.3.0'
+ //implementation 'com.posthog.android:posthog:1.+'
// compile project(':push')
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.fbjni'
- }
+ //debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
+ //exclude group:'com.facebook.fbjni'
+ //}
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.flipper'
- exclude group:'com.squareup.okhttp3', module:'okhttp'
- }
+ //debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
+ // exclude group:'com.facebook.flipper'
+ // exclude group:'com.squareup.okhttp3', module:'okhttp'
+ //}
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.flipper'
- }
+ //debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
+ // exclude group:'com.facebook.flipper'
+ //}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
diff --git a/android/app/src/debug/java/com/vanyah/androidnative/ReactNativeFlipper.java b/android/app/src/debug/java/com/vanyah/androidnative/ReactNativeFlipper.java
index 2900ebab..fcde3c95 100644
--- a/android/app/src/debug/java/com/vanyah/androidnative/ReactNativeFlipper.java
+++ b/android/app/src/debug/java/com/vanyah/androidnative/ReactNativeFlipper.java
@@ -1,72 +1,72 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- *
This source code is licensed under the MIT license found in the LICENSE file in the root
- * directory of this source tree.
- */
-package com.vanyah.androidnative;
+// /**
+// * Copyright (c) Facebook, Inc. and its affiliates.
+// *
+// *
This source code is licensed under the MIT license found in the LICENSE file in the root
+// * directory of this source tree.
+// */
+// package com.vanyah.androidnative;
-import android.content.Context;
-import com.facebook.flipper.android.AndroidFlipperClient;
-import com.facebook.flipper.android.utils.FlipperUtils;
-import com.facebook.flipper.core.FlipperClient;
-import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
-import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
-import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
-import com.facebook.flipper.plugins.inspector.DescriptorMapping;
-import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
-import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
-import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
-import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
-import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
-import com.facebook.react.ReactInstanceManager;
-import com.facebook.react.bridge.ReactContext;
-import com.facebook.react.modules.network.NetworkingModule;
-import okhttp3.OkHttpClient;
+// import android.content.Context;
+// import com.facebook.flipper.android.AndroidFlipperClient;
+// import com.facebook.flipper.android.utils.FlipperUtils;
+// import com.facebook.flipper.core.FlipperClient;
+// import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
+// import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
+// import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
+// import com.facebook.flipper.plugins.inspector.DescriptorMapping;
+// import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
+// import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
+// import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
+// import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
+// import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
+// import com.facebook.react.ReactInstanceManager;
+// import com.facebook.react.bridge.ReactContext;
+// import com.facebook.react.modules.network.NetworkingModule;
+// import okhttp3.OkHttpClient;
-public class ReactNativeFlipper {
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
- if (FlipperUtils.shouldEnableFlipper(context)) {
- final FlipperClient client = AndroidFlipperClient.getInstance(context);
+// public class ReactNativeFlipper {
+// public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
+// if (FlipperUtils.shouldEnableFlipper(context)) {
+// final FlipperClient client = AndroidFlipperClient.getInstance(context);
- client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
- client.addPlugin(new ReactFlipperPlugin());
- client.addPlugin(new DatabasesFlipperPlugin(context));
- client.addPlugin(new SharedPreferencesFlipperPlugin(context));
- client.addPlugin(CrashReporterPlugin.getInstance());
+// client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
+// client.addPlugin(new ReactFlipperPlugin());
+// client.addPlugin(new DatabasesFlipperPlugin(context));
+// client.addPlugin(new SharedPreferencesFlipperPlugin(context));
+// client.addPlugin(CrashReporterPlugin.getInstance());
- NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
- NetworkingModule.setCustomClientBuilder(
- new NetworkingModule.CustomClientBuilder() {
- @Override
- public void apply(OkHttpClient.Builder builder) {
- builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
- }
- });
- client.addPlugin(networkFlipperPlugin);
- client.start();
+// NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
+// NetworkingModule.setCustomClientBuilder(
+// new NetworkingModule.CustomClientBuilder() {
+// @Override
+// public void apply(OkHttpClient.Builder builder) {
+// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
+// }
+// });
+// client.addPlugin(networkFlipperPlugin);
+// client.start();
- // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
- // Hence we run if after all native modules have been initialized
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
- if (reactContext == null) {
- reactInstanceManager.addReactInstanceEventListener(
- new ReactInstanceManager.ReactInstanceEventListener() {
- @Override
- public void onReactContextInitialized(ReactContext reactContext) {
- reactInstanceManager.removeReactInstanceEventListener(this);
- reactContext.runOnNativeModulesQueueThread(
- new Runnable() {
- @Override
- public void run() {
- client.addPlugin(new FrescoFlipperPlugin());
- }
- });
- }
- });
- } else {
- client.addPlugin(new FrescoFlipperPlugin());
- }
- }
- }
-}
+// // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
+// // Hence we run if after all native modules have been initialized
+// ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
+// if (reactContext == null) {
+// reactInstanceManager.addReactInstanceEventListener(
+// new ReactInstanceManager.ReactInstanceEventListener() {
+// @Override
+// public void onReactContextInitialized(ReactContext reactContext) {
+// reactInstanceManager.removeReactInstanceEventListener(this);
+// reactContext.runOnNativeModulesQueueThread(
+// new Runnable() {
+// @Override
+// public void run() {
+// client.addPlugin(new FrescoFlipperPlugin());
+// }
+// });
+// }
+// });
+// } else {
+// client.addPlugin(new FrescoFlipperPlugin());
+// }
+// }
+// }
+// }
diff --git a/android/app/src/main/java/com/vanyah/androidnative/MainApplication.java b/android/app/src/main/java/com/vanyah/androidnative/MainApplication.java
index f79f96f8..72040def 100644
--- a/android/app/src/main/java/com/vanyah/androidnative/MainApplication.java
+++ b/android/app/src/main/java/com/vanyah/androidnative/MainApplication.java
@@ -74,7 +74,7 @@ public ReactNativeHost getReactNativeHost() {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
- initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
+ // initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
JPushModule.registerActivityLifecycle(this);
// UMConfigure.setLogEnabled(true);
@@ -92,27 +92,27 @@ public void onCreate() {
* @param context
* @param reactInstanceManager
*/
- private static void initializeFlipper(
- Context context, ReactInstanceManager reactInstanceManager) {
- if (BuildConfig.DEBUG) {
- try {
- /*
- We use reflection here to pick up the class that initializes Flipper,
- since Flipper library is not available in release mode
- */
- Class> aClass = Class.forName("com.vanyah.androidnative.ReactNativeFlipper");
- aClass
- .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
- .invoke(null, context, reactInstanceManager);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
- }
- }
+ // private static void initializeFlipper(
+ // Context context, ReactInstanceManager reactInstanceManager) {
+ // if (BuildConfig.DEBUG) {
+ // try {
+ // /*
+ // We use reflection here to pick up the class that initializes Flipper,
+ // since Flipper library is not available in release mode
+ // */
+ // Class> aClass = Class.forName("com.vanyah.androidnative.ReactNativeFlipper");
+ // aClass
+ // .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
+ // .invoke(null, context, reactInstanceManager);
+ // } catch (ClassNotFoundException e) {
+ // e.printStackTrace();
+ // } catch (NoSuchMethodException e) {
+ // e.printStackTrace();
+ // } catch (IllegalAccessException e) {
+ // e.printStackTrace();
+ // } catch (InvocationTargetException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // }
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 8b152f2a..6fd7c5cb 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -25,4 +25,4 @@ android.useAndroidX=true
android.enableJetifier=true
# Version of flipper SDK to use with React Native
-FLIPPER_VERSION=0.37.0
\ No newline at end of file
+# FLIPPER_VERSION=0.37.0
\ No newline at end of file
diff --git a/android/settings.gradle b/android/settings.gradle
index edc0568b..ae9cc453 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -21,4 +21,7 @@ project(':jverification-react-native').projectDir = new File(rootProject.project
include ':jpush-react-native'
project(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')
include ':jcore-react-native'
-project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
\ No newline at end of file
+project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
+
+//include ':posthog-react-native'
+//project(':posthog-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/posthog-react-native/android')
\ No newline at end of file
diff --git a/iconfont.json b/iconfont.json
index f4ade038..2ec83d6c 100644
--- a/iconfont.json
+++ b/iconfont.json
@@ -1,7 +1,7 @@
{
- "symbol_url": "//at.alicdn.com/t/font_1446105_znjtkpzvld.js",
+ "symbol_url": "//at.alicdn.com/t/font_1446105_dfbygoqunkb.js",
"use_typescript": false,
"save_dir": "./src/iconfont",
"trim_icon_prefix": "icon",
"default_icon_size": 16
-}
\ No newline at end of file
+}
diff --git a/index.js b/index.js
index cf4dbc8b..eb156fa4 100644
--- a/index.js
+++ b/index.js
@@ -3,7 +3,9 @@
*/
// import './logbox'
-
+if(__DEV__) {
+ import('./ReactotronConfig').then(() => console.log('Reactotron Configured'))
+}
import 'react-native-gesture-handler';
import React, {Component} from 'react';
diff --git a/ios/Podfile b/ios/Podfile
index cb6ddc09..b23d1e1a 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -114,10 +114,14 @@ target 'wanya_native' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
- use_flipper!
- post_install do |installer|
- flipper_post_install(installer)
- end
+ #use_flipper!
+ # use_flipper!({ 'Flipper' => '0.101.0' })
+ # 暂时指定版本
+ # https://stackoverflow.com/questions/68264876/xcode-build-error-with-react-native-cxa-increment-exception-refcount
+ # use_flipper!({'Flipper' => '0.92.0', 'Flipper-Folly' => '2.6.7'})
+ # post_install do |installer|
+ # flipper_post_install(installer)
+ # end
end
target 'wanya_native-tvOS' do
diff --git a/ios/wanya_native.xcodeproj/project.pbxproj b/ios/wanya_native.xcodeproj/project.pbxproj
index e13f708c..7663d699 100644
--- a/ios/wanya_native.xcodeproj/project.pbxproj
+++ b/ios/wanya_native.xcodeproj/project.pbxproj
@@ -798,7 +798,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = icons;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = wanya_native/wanya_nativeDebug.entitlements;
- CURRENT_PROJECT_VERSION = 46;
+ CURRENT_PROJECT_VERSION = 49;
DEVELOPMENT_TEAM = K7KF6RDWDW;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -808,7 +808,7 @@
INFOPLIST_FILE = wanya_native/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- MARKETING_VERSION = 0.0.25;
+ MARKETING_VERSION = 0.0.27;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -834,13 +834,13 @@
CODE_SIGN_ENTITLEMENTS = wanya_native/wanya_nativeRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 46;
+ CURRENT_PROJECT_VERSION = 49;
DEVELOPMENT_TEAM = K7KF6RDWDW;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = wanya_native/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- MARKETING_VERSION = 0.0.25;
+ MARKETING_VERSION = 0.0.27;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
diff --git a/ios/wanya_native.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/wanya_native.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 00000000..f9b0d7c5
--- /dev/null
+++ b/ios/wanya_native.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/ios/wanya_native/AppDelegate.m b/ios/wanya_native/AppDelegate.m
index d2553f4e..455fea82 100644
--- a/ios/wanya_native/AppDelegate.m
+++ b/ios/wanya_native/AppDelegate.m
@@ -20,27 +20,27 @@
#import
#ifdef FB_SONARKIT_ENABLED
-#import
-#import
-#import
-#import
-#import
-#import
+// #import
+// #import
+// #import
+// #import
+// #import
+// #import
// #ifdef DEBUG
// #import
// #endif
-static void InitializeFlipper(UIApplication *application) {
- FlipperClient *client = [FlipperClient sharedClient];
- SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
- [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
- [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
- [client addPlugin:[FlipperKitReactPlugin new]];
- [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
- [client start];
-}
+// static void InitializeFlipper(UIApplication *application) {
+// FlipperClient *client = [FlipperClient sharedClient];
+// SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
+// [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
+// [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
+// [client addPlugin:[FlipperKitReactPlugin new]];
+// [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
+// [client start];
+// }
#endif
//@interface AppDelegate()
@@ -51,7 +51,7 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
- InitializeFlipper(application);
+ // InitializeFlipper(application);
#endif
// #ifdef DEBUG
diff --git a/package.json b/package.json
index d243eff5..e69b65a6 100644
--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
"react-native-android-badge": "^0.5.0",
"react-native-animatable": "^1.3.3",
"react-native-apple-authentication": "^1.0.8",
- "react-native-audio": "^4.3.0",
+ "react-native-audio": "https://github.com/jsierles/react-native-audio.git",
"react-native-autoheight-webview": "^1.5.7",
"react-native-autolink": "^3.0.0",
"react-native-background-timer": "^2.2.0",
@@ -88,6 +88,7 @@
"react-native-view-shot": "^3.1.2",
"react-native-webview": "^11.4.2",
"react-native-wechat-lib": "^1.1.19",
+ "react-native-xupdate-new": "^1.0.2",
"react-redux": "^7.2.0",
"reanimated-bottom-sheet": "^1.0.0-alpha.22",
"recyclerlistview": "^3.0.5",
@@ -110,7 +111,8 @@
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-native-iconfont-cli": "^2.1.0",
- "react-test-renderer": "16.13.1"
+ "react-test-renderer": "16.13.1",
+ "reactotron-react-native": "^5.0.0"
},
"jest": {
"preset": "react-native"
diff --git a/src/api/account_api.js b/src/api/account_api.js
index adf64b69..03a7fad3 100644
--- a/src/api/account_api.js
+++ b/src/api/account_api.js
@@ -81,15 +81,6 @@ export const getAccountArticles = async params => {
return res;
};
-// export async function getAccountBaseInfo(nickname) {
-// const res = await request({
-// url: '/api/v1/accounts/base_info',
-// method: 'GET',
-// params: {name: nickname},
-// });
-// return res.data.account;
-// }
-
// 发布的帖子 收藏,喜欢的帖子
// type= publish, praise, star
export async function getAccountTopics(id, type, params = {}) {
@@ -104,34 +95,6 @@ export async function getAccountTopics(id, type, params = {}) {
return res;
}
-// 收藏,喜欢的动态
-// type= publish, praise, star
-// export async function getAccountPosts(id, type, params = {}) {
-// const res = await request({
-// url: `/api/v1/accounts/${id}/posts`,
-// method: 'GET',
-// params: {
-// type: type,
-// ...params,
-// },
-// });
-// return res;
-// }
-
-// 发布的帖子 收藏,喜欢的帖子
-// type= publish, praise, star
-// export async function getAccountArticles(id, type, params = {}) {
-// const res = await request({
-// url: `/api/v1/accounts/${id}/articles`,
-// method: 'GET',
-// params: {
-// type: type,
-// ...params,
-// },
-// });
-// return res;
-// }
-
// 发布的课程, 学过的课程, 收藏的课程
// type: publish, learn, star, praise, view
export async function getAccountCourses(id, type = 'publish', params = {}) {
@@ -173,24 +136,6 @@ export async function getAccountCounts(id, opts = {types: ''}) {
return res.data;
}
-// 关注用户
-// export async function followAccount(id) {
-// const res = await request({
-// url: `/api/v1/accounts/${id}/follow`,
-// method: 'POST',
-// });
-// return res.data;
-// }
-
-// // 取消关注用户
-// export async function unfollowAccount(id) {
-// const res = await request({
-// url: `/api/v1/accounts/${id}/unfollow`,
-// method: 'POST',
-// });
-// return res.data;
-// }
-
// 我的评论
export async function getReplyComments(params = {}) {
const res = await request({
@@ -264,29 +209,6 @@ export async function isLearnCourse(account_id) {
return res.data;
}
-// // 用户的粉丝列表
-// export async function getAccountFollowers(account_id, params = {}) {
-// const res = await request({
-// url: `/api/v1/accounts/${account_id}/followers`,
-// method: 'GET',
-// params: params,
-// });
-
-// return res;
-// }
-
-// 用户的粉丝列表
-
-// export async function getAccountFollowings(account_id, params = {}) {
-// const res = await request({
-// url: `/api/v1/accounts/${account_id}/followings`,
-// method: 'GET',
-// params: params,
-// });
-
-// return res;
-// }
-
export async function getAccountRecentFollowers(params = {}) {
const res = await request({
url: `/api/v1/accounts/${params.id}/recent_followers`,
@@ -375,16 +297,6 @@ export async function getAccountInviteList(data = {}) {
return res.data;
}
-// 用户的粉丝列表
-// export const getAccountFollowers = async params => {
-// const res = await request({
-// url: `/api/v1/accounts/${params.id}/followers`,
-// method: 'GET',
-// params,
-// });
-// return res;
-// };
-
// 主页 动态publish 喜欢praise 视频publish_video
export const getAccountPosts = async params => {
const res = await request({
@@ -433,20 +345,12 @@ export const getAccountFollowers = async params => {
return res;
};
-// export async function getAccountFollowers(params) {
-// const res = await request({
-// url: `/api/v1/accounts/${account_id}/followers`,
-// method: 'GET',
-// params
-// })
-// return res
-// }
-// export async function getAccountFollowings(account_id, params = {}) {
-// const res = await request({
-// url: `/api/v1/accounts/${account_id}/followings`,
-// method: 'GET',
-// params: params,
-// });
-
-// return res;
-// }
+// 用户互相关注
+export const getAccountFollowEeach = async params => {
+ const res = await request({
+ url: `/api/v1/accounts/${params.id}/follow_each`,
+ method: 'GET',
+ params,
+ });
+ return res;
+};
diff --git a/src/api/asset_api.js b/src/api/asset_api.js
index 05748d85..4c42932e 100644
--- a/src/api/asset_api.js
+++ b/src/api/asset_api.js
@@ -50,12 +50,10 @@ export async function getShareUrl(data = {item_id: '', item_type: ''}) {
// 获取到已分享过的详细信息
export async function getShareContent(data = {item_type: '', item_id: ''}) {
- console.log('item_type', data);
const res = await request({
url: '/api/v1/share_pages/share',
method: 'GET',
data: data,
});
- // console.log('res', res);
return res.data.share_content;
}
diff --git a/src/api/home_api.js b/src/api/home_api.js
index 62d31d76..10e1b5df 100644
--- a/src/api/home_api.js
+++ b/src/api/home_api.js
@@ -107,6 +107,16 @@ export const getFollowedNodePosts = async (params = {}) => {
return res;
};
+// 向用户推荐关注的人
+export const getRecommendAccounts = async params => {
+ const res = await request({
+ url: '/api/v1/recommend/recommend_accounts',
+ method: 'GET',
+ params,
+ });
+ return res;
+};
+
// export async function createComment(data = {}) {
// const res = await request({
// url: `/api/v1/comments`,
diff --git a/src/api/settings_api.js b/src/api/settings_api.js
index 5aa1d173..0ed98b86 100644
--- a/src/api/settings_api.js
+++ b/src/api/settings_api.js
@@ -1,4 +1,23 @@
import request from './request';
+import {getDeviceInfo} from "@/utils/device_info"
+
+export const getProsettings = async data => {
+ const res = await request({
+ url: '/api/v1/settings/prosettings.json',
+ method: 'GET',
+ data,
+ });
+ return res.data;
+};
+
+export const getVersionUpgrades = async data => {
+ const res = await request({
+ url: '/api/v1/version_upgrades',
+ method: 'GET',
+ data,
+ });
+ return res.data;
+};
export const getLabelList = async () => {
const res = await request({
@@ -95,3 +114,14 @@ export async function ahoyTrackEvents(params) {
});
return res.data;
}
+
+// 记录用户的统计数据
+export async function agentTrackEvents(params) {
+ const device_info = await getDeviceInfo();
+ const res = await request({
+ url: '/api/v1/visit_logs',
+ method: 'POST',
+ data: {...device_info, ...params},
+ });
+ return res.data;
+}
\ No newline at end of file
diff --git a/src/api/shop_brand_api.js b/src/api/shop_brand_api.js
index 59e327d3..6dd3c148 100644
--- a/src/api/shop_brand_api.js
+++ b/src/api/shop_brand_api.js
@@ -2,7 +2,6 @@ import request from './request';
// 品牌列表
export const getShopBrands = async (params, apiPath) => {
- console.log('path', apiPath);
const res = await request({
url: `/api/v1/shop_brands?${apiPath}`,
method: 'GET',
diff --git a/src/assets/images/download.png b/src/assets/images/download.png
new file mode 100644
index 00000000..977f61a2
Binary files /dev/null and b/src/assets/images/download.png differ
diff --git a/src/assets/tabimages/index-active.png b/src/assets/tabimages/index-active.png
index 54201b18..daf62f0a 100644
Binary files a/src/assets/tabimages/index-active.png and b/src/assets/tabimages/index-active.png differ
diff --git a/src/assets/tabimages/index-active1.png b/src/assets/tabimages/index-active1.png
new file mode 100644
index 00000000..54201b18
Binary files /dev/null and b/src/assets/tabimages/index-active1.png differ
diff --git a/src/components/ActionSheet.android.js b/src/components/ActionSheet.android.js
index cba7969c..a56e43b1 100644
--- a/src/components/ActionSheet.android.js
+++ b/src/components/ActionSheet.android.js
@@ -25,8 +25,6 @@ const ActionSheetAndroid = props => {
}, [props.showActionSheet]);
const onPressItem = actionItem => {
- // console.log('xxxxxxxxxxx');
-
actionItem.onPress();
setShowActionSheet(false);
if (props.changeModal) {
@@ -34,7 +32,6 @@ const ActionSheetAndroid = props => {
}
};
- // console.log('showActionSheet1', props)
return (
onPressItem(cancelItem)}
diff --git a/src/components/CollapsibleHeaders.js b/src/components/CollapsibleHeaders.js
index 2995f782..8ad34152 100644
--- a/src/components/CollapsibleHeaders.js
+++ b/src/components/CollapsibleHeaders.js
@@ -3,6 +3,8 @@ import {Animated, Platform, StatusBar, Dimensions, StyleSheet, View, Text} from
import {TabView} from 'react-native-tab-view';
import TabList from '@/components/TabList';
import {NAV_BAR_HEIGHT, IsIos, UNSAFE_TOP} from '@/utils/navbar';
+import * as RootNavigation from '@/navigator/root-navigation';
+import Helper from '@/utils/helper';
const tabBarHeight = 45; // tabbar middle高度
const titleHeight = IsIos ? NAV_BAR_HEIGHT + UNSAFE_TOP : NAV_BAR_HEIGHT; // 标题高度
@@ -137,6 +139,18 @@ const CollapsibleHeader = props => {
extrapolateRight: 'clamp',
});
+ const tabChange = item => {
+ props.onKeyChange(item.key, item.title);
+ const data = RootNavigation.getCurrentPage();
+ const recordData = {
+ event: `tab_${item.key}_${data.name}`,
+ name: `tab_${item.title}_${data.title || data.name}`,
+ project_name: 'tab点击',
+ meta: data,
+ };
+ Helper.recordVisit(recordData);
+ };
+
const viewStyles = {
top: 0,
zIndex: 1,
@@ -153,7 +167,7 @@ const CollapsibleHeader = props => {
align="center"
bottomLine={true}
separator={false}
- tabChange={tab => props.onKeyChange(tab.key)}
+ tabChange={tab => tabChange(tab)}
data={navigationState.routes}
/>
@@ -201,8 +215,6 @@ const CollapsibleHeader = props => {
extrapolate: 'clamp',
});
- // console.log('opacity', titleHeight);
- // console.log('opacity', opacity);
return (
{props.renderTopHeader}
diff --git a/src/components/FastImageGif.js b/src/components/FastImageGif.js
index 299758ff..d2929d75 100644
--- a/src/components/FastImageGif.js
+++ b/src/components/FastImageGif.js
@@ -16,7 +16,6 @@ const FastImgGif = props => {
const resizeMode = modeList[props.mode || 'cover'];
const onGif = event => {
- // console.log('xxx', props.gif_url)
if (props.gif_url) {
if (source.uri !== props.gif_url) {
setSource({uri: props.gif_url});
diff --git a/src/components/FocusAwareStatusBar.js b/src/components/FocusAwareStatusBar.js
index fc0b37d9..10503c4c 100644
--- a/src/components/FocusAwareStatusBar.js
+++ b/src/components/FocusAwareStatusBar.js
@@ -2,10 +2,9 @@ import * as React from 'react';
import {StatusBar} from 'react-native';
import {useIsFocused} from '@react-navigation/native';
-const FocusAwareStatusBar = (props) => {
+const FocusAwareStatusBar = props => {
const isFocused = useIsFocused();
- // console.log('isFocused', isFocused)
return isFocused ? : null;
-}
+};
export default FocusAwareStatusBar;
diff --git a/src/components/Item/base-account.js b/src/components/Item/base-account.js
index 1645441f..a74b639f 100644
--- a/src/components/Item/base-account.js
+++ b/src/components/Item/base-account.js
@@ -53,6 +53,7 @@ const BaseAccount = props => {
: `@${data.nickname} `,
mention_ids: savecomment.mention_ids ? [...savecomment.mention_ids, data.id] : [data.id],
};
+ console.log('comments', comments);
dispatch({type: action.SAVE_COMMENT_CONTENT, value: comments});
navigation.goBack();
}
diff --git a/src/components/Item/base-mail.js b/src/components/Item/base-mail.js
new file mode 100644
index 00000000..5778a478
--- /dev/null
+++ b/src/components/Item/base-mail.js
@@ -0,0 +1,58 @@
+import React from 'react';
+import {View, Text, Pressable, StyleSheet} from 'react-native';
+import {TabRouter, useNavigation} from '@react-navigation/native';
+import {Avator, JoinButton} from '@/components/NodeComponents';
+import {getChatGroupsDetail} from '@/api/chat_api';
+
+const BaseMail = ({item}) => {
+ const navigation = useNavigation();
+ const {id, nickname, intro} = item;
+
+ const handleGoDetail = () => {
+ navigation.push('AccountDetail', {accountId: id});
+ };
+
+ const handleCreateChat = async () => {
+ const params = {receiver_id: id};
+ const res = await getChatGroupsDetail(params);
+ const {uuid} = res.data.chat_group;
+ navigation.navigate('ChatDetail', {uuid, targetAccountId: item.id, targetAccountNickname: item.nickname });
+ };
+
+ return (
+
+
+
+ {nickname}
+
+ {intro || '探索与发现 记录与分享'}
+
+
+
+
+ );
+};
+
+const bStyles = StyleSheet.create({
+ wrapper: {
+ paddingHorizontal: 14,
+ paddingVertical: 12,
+ flexDirection: 'row',
+ alignItems: 'center',
+ backgroundColor: '#fff',
+ },
+ accountInfo: {
+ flex: 1,
+ marginLeft: 12,
+ },
+ nickname: {
+ fontSize: 15,
+ },
+ intro: {
+ fontSize: 12,
+ color: '#BDBDBD',
+ marginTop: 5,
+ },
+});
+
+export default BaseMail;
diff --git a/src/components/Item/base-node.js b/src/components/Item/base-node.js
index a9425ea9..40cf5d66 100644
--- a/src/components/Item/base-node.js
+++ b/src/components/Item/base-node.js
@@ -1,4 +1,4 @@
-import React, {useState} from 'react';
+import React, {useState, useEffect} from 'react';
import {useSelector, useDispatch} from 'react-redux';
import {useNavigation} from '@react-navigation/native';
import {View, Text, StyleSheet, Pressable} from 'react-native';
@@ -8,10 +8,13 @@ import {JoinButton} from '@/components/NodeComponents';
import {followItem, unfollowItem} from '@/api/mine_api';
import FastImg from '@/components/FastImg';
import Toast from '@/components/Toast';
+import {ScaleDistance} from '@/utils';
// add-node 创建帖子圈子选择
// mine-node 全部圈子 我创建
// list 圈子列表
+// nearby 附近圈子列表
+
const BaseNode = props => {
const navigation = useNavigation();
const dispatch = useDispatch();
@@ -32,7 +35,7 @@ const BaseNode = props => {
};
const goNodeDetail = () => {
- if (type === 'list') {
+ if (['list', 'nearby'].includes(type)) {
navigation.push('NodeDetail', {nodeId: data.id});
}
@@ -51,6 +54,10 @@ const BaseNode = props => {
}
};
+ useEffect(() => {
+ setFollowed(data.followed)
+ }, [data.followed])
+
return (
@@ -59,14 +66,18 @@ const BaseNode = props => {
{data.name}
{data.topics_count}篇帖子 · {data.accounts_count}位{data.nickname || '圈友'}
+ {type === 'nearby' && data.distance > 0 ? ` · 距你${ScaleDistance(data.distance)}` : ''}
- {/* list */}
- {type === 'list' && (
-
-
-
+ {/* list || nearby */}
+ {['list', 'nearby'].includes(type) && (
+
)}
{/* add-node */}
@@ -82,10 +93,14 @@ const BaseNode = props => {
{/* mine-node */}
{type === 'mine-node' && (
- {data.audit_status === 'new' && }
- {data.audit_status === 'auditing' && }
- {data.audit_status === 'failed' && }
- {data.audit_status === 'success' && }
+ {data.audit_status === 'new' && }
+ {data.audit_status === 'auditing' && (
+
+ )}
+ {data.audit_status === 'failed' && (
+
+ )}
+ {data.audit_status === 'success' && }
)}
@@ -103,8 +118,6 @@ const styles = StyleSheet.create({
width: 49,
height: 49,
borderRadius: 5,
- borderWidth: 3,
- borderColor: '#ffff00',
},
dataInfo: {
flex: 1,
diff --git a/src/components/Item/base-recommend-account.js b/src/components/Item/base-recommend-account.js
new file mode 100644
index 00000000..5c617544
--- /dev/null
+++ b/src/components/Item/base-recommend-account.js
@@ -0,0 +1,140 @@
+import React from 'react';
+import {View, Text, Pressable, StyleSheet, Dimensions} from 'react-native';
+import {useNavigation} from '@react-navigation/native';
+import {Avator} from '@/components/NodeComponents';
+import FastImg from '@/components/FastImg';
+import {RFValue, VWValue} from '@/utils/response-fontsize';
+import {getChatGroupsDetail} from '@/api/chat_api';
+
+const {width} = Dimensions.get('window');
+
+const imageWidth = (width - 14 * 2 - VWValue(45) - 12 - 4 * 4) / 5;
+
+const BaseRecommendAccount = ({data}) => {
+ const navigation = useNavigation();
+ const {id, nickname, intro, label_list, media} = data;
+
+ const handleCreateChat = async () => {
+ const params = {receiver_id: id};
+ const res = await getChatGroupsDetail(params);
+ const {uuid} = res.data.chat_group;
+ navigation.navigate('ChatDetail', {
+ uuid,
+ targetAccountId: data.id,
+ targetAccountNickname: data.nickname,
+ });
+ };
+
+ const goAccountDetail = () => {
+ navigation.navigate('AccountDetail', {accountId: id});
+ };
+
+ const lablelList = label_list.slice(0, 5);
+ const mediaList = media.slice(0, 5);
+
+ return (
+
+
+
+ {nickname}
+ {lablelList.length > 0 ? (
+
+ {lablelList.map((label, index) => (
+
+ {label}
+ {lablelList.length - 1 !== index && | }
+
+ ))}
+
+ ) : null}
+
+ {intro || '探索与发现 记录与分享'}
+
+ {mediaList.length > 0 ? (
+
+ {mediaList.map(item => (
+
+ ))}
+
+ ) : (
+
+ )}
+
+
+ 打招呼
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ wrap: {
+ paddingHorizontal: 14,
+ paddingTop: RFValue(14),
+ paddingBottom: RFValue(11),
+ flexDirection: 'row',
+ backgroundColor: '#fff',
+ },
+ accountInfo: {
+ flex: 1,
+ marginLeft: 12,
+ },
+ nickname: {
+ fontSize: 15,
+ marginTop: 5,
+ },
+ labelWrap: {
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ marginTop: 10,
+ },
+ label: {
+ fontSize: 12,
+ color: '#3d3d3d',
+ fontWeight: '300',
+ },
+ labelLine: {
+ width: StyleSheet.hairlineWidth,
+ height: 12,
+ marginHorizontal: 5,
+ backgroundColor: '#3d3d3d',
+ },
+ intro: {
+ fontSize: 12,
+ color: '#3d3d3d',
+ marginTop: 10,
+ },
+ imageWrap: {
+ flexDirection: 'row',
+ marginTop: 10,
+ },
+ image: {
+ width: imageWidth,
+ height: imageWidth,
+ marginRight: 4,
+ },
+ btn: {
+ width: 54,
+ height: 27,
+ lineHeight: 27,
+ textAlign: 'center',
+ fontSize: 12,
+ fontWeight: '500',
+ color: '#FF2242',
+ borderWidth: 1,
+ borderColor: '#FF2242',
+ borderRadius: 14,
+ position: 'absolute',
+ right: 0,
+ top: 2,
+ },
+});
+
+export default React.memo(BaseRecommendAccount);
diff --git a/src/components/Item/base-shop-store.js b/src/components/Item/base-shop-store.js
index feb83a49..1629f885 100644
--- a/src/components/Item/base-shop-store.js
+++ b/src/components/Item/base-shop-store.js
@@ -4,6 +4,7 @@ import {useNavigation} from '@react-navigation/native';
import {RFValue} from '@/utils/response-fontsize';
import FastImg from '@/components/FastImg';
import IconFont from '@/iconfont';
+import {ScaleDistance} from '@/utils';
const BaseShopstore = props => {
const navigation = useNavigation();
@@ -33,11 +34,7 @@ const BaseShopstore = props => {
{store_type === 'website' && '网店'}
- {store_type === 'entity' && distance > 0
- ? distance > 1000
- ? `${(distance / 1000).toFixed(1)}km`
- : `${distance}m`
- : ''}
+ {store_type === 'entity' && distance > 0 ? ScaleDistance(distance) : ''}
diff --git a/src/components/Item/base-space-detail.js b/src/components/Item/base-space-detail.js
index 11307076..a97cbe42 100644
--- a/src/components/Item/base-space-detail.js
+++ b/src/components/Item/base-space-detail.js
@@ -4,6 +4,7 @@ import {useNavigation} from '@react-navigation/native';
import {RFValue} from '@/utils/response-fontsize';
import FastImg from '@/components/FastImg';
import IconFont from '@/iconfont';
+import {ScaleDistance} from '@/utils';
const BaseSpceDetail = props => {
const navigation = useNavigation();
@@ -29,13 +30,7 @@ const BaseSpceDetail = props => {
{address}
-
- {distance > 0
- ? distance > 1000
- ? `${(distance / 1000).toFixed(1)}km`
- : `${distance}m`
- : ''}
-
+ {distance > 0 ? {ScaleDistance(distance)} : null}
{tag_list.map((tag, index) => (
diff --git a/src/components/Item/base-topic.js b/src/components/Item/base-topic.js
index c367e786..ded7ab5a 100644
--- a/src/components/Item/base-topic.js
+++ b/src/components/Item/base-topic.js
@@ -3,7 +3,7 @@ import {View, Text, Image, StyleSheet, Pressable} from 'react-native';
import {useDispatch} from 'react-redux';
import {useNavigation} from '@react-navigation/native';
import FastImg from '@/components/FastImg';
-import {Header, Bottom, PlainContent} from '@/components/Item/single-list-item';
+import {Header, Bottom, PlainContent, CommentBottom} from '@/components/Item/single-list-item';
import LocationBar from '@/components/LocationBar';
import {dispatchTopicDetail, dispatchPreviewImage} from '@/redux/actions';
import IconFont from '@/iconfont';
@@ -118,7 +118,7 @@ export const TopicLinkContent = props => {
};
const BaseTopic = props => {
- const {data, type} = props;
+ const {data, type, bottom} = props;
const {content_style} = data;
const navigation = useNavigation();
const goNodeDetail = () => {
@@ -172,7 +172,11 @@ const BaseTopic = props => {
)}
-
+ {bottom === 'comment' ? (
+
+ ) : (
+
+ )}
);
};
@@ -182,7 +186,7 @@ const styles = StyleSheet.create({
padding: 14,
paddingBottom: 0,
backgroundColor: '#fff',
- width: '100%'
+ width: '100%',
},
imageMultiWrapper: {
flexDirection: 'row',
@@ -260,4 +264,4 @@ const styles = StyleSheet.create({
},
});
-export default BaseTopic;
+export default React.memo(BaseTopic);
diff --git a/src/components/Item/single-list-item/comment-bottom.js b/src/components/Item/single-list-item/comment-bottom.js
new file mode 100644
index 00000000..9615cc8d
--- /dev/null
+++ b/src/components/Item/single-list-item/comment-bottom.js
@@ -0,0 +1,141 @@
+import React, {useState} from 'react';
+import {View, Text, StyleSheet, Pressable, Vibration} from 'react-native';
+import * as Animatable from 'react-native-animatable';
+import {useDispatch} from 'react-redux';
+import * as action from '@/redux/constants';
+import {dispatchShareItem} from '@/redux/actions';
+import IconFont from '@/iconfont';
+import Toast from '@/components/Toast';
+import {cancelAction, createAction} from '@/api/action_api';
+
+const hitSlop = {left: 10, right: 10, top: 10, bottom: 10};
+
+const zoomOut = {
+ 0: {opacity: 0, scale: 1},
+ 0.5: {opacity: 1, scale: 1.5},
+ 1: {opacity: 1, scale: 1},
+ duration: 600,
+};
+
+const CommentBottom = props => {
+ const {data, type} = props;
+ const dispatch = useDispatch();
+ const [praise, setPraise] = useState(data.praise);
+ const [praiseCount, setPraiseCount] = useState(data.praises_count);
+ const [an, setAn] = useState('');
+
+ const onPraise = async () => {
+ let res = null;
+ switch (props.type) {
+ case 'article':
+ const params = {target_id: data.id, target_type: 'Article', type: 'praise'};
+ res = praise ? await cancelAction(params) : await createAction(params);
+ break;
+ case 'topic':
+ const query = {target_id: data.id, target_type: 'Topic', type: 'praise'};
+ res = praise ? await cancelAction(query) : await createAction(query);
+ break;
+ }
+ if (res.data.status === 404) {
+ Toast.showError('该帖子已删除');
+ return false;
+ }
+ setPraise(!praise);
+ const count = praiseCount + (praise === true ? -1 : 1);
+ if (!praise) {
+ setAn(zoomOut);
+ Vibration.vibrate();
+ } else {
+ setAn('');
+ }
+ setPraiseCount(count);
+ };
+
+ const onShare = () => {
+ let shareOptions = {item_type: '', item_id: '', visible: true};
+
+ switch (props.type) {
+ case 'article':
+ shareOptions = {item_type: 'Article', item_id: data.id};
+ break;
+ case 'topic':
+ shareOptions = {item_type: 'Topic', item_id: data.id};
+ break;
+ default:
+ shareOptions;
+ break;
+ }
+
+ const shareContent = {...shareOptions, visible: true};
+ dispatch(dispatchShareItem(shareContent));
+ };
+
+ const handleComment = () => {
+ const commentContent = {
+ placeholder: '写点评论吧',
+ comment_type: 'topic',
+ commentable_type: type,
+ commentable_id: data.id,
+ content: '',
+ mention_ids: '',
+ };
+
+ dispatch({type: action.SAVE_COMMENT_CONTENT, value: commentContent});
+ dispatch({type: action.CHANGE_COMMENT_VISIBLE, value: true});
+ };
+
+ return (
+
+
+ 感觉好顽说两句...
+
+
+
+
+
+ {praiseCount > 0 ? (
+
+ {praiseCount}
+
+ ) : null}
+
+
+
+ {data.comments_count > 0 ? {data.comments_count} : null}
+
+
+
+
+
+ );
+};
+
+const bstyles = StyleSheet.create({
+ botView: {
+ flexDirection: 'row',
+ // paddingBottom: 18,
+ // paddingTop: 15,
+ alignItems: 'center',
+ height: 70,
+ },
+ commentText: {
+ flex: 1,
+ lineHeight: 50,
+ paddingRight: 30,
+ fontSize: 13,
+ color: '#BDBDBD',
+ marginRight: 'auto',
+ },
+ botCon: {
+ marginRight: 35,
+ flexDirection: 'row',
+ alignItems: 'center',
+ },
+ botNum: {
+ marginLeft: 5,
+ color: '#bdbdbd',
+ fontSize: 12,
+ },
+});
+
+export default CommentBottom;
diff --git a/src/components/Item/single-list-item/header.js b/src/components/Item/single-list-item/header.js
index 8c774e62..c6c0f46d 100644
--- a/src/components/Item/single-list-item/header.js
+++ b/src/components/Item/single-list-item/header.js
@@ -8,6 +8,7 @@ import FastImg from '@/components/FastImg';
import Toast from '@/components/Toast';
import LocationBar from '@/components/LocationBar';
import {VWValue} from '@/utils/response-fontsize';
+import {ScaleDistance} from '@/utils';
import {deleteTopic} from '@/api/topic_api';
import {deleteTheory} from '@/api/theory_api';
import ActionSheet from '@/components/ActionSheet';
@@ -138,7 +139,7 @@ export const Header = props => {
{published_at_text}
{distance && distance > 0 && (
- · {(distance / 1000).toFixed(1)}km
+ · ${ScaleDistance(distance)}
)}
diff --git a/src/components/Item/single-list-item/index.js b/src/components/Item/single-list-item/index.js
index 802a3627..1b2efb9e 100644
--- a/src/components/Item/single-list-item/index.js
+++ b/src/components/Item/single-list-item/index.js
@@ -1,9 +1,5 @@
-import HeaderNode from './header';
-import BottomNode from './bottom';
-import NoActionBottomNode from './noaction-bottom';
-import PlainContentNode from './plain-content';
-
-export const Header = HeaderNode;
-export const Bottom = BottomNode;
-export const NoActionBottom = NoActionBottomNode;
-export const PlainContent = PlainContentNode;
+export {default as Header} from './header';
+export {default as Bottom} from './bottom';
+export {default as CommentBottom} from './comment-bottom';
+export {default as NoActionBottom} from './noaction-bottom';
+export {default as PlainContent} from './plain-content';
diff --git a/src/components/List/activity-list.js b/src/components/List/activity-list.js
index 5b3a3db2..7f539d7e 100644
--- a/src/components/List/activity-list.js
+++ b/src/components/List/activity-list.js
@@ -19,7 +19,6 @@ const ActivityList = props => {
const {api, params} = props.request;
const res = await api({...params, page});
const data = props.dataKey ? res.data[props.dataKey] : res.data.activities;
- console.log('list data', data);
setHeaders(res.headers);
setListData(page === 1 ? data : [...listData, ...data]);
setLoading(false);
diff --git a/src/components/List/double-list.js b/src/components/List/double-list.js
index b5203e00..67fbb393 100644
--- a/src/components/List/double-list.js
+++ b/src/components/List/double-list.js
@@ -193,11 +193,6 @@ const DoubleList = props => {
const onRefresh = (page = 1) => {
loadData(page);
- // if (props.type === 'recommend' && (page === 1 || !page)) {
- // indexLoadData(pagination(headers).nextPage);
- // } else {
- // loadData(page);
- // }
};
useEffect(() => {
diff --git a/src/components/List/shop-store-list.js b/src/components/List/shop-store-list.js
index d3e49350..d3476d68 100644
--- a/src/components/List/shop-store-list.js
+++ b/src/components/List/shop-store-list.js
@@ -19,7 +19,6 @@ const ShopStoreList = props => {
const {api, params} = props.request;
const res = await api({...params, page});
const data = props.dataKey ? res.data[props.dataKey] : res.data.shop_stores;
- // console.log('list data', data);
setHeaders(res.headers);
setListData(page === 1 ? data : [...listData, ...data]);
setLoading(false);
diff --git a/src/components/List/space-list-detail.js b/src/components/List/space-list-detail.js
index 6aa6594c..00a5c328 100644
--- a/src/components/List/space-list-detail.js
+++ b/src/components/List/space-list-detail.js
@@ -19,7 +19,6 @@ const SpaceListDetail = props => {
const {api, params} = props.request;
const res = await api({...params, page});
const data = props.dataKey ? res.data[props.dataKey] : res.data.spaces;
- console.log('list data', data);
setHeaders(res.headers);
setListData(page === 1 ? data : [...listData, ...data]);
setLoading(false);
diff --git a/src/components/LocationBar.js b/src/components/LocationBar.js
index 33bd4e01..64a86bc0 100644
--- a/src/components/LocationBar.js
+++ b/src/components/LocationBar.js
@@ -18,18 +18,18 @@ const LocationBar = ({space, location, style}) => {
return (
<>
- {space && (
+ {space ? (
{space.name}
- )}
- {location && (
+ ) : null}
+ {location ? (
{location.name.toString().substr(0, 13)}
- )}
+ ) : null}
>
);
};
diff --git a/src/components/MediasPicker.js b/src/components/MediasPicker.js
index e4f29b85..3ba3608c 100644
--- a/src/components/MediasPicker.js
+++ b/src/components/MediasPicker.js
@@ -55,7 +55,6 @@ const MediasPicker = WrapperComponent => {
});
})
.catch(err => {
- console.log('errr', err);
reject(err);
});
});
@@ -153,7 +152,6 @@ const MediasPicker = WrapperComponent => {
});
})
.catch(err => {
- console.log('error', err);
reject(err);
});
});
@@ -197,7 +195,6 @@ const MediasPicker = WrapperComponent => {
});
})
.catch(err => {
- console.log('error', err);
reject(err);
});
});
diff --git a/src/components/NodeComponents/Button.js b/src/components/NodeComponents/Button.js
index 63067d26..1aa381b5 100644
--- a/src/components/NodeComponents/Button.js
+++ b/src/components/NodeComponents/Button.js
@@ -2,14 +2,30 @@ import React from 'react';
import {Text, StyleSheet} from 'react-native';
import {RFValue} from '@/utils/response-fontsize';
-const JoinStyles = StyleSheet.create({
+export const JoinBtn = props => {
+ const {join, style, joinedStyle, joinStyle, borderRadius} = props;
+
+ return (
+
+ {props.text}
+
+ );
+};
+
+const JStyles = StyleSheet.create({
btn: {
width: RFValue(54),
height: RFValue(27),
lineHeight: RFValue(27),
textAlign: 'center',
fontSize: 13,
- borderRadius: 1,
fontWeight: '500',
overflow: 'hidden',
zIndex: 10,
@@ -23,16 +39,3 @@ const JoinStyles = StyleSheet.create({
backgroundColor: '#000',
},
});
-
-export const JoinBtn = props => {
- return (
-
- {props.text}
-
- );
-};
diff --git a/src/components/NodeComponents/Modal.js b/src/components/NodeComponents/Modal.js
index bd900e9d..f8169f23 100644
--- a/src/components/NodeComponents/Modal.js
+++ b/src/components/NodeComponents/Modal.js
@@ -4,7 +4,7 @@ import {Text, View, ActivityIndicator, Modal} from 'react-native';
export const Loading = props => {
return (
-
+
{props.title && {props.title} }
diff --git a/src/components/NodeComponents/RecommendSearch.js b/src/components/NodeComponents/RecommendSearch.js
index f6089d45..2cd30c06 100644
--- a/src/components/NodeComponents/RecommendSearch.js
+++ b/src/components/NodeComponents/RecommendSearch.js
@@ -1,32 +1,24 @@
import React, {useState} from 'react';
-import {StyleSheet, View, Pressable, StatusBar} from 'react-native';
-import {useSelector} from 'react-redux';
+import {StyleSheet, View, StatusBar} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import {BarHeight, IsIos} from '@/utils/navbar';
-import {RFValue, VWValue} from '@/utils/response-fontsize';
-import FastImg from '@/components/FastImg';
+import {RFValue} from '@/utils/response-fontsize';
import Search from './Search';
-import BadgeMessage from './BadgeMessage';
+import CurrentAvator from '@/pages/tabBar/current-avator';
-const RecommendSearch = () => {
+const RecommendSearch = props => {
const navigation = useNavigation();
- const [inputRef, setinputRef] = useState(null);
- const {currentAccount, currentBaseInfo} = useSelector(state => state.account);
+ const {border, style} = props;
- const UnreadMessageCount = () => {
- if (!currentBaseInfo || currentBaseInfo.new_message_count === 0) {
- return 0;
- }
- return currentBaseInfo.new_message_count;
- };
+ const [inputRef, setinputRef] = useState(null);
return (
- <>
+
-
+
setinputRef(refs)}
- style={{backgroundColor: '#fff', paddingRight: 14, paddingBottom: 0}}
+ style={{...style, backgroundColor: '#fff', paddingRight: 14}}
inputStyle={{borderRadius: RFValue(18), backgroundColor: '#f2f3f5'}}
height={RFValue(36)}
placeholderTextColor="#aaa"
@@ -37,46 +29,25 @@ const RecommendSearch = () => {
navigation.push('SearchIndex');
}}
prefix={
- navigation.openDrawer()} style={styles.avatorWrap}>
- = 1 && UnreadMessageCount() < 10
- ? -VWValue(-4)
- : UnreadMessageCount() > 99
- ? -VWValue(4) * 1.75
- : -VWValue(1) * 1.45,
- },
- ]}
- />
-
-
+
+
+
}
/>
- >
+
);
};
const styles = StyleSheet.create({
+ searchWrapper: {
+ borderBottomColor: '#EBEBEB',
+ borderBottomWidth: StyleSheet.hairlineWidth,
+ },
avatorWrap: {
position: 'relative',
zIndex: 2,
- },
- avator: {
- width: RFValue(30),
- height: RFValue(30),
- borderRadius: RFValue(15),
marginRight: 14,
},
- badge: {
- position: 'absolute',
- top: -5,
- zIndex: 1,
- },
});
export default RecommendSearch;
diff --git a/src/components/NodeComponents/Search.js b/src/components/NodeComponents/Search.js
index 448136c2..c92dc0b3 100644
--- a/src/components/NodeComponents/Search.js
+++ b/src/components/NodeComponents/Search.js
@@ -6,6 +6,7 @@ import {RFValue} from '@/utils/response-fontsize';
const Search = props => {
const {height, cancelWidth, placeholderTextColor} = props;
+
return (
{props.prefix ? props.prefix : null}
@@ -27,16 +28,6 @@ const Search = props => {
/>
- {/* {props.children ? (
- props.children
- ) : (
-
-
- 取消
-
-
- )} */}
-
{props.cancel && (
{
const [cancelText, setCancelText] = useState('拒绝');
const agreePolicy = async () => {
- console.log('cancel');
Helper.setData('agree_policy', 'ok');
canShowAgreeFunc(false);
- // console.log('showModal', showModal);
};
const loadPolicy = async () => {
const agree_policy_status = await Helper.getData('agree_policy');
- // console.log('agree_policy_status', agree_policy_status)
if (agree_policy_status !== 'ok') {
canShowAgreeFunc(true);
}
@@ -55,7 +52,6 @@ const PolicyModal = ({navigation, route, canShowAgree, canShowAgreeFunc}) => {
if (cancelText === '拒绝') {
setCancelText('拒绝并退出');
} else {
- console.log('exist');
BackHandler.exitApp();
}
};
@@ -75,9 +71,7 @@ const PolicyModal = ({navigation, route, canShowAgree, canShowAgreeFunc}) => {
visible={canShowAgree}
statusBarTranslucent={true}
// presentationStyle={'fillScreen'}
- onRequestClose={() => {
- console.log('Modal has been closed.');
- }}>
+ onRequestClose={() => {}}>
diff --git a/src/components/RichHtml.js b/src/components/RichHtml.js
index 8a067412..ce08957c 100644
--- a/src/components/RichHtml.js
+++ b/src/components/RichHtml.js
@@ -12,7 +12,6 @@ const RichHTML = props => {
return ;
} else {
const findImg = images_info.find(x => x.url === htmlAttribs.src);
- // console.log(images_info);
return (
{
-
- },
+ id: 'flat_list',
+ onRequest: isRefresh => {},
};
/**
@@ -79,7 +76,6 @@ class Scroll extends Component {
});
}
-
/**
* 刷新触发
* @private
@@ -95,7 +91,9 @@ class Scroll extends Component {
* @returns {boolean}
*/
_enableRefresh = () => {
- return !(this.props.requestState === State.REFRESHING || this.props.requestState === State.LOADING);
+ return !(
+ this.props.requestState === State.REFRESHING || this.props.requestState === State.LOADING
+ );
};
_onEndReached = () => {
if (this._enableLoad()) {
@@ -118,7 +116,7 @@ class Scroll extends Component {
* @param isRefresh
* @private
*/
- _reRequest = (isRefresh) => {
+ _reRequest = isRefresh => {
//回调外部方法
this.props.onRequest && this.props.onRequest(isRefresh);
};
@@ -135,15 +133,18 @@ class Scroll extends Component {
if (separator) {
return separator();
}
- return ;
+ return (
+
+ );
};
-
/**
* 渲染底部
* @returns {*}
@@ -156,7 +157,7 @@ class Scroll extends Component {
const hasData = this.props.data && this.props.data.length > 0;
switch (this.props.requestState) {
case State.NORMAL:
- footer = ();
+ footer = ;
break;
case State.ERROR: {
//是否有数据
@@ -164,21 +165,22 @@ class Scroll extends Component {
+ onPress={this._reRequest}>
{loadErrorText}
- ) : ();
+ ) : (
+
+ );
break;
}
case State.NO_DATA: {
- footer = ;
+ footer = ;
break;
}
case State.LOADING: {
footer = (
-
+
{loadingText}
);
@@ -196,28 +198,24 @@ class Scroll extends Component {
return footer;
};
-
render() {
- let {
- renderItem = () => {
- }
- } = this.props;
-
- // console.log('this.props', this.props)
-
- return
-
-
+ let {renderItem = () => {}} = this.props;
+
+ return (
+
+
+
+ );
}
}
@@ -225,17 +223,16 @@ const styles = StyleSheet.create({
//底部默认样式
footerContainer: {
flex: 1,
- flexDirection: "row",
- justifyContent: "center",
- alignItems: "center",
+ flexDirection: 'row',
+ justifyContent: 'center',
+ alignItems: 'center',
padding: 10,
height: 44,
},
footerText: {
fontSize: 14,
- color: "red"
- }
+ color: 'red',
+ },
});
-
-export default Scroll;
\ No newline at end of file
+export default Scroll;
diff --git a/src/components/ShareMultiModal.js b/src/components/ShareMultiModal.js
index 5169f4f6..12a2822e 100644
--- a/src/components/ShareMultiModal.js
+++ b/src/components/ShareMultiModal.js
@@ -140,7 +140,7 @@ const ShareMultiModal = () => {
return (
{
modalTitle={
diff --git a/src/components/TabList.js b/src/components/TabList.js
index 4cdebbf3..02479491 100644
--- a/src/components/TabList.js
+++ b/src/components/TabList.js
@@ -6,8 +6,8 @@ const DeviceWidth = Dimensions.get('window').width;
const TabList = props => {
const scrollRef = useRef(null);
- const defaultIndex = props.data.findIndex(v => v.key === props.current);
- const {align, bottomLine, separator} = props;
+ const {data, current, align, bottomLine, separator, tabChange, tabStyle, tabScrollStyle} = props;
+ const defaultIndex = data.findIndex(v => v.key === current);
const [currentIndex, setCurrentIndex] = useState(defaultIndex);
const [scrollEnabled, setScrollEnabled] = useState(false);
const [contentWidth, setContentWidth] = useState(0);
@@ -20,7 +20,7 @@ const TabList = props => {
};
const setIndex = (item, index) => {
- props.tabChange(item, index);
+ tabChange(item, index);
if (scrollEnabled) {
onScroll(index);
}
@@ -35,14 +35,22 @@ const TabList = props => {
};
useEffect(() => {
- const isAllLayout =
- layoutList.length === props.data.length && layoutList.every(item => item && item.width);
- if (isAllLayout) {
- const index = props.data.findIndex(v => v.key === props.current);
+ if (layoutList.length === 0) {
+ setLayoutList(new Array(data.length).fill({}));
+ }
+ }, [data]);
+
+ useEffect(() => {
+ if (data.length !== layoutList.length) {
+ return;
+ }
+ const allRender = layoutList.every(item => item.x >= 0);
+ if (allRender) {
+ const index = data.findIndex(v => v.key === current);
setCurrentIndex(index);
onScroll(index);
}
- }, [props.current, layoutList]);
+ }, [current, layoutList]);
useEffect(() => {
if (contentWidth > DeviceWidth) {
@@ -52,29 +60,38 @@ const TabList = props => {
return (
<>
-
+
- {props.data.length > 0 &&
- props.data.map((item, index) => {
+ {data.length > 0 &&
+ data.map((item, index) => {
return (
setIndex(item, index)}
onLayout={e => setLayout(e.nativeEvent.layout, index)}
style={styles.tabItem}>
-
- {item.title}
-
+ {typeof item.title === 'string' ? (
+
+ {item.title}
+
+ ) : (
+ item.title
+ )}
+
{currentIndex === index ? : null}
);
@@ -125,6 +142,7 @@ const styles = StyleSheet.create({
},
tabcenter: {
alignItems: 'center',
+ textAlign: 'center',
},
bottomLine: {
borderBottomColor: '#EBEBEB',
diff --git a/src/components/TabView.js b/src/components/TabView.js
index 4d328fea..7ca345bd 100644
--- a/src/components/TabView.js
+++ b/src/components/TabView.js
@@ -1,6 +1,8 @@
import React, {useEffect, useState} from 'react';
import {Dimensions, View, Text} from 'react-native';
import {TabView, SceneMap} from 'react-native-tab-view';
+import Helper from '@/utils/helper';
+import * as RootNavigation from '@/navigator/root-navigation';
import PropTypes from 'prop-types';
import TabList from './TabList';
@@ -10,6 +12,7 @@ const initialLayout = {
};
const TabViewIndex = props => {
+ const [tab, setTab] = useState([]);
const [routes, setRoutes] = useState([]);
const [scenes, setScenes] = useState([]);
const [index, setIndex] = useState(0);
@@ -22,6 +25,13 @@ const TabViewIndex = props => {
const tabChange = item => {
props.onChange(item.key, item.title);
+ const data = RootNavigation.getCurrentPage();
+ Helper.recordVisit({
+ event: `tab_${item.key}_${data.name}`,
+ name: `${item.title}_${data.name}`,
+ project_name: 'tab点击',
+ meta: data,
+ });
};
const initScene = () => {
@@ -46,6 +56,11 @@ const TabViewIndex = props => {
setIndex(i);
}, [props.currentKey]);
+ useEffect(() => {
+ const data = props.tabData.map(v => ({key: v.key, title: v.title}));
+ setTab(data);
+ }, [props.tabData]);
+
return (
routes.length > 0 && (
{
separator={props.separator}
align={props.align}
tabChange={tabChange}
- data={routes}
+ data={tab}
+ tabStyle={props.tabStyle}
+ tabScrollStyle={props.tabScrollStyle}
/>
)}
navigationState={{index, routes}}
diff --git a/src/components/comment-input/index.js b/src/components/comment-input/index.js
new file mode 100644
index 00000000..8716bd40
--- /dev/null
+++ b/src/components/comment-input/index.js
@@ -0,0 +1,160 @@
+import React, {useState, useEffect} from 'react';
+import {
+ View,
+ Text,
+ TextInput,
+ StyleSheet,
+ Platform,
+ Pressable,
+ KeyboardAvoidingView,
+} from 'react-native';
+import Modal from 'react-native-modal';
+import {useSelector, useDispatch} from 'react-redux';
+import * as action from '@/redux/constants';
+import Toast from '@/components/Toast';
+import {IsIos, STATUS_BAR_HEIGHT, BOTTOM_HEIGHT} from '@/utils/navbar';
+import {createComment} from '@/api/comment_api';
+import * as RootNavigation from '@/navigator/root-navigation';
+const CommentInput = (props) => {
+ const dispatch = useDispatch();
+ const [value, setValue] = useState('');
+ const {commentContent, commentVisible} = useSelector(state => state.home);
+ const isCanComment = value ? true : false;
+
+ // this.inputRef = null
+
+ // const getValueLength = str => {
+ // if (!str) {
+ // return 0;
+ // }
+ // return str.replace(/\s+/g, '').length;
+ // };
+
+ const onChangeText = text => {
+ // if (getValueLength(text) >= getValueLength(value)) {
+ // if (text.substr(-1) === '@') {
+ // navigation.push('AddMentionAccount', {type: 'comment'});
+ // const saveComments = {...commentContent, content: text.substr(0, text.length - 1)};
+ // dispatch({type: action.SAVE_COMMENT_CONTENT, value: saveComments});
+ // }
+ // }
+
+ setValue(text);
+ };
+
+ const handlePublishComment = async () => {
+ const params = {
+ placeholder: commentContent.placeholder,
+ comment: {
+ comment_type: commentContent.comment_type,
+ content: value,
+ mention_ids: commentContent.mention_ids,
+ commentable_type: commentContent.commentable_type,
+ commentable_id: commentContent.commentable_id || '',
+ target_comment_id: commentContent.target_comment_id || '',
+ },
+ };
+
+ try {
+ Toast.showLoading('发送中');
+ await createComment(params);
+ dispatch({type: action.SAVE_COMMENT_CONTENT, value: {content: ''}});
+ dispatch({type: action.CHANGE_COMMENT_VISIBLE, value: false});
+ Toast.hide();
+ Toast.show('评论成功啦');
+ } catch (e) {
+ Toast.show('评论出错了');
+ Toast.hide();
+ }
+ };
+
+ const onBackdropPress = () => {
+ dispatch({type: action.CHANGE_COMMENT_VISIBLE, value: false});
+ dispatch({type: action.SAVE_COMMENT_CONTENT, value: {content: ''}});
+ };
+
+ useEffect(() => {
+ if (commentVisible) {
+ setValue('');
+ }
+ }, [commentVisible]);
+
+ return (
+ {
+ setTimeout(() => {
+ this.inputRef.blur();
+ this.inputRef.focus();
+ }, 200)
+ }}
+ style={{margin: 0, flex: 1}}>
+
+
+
+
+ (this.inputRef = ref)}
+ value={value}
+ onChangeText={onChangeText}
+ style={styles.input}
+ placeholder="写点评论吧"
+ autoFocus
+ selectionColor="#ff193a"
+ />
+
+ 发送
+
+
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ wrapper: {
+ height: 50,
+ flexDirection: 'row',
+ paddingHorizontal: 15,
+ alignItems: 'center',
+ backgroundColor: '#fafafa',
+ borderTopColor: '#ebebeb',
+ borderTopWidth: 1,
+ },
+ content: {
+ flex: 1,
+ backgroundColor: 'transparent',
+ },
+ input: {
+ flex: 1,
+ height: 40,
+ alignItems: 'center',
+ backgroundColor: '#f2f3f5',
+ overflow: 'hidden',
+ padding: 0,
+ paddingLeft: 19,
+ borderRadius: 15,
+ },
+ sendBtn: {
+ width: 70,
+ height: 40,
+ lineHeight: 40,
+ backgroundColor: '#f2f3f5',
+ borderRadius: 15,
+ overflow: 'hidden',
+ textAlign: 'center',
+ fontSize: 13,
+ marginLeft: 10,
+ },
+});
+
+export default CommentInput;
diff --git a/src/components/react-native-video-player.js b/src/components/react-native-video-player.js
index bbf31d4b..fc7bb154 100644
--- a/src/components/react-native-video-player.js
+++ b/src/components/react-native-video-player.js
@@ -11,7 +11,7 @@ import {
ViewPropTypes,
ActivityIndicator,
NativeModules,
- Pressable
+ Pressable,
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import Video from 'react-native-video';
@@ -174,7 +174,6 @@ export default class VideoPlayer extends Component {
}
componentWillUnmount() {
- // console.log('xxx', 'xxxx')
if (this.controlsTimeout) {
clearTimeout(this.controlsTimeout);
this.controlsTimeout = null;
@@ -189,7 +188,6 @@ export default class VideoPlayer extends Component {
}
onStartPress() {
- console.log('onStartPress');
if (this.props.onStart) {
this.props.onStart();
}
@@ -257,7 +255,6 @@ export default class VideoPlayer extends Component {
};
onPlayPress() {
- // console.log('onPlayPress');
// if (this.props.onPlayPress) {
// this.props.onPlayPress(!this.state.isPlaying);
// }
@@ -640,7 +637,6 @@ export default class VideoPlayer extends Component {
}
render() {
- // console.log('xxxxxxxxxxxxx')
return (
{this.renderContent()}
diff --git a/src/iconfont/IconGuanbi.d.ts b/src/iconfont/IconGuanbi.d.ts
new file mode 100644
index 00000000..21f60007
--- /dev/null
+++ b/src/iconfont/IconGuanbi.d.ts
@@ -0,0 +1,15 @@
+/* eslint-disable */
+
+import { FunctionComponent } from 'react';
+// Don't forget to install package: @types/react-native
+import { ViewProps } from 'react-native';
+import { GProps } from 'react-native-svg';
+
+interface Props extends GProps, ViewProps {
+ size?: number;
+ color?: string | string[];
+}
+
+declare const IconGuanbi: FunctionComponent;
+
+export default IconGuanbi;
diff --git a/src/iconfont/IconGuanbi.js b/src/iconfont/IconGuanbi.js
new file mode 100644
index 00000000..bedd2ed7
--- /dev/null
+++ b/src/iconfont/IconGuanbi.js
@@ -0,0 +1,32 @@
+/* eslint-disable */
+
+import React from 'react';
+import { Svg, Path } from 'react-native-svg';
+import { getIconColor } from './helper';
+
+let IconGuanbi = ({ size, color, ...rest }) => {
+ return (
+
+
+
+
+
+ );
+};
+
+IconGuanbi.defaultProps = {
+ size: 16,
+};
+
+IconGuanbi = React.memo ? React.memo(IconGuanbi) : IconGuanbi;
+
+export default IconGuanbi;
diff --git a/src/iconfont/IconJiahaoyuan.d.ts b/src/iconfont/IconJiahaoyuan.d.ts
new file mode 100644
index 00000000..3bf0a185
--- /dev/null
+++ b/src/iconfont/IconJiahaoyuan.d.ts
@@ -0,0 +1,15 @@
+/* eslint-disable */
+
+import { FunctionComponent } from 'react';
+// Don't forget to install package: @types/react-native
+import { ViewProps } from 'react-native';
+import { GProps } from 'react-native-svg';
+
+interface Props extends GProps, ViewProps {
+ size?: number;
+ color?: string | string[];
+}
+
+declare const IconJiahaoyuan: FunctionComponent;
+
+export default IconJiahaoyuan;
diff --git a/src/iconfont/IconJiahaoyuan.js b/src/iconfont/IconJiahaoyuan.js
new file mode 100644
index 00000000..86c2efcc
--- /dev/null
+++ b/src/iconfont/IconJiahaoyuan.js
@@ -0,0 +1,32 @@
+/* eslint-disable */
+
+import React from 'react';
+import { Svg, Path } from 'react-native-svg';
+import { getIconColor } from './helper';
+
+let IconJiahaoyuan = ({ size, color, ...rest }) => {
+ return (
+
+
+
+
+
+ );
+};
+
+IconJiahaoyuan.defaultProps = {
+ size: 16,
+};
+
+IconJiahaoyuan = React.memo ? React.memo(IconJiahaoyuan) : IconJiahaoyuan;
+
+export default IconJiahaoyuan;
diff --git a/src/iconfont/index.d.ts b/src/iconfont/index.d.ts
index c12acb99..bf80ab54 100644
--- a/src/iconfont/index.d.ts
+++ b/src/iconfont/index.d.ts
@@ -6,7 +6,7 @@ import { ViewProps } from 'react-native';
import { GProps } from 'react-native-svg';
interface Props extends GProps, ViewProps {
- name: 'fasong' | 'biaoqing' | 'yuyin' | 'liaotian' | 'tongzhi' | 'fankui' | 'zhuye' | 'shezhi' | 'shangchuan' | 'qingkong' | 'check' | 'closed' | 'weixuan' | 'yixuan' | 'lujing' | 'sanjiaoxing' | 'qingchu' | 'kejian' | 'yincang' | 'ziyuan' | 'gengduo' | 'weixin1' | 'shouji' | 'wuwangluo' | 'close' | 'home-recommend' | 'home-recommend-outline' | 'home-newtopic' | 'home-mine-outline' | 'home-mine' | 'notice' | 'weixin' | 'search' | 'space-point' | 'upper' | 'down' | 'calendar' | 'people' | 'join' | 'double-circle' | 'white-circle' | 'backdown' | 'didian' | 'plus' | 'arrow-right' | 'fenxiang-2' | 'at' | 'hashtag' | 'question' | 'man' | 'woman' | 'yaogunshoushi' | 'node-solid' | 'blank-node' | 'quanzi2' | 'comment' | 'unlike' | 'zhuanfa' | 'like' | 'takephoto' | 'chose-success' | 'sousuo' | 'settings' | 'kecheng3' | 'kecheng2' | 'tianjia' | 'biaoqian' | 'biaoqian1' | 'duigou' | 'tianjia1' | 'kecheng' | 'kecheng1' | 'fenxiang-copy' | 'fenxiang' | 'blackpraise' | 'learncount' | 'pinglunanniu' | 'coursegonewtopic' | 'blank-star' | 'arrow-left' | 'icon' | 'star' | 'arrow-down' | 'black-dot' | 'cancel' | 'comments' | 'datetime' | 'praise-solid' | 'star-solid' | 'unread-messages';
+ name: 'jiahaoyuan' | 'guanbi' | 'fasong' | 'biaoqing' | 'yuyin' | 'liaotian' | 'tongzhi' | 'fankui' | 'zhuye' | 'shezhi' | 'shangchuan' | 'qingkong' | 'check' | 'closed' | 'weixuan' | 'yixuan' | 'lujing' | 'sanjiaoxing' | 'qingchu' | 'kejian' | 'yincang' | 'ziyuan' | 'gengduo' | 'weixin1' | 'shouji' | 'wuwangluo' | 'close' | 'home-recommend' | 'home-recommend-outline' | 'home-newtopic' | 'home-mine-outline' | 'home-mine' | 'notice' | 'weixin' | 'search' | 'space-point' | 'upper' | 'down' | 'calendar' | 'people' | 'join' | 'double-circle' | 'white-circle' | 'backdown' | 'didian' | 'plus' | 'arrow-right' | 'fenxiang-2' | 'at' | 'hashtag' | 'question' | 'man' | 'woman' | 'yaogunshoushi' | 'node-solid' | 'blank-node' | 'quanzi2' | 'comment' | 'unlike' | 'zhuanfa' | 'like' | 'takephoto' | 'chose-success' | 'sousuo' | 'settings' | 'kecheng3' | 'kecheng2' | 'tianjia' | 'biaoqian' | 'biaoqian1' | 'duigou' | 'tianjia1' | 'kecheng' | 'kecheng1' | 'fenxiang-copy' | 'fenxiang' | 'blackpraise' | 'learncount' | 'pinglunanniu' | 'coursegonewtopic' | 'blank-star' | 'arrow-left' | 'icon' | 'star' | 'arrow-down' | 'black-dot' | 'cancel' | 'comments' | 'datetime' | 'praise-solid' | 'star-solid' | 'unread-messages';
size?: number;
color?: string | string[];
}
diff --git a/src/iconfont/index.js b/src/iconfont/index.js
index a65d5c6e..60275512 100644
--- a/src/iconfont/index.js
+++ b/src/iconfont/index.js
@@ -2,6 +2,8 @@
import React from 'react';
+import IconJiahaoyuan from './IconJiahaoyuan';
+import IconGuanbi from './IconGuanbi';
import IconFasong from './IconFasong';
import IconBiaoqing from './IconBiaoqing';
import IconYuyin from './IconYuyin';
@@ -95,186 +97,190 @@ import IconUnreadMessages from './IconUnreadMessages';
let IconFont = ({ name, ...rest }) => {
switch (name) {
+ case 'jiahaoyuan':
+ return ;
+ case 'guanbi':
+ return ;
case 'fasong':
- return ;
+ return ;
case 'biaoqing':
- return ;
+ return ;
case 'yuyin':
- return ;
+ return ;
case 'liaotian':
- return ;
+ return ;
case 'tongzhi':
- return ;
+ return ;
case 'fankui':
- return ;
+ return ;
case 'zhuye':
- return ;
+ return ;
case 'shezhi':
- return ;
+ return ;
case 'shangchuan':
- return ;
+ return ;
case 'qingkong':
- return ;
+ return ;
case 'check':
- return ;
+ return ;
case 'closed':
- return ;
+ return ;
case 'weixuan':
- return ;
+ return ;
case 'yixuan':
- return ;
+ return ;
case 'lujing':
- return ;
+ return ;
case 'sanjiaoxing':
- return ;
+ return ;
case 'qingchu':
- return ;
+ return ;
case 'kejian':
- return ;
+ return ;
case 'yincang':
- return ;
+ return ;
case 'ziyuan':
- return ;
+ return ;
case 'gengduo':
- return ;
+ return ;
case 'weixin1':
- return ;
+ return ;
case 'shouji':
- return ;
+ return ;
case 'wuwangluo':
- return ;
+ return ;
case 'close':
- return ;
+ return ;
case 'home-recommend':
- return ;
+ return ;
case 'home-recommend-outline':
- return ;
+ return ;
case 'home-newtopic':
- return ;
+ return ;
case 'home-mine-outline':
- return ;
+ return ;
case 'home-mine':
- return ;
+ return ;
case 'notice':
- return ;
+ return ;
case 'weixin':
- return ;
+ return ;
case 'search':
- return ;
+ return ;
case 'space-point':
- return ;
+ return ;
case 'upper':
- return ;
+ return ;
case 'down':
- return ;
+ return ;
case 'calendar':
- return ;
+ return ;
case 'people':
- return ;
+ return ;
case 'join':
- return ;
+ return ;
case 'double-circle':
- return ;
+ return ;
case 'white-circle':
- return ;
+ return ;
case 'backdown':
- return ;
+ return ;
case 'didian':
- return ;
+ return ;
case 'plus':
- return ;
+ return ;
case 'arrow-right':
- return ;
+ return ;
case 'fenxiang-2':
- return ;
+ return ;
case 'at':
- return ;
+ return ;
case 'hashtag':
- return ;
+ return ;
case 'question':
- return ;
+ return ;
case 'man':
- return ;
+ return ;
case 'woman':
- return ;
+ return ;
case 'yaogunshoushi':
- return ;
+ return ;
case 'node-solid':
- return ;
+ return ;
case 'blank-node':
- return ;
+ return ;
case 'quanzi2':
- return ;
+ return ;
case 'comment':
- return ;
+ return ;
case 'unlike':
- return ;
+ return ;
case 'zhuanfa':
- return ;
+ return ;
case 'like':
- return ;
+ return ;
case 'takephoto':
- return ;
+ return ;
case 'chose-success':
- return ;
+ return ;
case 'sousuo':
- return ;
+ return ;
case 'settings':
- return ;
+ return ;
case 'kecheng3':
- return ;
+ return ;
case 'kecheng2':
- return ;
+ return ;
case 'tianjia':
- return ;
+ return ;
case 'biaoqian':
- return ;
+ return ;
case 'biaoqian1':
- return ;
+ return ;
case 'duigou':
- return ;
+ return ;
case 'tianjia1':
- return ;
+ return ;
case 'kecheng':
- return ;
+ return ;
case 'kecheng1':
- return ;
+ return ;
case 'fenxiang-copy':
- return ;
+ return ;
case 'fenxiang':
- return ;
+ return ;
case 'blackpraise':
- return ;
+ return ;
case 'learncount':
- return ;
+ return ;
case 'pinglunanniu':
- return ;
+ return ;
case 'coursegonewtopic':
- return ;
+ return ;
case 'blank-star':
- return ;
+ return ;
case 'arrow-left':
- return ;
+ return ;
case 'icon':
- return ;
+ return ;
case 'star':
- return ;
+ return ;
case 'arrow-down':
- return ;
+ return ;
case 'black-dot':
- return ;
+ return ;
case 'cancel':
- return ;
+ return ;
case 'comments':
- return ;
+ return ;
case 'datetime':
- return ;
+ return ;
case 'praise-solid':
- return ;
+ return ;
case 'star-solid':
- return ;
+ return ;
case 'unread-messages':
- return ;
+ return ;
}
return null;
diff --git a/src/navigator/config.js b/src/navigator/config.js
index 72c3e3bc..729793d7 100644
--- a/src/navigator/config.js
+++ b/src/navigator/config.js
@@ -96,7 +96,6 @@ import ChatDetail from '@/pages/chats/chat-detail/index';
import ChatGroups from '@/pages/chats/chat_groups';
// 公用页面
-import RelatedAccounts from '@/pages/home/related-account-list'; //关注页面相关推荐
import ChooseCity from '@/components/List/choose-city'; //选择城市
import JoinAccountsList from '@/components/List/join-accounts-list'; //最近加入好友
import WebView from '@/pages/webview/webview'; //webview
@@ -135,9 +134,13 @@ const searchRouter = [
];
const topicRouter = [
- {name: 'TopicDetail', component: TopicDetail, options: {headerShown: false}},
- {name: 'TopicLinkDetail', component: TopicLinkDetail, options: {headerShown: false}},
- {name: 'AddNode', component: AddNode},
+ {name: 'TopicDetail', component: TopicDetail, options: {headerShown: false, title: '帖子详情页'}},
+ {
+ name: 'TopicLinkDetail',
+ component: TopicLinkDetail,
+ options: {headerShown: false, title: '外链帖子展示页'},
+ },
+ {name: 'AddNode', component: AddNode, options: {title: '添加圈子页面'}},
{name: 'AddRelated', component: AddRelated, options: {headerShown: false, herderColor: '#fff'}},
{name: 'AddLink', component: AddLink},
{name: 'AddHashTag', component: AddHashTag, options: {headerShown: false, herderColor: '#fff'}},
@@ -251,12 +254,10 @@ const accountRouter = [
];
const commonRouter = [
- {name: 'RelatedAccounts', component: RelatedAccounts, options: {title: '相关推荐'}},
{name: 'ChooseCity', component: ChooseCity, options: {title: '选择城市'}},
{name: 'JoinAccountsList', component: JoinAccountsList, options: {title: '最近加入列表'}},
{name: 'SharePage', component: SharePage, options: {title: '分享'}},
{name: 'Report', component: Report, options: {title: '投诉'}},
- // {name: 'OneLogin', component: OneLogin, options: {title: '一键登录'}},
];
const LabRouter = [
@@ -296,8 +297,8 @@ const authRouter = [
{name: 'LoginPasswordCode', component: LoginPasswordCode},
{name: 'LoginPhoneCode', component: LoginPhoneCode},
{name: 'LoginVerifyCode', component: LoginVerifyCode},
- {name: 'BindPhone', component: BindPhone},
- {name: 'WebView', component: WebView}
+ {name: 'BindPhone', component: BindPhone, options: {title: '绑定手机页面'}},
+ {name: 'WebView', component: WebView, options: {title: 'webview'}},
];
export const MainRouters = [
diff --git a/src/navigator/drawer-content.js b/src/navigator/drawer-content.js
index 8d4874ec..00c209ee 100644
--- a/src/navigator/drawer-content.js
+++ b/src/navigator/drawer-content.js
@@ -23,20 +23,20 @@ const DrawerContent = ({navigation}) => {
navigation.navigate('Feedback');
};
- const onNotifyIndex = () => {
- navigation.navigate('NotifyIndex');
- };
+ // const onNotifyIndex = () => {
+ // navigation.navigate('NotifyIndex');
+ // };
const onSettings = () => {
navigation.navigate('Settings');
};
- const UnreadMessageCount = () => {
- if (!currentBaseInfo || currentBaseInfo.new_message_count === 0) {
- return 0;
- }
- return currentBaseInfo.new_message_count;
- };
+ // const UnreadMessageCount = () => {
+ // if (!currentBaseInfo || currentBaseInfo.new_message_count === 0) {
+ // return 0;
+ // }
+ // return currentBaseInfo.new_message_count;
+ // };
return (
@@ -62,18 +62,18 @@ const DrawerContent = ({navigation}) => {
-
-
- 互动通知
-
-
-
-
-
+ {/**/}
+ {/* */}
+ {/* 互动通知 */}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* */}
反馈
diff --git a/src/navigator/index.js b/src/navigator/index.js
index e813d119..6dd4ab19 100644
--- a/src/navigator/index.js
+++ b/src/navigator/index.js
@@ -52,15 +52,25 @@ const Navigation = () => {
const onStateChangeRecord = state => {
const previousRouteName = routeNameRef.current;
const currentRouteName = navigationRef.current.getCurrentRoute().name;
+ const currentRouteParams = navigationRef.current.getCurrentRoute().params;
+ const currentRouteTitle = navigationRef.current.getCurrentOptions().title;
if (previousRouteName !== currentRouteName) {
AnalyticsUtil.onPageStart(currentRouteName);
}
+ // console.log('navigationRef.current.getCurrentRoute()', navigationRef.current.getCurrentOptions());
+ const recordData = {
+ event: `page_visit_${currentRouteName}`,
+ name: `访问${currentRouteTitle || currentRouteName}`,
+ project_name: '页面访问',
+ meta: currentRouteParams,
+ };
+ Helper.recordVisit(recordData);
AnalyticsUtil.onPageEnd(currentRouteName);
routeNameRef.current = currentRouteName;
};
- console.log('login.auth_token', login.auth_token);
+ // console.log('login.auth_token', login.auth_token);
return (
{
const RenderImage = (name, focused) => {
switch (name) {
+ case 'Accounts':
+ return 顽友 ;
case 'ChatGroups':
return 聊天 ;
+ case 'Community':
+ return 社区 ;
+ case 'Discovery':
+ return 发现 ;
case 'Recommend':
- const style = {width: (500 * RFValue(27)) / 351, height: RFValue(27)};
+ const style = {width: (500 * (24)) / 351, height: (24)};
return focused ? (
-
+
+
+
) : (
- 首页
+ 顽鸦
);
- case 'Discovery':
- return 发现 ;
}
};
const UnreadMessageCount = () => {
- if (!currentBaseInfo || currentBaseInfo.unread_chat_messages_count === 0) {
+ if (!currentBaseInfo) {
return 0;
}
- return currentBaseInfo.unread_chat_messages_count;
+
+ return currentBaseInfo.new_message_count + currentBaseInfo.unread_chat_messages_count;
};
return (
@@ -94,33 +103,33 @@ const MainTabScreen = props => {
initialRouteName="Recommend"
screenOptions={({route, navigation}) => ({
tabBarIcon: ({focused}) => {
+ const rightDis = (UnreadMessageCount() >= 1 && UnreadMessageCount() < 10
+ ? -VWValue(9)
+ : UnreadMessageCount() > 99
+ ? -VWValue(12) * 1.75
+ : -VWValue(11) * 1.45)
return route.name === 'ChatGroups' ? (
-
+
= 1 && UnreadMessageCount() < 10
- ? -VWValue(9)
- : UnreadMessageCount() > 99
- ? -VWValue(12) * 1.75
- : -VWValue(11) * 1.45,
+ right: IsIos ? rightDis : rightDis+6
},
]}
/>
{RenderImage(route.name, focused)}
{focused && (
-
+
)}
) : (
{RenderImage(route.name, focused)}
- {focused && route.name === 'Discovery' && (
-
+ {focused && route.name !== 'Recommend' && (
+
)}
);
@@ -129,16 +138,14 @@ const MainTabScreen = props => {
tabBarOptions={{
safeAreaInsets: {...insets, bottom: insets.bottom + BOTTOM_HEIGHT},
showLabel: false,
- tabStyle: {height: RFValue(40)},
+ tabStyle: {height: RFValue(45)},
style: {
- backgroundColor: 'white',
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: '#EBEBEB',
- height: RFValue(40),
- paddingLeft: VWValue(34),
- paddingRight: VWValue(34),
+ height: RFValue(45),
},
}}>
+
{
},
})}
/>
-
+
+
>
);
@@ -184,14 +192,14 @@ const styles = StyleSheet.create({
paddingBottom: RFValue(30),
},
tabText: {
- width: RFValue(40),
+ width: RFValue(50),
textAlign: 'center',
fontSize: 15,
- color: '#aaa',
+ color: '#93a2a9',
fontWeight: '500',
},
tabActiveText: {
- width: RFValue(40),
+ width: RFValue(50),
textAlign: 'center',
fontSize: 16,
color: '#000',
diff --git a/src/navigator/root-navigation.js b/src/navigator/root-navigation.js
index a84166d0..b5b870bb 100644
--- a/src/navigator/root-navigation.js
+++ b/src/navigator/root-navigation.js
@@ -15,5 +15,21 @@ export function reset(name, params) {
navigationRef.current?.reset(name, params);
}
+// export function getCurrentPage() {
+// return {
+// name: navigationRef.current.getCurrentRoute().name,
+// params: navigationRef.current.getCurrentRoute().params,
+// title: navigationRef.current.getCurrentOptions().title
+// }
+// }
+
+export function getCurrentPage() {
+ return {
+ name: navigationRef?.current?.getCurrentRoute().name,
+ params: navigationRef?.current?.getCurrentRoute().params,
+ title: navigationRef?.current?.getCurrentOptions().title,
+ };
+}
+
// https://reactnavigation.org/docs/navigating-without-navigation-prop
// RootNavigation.js
diff --git a/src/pages/accounts/account-detail.js b/src/pages/accounts/account-detail.js
index 16cc1096..545fd10f 100644
--- a/src/pages/accounts/account-detail.js
+++ b/src/pages/accounts/account-detail.js
@@ -1,5 +1,6 @@
-import React, {useState, useEffect} from 'react';
+import React, {useState, useEffect, useCallback} from 'react';
import {View, Text, StyleSheet, Pressable, StatusBar} from 'react-native';
+import {useFocusEffect} from '@react-navigation/native';
import {useSelector, useDispatch} from 'react-redux';
import {dispatchPreviewImage} from '@/redux/actions';
import CollapsibleHeader from '@/components/CollapsibleHeaders';
@@ -81,7 +82,7 @@ const AccountDetail = ({navigation, route}) => {
const params = {receiver_id: account.id};
const res = await getChatGroupsDetail(params);
const {uuid} = res.data.chat_group;
- navigation.navigate('ChatDetail', {uuid, targetAccount: account});
+ navigation.navigate('ChatDetail', {uuid, targetAccountId: account.id, targetAccountNickname: account.nickname});
};
const actionItems = [
@@ -129,9 +130,11 @@ const AccountDetail = ({navigation, route}) => {
setAccount(res.data.account);
};
- useEffect(() => {
- loadData();
- }, []);
+ useFocusEffect(
+ useCallback(() => {
+ loadData();
+ }, [])
+ );
const Header = () => {
const defaultImage = account.background_img_url || AccountDetailBgImg;
@@ -186,12 +189,12 @@ const AccountDetail = ({navigation, route}) => {
)}
{account.age || '18'}岁
- {account.city.replace(',', ' ') || '未知街区'}
+ {account.city && account.city.replace(',', ' ') || '未知街区'}
{account.label_list.map((label, index) => (
<>
- {label}
+ {label}
{account.label_list.length - 1 !== index && (
|
)}
diff --git a/src/pages/auth-login/login-phone-code.js b/src/pages/auth-login/login-phone-code.js
index e35f39a1..b938313c 100644
--- a/src/pages/auth-login/login-phone-code.js
+++ b/src/pages/auth-login/login-phone-code.js
@@ -51,8 +51,8 @@ const LoginPhoneCode = ({navigation}) => {
const timestamp = new Date().getTime();
const secret = md5(`phone_${phone}_${timestamp}`);
const data = {phone, secret, timestamp, send_code_type: SendCodeType.Login};
- if(__DEV__) {
- return
+ if (__DEV__) {
+ return;
}
const res = await sendPhoneCode(data);
Toast.showError(res.status === 'success' && !res.error ? '发送成功' : res.error);
diff --git a/src/pages/auth-login/register/register-info-invite.js b/src/pages/auth-login/register/register-info-invite.js
index dca52278..f9ecdb93 100644
--- a/src/pages/auth-login/register/register-info-invite.js
+++ b/src/pages/auth-login/register/register-info-invite.js
@@ -1,19 +1,20 @@
-import React, {useState} from 'react';
-import {Text, StyleSheet, Pressable, Keyboard} from 'react-native';
+import React, {useState, useEffect, useLayoutEffect} from 'react';
+import {Text, StyleSheet, Pressable} from 'react-native';
import Clipboard from '@react-native-community/clipboard';
import {useSelector, useDispatch} from 'react-redux';
import {dispatchSetAuthToken} from '@/redux/actions';
import {RFValue, VWValue} from '@/utils/response-fontsize';
import {SCREEN_WIDTH} from '@/utils/navbar';
import Toast from '@/components/Toast';
-import * as WeChat from 'react-native-wechat-lib';
import {verifyInviteCode} from '@/api/phone_sign_api';
+import {getProsettings} from '@/api/settings_api';
import CodeComponent from '../code-component';
import cStyles from '../style';
const AccountInfoInvite = ({navigation}) => {
const dispatch = useDispatch();
const {socialToken} = useSelector(state => state.login);
+ const [showSkip, setShowSkip] = useState(false);
const [code, setCode] = useState('');
const isCanClick = code.length === 6;
@@ -34,6 +35,34 @@ const AccountInfoInvite = ({navigation}) => {
Toast.showError('顽鸦客服微信已复制剪贴板');
};
+ const handleSkip = async () => {
+ await dispatch(dispatchSetAuthToken(socialToken));
+ navigation.reset({index: 0, routes: [{name: 'Recommend'}]});
+ };
+
+ const loadSkip = async () => {
+ const res = await getProsettings();
+ setShowSkip(res.can_skip_invited === 'yes' ? true : false);
+ };
+
+ useEffect(() => {
+ loadSkip();
+ }, []);
+
+ useLayoutEffect(() => {
+ if (showSkip) {
+ const hitSlop = {top: 20, bottom: 20, left: 10, right: 10};
+
+ navigation.setOptions({
+ headerRight: () => (
+
+ 跳过
+
+ ),
+ });
+ }
+ }, [navigation, showSkip]);
+
return (
{}}>
内测邀请
diff --git a/src/pages/chats/base-chat-group.js b/src/pages/chats/base-chat-group.js
index a66be575..019a4035 100644
--- a/src/pages/chats/base-chat-group.js
+++ b/src/pages/chats/base-chat-group.js
@@ -8,6 +8,7 @@ import {RFValue} from '@/utils/response-fontsize';
import {EMOJIS_DATA, EMOJIS_ZH} from '@/plugins/react-native-easy-chat-ui';
import Swipeout from '@/components/Swipeout';
import * as RootNavigation from '@/navigator/root-navigation';
+
const PATTERNS = {
url: /(https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/i,
phone: /[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,7}/,
@@ -25,9 +26,12 @@ const BaseChatGroup = ({chat_group, deleteChatgroup, currentOpenId, onOpen}) =>
} = chat_group;
const goChatDetail = () => {
- RootNavigation.push('ChatDetail', {uuid, targetAccount: send_message_account});
- unread_message[currentAccount.id] = 0;
- readSingleChatGroupMessage({uuid: uuid});
+ // console.log('targetAccount', 'xxx')
+ RootNavigation.navigate('ChatDetail', {uuid, targetAccountId: send_message_account.id, targetAccountNickname: send_message_account.nickname});
+ setTimeout(() => {
+ unread_message[currentAccount.id] = 0;
+ readSingleChatGroupMessage({uuid: uuid});
+ }, 500);
};
const _matchContentString = (textContent, views) => {
@@ -89,59 +93,59 @@ const BaseChatGroup = ({chat_group, deleteChatgroup, currentOpenId, onOpen}) =>
};
const changeOpen = (sectionID, rowId) => {
- console.log('onOpen item', sectionID, rowId);
+ console.log('xxxx')
onOpen(sectionID);
};
return (
- {
- console.log(item)
- deleteChatgroup({uuid: item.key});
- },
- key: chat_group.uuid,
- backgroundColor: '#FF2242',
- type: 'delete',
-
- autoClose: false,
- },
- ]}
- close={true}
- rowID={chat_group.uuid}
- sectionID={chat_group.uuid}
- autoClose={true}
- onOpen={changeOpen}
- key={chat_group.uuid}
- >
-
-
-
-
-
-
- {send_message_account.nickname}
- {last_conversation ? (
-
- {last_conversation.category === 'text' ? (
- _getActualText(last_conversation.content)
- ) : (
- {last_conversation.payload.text}
- )}
-
- ) : (
-
- )}
-
-
- {last_message_at_text}
-
-
-
+
+
+
+
+
+
+ {send_message_account.nickname}
+ {last_conversation ? (
+
+ {last_conversation.category === 'text' ? (
+ _getActualText(last_conversation.content)
+ ) : (
+ {last_conversation.payload.text}
+ )}
+
+ ) : (
+
+ )}
+
+
+ {last_message_at_text}
+
+
+
+ // {
+ // deleteChatgroup({uuid: item.key});
+ // },
+ // key: chat_group.uuid,
+ // backgroundColor: '#FF2242',
+ // type: 'delete',
+ // autoClose: false,
+ // },
+ // ]}
+ // close={true}
+ // rowID={chat_group.uuid}
+ // sectionID={chat_group.uuid}
+ // autoClose={true}
+ // sensitivity={5}
+ // onOpen={changeOpen}
+ // key={chat_group.uuid}>
+
+ //
);
};
@@ -152,33 +156,31 @@ const styles = StyleSheet.create({
top: -3,
},
itemView: {
- flexDirection: 'row',
paddingHorizontal: 14,
- paddingVertical: RFValue(12),
+ paddingVertical: 12,
+ flexDirection: 'row',
+ alignItems: 'center',
backgroundColor: '#fff',
- width: '100%',
- height: 70
},
coverWrapView: {
marginRight: 12,
},
notifyContent: {
flex: 1,
- justifyContent: 'center',
},
notifyContentTitle: {
fontSize: 15,
- letterSpacing: 1,
},
notifyContentDesc: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 5,
+ fontSize: 12,
},
notifyContentText: {
color: '#BDBDBD',
- letterSpacing: 1,
- fontSize: 13,
+ fontSize: 12,
+ marginTop: 5,
},
timeText: {
fontSize: 11,
@@ -187,6 +189,7 @@ const styles = StyleSheet.create({
},
messageContent: {
flexDirection: 'row',
+ marginBottom: 20,
},
subEmojiStyle: {
width: 18,
@@ -194,4 +197,4 @@ const styles = StyleSheet.create({
},
});
-export default BaseChatGroup;
+export default (BaseChatGroup);
diff --git a/src/pages/chats/chat-detail/index.js b/src/pages/chats/chat-detail/index.js
index 31e2066c..abea83ef 100644
--- a/src/pages/chats/chat-detail/index.js
+++ b/src/pages/chats/chat-detail/index.js
@@ -25,6 +25,7 @@ import {consumerWsUrl} from '@/utils/config';
import Helper from '@/utils/helper';
import {getAccount, followAccount, unfollowAccount} from '@/api/account_api';
import {
+ deleteChatGroup,
getChatGroupsConversations,
getChatGroupsSendMessage,
readSingleChatGroupMessage,
@@ -51,7 +52,7 @@ let timer = null;
const ChartDetail = props => {
const dispatch = useDispatch();
const {navigation, route, imagePick, videoPick, uploadVideo, uploadAudio} = props;
- const {uuid, targetAccount} = route.params;
+ const {uuid, targetAccountId, targetAccountNickname} = route.params;
const {
account: {currentAccount},
login: {auth_token},
@@ -117,7 +118,6 @@ const ChartDetail = props => {
const chatGroupSendMessage = async params => {
try {
- console.log('params', params);
// 先直接本地发送,接收数据后再排除掉当前列表中有相同的uid的数据;
const uid = Helper.generateUuid();
if (params.conversation.category === 'text') {
@@ -135,7 +135,6 @@ const ChartDetail = props => {
sendStatus: 1,
time: new Date().getTime(),
};
- console.log('fakeData', fakeData);
setMessages(m => m.concat(fakeData));
}
@@ -143,7 +142,7 @@ const ChartDetail = props => {
await getChatGroupsSendMessage(paramsData);
Toast.hide();
} catch (e) {
- console.log('error', e);
+ // console.log('error', e);
Toast.hide();
}
};
@@ -180,10 +179,8 @@ const ChartDetail = props => {
{
title: '删除',
onPress: () => {
- console.log('type', type, index, text);
chatChannel.deleteMessage(message.id);
messages.splice(index, 1);
- console.log('message', messages);
setMessages([...messages]);
},
},
@@ -203,7 +200,7 @@ const ChartDetail = props => {
);
setHasPermission(granted === PermissionsAndroid.RESULTS.GRANTED);
} catch (e) {
- console.log(e);
+ // console.log(e);
}
};
@@ -251,7 +248,7 @@ const ChartDetail = props => {
try {
await AudioRecorder.pauseRecording(); // Android 由于API问题无法使用此方法
} catch (e) {
- console.log(e);
+ // console.log(e);
}
};
@@ -259,7 +256,7 @@ const ChartDetail = props => {
try {
await AudioRecorder.resumeRecording(); // Android 由于API问题无法使用此方法
} catch (e) {
- console.log(e);
+ // console.log(e);
}
};
@@ -267,7 +264,7 @@ const ChartDetail = props => {
try {
await AudioRecorder.startRecording();
} catch (error) {
- console.log(error);
+ // console.log(error);
}
};
@@ -276,7 +273,7 @@ const ChartDetail = props => {
await AudioRecorder.stopRecording();
timer && clearInterval(timer);
} catch (error) {
- console.log(error);
+ // console.log(error);
}
};
@@ -406,13 +403,21 @@ const ChartDetail = props => {
{
id: 1,
label: '个人主页',
- onPress: () => navigation.navigate('AccountDetail', {accountId: targetAccount.id}),
+ onPress: () => navigation.navigate('AccountDetail', {accountId: targetAccountId}),
},
{
id: 2,
label: '举报',
onPress: async () => {
- navigation.navigate('Report', {report_type: 'Account', report_type_id: targetAccount.id});
+ navigation.navigate('Report', {report_type: 'Account', report_type_id: targetAccountId});
+ },
+ },
+ {
+ id: 3,
+ label: '删除',
+ onPress: async () => {
+ deleteChatGroup({uuid: uuid});
+ navigation.goBack();
},
},
];
@@ -432,7 +437,7 @@ const ChartDetail = props => {
};
const loadAccount = async () => {
- const ret = await getAccount(targetAccount.id);
+ const ret = await getAccount(targetAccountId);
setTargetAccountDetail(ret.data.account);
};
@@ -453,7 +458,7 @@ const ChartDetail = props => {
useEffect(() => {
navigation.setOptions({
- title: targetAccount.nickname,
+ title: targetAccountNickname,
headerStyle: {
borderBottomWidth: 0,
borderBottomColor: '#EBEBEB',
diff --git a/src/pages/chats/chat-detail/style.js b/src/pages/chats/chat-detail/style.js
index 4ee48aaf..582870ca 100644
--- a/src/pages/chats/chat-detail/style.js
+++ b/src/pages/chats/chat-detail/style.js
@@ -39,7 +39,7 @@ const styles = StyleSheet.create({
fontWeight: '500',
textAlign: 'center',
backgroundColor: '#000',
- borderRadius: 2,
+ borderRadius: 12,
overflow: 'hidden',
},
avatarStyle: {
diff --git a/src/pages/chats/chat_groups.js b/src/pages/chats/chat_groups.js
index a1e40aeb..4de4ae1f 100644
--- a/src/pages/chats/chat_groups.js
+++ b/src/pages/chats/chat_groups.js
@@ -2,7 +2,6 @@ import React, {useCallback, useState, useEffect} from 'react';
import {StyleSheet, View} from 'react-native';
import {useDispatch} from 'react-redux';
import {useFocusEffect} from '@react-navigation/native';
-import {RecommendSearch} from '@/components/NodeComponents';
import {dispatchCurrentAccount, dispatchBaseCurrentAccount} from '@/redux/actions';
import {getChatGroups, deleteChatGroup} from '@/api/chat_api';
import ScrollList from '@/components/ScrollList';
@@ -36,10 +35,7 @@ const ChatGroups = ({navigation}) => {
);
});
const deleteChatgroup = (data = {}) => {
- console.log('real delete', data);
deleteChatGroup({uuid: data.uuid});
- // console.log('new1', listData)
- // console.log('new', newlist);
setListData(m => m.filter(item => item.uuid !== data.uuid));
};
@@ -48,7 +44,6 @@ const ChatGroups = ({navigation}) => {
};
const loadData = async (page = 1) => {
- // setLoading(true);
const res = await getChatGroups({page: page});
setHeaders(res.headers);
setListData(page === 1 ? res.data.chat_groups : [...listData, ...res.data.chat_groups]);
@@ -76,7 +71,6 @@ const ChatGroups = ({navigation}) => {
return (
-
`${item.uuid}`, [])}
data={listData}
@@ -88,8 +82,9 @@ const ChatGroups = ({navigation}) => {
getItemLayout={(data, index) => ({length: 71, offset: 71 * index, index})}
settings={{
initialNumToRender: 10,
- windowSize: 10
+ windowSize: 10,
}}
+ style={{backgroundColor: '#fff'}}
/>
);
@@ -103,7 +98,7 @@ const styles = StyleSheet.create({
speator: {
height: StyleSheet.hairlineWidth,
backgroundColor: '#ebebeb',
- marginLeft: 45 + 12,
+ marginLeft: 14 + 45 + 12,
},
});
diff --git a/src/pages/discoveries/discovery.js b/src/pages/discoveries/discovery.js
index 854eb517..af5d4069 100644
--- a/src/pages/discoveries/discovery.js
+++ b/src/pages/discoveries/discovery.js
@@ -17,6 +17,7 @@ const CategoryComponent = props => {
const {
navigation,
currentKey,
+ category,
category: {movement, space, activity, shop_store, shop_brand},
} = props;
@@ -25,7 +26,7 @@ const CategoryComponent = props => {
type: action.GET_LOCATION,
value: {...location, chooseCity: location.positionCity || '全国'},
});
- navigation.navigate(name, {category: currentKey});
+ navigation.navigate(name, {category: category.category_name});
};
return (
@@ -37,7 +38,7 @@ const CategoryComponent = props => {
{movement.count > 0 ? `${movement.count}个` : '还没有'}
- {currentKey}技巧
+ {category.category_name}技巧
@@ -51,7 +52,7 @@ const CategoryComponent = props => {
{space.count > 0 ? `${space.count}个` : '还没有'}
- {currentKey}场地
+ {category.category_name}场地
@@ -65,7 +66,7 @@ const CategoryComponent = props => {
{activity.count > 0 ? `${activity.count}个` : '还没有'}
- {currentKey}活动
+ {category.category_name}活动
@@ -79,7 +80,7 @@ const CategoryComponent = props => {
{shop_store.count > 0 ? `${shop_store.count}个` : '还没有'}
- {currentKey}店
+ {category.category_name}店
@@ -93,7 +94,7 @@ const CategoryComponent = props => {
{shop_brand.count > 0 ? `${shop_brand.count}个` : '还没有'}
- {currentKey}品牌
+ {category.category_name}品牌
@@ -109,12 +110,12 @@ const DiscoveryIndex = props => {
const loadData = async () => {
const res = await getAppCardList();
- setCurrentKey(res.data.list[0].category_name);
+ setCurrentKey(res.data.list[0].category_key);
setCoveryData(res.data.list);
};
const RenderCaCategory = () => {
- const current = coveryData.find(item => item.category_name === currentKey);
+ const current = coveryData.find(item => item.category_key === currentKey);
return ;
};
@@ -124,7 +125,7 @@ const DiscoveryIndex = props => {
return (
-
+
{coveryData.length > 0 ? (
{
separator={false}
tabData={coveryData.map(category => {
return {
- key: category.category_name,
+ key: category.category_key,
title: category.category_name,
component: RenderCaCategory,
};
diff --git a/src/pages/home/related-account-list.js b/src/pages/home/related-account-list.js
deleted file mode 100644
index 570202b9..00000000
--- a/src/pages/home/related-account-list.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import React from 'react';
-import {Text, StyleSheet, StatusBar} from 'react-native';
-import AccountsList from '@/components/List/accounts-list';
-import {recommendAccounts} from '@/api/mine_api';
-
-const RelatedAccounts = () => {
- return (
- <>
-
- 只显示前50位好友 }
- />
- >
- );
-};
-
-const styles = StyleSheet.create({
- footer: {
- height: 50,
- lineHeight: 50,
- textAlign: 'center',
- backgroundColor: '#fafafa',
- color: '#bdbdbd',
- position: 'absolute',
- left: 0,
- right: 0,
- bottom: 0,
- },
-});
-
-export default RelatedAccounts;
diff --git a/src/pages/labs/galley.js b/src/pages/labs/galley.js
index 3b7d5d68..014628ca 100644
--- a/src/pages/labs/galley.js
+++ b/src/pages/labs/galley.js
@@ -176,3 +176,312 @@ const styles = {
};
export default Galley;
+
+/**
+ * Sample React Native App
+ * https://github.com/facebook/react-native
+ *
+ * @format
+ * @flow
+ */
+
+// import React, {Component} from 'react';
+// import {SafeAreaView, StyleSheet, ScrollView, Button, View, Text, StatusBar} from 'react-native';
+//
+// import {Colors} from 'react-native/Libraries/NewAppScreen';
+//
+// import {XUpdate, InitArgs, UpdateArgs} from 'react-native-xupdate-new';
+// // import AppInfo from './update_custom';
+//
+// const AppInfo = {
+// Code: 0,
+// Msg: '',
+// UpdateStatus: 2,
+// VersionCode: 20,
+// VersionName: '1.0.2',
+// UploadTime: '2021-07-10 17:28:41',
+// ModifyContent:
+// ' 1、优化api接口。 2、添加使用demo演示。 3、新增自定义更新服务API接口。 4、优化更新提示界面。',
+// DownloadUrl: 'https://xuexiangjys.oss-cn-shanghai.aliyuncs.com/apk/xupdate_demo_1.0.2.apk',
+// ApkSize: 2048,
+// ApkMd5: 'E4B79A36EFB9F17DF7E3BB161F9BCFD8',
+// };
+//
+// const _updateUrl = 'http://xinxue.meirixinxue.com/v.json';
+//
+// const _updateUrl2 = 'http://xinxue.meirixinxue.com/v.json';
+//
+// const _updateUrl3 = 'http://xinxue.meirixinxue.com/v.json';
+//
+// export default class App extends Component<{}> {
+// state = {
+// _message: '',
+// };
+//
+// //自定义的异常处理
+// errorListener = error => {
+// console.log(error);
+// //下载失败
+// if (error.code === 4000) {
+// XUpdate.showRetryUpdateTip(
+// 'Github被墙无法继续下载,是否考虑切换蒲公英下载?',
+// 'https://www.pgyer.com/flutter_learn'
+// );
+// }
+// this.setState({
+// _message: '发送异常:' + JSON.stringify(error),
+// });
+// };
+//
+// componentDidMount() {
+// this.initXUpdate();
+// }
+//
+// initXUpdate() {
+// let args = new InitArgs();
+// args.debug = true;
+// args.isPostJson = false;
+// args.timeout = 25000;
+// args.isWifiOnly = false;
+// args.isAutoMode = false;
+// args.supportSilentInstall = false;
+// args.enableRetry = false;
+// XUpdate.init(args)
+// .then(result => {
+// this.setState({
+// _message: '初始化成功:' + JSON.stringify(result),
+// });
+// })
+// .catch(error => {
+// console.log(error);
+// this.setState({
+// _message: '初始化失败:' + error,
+// });
+// });
+//
+// //设置自定义解析
+// XUpdate.setCustomParser({parseJson: this.customParser});
+// //设置错误监听
+// XUpdate.addErrorListener(this.errorListener);
+// }
+//
+// componentWillUnmount() {
+// XUpdate.removeErrorListener(this.errorListener);
+// }
+//
+// render() {
+// return (
+// <>
+//
+//
+//
+//
+//
+// XUpdate
+//
+//
+// {this.state._message}
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// >
+// );
+// }
+//
+// ///默认App更新
+// checkUpdateDefault() {
+// let args = new UpdateArgs(_updateUrl);
+// XUpdate.update(args);
+// }
+//
+// ///默认App更新 + 支持后台更新
+// checkUpdateSupportBackground() {
+// let args = new UpdateArgs(_updateUrl);
+// args.supportBackgroundUpdate = true;
+// XUpdate.update(args);
+// }
+//
+// ///调整宽高比
+// checkUpdateRatio() {
+// let args = new UpdateArgs(_updateUrl);
+// args.widthRatio = 2;
+// // args.heightRatio = 1;
+// XUpdate.update(args);
+// }
+//
+// ///强制更新
+// checkUpdateForce() {
+// let args = new UpdateArgs(_updateUrl2);
+// XUpdate.update(args);
+// }
+//
+// ///自动模式, 如果需要完全无人干预,自动更新,需要root权限【静默安装需要】
+// checkUpdateAutoMode() {
+// let args = new UpdateArgs(_updateUrl);
+// args.isAutoMode = true;
+// XUpdate.update(args);
+// }
+//
+// ///下载时点击取消允许切换下载方式
+// enableChangeDownLoadType() {
+// let args = new UpdateArgs(_updateUrl);
+// args.overrideGlobalRetryStrategy = true;
+// args.enableRetry = true;
+// args.retryContent = 'Github下载速度太慢了,是否考虑切换蒲公英下载?';
+// args.retryUrl = 'https://www.pgyer.com/flutter_learn';
+// XUpdate.update(args);
+// }
+//
+// ///显示重试提示弹窗
+// showRetryDialogTip() {
+// XUpdate.showRetryUpdateTip(
+// 'Github下载速度太慢了,是否考虑切换蒲公英下载?',
+// 'https://www.pgyer.com/flutter_learn'
+// );
+// }
+//
+// ///使用自定义json解析
+// customJsonParse() {
+// let args = new UpdateArgs(_updateUrl3);
+// args.isCustomParse = true;
+// XUpdate.update(args);
+// }
+//
+// ///直接传入UpdateEntity进行更新提示
+// checkUpdateByUpdateEntity() {
+// let args = new UpdateArgs();
+// args.supportBackgroundUpdate = true;
+// XUpdate.updateByInfo(args, {
+// hasUpdate: AppInfo.hasUpdate,
+// versionCode: AppInfo.versionCode,
+// versionName: AppInfo.versionName,
+// updateContent: AppInfo.updateLog,
+// downloadUrl: AppInfo.apkUrl,
+// //选填
+// isIgnorable: AppInfo.isIgnorable,
+// apkSize: AppInfo.apkSize,
+// });
+// }
+//
+// ///自定义更新弹窗样式
+// customPromptDialog() {
+// let args = new UpdateArgs(_updateUrl);
+// // args.themeColor = '#ffffff';
+// // args.topImageRes = 'bg_update_top';
+// args.buttonTextColor = '#00000000';
+// XUpdate.update(args);
+// }
+//
+// //自定义解析
+// customParser = json => {
+// let appInfo = JSON.parse(json);
+// return {
+// //必填
+// hasUpdate: appInfo.hasUpdate,
+// versionCode: appInfo.versionCode,
+// versionName: appInfo.versionName,
+// updateContent: appInfo.updateLog,
+// downloadUrl: appInfo.apkUrl,
+// //选填
+// isIgnorable: appInfo.isIgnorable,
+// apkSize: appInfo.apkSize,
+// };
+// };
+// }
+//
+// const styles = StyleSheet.create({
+// scrollView: {
+// backgroundColor: Colors.white,
+// },
+// engine: {
+// position: 'absolute',
+// right: 0,
+// },
+// sectionContainer: {
+// marginTop: 32,
+// paddingHorizontal: 24,
+// },
+// sectionTitle: {
+// fontSize: 24,
+// fontWeight: '600',
+// color: Colors.black,
+// },
+// sectionDescription: {
+// marginTop: 8,
+// fontSize: 18,
+// fontWeight: '400',
+// color: Colors.dark,
+// },
+// logContainer: {
+// marginTop: 16,
+// paddingHorizontal: 24,
+// },
+// logStyle: {
+// padding: 16,
+// backgroundColor: '#E0E0E0',
+// minHeight: 150,
+// },
+// buttonContainer: {
+// marginTop: 16,
+// paddingHorizontal: 24,
+// },
+// });
diff --git a/src/pages/labs/index.js b/src/pages/labs/index.js
index 06e60a7a..a27239ec 100644
--- a/src/pages/labs/index.js
+++ b/src/pages/labs/index.js
@@ -15,6 +15,7 @@ import {
openSettings,
} from 'react-native-permissions';
import {useDispatch, useSelector} from 'react-redux';
+// import {XUpdate} from 'react-native-xupdate-new';
const LabIndex = props => {
const navigation = props.navigation;
diff --git a/src/pages/mine/mine-detail.js b/src/pages/mine/mine-detail.js
index e0acfdfb..af5bd916 100644
--- a/src/pages/mine/mine-detail.js
+++ b/src/pages/mine/mine-detail.js
@@ -147,12 +147,15 @@ const MineDetail = props => {
};
useLayoutEffect(() => {
+ console.log('useLayoutEffect');
props.navigation.setOptions({});
loadData();
}, []);
useFocusEffect(
useCallback(() => {
+ console.log('focues');
+
setuseFocus(true);
setCurrentKey('publish');
dispatch(dispatchBaseCurrentAccount());
diff --git a/src/pages/mine/settings/account-content.js b/src/pages/mine/settings/account-content.js
index 5a1091fd..4e58294e 100644
--- a/src/pages/mine/settings/account-content.js
+++ b/src/pages/mine/settings/account-content.js
@@ -184,8 +184,7 @@ const AccountContent = props => {
{label: '男', value: 'man'},
{label: '女', value: 'woman'},
{label: '保密', value: 'other'},
- ]}
- >
+ ]}>
{currentAccount.gender_text}
diff --git a/src/pages/mine/settings/edit-account-content.js b/src/pages/mine/settings/edit-account-content.js
index 59248060..75c5be32 100644
--- a/src/pages/mine/settings/edit-account-content.js
+++ b/src/pages/mine/settings/edit-account-content.js
@@ -8,7 +8,6 @@ import {
TextInput,
} from 'react-native';
import {useSelector} from 'react-redux';
-// import {SafeAreaView} from 'react-native-safe-area-context';
import {syncAccountInfo} from '@/api/mine_api';
import {secureCheck} from '@/api/secure_check';
import {Button} from 'react-native-elements';
@@ -18,6 +17,7 @@ const EditAccountContent = ({navigation, route}) => {
const [editKey, setEditKey] = useState('');
const [content, setContent] = useState('');
const currentAccount = useSelector(state => state.account.currentAccount);
+
useLayoutEffect(() => {}, [navigation]);
useEffect(() => {
@@ -47,6 +47,7 @@ const EditAccountContent = ({navigation, route}) => {
}
const res = await secureCheck('text', content);
+
if (!res.status) {
return;
}
@@ -59,7 +60,7 @@ const EditAccountContent = ({navigation, route}) => {
data = {...data, intro: content};
}
- syncAccountInfo({account: data});
+ await syncAccountInfo({account: data});
navigation.goBack();
};
@@ -101,15 +102,13 @@ const EditAccountContent = ({navigation, route}) => {
style={styles.multiLine}
/>
)}
- {/*{editKey === 'province' && }*/}
+
{
- saveContent();
- }}
+ onPress={saveContent}
/>
diff --git a/src/pages/nodes/node-detail.js b/src/pages/nodes/node-detail.js
index 6dd99c97..23472bcb 100644
--- a/src/pages/nodes/node-detail.js
+++ b/src/pages/nodes/node-detail.js
@@ -147,12 +147,9 @@ const NodeDetail = ({navigation, route}) => {
{detail.name}
-
+
{detail.topics_count}篇动态
- {(detail.space || detail.location) && (
- ·
- )}
+ {(detail.space || detail.location) && · }
@@ -276,10 +273,15 @@ const styles = StyleSheet.create({
marginTop: 6,
fontWeight: '500',
},
+ nodeView: {
+ flexDirection: 'row',
+ justifyContent: 'center',
+ alignItems: 'center',
+ marginTop: 12,
+ },
nodeNum: {
fontSize: 11,
color: '#fff',
- marginTop: 11,
},
descWrap: {
marginTop: RFValue(20),
diff --git a/src/pages/nodes/node-index.js b/src/pages/nodes/node-index.js
index 1b9f9c43..cdf32b2a 100644
--- a/src/pages/nodes/node-index.js
+++ b/src/pages/nodes/node-index.js
@@ -1,20 +1,22 @@
-import React, {useEffect, useState, useRef} from 'react';
+import React, {useEffect, useState, useRef, useCallback} from 'react';
import {View, Text, ScrollView, StyleSheet, Pressable, StatusBar} from 'react-native';
import {useSelector, useDispatch} from 'react-redux';
-import {nodeAction} from '@/redux/actions';
+import {useFocusEffect} from '@react-navigation/native';
+import {nodeAction, dispatchFetchCategoryList} from '@/redux/actions';
import Loading from '@/components/Loading';
import BaseNode from '@/components/Item/base-node';
import {RFValue} from '@/utils/response-fontsize';
import {styles} from '@/components/NodeIndex';
-const NodeIndex = () => {
+const NodeIndex = props => {
+ const showAll = props.showAll ? true : false;
const scrollRef = useRef(null);
const dispatch = useDispatch();
const currentAccount = useSelector(state => state.account.currentBaseInfo);
const {nodes, followNodes, checkNodes} = useSelector(state => state.node);
const {categoryList} = useSelector(state => state.home);
- const categories = [{id: 0, name: '我的'}, ...categoryList];
- const [layoutList, setLayoutList] = useState(Array(categoryList.length).fill({y: -1}));
+ const categories = props.showAll ? categoryList : [{id: 0, name: '我的'}, ...categoryList];
+ const [layoutList, setLayoutList] = useState([]);
const [active, setActive] = useState(1);
const [allNodes, setAllNodes] = useState([]);
@@ -39,11 +41,19 @@ const NodeIndex = () => {
}, []);
useEffect(() => {
- if (layoutList.length === categories.length) {
- const allTrue = layoutList.every(item => item.y >= 0);
- if (allTrue) {
- scrollRef.current.scrollTo({y: layoutList[1].y, animated: true});
- }
+ if (layoutList.length === 0) {
+ setLayoutList(new Array(categories.length).fill({}));
+ }
+ }, [categories]);
+
+ useEffect(() => {
+ if (categories.length !== layoutList.length) {
+ return;
+ }
+
+ const allRender = layoutList.every(item => item.x >= 0);
+ if (allRender && !showAll) {
+ scrollRef.current.scrollTo({y: layoutList[1].y, animated: true});
}
}, [layoutList]);
@@ -55,7 +65,7 @@ const NodeIndex = () => {
setAllNodes(allMineNodes.concat(nodes));
}, [nodes, followNodes, checkNodes]);
- return allNodes.length > 0 ? (
+ return allNodes.length > 0 && categories.length > 0 ? (
<>
diff --git a/src/pages/notify/notify-index.js b/src/pages/notify/notify-index.js
index 16d98309..98f29ea3 100644
--- a/src/pages/notify/notify-index.js
+++ b/src/pages/notify/notify-index.js
@@ -1,7 +1,7 @@
import React, {useCallback} from 'react';
import {StyleSheet, StatusBar, View, Text, Image, Pressable} from 'react-native';
import {useSelector, useDispatch} from 'react-redux';
-import {useFocusEffect} from '@react-navigation/native';
+import {useFocusEffect, useNavigation} from '@react-navigation/native';
import JPush from 'jpush-react-native';
import {syncAccountInfo} from '@/api/mine_api';
import {BadgeMessage, Avator} from '@/components/NodeComponents';
@@ -14,10 +14,12 @@ import {
SystemNoticeImg,
MineMentionNoticeUserImg,
} from '@/utils/default-image';
-var BadgeAndroid = require('react-native-android-badge');
-const NotifyIndex = ({navigation}) => {
+const BadgeAndroid = require('react-native-android-badge');
+
+const NotifyIndex = () => {
const dispatch = useDispatch();
+ const navigation = useNavigation();
const {currentAccount} = useSelector(state => state.account);
const {currentBaseInfo} = useSelector(state => state.account);
const {
@@ -210,36 +212,33 @@ const styles = StyleSheet.create({
},
wrapView: {
backgroundColor: '#fff',
- paddingLeft: 14,
},
itemView: {
+ paddingHorizontal: 14,
+ paddingVertical: 12,
flexDirection: 'row',
- paddingVertical: 17,
+ alignItems: 'center',
+ backgroundColor: '#fff',
},
coverWrapView: {
marginRight: 12,
},
notifyContent: {
flex: 1,
- justifyContent: 'center',
},
notifyContentTitle: {
- height: 20,
- lineHeight: 20,
- fontSize: 16,
- letterSpacing: 1,
+ fontSize: 15,
fontWeight: '500',
},
notifyContentDesc: {
- marginTop: 4,
color: '#BDBDBD',
- letterSpacing: 1,
- fontSize: 13,
+ fontSize: 12,
+ marginTop: 5,
},
speator: {
height: StyleSheet.hairlineWidth,
backgroundColor: '#ebebeb',
- marginLeft: 45 + 12,
+ marginLeft: 14 + 45 + 12,
},
});
diff --git a/src/pages/sessions/phone-login.js b/src/pages/sessions/phone-login.js
index 03644610..05cbfa25 100644
--- a/src/pages/sessions/phone-login.js
+++ b/src/pages/sessions/phone-login.js
@@ -25,7 +25,7 @@ const PhoneLogin = ({navigation, route}) => {
const downTimeRunner = () => {
var timeo = 59;
- var timeStop = setInterval(function () {
+ var timeStop = setInterval(function() {
timeo--;
if (timeo >= 1) {
let text = `重新获取(${timeo}s)`;
@@ -84,12 +84,10 @@ const PhoneLogin = ({navigation, route}) => {
let res = {};
if (isRegister) {
- console.log('data', data, isRegister);
res = await phoneRegisterAccount(data);
} else {
res = await verifyPhoneCode(data);
}
- console.log('res', res);
if (res.error) {
Toast.showError(res.error, {});
} else {
diff --git a/src/pages/shopStores/shop-store-detail.js b/src/pages/shopStores/shop-store-detail.js
index 6e442c27..e8cf4189 100644
--- a/src/pages/shopStores/shop-store-detail.js
+++ b/src/pages/shopStores/shop-store-detail.js
@@ -110,7 +110,7 @@ const RenderHeader = props => {
text={joined ? '已收藏' : '收藏'}
onPress={handleJoin}
joinedStyle={{color: '#BDBDBD', backgroundColor: '#fff'}}
- joineStyle={{color: '#000000', backgroundColor: '#fff'}}
+ joinStyle={{color: '#000000', backgroundColor: '#fff'}}
/>
{
+ const [loading, setLoading] = useState(true);
+ const [headers, setHeaders] = useState();
+ const [listData, setListData] = useState([]);
+
+ const RenderItem = ({item, index}) => {
+ return ;
+ };
+
+ const loadData = async (page = 1, params) => {
+ if (page === 1) {
+ setLoading(true);
+ }
+ const res = await getRecommendAccounts({page, ...params});
+ if(page === 1) {
+ setListData(res.data.accounts)
+ } else {
+ let newaccounts = uniqBy(listData.concat(res.data.accounts), 'id')
+ setListData(newaccounts)
+ }
+ setLoading(false);
+ setHeaders(res.headers);
+ };
+
+ useEffect(() => {
+ loadData();
+ }, []);
+
+ return (
+
+
+ }
+ style={{backgroundColor: '#fff'}}
+ keyExtractor={(item, index) => `account${item.id}`}
+ settings={{
+ initialNumToRender: 15
+ }}
+ />
+
+ );
+};
+
+const styles = StyleSheet.create({
+ speator: {
+ backgroundColor: '#EBEBEB',
+ height: StyleSheet.hairlineWidth,
+ marginLeft: 14 + VWValue(45) + 12,
+ marginRight: 14,
+ },
+});
+
+export default TabBarAccounts;
diff --git a/src/pages/tabBar/chat-groups/index.js b/src/pages/tabBar/chat-groups/index.js
new file mode 100644
index 00000000..b1ebc0b0
--- /dev/null
+++ b/src/pages/tabBar/chat-groups/index.js
@@ -0,0 +1,119 @@
+import React, {useState} from 'react';
+import {View, Text, Pressable, StyleSheet} from 'react-native';
+import {useDispatch, useSelector} from 'react-redux';
+import TabView from '@/components/TabView';
+import IconFont from '@/iconfont';
+import {RFValue, VWValue} from '@/utils/response-fontsize';
+import MailListPage from '@/pages/tabBar/chat-groups/mail-list';
+import ChatListPage from '@/pages/chats/chat_groups';
+import NotifyIndex from '@/pages/notify/notify-index';
+import CurrentAvator from '@/pages/tabBar/current-avator';
+import {BadgeMessage} from '@/components/NodeComponents';
+import {Cstyles, BoothHeight} from '@/pages/tabBar/style';
+import {dispatchShareItem} from '@/redux/actions';
+
+const Message = ({count = 0}) => {
+ const right =
+ count >= 1 && count < 10 ? -VWValue(9) : count > 99 ? -VWValue(12) * 1.75 : -VWValue(11) * 1.45;
+
+ return ;
+};
+
+const ChatGroups = props => {
+ const dispatch = useDispatch();
+ const [currentKey, setCurrentKey] = useState('chat');
+ const {currentBaseInfo, currentAccount} = useSelector(state => state.account);
+
+ const onChange = key => {
+ setCurrentKey(key);
+ };
+
+ const handleShare = () => {
+ const shareContent = {
+ item_type: 'Account',
+ item_id: currentAccount.id,
+ visible: true,
+ title: '邀请好友来顽',
+ };
+ dispatch(dispatchShareItem(shareContent));
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+ 通讯录
+
+ ),
+ component: MailListPage,
+ },
+ {
+ key: 'chat',
+ title: (
+
+
+ 聊天
+
+
+
+ ),
+ component: ChatListPage,
+ },
+ {
+ key: 'notify',
+ title: (
+
+
+ 互动
+
+
+
+ ),
+ component: NotifyIndex,
+ },
+ ]}
+ />
+
+ );
+};
+
+const styles = StyleSheet.create({
+ tabItemText: {
+ fontSize: 16,
+ color: '#93a2a9',
+ backgroundColor: '#fff',
+ marginHorizontal: 8,
+ },
+ tabItemTextActive: {
+ fontSize: 16,
+ color: '#000',
+ fontWeight: '600',
+ },
+ badge: {
+ position: 'absolute',
+ top: -8,
+ zIndex: 99999,
+ },
+});
+
+export default ChatGroups;
diff --git a/src/pages/tabBar/chat-groups/mail-list/index.js b/src/pages/tabBar/chat-groups/mail-list/index.js
new file mode 100644
index 00000000..91f6e1a2
--- /dev/null
+++ b/src/pages/tabBar/chat-groups/mail-list/index.js
@@ -0,0 +1,128 @@
+import React, {useState, useEffect} from 'react';
+import {View, Text, StyleSheet} from 'react-native';
+import {useSelector} from 'react-redux';
+import ScrollList, {pagination} from '@/components/ScrollList';
+import BaseMail from '@/components/Item/base-mail';
+import {getAccountFollowEeach, getAccountFollowings, getAccountFollowers} from '@/api/account_api';
+
+const TextData = [
+ {text: '互相关注', key: '互关', api: getAccountFollowEeach},
+ {text: '我的关注', key: '关注', api: getAccountFollowings},
+ {text: '我的粉丝', key: '粉丝', api: getAccountFollowers},
+];
+
+const MailList = () => {
+ const {account} = useSelector(state => state);
+
+ const [loading, setLoading] = useState(true);
+ const [headers, setHeaders] = useState();
+ const [listData, setListData] = useState([]);
+ const [pagin, setPagin] = useState({});
+ const [current, setCurrent] = useState(0);
+
+ const handleChange = index => {
+ setCurrent(index);
+ };
+
+ const RenderItem = ({item}) => {
+ return ;
+ };
+
+ const loadData = async (page = 1, params) => {
+ if (page === 1) {
+ setLoading(true);
+ }
+
+ const request = TextData[current].api;
+ const res = await request({page, ...params});
+ setPagin(pagination(res.headers));
+ setListData(page === 1 ? res.data.accounts : [...listData, ...res.data.accounts]);
+ setLoading(false);
+ setHeaders(res.headers);
+ };
+
+ const onRefresh = page => {
+ loadData(page, {id: account.currentAccount.id});
+ };
+
+ useEffect(() => {
+ onRefresh(1);
+ }, [current]);
+
+ return (
+
+
+
+ {TextData[current].text}({pagin.total})
+
+
+ {TextData.map((item, index) => {
+ return (
+ handleChange(index)}
+ style={[styles.followText, current === index ? styles.active : {}]}>
+ {item.key}
+
+ );
+ })}
+
+
+
+ }
+ enableRefresh={false}
+ style={{backgroundColor: '#fff'}}
+ />
+
+ );
+};
+
+const styles = StyleSheet.create({
+ wrapper: {
+ flex: 1,
+ },
+ followHeader: {
+ height: 50,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ paddingHorizontal: 14,
+ },
+ introText: {
+ fontWeight: '500',
+ },
+ followWrap: {
+ height: 25,
+ flexDirection: 'row',
+ backgroundColor: '#fff',
+ padding: 2,
+ borderRadius: 14,
+ },
+ followText: {
+ height: 21,
+ lineHeight: 21,
+ paddingHorizontal: 9,
+ borderRadius: 10,
+ overflow: 'hidden',
+ fontSize: 11,
+ color: '#BDBDBD',
+ },
+ active: {
+ backgroundColor: '#ffe1e6',
+ color: '#FF2242',
+ fontWeight: '500',
+ },
+ separator: {
+ height: 1,
+ backgroundColor: '#fafafa',
+ marginLeft: 14 + 45 + 12,
+ },
+});
+
+export default MailList;
diff --git a/src/pages/tabBar/community/index.js b/src/pages/tabBar/community/index.js
new file mode 100644
index 00000000..3c904811
--- /dev/null
+++ b/src/pages/tabBar/community/index.js
@@ -0,0 +1,122 @@
+import React, {useState, useCallback} from 'react';
+import {View, Text, Pressable, StyleSheet} from 'react-native';
+import {useFocusEffect} from '@react-navigation/native';
+import {useSelector, useDispatch} from 'react-redux';
+import TabView from '@/components/TabView';
+import IconFont from '@/iconfont';
+import {dispatchBaseCurrentAccount, dispatchFetchCategoryList} from '@/redux/actions';
+import {RFValue} from '@/utils/response-fontsize';
+import MineNodeListPage from '@/pages/tabBar/community/mine-node-list';
+import NodeIndex from '@/pages/nodes/node-index';
+import NearbyNodesListPage from '@/pages/tabBar/community/nearby-nodes';
+import CurrentAvator from '@/pages/tabBar/current-avator';
+import DownLoadModal from '@/pages/tabBar/download-modal';
+import {Cstyles, BoothHeight} from '@/pages/tabBar/style';
+
+const Community = props => {
+ const {navigation} = props;
+ const dispatch = useDispatch();
+
+ const {
+ home: {location},
+ } = useSelector(state => state);
+
+ const [currentKey, setCurrentKey] = useState('square');
+
+ const openAddress = location.latitude && location.longitude ? true : false;
+ const nodeTabTitle = openAddress ? location.positionCity : '本地';
+
+ const onChange = key => {
+ setCurrentKey(key);
+ };
+
+ const handleCreateNode = () => {
+ navigation.navigate('CreateNodeIntro');
+ };
+
+ const SquareListPage = () => ;
+
+ useFocusEffect(
+ useCallback(() => {
+ dispatch(dispatchBaseCurrentAccount());
+ dispatch(dispatchFetchCategoryList());
+ }, [])
+ );
+
+ return (
+
+
+
+
+
+
+
+ 创建
+
+
+
+ 我的
+
+
+ ),
+ component: MineNodeListPage,
+ },
+ {
+ key: 'square',
+ title: (
+
+
+ 广场
+
+
+ ),
+ component: SquareListPage,
+ },
+ {
+ key: 'city',
+ title: (
+
+
+ {nodeTabTitle}
+
+
+ ),
+ component: NearbyNodesListPage,
+ },
+ ]}
+ />
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ tabItemText: {
+ fontSize: 16,
+ color: '#93a2a9',
+ backgroundColor: '#fff',
+ marginHorizontal: 8,
+ },
+ tabItemTextActive: {
+ fontSize: 16,
+ color: '#000',
+ fontWeight: '600',
+ },
+});
+
+export default Community;
diff --git a/src/pages/tabBar/community/mine-node-list/index.js b/src/pages/tabBar/community/mine-node-list/index.js
new file mode 100644
index 00000000..3d242ef6
--- /dev/null
+++ b/src/pages/tabBar/community/mine-node-list/index.js
@@ -0,0 +1,213 @@
+import React, {useState, useEffect, useCallback, useMemo} from 'react';
+import {View, Text, Platform, ScrollView, Pressable, StyleSheet} from 'react-native';
+import {useFocusEffect, useNavigation} from '@react-navigation/native';
+import {useDispatch, useSelector} from 'react-redux';
+import {nodeAction} from '@/redux/actions';
+import {throttle} from 'lodash';
+import {TransFormType} from '@/utils';
+import FastImg from '@/components/FastImg';
+import ScrollList from '@/components/ScrollList';
+import BaseTopic from '@/components/Item/base-topic';
+import BaseArticle from '@/components/Item/base-article';
+import BaseTheory from '@/components/Item/base-theory';
+import {AllNodeImg} from '@/utils/default-image';
+import {getFollowedNodePosts} from '@/api/home_api';
+import {ListEmpty as lstyles} from '@/styles/baseCommon';
+
+const NodeScrollView = () => {
+ const dispatch = useDispatch();
+ const navigation = useNavigation();
+ const currentAccount = useSelector(state => state.account.currentBaseInfo);
+ const {homeNodes = []} = useSelector(state => state.node);
+
+ useFocusEffect(
+ useCallback(() => {
+ dispatch(nodeAction.dispatchUpdateHomeNodes(currentAccount.id));
+ }, [])
+ );
+
+ return (
+
+ {homeNodes.length === 0 ? (
+ navigation.navigate('NodeIndex')}>
+
+
+ 全部圈子
+
+
+ ) : null}
+
+ {homeNodes.length > 0 &&
+ homeNodes.map(node => {
+ return (
+ navigation.push('NodeDetail', {nodeId: node.id})}>
+
+
+ {node.role === 'super_admin' && 圈主 }
+
+
+ {node.name}
+
+
+ );
+ })}
+
+ );
+};
+
+const MineNodeList = () => {
+ const navigation = useNavigation();
+ const [loading, setLoading] = useState(false);
+ const [headers, setHeaders] = useState();
+ const [listData, setListData] = useState([]);
+
+ const onRemove = index => {
+ const data = JSON.parse(JSON.stringify(listData));
+ data.splice(index, 1);
+ setListData([...data]);
+ };
+
+ const RenderItem = React.memo(({item, index}) => {
+ const data = {
+ ...item.item,
+ published_at_text: `发布了${TransFormType(item.item)}`,
+ nodeInfo: item.node,
+ };
+
+ return useMemo(() => {
+ switch (item.item_type) {
+ case 'Topic':
+ return (
+ onRemove(index)}
+ bottom="comment"
+ type="recommend-node"
+ />
+ );
+ case 'Article':
+ return ;
+ case 'Theory':
+ return (
+ onRemove(index)}
+ bottom="comment"
+ type="recommend-node"
+ />
+ );
+ default:
+ return ;
+ }
+ }, [item.id]);
+ });
+
+ const renderItemMemo = useCallback(itemProps => , [listData]);
+
+ const onRefresh = (page = 1) => {
+ loadData(page);
+ };
+
+ const loadData = async (page = 1, params) => {
+ if (page === 1) {
+ setLoading(true);
+ }
+ const res = await getFollowedNodePosts({page, ...params});
+ setListData(page === 1 ? res.data.posts : [...listData, ...res.data.posts]);
+ setLoading(false);
+ setHeaders(res.headers);
+ };
+
+ useEffect(() => {
+ loadData(1);
+ }, []);
+
+ return (
+ }
+ ListHeaderComponent={
+ <>
+
+
+ >
+ }
+ renderEmpty={
+
+
+ 你还没有加入圈子
+ 点击发现更多圈子
+
+ navigation.navigate('NodeIndex')}>
+ 发现更多圈子
+
+
+ }
+ />
+ );
+};
+
+const styles = StyleSheet.create({
+ nodeView: {
+ backgroundColor: '#fff',
+ paddingLeft: 14,
+ paddingTop: 12,
+ paddingBottom: 9,
+ },
+ nodeWrap: {
+ width: 57,
+ marginRight: 15,
+ },
+ nodeImg: {
+ width: 57,
+ height: 57,
+ },
+ nodeName: {
+ fontSize: 11,
+ marginTop: 5,
+ maxHeight: 18,
+ minHeight: 16,
+ height: 18,
+ lineHeight: 18,
+ textAlign: 'center',
+ fontWeight: '300',
+ },
+ nodeSelf: {
+ width: 34,
+ height: 18,
+ lineHeight: 18,
+ textAlign: 'center',
+ borderRadius: 9,
+ overflow: 'hidden',
+ backgroundColor: '#000',
+ opacity: 0.7,
+ color: '#FFFF00',
+ fontSize: 10,
+ position: 'absolute',
+ bottom: 0,
+ left: '50%',
+ marginLeft: -17,
+ },
+ speator: {
+ backgroundColor: '#ebebeb',
+ height: StyleSheet.hairlineWidth,
+ marginHorizontal: 14,
+ },
+});
+
+export default MineNodeList;
diff --git a/src/pages/tabBar/community/nearby-nodes/index.js b/src/pages/tabBar/community/nearby-nodes/index.js
new file mode 100644
index 00000000..e9bb9250
--- /dev/null
+++ b/src/pages/tabBar/community/nearby-nodes/index.js
@@ -0,0 +1,124 @@
+import React, {useState, useEffect} from 'react';
+import {View, Text, Pressable, StatusBar, StyleSheet, AppState} from 'react-native';
+import {useNavigation} from '@react-navigation/native';
+import {useSelector, useDispatch} from 'react-redux';
+import ScrollList from '@/components/ScrollList';
+import BaseNode from '@/components/Item/base-node';
+import {RFValue} from '@/utils/response-fontsize';
+import {ListEmpty as lstyles} from '@/styles/baseCommon';
+import {loadLocation} from '@/utils/get-location';
+import {getNodeIndex} from '@/api/node_api';
+
+const RenderPermission = () => {
+ const dispatch = useDispatch();
+
+ const onOpenLocation = () => {
+ loadLocation(dispatch);
+ };
+
+ return (
+
+
+ 你还没有授权地理位置权限
+ 授权后可看到更多本地圈子
+
+
+ 授权地理位置权限
+
+
+ );
+};
+
+const RenderEmpty = () => {
+ const navigation = useNavigation();
+
+ return (
+
+
+ 所在地区还没有青年社区
+ 你可以创建当地首个圈子
+
+ navigation.navigate('CreateNodeIntro')}>
+ 开始创建本地圈子
+
+
+ );
+};
+
+const NearbyNodes = () => {
+ const dispatch = useDispatch();
+ const {home} = useSelector(state => state);
+ const openAddress = home.location.latitude && home.location.longitude ? true : false;
+
+ const [loading, setLoading] = useState(true);
+ const [headers, setHeaders] = useState();
+ const [listData, setListData] = useState([]);
+
+ const RenderItem = ({item}) => {
+ return ;
+ };
+
+ const loadData = async (page = 1, params) => {
+ if (page === 1) {
+ setLoading(true);
+ }
+ const res = await getNodeIndex({page, ...params});
+ setListData(page === 1 ? res.data.nodes : [...listData, ...res.data.nodes]);
+ setLoading(false);
+ setHeaders(res.headers);
+ };
+
+ const onRefresh = page => {
+ const {latitude, longitude} = home.location;
+ loadData(page, {latitude, longitude, type: 'nearby'});
+ };
+
+ const handleAppStateChange = nextAppState => {
+ if (nextAppState === 'active') {
+ loadLocation(dispatch);
+ }
+ };
+
+ useEffect(() => {
+ AppState.addEventListener('change', handleAppStateChange);
+ return () => {
+ AppState.removeEventListener('change', handleAppStateChange);
+ };
+ }, []);
+
+ useEffect(() => {
+ if (openAddress) {
+ onRefresh(1);
+ }
+ }, [openAddress]);
+
+ return (
+ <>
+
+ {openAddress ? (
+ }
+ enableRefresh={false}
+ renderEmpty={ }
+ />
+ ) : (
+
+ )}
+ >
+ );
+};
+
+const styles = StyleSheet.create({
+ separator: {
+ height: StyleSheet.hairlineWidth,
+ backgroundColor: '#fafafa',
+ marginLeft: 14 + 49 + 10,
+ },
+});
+
+export default NearbyNodes;
diff --git a/src/pages/tabBar/current-avator.js b/src/pages/tabBar/current-avator.js
new file mode 100644
index 00000000..bee965a7
--- /dev/null
+++ b/src/pages/tabBar/current-avator.js
@@ -0,0 +1,30 @@
+import React from 'react';
+import {StyleSheet, Pressable} from 'react-native';
+import {useSelector} from 'react-redux';
+import {useNavigation} from '@react-navigation/native';
+import FastImg from '@/components/FastImg';
+import {RFValue} from '@/utils/response-fontsize';
+
+const CurrentAvator = () => {
+ const navigation = useNavigation();
+ const {currentAccount} = useSelector(state => state.account);
+
+ return (
+ navigation.openDrawer()} style={styles.avatorWrap}>
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ avatorWrap: {
+ zIndex: 2,
+ },
+ avator: {
+ width: RFValue(30),
+ height: RFValue(30),
+ borderRadius: RFValue(15),
+ },
+});
+
+export default CurrentAvator;
diff --git a/src/pages/tabBar/download-modal/index.android.js b/src/pages/tabBar/download-modal/index.android.js
new file mode 100644
index 00000000..5746ef1a
--- /dev/null
+++ b/src/pages/tabBar/download-modal/index.android.js
@@ -0,0 +1,89 @@
+import React, {useEffect} from 'react';
+import {View} from 'react-native';
+import {XUpdate, InitArgs, UpdateArgs} from 'react-native-xupdate-new';
+import {getVersionUpgrades} from '@/api/settings_api';
+import {WANYA_VERSION} from '@/utils/config';
+import Helper from '@/utils/helper';
+
+const DownLoadModal = () => {
+ const initXUpdate = () => {
+ let args = new InitArgs();
+ args.debug = false;
+ args.isPostJson = false;
+ args.timeout = 25000;
+ args.isWifiOnly = false;
+ args.isAutoMode = false;
+ args.supportSilentInstall = false;
+ args.enableRetry = true;
+ XUpdate.init(args)
+ .then(result => {
+ console.log('初始化成功', JSON.stringify(result));
+ })
+ .catch(error => {
+ console.log(error);
+ });
+
+ //设置自定义解析
+ // XUpdate.setCustomParser({parseJson: customParser});
+ //设置错误监听
+ XUpdate.addErrorListener(errorListener);
+ };
+
+ const errorListener = error => {
+ console.log(error);
+ //下载失败
+ if (error.code === 4000) {
+ XUpdate.showRetryUpdateTip(
+ '无法继续下载,是否考虑切换fir下载?',
+ 'http://fir.vanyah.cn/vanyahapp'
+ );
+ }
+ console.log('发送异常:' + JSON.stringify(error));
+ };
+
+ const checkUpdateDefault = async () => {
+ const params = {platform: 'android', version: WANYA_VERSION}; // 0.0.24
+ const res = await getVersionUpgrades(params);
+ if (!res.title) {
+ return;
+ }
+
+ let cache_key = `OVERDUCETIME_${res.version_name}`;
+ if (!res.force_update) {
+ const last_check_time = await Helper.getData(cache_key);
+ // eslint-disable-next-line radix
+ if (last_check_time && parseInt(last_check_time) > new Date().getTime()) {
+ console.log(cache_key, 'checked!');
+ return 'checked!';
+ }
+ const timestamp = 3 * 24 * 60 * 60 * 1000;
+ const overdueTime = new Date().getTime() + timestamp;
+ Helper.setData(cache_key, overdueTime.toString());
+ }
+ let args = new UpdateArgs();
+ args.supportBackgroundUpdate = true;
+ XUpdate.updateByInfo(args, {
+ hasUpdate: true,
+ isForce: res.force_update,
+ versionCode: res.version_code,
+ versionName: res.version_name,
+ updateContent: res.desc,
+ downloadUrl: res.download_url,
+ //选填
+ isIgnorable: false,
+ apkSize: res.apk_size,
+ apkMd5: '',
+ });
+ };
+
+ useEffect(() => {
+ initXUpdate();
+ checkUpdateDefault();
+ return () => {
+ XUpdate.removeErrorListener(errorListener);
+ };
+ }, []);
+
+ return ;
+};
+export default DownLoadModal;
diff --git a/src/pages/tabBar/download-modal/index.ios.js b/src/pages/tabBar/download-modal/index.ios.js
new file mode 100644
index 00000000..1703c15b
--- /dev/null
+++ b/src/pages/tabBar/download-modal/index.ios.js
@@ -0,0 +1,136 @@
+import React, {useState, useEffect} from 'react';
+import {View, Text, StyleSheet, Dimensions, Linking} from 'react-native';
+import Modal from 'react-native-modal';
+import FastImg from '@/components/FastImg';
+import IconFont from '@/iconfont';
+import {RFValue} from '@/utils/response-fontsize';
+import {getVersionUpgrades} from '@/api/settings_api';
+import {WANYA_VERSION} from '@/utils/config';
+import Helper from '@/utils/helper';
+import DownLoadImg from '@/assets/images/download.png';
+import {Pressable} from 'react-native';
+const {width} = Dimensions.get('window');
+
+const DownloadModal = () => {
+ const [visible, setVisible] = useState(false);
+ const [info, setInfo] = useState({});
+
+ const handleUpdate = () => {
+ if (info.category === 'ios') {
+ Linking.openURL(info.download_url);
+ }
+ };
+
+ const handleClose = () => {
+ setVisible(false);
+ };
+
+ const loadData = async () => {
+ try {
+ const params = {platform: 'ios', version: WANYA_VERSION}; // 0.0.24
+ const res = await getVersionUpgrades(params);
+
+ if (res.title) {
+ setInfo(res);
+ if (!res.force_update) {
+ let cache_key = `OVERDUCETIME_${res.version_name}`;
+ const last_check_time = await Helper.getData(cache_key);
+ // eslint-disable-next-line radix
+ if (last_check_time && parseInt(last_check_time) > new Date().getTime()) {
+ console.log(cache_key, 'checked!');
+ return 'checked!';
+ }
+ const timestamp = 3 * 24 * 60 * 60 * 1000;
+ const overdueTime = new Date().getTime() + timestamp;
+ Helper.setData(cache_key, overdueTime.toString());
+ }
+
+ setVisible(true);
+ }
+ } catch (e) {
+ console.log('ios error', e);
+ }
+ };
+
+ const init = async () => {
+ setTimeout(() => {
+ loadData();
+ }, 3000);
+ };
+
+ useEffect(() => {
+ init();
+ }, []);
+
+ return (
+
+
+
+ 版本更新 V {info.version_name}
+ {info.desc}
+
+ 立即更新
+
+
+ {info.force_update ? null : (
+
+
+
+ )}
+
+
+ );
+};
+
+const imageWidth = width - RFValue(50 * 2) - RFValue(25 * 2) - RFValue(25 * 2);
+const styles = StyleSheet.create({
+ modalView: {
+ marginHorizontal: RFValue(50),
+ // flex: 1
+ },
+ modalContent: {
+ paddingHorizontal: RFValue(40),
+ paddingVertical: RFValue(25),
+ backgroundColor: '#fff',
+ alignItems: 'center',
+ borderRadius: 5,
+ },
+ image: {
+ width: imageWidth,
+ height: (578 * imageWidth) / 670,
+ },
+ title: {
+ fontWeight: '600',
+ fontSize: 16,
+ marginVertical: RFValue(30),
+ },
+ content: {
+ fontSize: 14,
+ lineHeight: 20,
+ textAlign: 'justify',
+ },
+ btn: {
+ width: '100%',
+ height: 45,
+ lineHeight: 45,
+ textAlign: 'center',
+ fontSize: 16,
+ fontWeight: '500',
+ color: '#fff',
+ backgroundColor: '#ff2242',
+ borderRadius: 20,
+ overflow: 'hidden',
+ marginTop: RFValue(20),
+ },
+ icon: {
+ position: 'absolute',
+ bottom: -35,
+ },
+});
+
+export default DownloadModal;
diff --git a/src/pages/home/follow-list-post.js b/src/pages/tabBar/home/follow-list-post.js
similarity index 65%
rename from src/pages/home/follow-list-post.js
rename to src/pages/tabBar/home/follow-list-post.js
index 567bd0f5..a0bd6323 100644
--- a/src/pages/home/follow-list-post.js
+++ b/src/pages/tabBar/home/follow-list-post.js
@@ -1,11 +1,9 @@
import React, {useState, useEffect, useCallback, useMemo} from 'react';
-import {Platform, View, Text, Pressable, ScrollView, StyleSheet} from 'react-native';
+import {Platform, View, Text, Pressable, StyleSheet} from 'react-native';
import {useSelector, useDispatch} from 'react-redux';
import {useNavigation} from '@react-navigation/native';
import * as action from '@/redux/constants';
import {throttle} from 'lodash';
-import Toast from '@/components/Toast';
-import {Avator} from '@/components/NodeComponents';
import IconFont from '@/iconfont';
import {BlurView} from '@/components/NodeComponents';
import FastImg from '@/components/FastImg';
@@ -14,8 +12,6 @@ import BaseTopic from '@/components/Item/base-topic';
import BaseArticle from '@/components/Item/base-article';
import BaseTheory from '@/components/Item/base-theory';
import {getFollowedPosts} from '@/api/home_api';
-import {recommendAccounts} from '@/api/mine_api';
-import {followAccount} from '@/api/account_api';
import {RFValue} from '@/utils/response-fontsize';
import {ShareWrapper as lstyles} from '@/styles/baseCommon';
@@ -57,71 +53,6 @@ export const FollowShareComponent = () => {
) : null;
};
-const RelatedRecommend = () => {
- const navigation = useNavigation();
- const [account, setAccount] = useState([]);
-
- const loadData = async () => {
- const res = await recommendAccounts();
- setAccount(res.data.accounts);
- };
-
- const onFollow = async (item, index) => {
- if (item.followed === false) {
- await followAccount(item.id);
- Toast.showError('关注成功');
- account[index].followed = true;
- setAccount([...account]);
- }
-
- setTimeout(() => {
- account.splice(index, 1);
- setAccount([...account]);
- }, 1000);
- };
-
- const goDetail = item => {
- navigation.navigate('AccountDetail', {accountId: item.id});
- };
-
- const goRelatedDetail = () => {
- navigation.navigate('RelatedAccounts');
- };
-
- useEffect(() => {
- loadData();
- }, []);
-
- return account.length > 0 ? (
-
-
- 为您推荐
-
- 相关推荐
-
-
-
-
-
- {account.map((item, index) => (
- goDetail(item)}>
-
-
- {item.nickname}
-
- onFollow(item, index)}>
- {item.followed ? '已关注' : '关注'}
-
-
- ))}
-
-
-
- ) : null;
-};
-
const FollowListPost = () => {
const [loading, setLoading] = useState(false);
const [headers, setHeaders] = useState();
@@ -137,29 +68,18 @@ const FollowListPost = () => {
return useMemo(() => {
switch (item.item_type) {
case 'Topic':
- return onRemove(index)} />;
+ return onRemove(index)} bottom="comment" />;
case 'Article':
return ;
case 'Theory':
- return onRemove(index)} />;
+ return onRemove(index)} bottom="comment" />;
default:
return ;
}
}, [item.id]);
});
- const renderItemMemo = useCallback(
- itemProps =>
- itemProps.index === 1 ? (
- <>
-
-
- >
- ) : (
-
- ),
- [listData]
- );
+ const renderItemMemo = useCallback(itemProps => , [listData]);
const onRefresh = (page = 1) => {
loadData(page);
@@ -191,10 +111,10 @@ const FollowListPost = () => {
windowSize={Platform.OS === 'ios' ? 10 : 20}
ListHeaderComponent={FollowShareComponent()}
renderSeparator={() => }
- renderEmpty={RelatedRecommend()}
/>
);
};
+
const styles = StyleSheet.create({
wrapper: {
paddingLeft: 14,
diff --git a/src/pages/home/nearby-list-post.js b/src/pages/tabBar/home/nearby-list-post/index.js
similarity index 77%
rename from src/pages/home/nearby-list-post.js
rename to src/pages/tabBar/home/nearby-list-post/index.js
index ec14dcc9..fc4ca223 100644
--- a/src/pages/home/nearby-list-post.js
+++ b/src/pages/tabBar/home/nearby-list-post/index.js
@@ -1,5 +1,5 @@
import React, {useState, useEffect, useCallback, useMemo} from 'react';
-import {View, Text, Pressable, Platform, StyleSheet} from 'react-native';
+import {View, Text, Pressable, Platform, StyleSheet, AppState} from 'react-native';
import {useSelector, useDispatch} from 'react-redux';
import * as action from '@/redux/constants';
import {throttle} from 'lodash';
@@ -12,16 +12,86 @@ import BaseTopic from '@/components/Item/base-topic';
import BaseArticle from '@/components/Item/base-article';
import BaseTheory from '@/components/Item/base-theory';
import {getNearbyPosts} from '@/api/home_api';
-import {getLocation} from './getLocation';
+import {loadLocation} from '@/utils/get-location';
import {useNavigation} from '@react-navigation/native';
import {ListEmpty as lstyles, ShareWrapper as styles} from '@/styles/baseCommon';
import ShareNearByImg from '@/assets/images/share-nearby.png';
+const RenderPermission = () => {
+ const dispatch = useDispatch();
+
+ const onOpenLocation = () => {
+ loadLocation(dispatch);
+ };
+
+ return (
+
+
+ 你还没有开启【定位服务】权限
+ 在【设置】中授权后将获得更多附近信息
+
+
+ 开启位置访问权限
+
+
+ );
+};
+
+const RenderEmpty = () => {
+ const navigation = useNavigation();
+
+ return (
+ navigation.navigate('InviteDetail')}>
+
+ 附近还没有更多顽友
+ 邀请小伙伴一起玩呀
+
+ 分享给身边好友
+
+ );
+};
+
+const NearbyShareComponent = props => {
+ const {shareNearbyStatus, dispatch, navigation} = props;
+
+ const onShareClose = () => {
+ dispatch({type: action.CHANGE_SHARE_NEARBY_STATUS, value: false});
+ };
+
+ const onShare = () => {
+ navigation.navigate('InviteDetail');
+ };
+
+ return shareNearbyStatus ? (
+
+
+
+
+ 获取更多附近信息
+ 分享给身边好友,邀请小伙伴一起玩呀!
+
+
+
+
+
+
+ ) : null;
+};
+
const NearByListPost = () => {
const navigation = useNavigation();
const dispatch = useDispatch();
- const {location} = useSelector(state => state.home);
- const {shareNearbyStatus} = useSelector(state => state.home);
+ const {
+ home: {location, shareNearbyStatus},
+ } = useSelector(state => state);
+ const openAddress = location.latitude && location.longitude ? true : false;
const [loading, setLoading] = useState(false);
const [headers, setHeaders] = useState();
@@ -58,27 +128,6 @@ const NearByListPost = () => {
const renderItemMemo = useCallback(itemProps => , [listData]);
- const onOpenLocation = () => {
- // location为false 不同判断
- getLocation(true, result => {
- if (result) {
- dispatch({
- type: action.GET_LOCATION,
- value: {...result.position.coords},
- });
- const {latitude, longitude} = result.position.coords;
- loadData(1, {latitude, longitude});
- } else {
- dispatch({type: action.GET_LOCATION, value: {}});
- }
- });
- };
-
- const onRefresh = (page = 1) => {
- const {latitude, longitude} = location;
- loadData(page, {latitude, longitude});
- };
-
const loadData = async (page = 1, params) => {
if (page === 1) {
setLoading(true);
@@ -89,14 +138,31 @@ const NearByListPost = () => {
setHeaders(res.headers);
};
+ const handleAppStateChange = nextAppState => {
+ if (nextAppState === 'active') {
+ loadLocation(dispatch);
+ }
+ };
+
+ const onRefresh = (page = 1) => {
+ const {latitude, longitude} = location;
+ loadData(page, {latitude, longitude});
+ };
+
+ useEffect(() => {
+ AppState.addEventListener('change', handleAppStateChange);
+ return () => {
+ AppState.removeEventListener('change', handleAppStateChange);
+ };
+ }, []);
+
useEffect(() => {
- if (location.latitude && location.longitude) {
- const {latitude, longitude} = location;
- loadData(1, {latitude, longitude});
+ if (openAddress) {
+ loadData(1);
}
- }, [location.latitude, location.longitude]);
+ }, [openAddress]);
- return location.latitude && location.longitude ? (
+ return openAddress ? (
{
onEndReachedThreshold={0.25}
windowSize={Platform.OS === 'ios' ? 8 : 20}
renderSeparator={() => }
- renderEmpty={
- navigation.navigate('InviteDetail')}>
-
- 附近还没有更多顽友
- 邀请小伙伴一起玩呀
-
- 分享给身边好友
-
- }
+ renderEmpty={ }
/>
) : (
-
-
- 你还没有开启【定位服务】权限
- 在【设置】中授权后将获得更多附近信息
-
-
- 开启位置访问权限
-
-
+
);
};
-const NearbyShareComponent = props => {
- const {shareNearbyStatus, dispatch, navigation} = props;
-
- const onShareClose = () => {
- dispatch({type: action.CHANGE_SHARE_NEARBY_STATUS, value: false});
- };
-
- const onShare = () => {
- navigation.navigate('InviteDetail');
- };
-
- return shareNearbyStatus ? (
-
-
-
-
- 获取更多附近信息
- 分享给身边好友,邀请小伙伴一起玩呀!
-
-
-
-
-
-
- ) : null;
-};
-
const nstyles = StyleSheet.create({
speator: {
backgroundColor: '#ebebeb',
diff --git a/src/pages/home/node-list-page.js b/src/pages/tabBar/home/node-list-page.js
similarity index 100%
rename from src/pages/home/node-list-page.js
rename to src/pages/tabBar/home/node-list-page.js
diff --git a/src/pages/home/recommend-list-post.js b/src/pages/tabBar/home/recommend-list-post.js
similarity index 93%
rename from src/pages/home/recommend-list-post.js
rename to src/pages/tabBar/home/recommend-list-post.js
index fa5f9ec3..3e8b56cf 100644
--- a/src/pages/home/recommend-list-post.js
+++ b/src/pages/tabBar/home/recommend-list-post.js
@@ -24,11 +24,11 @@ const RecommendListPost = () => {
return useMemo(() => {
switch (item.item_type) {
case 'Topic':
- return onRemove(index)} />;
+ return onRemove(index)} bottom="comment" />;
case 'Article':
return ;
case 'Theory':
- return onRemove(index)} />;
+ return onRemove(index)} bottom="comment" />;
default:
return ;
}
@@ -38,7 +38,7 @@ const RecommendListPost = () => {
const renderItemMemo = useCallback(itemProps => , [listData]);
const loadData = async (page = 1) => {
- let itemList = []
+ let itemList = [];
if (page === 1) {
// 加载置顶
setLoading(true);
@@ -65,10 +65,10 @@ const RecommendListPost = () => {
// console.log('page', page)
if (page === 1 || !page) {
// console.log('a')
- indexLoadData(pagination(headers).nextPage)
+ indexLoadData(pagination(headers).nextPage);
} else {
// console.log('b')
- loadData(page)
+ loadData(page);
}
};
@@ -81,7 +81,7 @@ const RecommendListPost = () => {
keyExtractor={useCallback(item => `${item.id}${item.item_type}`, [])}
data={listData}
loading={loading}
- onRefresh={throttle(onRefresh, 300)}
+ onRefresh={throttle(onRefresh, 0)}
headers={headers}
renderItem={renderItemMemo}
initialNumToRender={6}
diff --git a/src/pages/home/recommend.js b/src/pages/tabBar/home/recommend.js
similarity index 66%
rename from src/pages/home/recommend.js
rename to src/pages/tabBar/home/recommend.js
index 5d7a3712..78f5c58d 100644
--- a/src/pages/home/recommend.js
+++ b/src/pages/tabBar/home/recommend.js
@@ -1,43 +1,48 @@
-import React, {useState, useMemo, useEffect, useCallback} from 'react';
-import {View, Text, StyleSheet, StatusBar} from 'react-native';
+import React, {useState, useEffect, useCallback, useMemo} from 'react';
+import {View, Text, StyleSheet} from 'react-native';
import {useDispatch, useSelector} from 'react-redux';
import {useFocusEffect} from '@react-navigation/native';
+import {createConsumer} from '@rails/actioncable';
import Video from 'react-native-video';
import * as action from '@/redux/constants';
import IconFont from '@/iconfont';
import {RFValue} from '@/utils/response-fontsize';
+import deviceInfo from '@/utils/device_info';
+import {consumerWsUrl} from '@/utils/config';
import {RecommendSearch} from '@/components/NodeComponents';
import MediasPicker from '@/components/MediasPicker';
import TabView from '@/components/TabView';
import SingleList from '@/components/List/single-list';
import DoubleList from '@/components/List/double-list';
import {getChannelPosts} from '@/api/home_api';
-import {recordDeviceInfo, ahoyTrackEvents} from '@/api/settings_api';
+import {getLocationInfo, loadLocation} from '@/utils/get-location';
+import LongVideoList from '@/components/List/long-video-list';
+import FollowListPage from '@/pages/tabBar/home/follow-list-post';
+import RecommendListPage from '@/pages/tabBar/home/recommend-list-post';
+import NodeListPage from '@/pages/tabBar/home/node-list-page';
+import NearbyListPage from '@/pages/tabBar/home/nearby-list-post';
import {syncDeviceToken} from '@/api/app_device_api';
-import {getLocationInfo, loadLocation} from './getLocation';
-import deviceInfo from '@/utils/device_info';
-import {consumerWsUrl} from '@/utils/config';
-import {createConsumer} from '@rails/actioncable';
+import {recordDeviceInfo} from '@/api/settings_api';
+
import {
+ dispatchFetchUploadTopic,
+ changeUploadStatus,
dispatchFetchCategoryList,
dispatchFetchLabelList,
dispatchBaseCurrentAccount,
dispatchCurrentAccount,
- dispatchFetchUploadTopic,
- changeUploadStatus,
} from '@/redux/actions';
-import LongVideoList from '@/components/List/long-video-list';
-import FollowListPage from './follow-list-post';
-import NodeListPage from './node-list-page';
-import RecommendListPage from './recommend-list-post';
-import NearbyListPage from './nearby-list-post';
const Recommend = props => {
const dispatch = useDispatch();
const defaultKey = props.route.params && props.route.params.activityKey;
const uploadStatus = useSelector(state => state.topic.uploadStatus);
- const auth_token = useSelector(state => state.login.auth_token);
const home = useSelector(state => state.home);
+
+ const {
+ login: {auth_token},
+ } = useSelector(state => state);
+
const [currentKey, setCurrentKey] = useState(defaultKey || 'recommend');
const MemoVideo = React.memo(() => {
@@ -52,56 +57,6 @@ const Recommend = props => {
);
});
- const onlineChannel = useMemo(() => {
- // const url = `wss://xinxue.meirixinxue.com//cable?auth_token=${auth_token}`;
- return createConsumer(consumerWsUrl(auth_token)).subscriptions.create(
- {channel: 'OnlineChannel'},
- {
- // received(data) {},
- initialized() {
- // console.log('initialized');
- },
- connected() {
- // console.log('connected');
- },
- disconnected() {
- // console.log('disconnected');
- },
- rejected() {
- console.log('rejected');
- },
- unsubscribe() {
- // console.log('unsubscribe');
- },
- appear() {
- // console.log('appear')
- // this.perform('appear', {});
- },
- }
- );
- }, []);
-
- // 同步用户是否在线
- const appearOnline = () => {
- setInterval(() => {
- // console.log('appear');
- onlineChannel.perform('appear');
- }, 5000);
- };
-
- const onTouchStart = event => {
- // console.log('event', event['_targetInst'])
- // const memprops = event?._targetInst?.memoizedProps;
- // if (memprops && memprops?.visit_key) {
- // const visit_key = memprops?.visit_key;
- // const visit_value = memprops?.visit_value;
- // ahoyTrackEvents({
- // name: visit_key,
- // properties: {...visit_value, page: 'recommend'},
- // page: 'recommend',
- // });
- // }
- };
const CallBackVideo = useCallback(() => , []);
const UploadTopic = () => {
@@ -127,7 +82,6 @@ const Recommend = props => {
);
};
- // console.log(home.channels);
const channels = home.channels.map(item => {
const params = {channel_id: item.id, channel_name: item.name};
return {
@@ -172,12 +126,6 @@ const Recommend = props => {
});
const onChange = async (key, title) => {
- ahoyTrackEvents({
- name: `click_${key}`,
- properties: {title: title, page: 'recommend'},
- page: 'recommend',
- });
-
const {location} = home;
if (key === 'nearby' && (!location.latitude || !location.longitude)) {
getLocationInfo(false, result => {
@@ -191,73 +139,78 @@ const Recommend = props => {
}
};
- useFocusEffect(
- useCallback(() => {
- dispatch(dispatchBaseCurrentAccount());
- }, [])
- );
+ const onlineChannel = useMemo(() => {
+ return createConsumer(consumerWsUrl(auth_token)).subscriptions.create({
+ channel: 'OnlineChannel',
+ });
+ }, []);
- useEffect(() => {
+ const init = () => {
syncDeviceToken();
recordDeviceInfo(deviceInfo);
- appearOnline(); // 是否在线
dispatch(dispatchCurrentAccount());
dispatch(dispatchFetchCategoryList());
dispatch(dispatchFetchLabelList());
+ // 同步用户是否在线
+ setInterval(() => {
+ onlineChannel.perform('appear');
+ }, 5000);
+ };
+
+ useEffect(() => {
+ init();
if (uploadStatus) {
const upload = (file, cb) => props.uploadVideo(file, cb);
dispatch(changeUploadStatus({...uploadStatus, status: 'upload', progress: 0, upload}));
dispatch(dispatchFetchUploadTopic({...uploadStatus, upload}));
}
+
setTimeout(() => {
- // 如果在这里请求的话,必须要等待1s之后才可以
loadLocation(dispatch);
}, 1000);
}, []);
+ useFocusEffect(
+ useCallback(() => {
+ dispatch(dispatchBaseCurrentAccount());
+ }, [])
+ );
+
return (
- <>
-
-
-
- {uploadStatus ? (
-
-
-
-
- ) : null}
- {channels.length > 0 && (
-
-
-
- )}
-
- >
+
+
+ {uploadStatus ? (
+
+
+
+
+ ) : null}
+ {channels.length > 0 && (
+
+
+
+ )}
+
);
};
diff --git a/src/pages/tabBar/style.js b/src/pages/tabBar/style.js
new file mode 100644
index 00000000..efd1cd84
--- /dev/null
+++ b/src/pages/tabBar/style.js
@@ -0,0 +1,35 @@
+import {StyleSheet} from 'react-native';
+import {BarHeight, IsIos} from '@/utils/navbar';
+import {RFValue} from '@/utils/response-fontsize';
+
+export const TopHeight = RFValue(5);
+export const BoothHeight = IsIos ? BarHeight + TopHeight : TopHeight;
+
+const positionStyle = {
+ height: RFValue(33),
+ position: 'absolute',
+ top: IsIos ? BarHeight + TopHeight : TopHeight,
+ zIndex: 99,
+ flexDirection: 'row',
+ alignItems: 'center',
+};
+
+export const Cstyles = StyleSheet.create({
+ wrapper: {
+ flex: 1,
+ backgroundColor: '#fafafa',
+ },
+ avatorWrap: {
+ ...positionStyle,
+ left: 14,
+ },
+ createWrap: {
+ ...positionStyle,
+ right: 14,
+ },
+ createText: {
+ fontSize: 14,
+ color: '#2C2C2C',
+ marginLeft: 5,
+ },
+});
diff --git a/src/pages/theories/component/theory-media-picker.js b/src/pages/theories/component/theory-media-picker.js
index 6d0b3c9e..979e3f0e 100644
--- a/src/pages/theories/component/theory-media-picker.js
+++ b/src/pages/theories/component/theory-media-picker.js
@@ -20,7 +20,7 @@ const StepMediaPicker = WrapperComponent => {
const uploadImage = async (file, params, cb) => {
const token = await Helper.getData('auth_token');
- console.log('file', file)
+ console.log('file', file);
const options = {
...config,
url: `${baseUrl}/api/v1/assets`,
@@ -35,7 +35,7 @@ const StepMediaPicker = WrapperComponent => {
headers: {'content-type': 'application/octet-stream', token: token},
};
- console.log('options', options)
+ console.log('options', options);
return new Promise(async (resolve, reject) => {
Upload.startUpload(options)
.then(uploadId => {
@@ -50,7 +50,7 @@ const StepMediaPicker = WrapperComponent => {
});
})
.catch(err => {
- console.log('erro', err)
+ console.log('erro', err);
reject(err);
});
});
diff --git a/src/pages/topics/new-topic.js b/src/pages/topics/new-topic.js
index 69f22582..da9ca628 100644
--- a/src/pages/topics/new-topic.js
+++ b/src/pages/topics/new-topic.js
@@ -19,7 +19,7 @@ import Toast from '@/components/Toast';
import GetLocation from '@/components/GetLocation';
import FastImg from '@/components/FastImg';
import {getLocation} from '@/api/space_api';
-import {loadLocation} from '@/pages/home/getLocation';
+import {loadLocation} from '@/utils/get-location';
const {width: windowWidth} = Dimensions.get('window');
const mediaSize = (windowWidth - 60 - 30) / 4; //图片尺寸
@@ -474,7 +474,7 @@ const NewTopic = props => {
value={content}
selectionColor={'#ff193a'}
/>
-
+
navigation.navigate('AddHashTag')}
diff --git a/src/plugins/react-native-easy-chat-ui/app/chat/ChatItem.js b/src/plugins/react-native-easy-chat-ui/app/chat/ChatItem.js
index eb69cca1..bf6154f4 100644
--- a/src/plugins/react-native-easy-chat-ui/app/chat/ChatItem.js
+++ b/src/plugins/react-native-easy-chat-ui/app/chat/ChatItem.js
@@ -477,7 +477,6 @@ const styles = StyleSheet.create({
check: {
width: 20,
height: 20,
- backgroundColor: 'green',
borderRadius: 10,
marginTop: 14,
justifyContent: 'center',
diff --git a/src/redux/constants/index.js b/src/redux/constants/index.js
index e0a78095..74b1f8e0 100644
--- a/src/redux/constants/index.js
+++ b/src/redux/constants/index.js
@@ -26,7 +26,7 @@ export const UPDATE_SOCIAL_ACCOUNT = 'UPDATE_SOCIAL_ACCOUNT';
// 公共数据
export const UPDATE_TOTAL_LABEL_LIST = 'UPDATE_TOTAL_LABEL_LIST'; //标签数据
-export const TOTAL_LABEL_LIST = 'TOTAL_LABEL_LIST'
+export const TOTAL_LABEL_LIST = 'TOTAL_LABEL_LIST';
// 用户的基本信息
export const ACCOUNT_DETAIL_REQUEST = 'ACCOUNT_DETAIL_REQUEST';
@@ -187,6 +187,7 @@ export const LEARNING_RECORDS_SUCCESS = 'LEARNING_RECORDS_SUCCESS';
// common
export const SAVE_COMMENT_CONTENT = 'SAVE_COMMENT_CONTENT'; // 评论内容
+export const CHANGE_COMMENT_VISIBLE = 'CHANGE_COMMENT_VISIBLE'; // 全局评论框
// new topic
export const SAVE_NEW_TOPIC = 'SAVE_NEW_TOPIC';
diff --git a/src/redux/reducers/home_reducer.js b/src/redux/reducers/home_reducer.js
index cf8d777d..5345c266 100644
--- a/src/redux/reducers/home_reducer.js
+++ b/src/redux/reducers/home_reducer.js
@@ -14,7 +14,8 @@ const defaultState = {
item_id: '',
item_type: '',
},
- commentContent: {content: ''},
+ commentVisible: false,
+ commentContent: {},
location: {chooseCity: ''},
categoryList: [],
shareStatus: true,
@@ -47,6 +48,8 @@ export const homeReducer = (state = defaultState, action) => {
...state,
shareContent: action.shareContent,
};
+ case constants.CHANGE_COMMENT_VISIBLE:
+ return {...state, commentVisible: action.value};
case constants.SAVE_COMMENT_CONTENT:
return {
...state,
diff --git a/src/redux/reducers/theory_reducer.js b/src/redux/reducers/theory_reducer.js
index b335b6b0..077cee41 100644
--- a/src/redux/reducers/theory_reducer.js
+++ b/src/redux/reducers/theory_reducer.js
@@ -1,5 +1,4 @@
import * as constants from '../constants';
-import {THEORY_VIDEO_LIST, THEORY_VIDEO_STATE} from '../constants';
const defaultVideoList = {
video_1: true,
@@ -9,12 +8,12 @@ const defaultVideoList = {
video_5: true,
video_6: true,
video_7: true,
-}
+};
const defaultState = {
theory: {},
theoryDetail: null,
- videoList: defaultVideoList
+ videoList: defaultVideoList,
};
function theoryReducer(state = defaultState, action) {
@@ -30,12 +29,10 @@ function theoryReducer(state = defaultState, action) {
theoryDetail: action.value,
});
case constants.THEORY_VIDEO_STATE:
- // console.log('action', action)
- const newVideoState = {...defaultVideoList, [action.videoId]: action.pause}
- // console.log('action2', newVideoState)
+ const newVideoState = {...defaultVideoList, [action.videoId]: action.pause};
return (state = {
...state,
- videoList: newVideoState
+ videoList: newVideoState,
});
default:
return state;
diff --git a/src/styles/baseCommon.js b/src/styles/baseCommon.js
index 6b169024..fec1b36e 100644
--- a/src/styles/baseCommon.js
+++ b/src/styles/baseCommon.js
@@ -70,7 +70,6 @@ export const ListEmpty = {
alignItems: 'center',
},
emptyTextWrap: {
- flexDirection: 'column',
marginTop: RFValue(110),
},
emptyText: {
@@ -84,11 +83,12 @@ export const ListEmpty = {
height: RFValue(45),
lineHeight: RFValue(45),
backgroundColor: '#000',
- borderRadius: 6,
+ // borderRadius: 6,
overflow: 'hidden',
marginTop: RFValue(20),
color: '#fff',
textAlign: 'center',
+ borderRadius: 24,
},
};
diff --git a/src/utils/codepush.js b/src/utils/codepush.js
index fbfbeccd..066e6097 100644
--- a/src/utils/codepush.js
+++ b/src/utils/codepush.js
@@ -1,4 +1,4 @@
-import Toast from "@/components/Toast";
+import Toast from '@/components/Toast';
export default CodePush => {
CodePush.sync(
@@ -26,20 +26,19 @@ export default CodePush => {
},
},
status => {
- console.log('status', status)
switch (status) {
case CodePush.SyncStatus.CHECKING_FOR_UPDATE: // 检查更新
- Toast.showError('正在检测更新...')
+ Toast.showError('正在检测更新...');
break;
case CodePush.SyncStatus.DOWNLOADING_PACKAGE: // 正在下载
break;
case CodePush.SyncStatus.AWAITING_USER_ACTION: // 等待用户操作
break;
case CodePush.SyncStatus.INSTALLING_UPDATE: // 下载更新
- Toast.showError('下载更新')
+ Toast.showError('下载更新');
break;
case CodePush.SyncStatus.UP_TO_DATE: // 已更新
- Toast.showError('已更新为最新版本')
+ Toast.showError('已更新为最新版本');
break;
case CodePush.SyncStatus.UPDATE_IGNORED: // 忽略更新
break;
@@ -48,7 +47,7 @@ export default CodePush => {
case CodePush.SyncStatus.UNKNOWN_ERROR: // 未知错误
break;
default:
- console.log('status111', status)
+ break;
}
},
({receivedBytes, totalBytes}) => {
@@ -56,6 +55,6 @@ export default CodePush => {
if (receivedBytes >= totalBytes) {
CodePush.allowRestart(); // 强制更新
}
- },
+ }
);
};
diff --git a/src/utils/config.js b/src/utils/config.js
index 9557ef94..8e05f536 100644
--- a/src/utils/config.js
+++ b/src/utils/config.js
@@ -6,10 +6,14 @@ export const BaseProApi = 'https://meirixinxue.com/'; //'https://meirixinxue.com
// export const BaseDevApi = 'http://tl-test.ce04.com/';
export const BaseDevApi = 'https://meirixinxue.com/';
+
+
+
+
export const BaseApiUrl = __DEV__ ? BaseDevApi : BaseProApi;
//标识当前版本
-export const WANYA_VERSION = '0.0.25';
+export const WANYA_VERSION = '0.0.27';
// sentry 错误收集
export const BaseDevSentryURL = 'https://4a1adfee8b7e49dc91f3a0de7dfcde82@sentry.meirixinxue.com/5';
const BaseProSentryIOSURL = 'https://51fe408bc69c413989f6c84304eb13db@sentry.meirixinxue.com/6';
@@ -17,6 +21,10 @@ const BaseProSentryAndroidURL = 'http://a15165bfa1514bcfbfc94e2ad5b9b956@sentry.
const BaseProSentryURL = Platform.OS === 'ios' ? BaseProSentryIOSURL : BaseProSentryAndroidURL;
export const BaseSentryURL = __DEV__ ? BaseDevSentryURL : BaseProSentryURL;
+// 统计的key
+const BASE_DEV_POSTHOG_KEY = 'phc_7oa7WciZKsaihLOfxD9TfxUnp3naK6E3YOkp277Ogx4';
+const BASE_PRO_POSTHOG_KEY = 'phc_7oa7WciZKsaihLOfxD9TfxUnp3naK6E3YOkp277Ogx4';
+export const BasePosthogKey = __DEV__ ? BASE_DEV_POSTHOG_KEY : BASE_PRO_POSTHOG_KEY;
// 高德定位的key
export const IOS_LOCATION_KEY = '6da6626cf6588fb6e3052deff1e8d4e9';
export const ANDROID_LOCATION_KEY = '648f6e4ce8f5b83b30e2eabcac060eee';
@@ -24,6 +32,5 @@ export const ANDROID_LOCATION_KEY = '648f6e4ce8f5b83b30e2eabcac060eee';
export const consumerWsUrl = auth_token => {
const wsURL = BaseApiUrl.replace('https://', 'wss://');
const wssUrl = `${wsURL}/cable?auth_token=${auth_token}`;
- // console.log('wssUrl', wssUrl);
return wssUrl;
};
diff --git a/src/utils/device_info.js b/src/utils/device_info.js
index 31c25c44..7f8c545f 100644
--- a/src/utils/device_info.js
+++ b/src/utils/device_info.js
@@ -1,12 +1,26 @@
import {WANYA_VERSION} from '@/utils/config';
import DeviceInfo from 'react-native-device-info';
+
const deviceId = DeviceInfo.getSystemVersion();
const systemName = DeviceInfo.getSystemName();
+export const getDeviceInfo = async () => {
+ const user_agent = await DeviceInfo.getUserAgent();
+
+ return {
+ deviceId: deviceId,
+ systemName: systemName,
+ Version: WANYA_VERSION,
+ system_name: systemName,
+ device_id: deviceId,
+ user_agent: user_agent,
+ };
+};
+
export default {
deviceInfo: {
deviceId: deviceId,
systemName: systemName,
Version: WANYA_VERSION,
},
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/src/pages/home/getLocation.js b/src/utils/get-location.js
similarity index 74%
rename from src/pages/home/getLocation.js
rename to src/utils/get-location.js
index bd7716da..22a84a37 100644
--- a/src/pages/home/getLocation.js
+++ b/src/utils/get-location.js
@@ -6,30 +6,48 @@ import {Geolocation as GeolocationAndroid1} from 'react-native-amap-geolocation'
import {getLocation} from '@/api/space_api';
import {createLocations} from '@/api/location_api';
-const iosLocationPermission =
+// 圈子获取权限
+// 社区 本地tab
+
+const Permission =
Platform.OS === 'ios'
? PERMISSIONS.IOS.LOCATION_WHEN_IN_USE
: PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION;
-export const getLocationInfo = async (open, handleClick) => {
+export const checkPermission = async () => {
+ const result = await check(Permission);
+ switch (result) {
+ case RESULTS.UNAVAILABLE:
+ console.log('This feature is not available (on this device / in this context)');
+ return false;
+ case RESULTS.DENIED:
+ return false;
+ case RESULTS.GRANTED:
+ //拥有此权限
+ console.log('The permission is granted');
+ return true;
+ case RESULTS.BLOCKED:
+ console.log('The permission is denied and not requestable anymore');
+ return false;
+ }
+};
+
+export const getLocationInfo = async handleClick => {
const answer = await checkPermission();
if (answer === 'WAIT') {
console.log('等待授权中');
}
- if (!answer) {
+ if (answer === false) {
console.log('没权限');
- if (open) {
- await openSettings();
- } else {
- handleClick(false);
- }
+ await openSettings();
}
if (Platform.OS === 'ios') {
Geolocation.getCurrentPosition(
position => {
+ console.log('position', position);
handleClick && handleClick({position});
},
error => {
@@ -39,55 +57,33 @@ export const getLocationInfo = async (open, handleClick) => {
{enableHighAccuracy: false, timeout: 3000, maximumAge: 10000, distanceFilter: 100}
);
} else {
- const re = await PermissionsAndroid.requestMultiple([
+ const ret = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
]);
- if (re['"android.permission.ACCESS_FINE_LOCATION"'] === 'never_ask_again') {
+ if (ret['"android.permission.ACCESS_FINE_LOCATION"'] === 'never_ask_again') {
return false;
}
GeolocationAndroid1.getCurrentPosition(position => {
- // console.log('position => ', position);
handleClick({position: position});
});
}
};
-const checkPermission = async () => {
- const result = await check(iosLocationPermission);
- let Permission = false;
- switch (result) {
- case RESULTS.UNAVAILABLE:
- console.log('This feature is not available (on this device / in this context)');
- return false;
- case RESULTS.DENIED:
- return false;
- case RESULTS.GRANTED:
- //拥有此权限
- console.log('The permission is granted');
- return true;
- case RESULTS.BLOCKED:
- console.log('The permission is denied and not requestable anymore');
- return false;
- }
- return Permission;
-};
-
export const loadLocation = dispatch => {
- getLocationInfo(false, async result => {
+ getLocationInfo(async result => {
if (result) {
const {latitude, longitude} = result.position.coords;
const res = await getLocation({latitude, longitude});
- const {city} = res.data;
- const ret = await createLocations({location: {name: city}});
+ const ret = await createLocations({location: {name: res.data.city}});
dispatch({
type: action.GET_LOCATION,
value: {
...result.position.coords,
- positionCity: city,
- chooseCity: city,
+ positionCity: res.data.city,
+ chooseCity: res.data.city,
createLocation: ret.data.location,
},
});
diff --git a/src/utils/helper.js b/src/utils/helper.js
index e4d1f802..067711c7 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -2,6 +2,7 @@ import AsyncStorage from '@react-native-community/async-storage';
import Clipboard from '@react-native-community/clipboard';
import dayjs from 'dayjs';
+import {agentTrackEvents} from '@/api/settings_api';
export default class Helper {
static async setData(name, value) {
@@ -15,9 +16,7 @@ export default class Helper {
static async getData(name) {
try {
let value = await AsyncStorage.getItem(name);
- // console.log('store preve value', value)
value = value === null || value === undefined ? '' : value;
- // console.log('store value', value)
return value;
} catch (e) {
return '';
@@ -40,6 +39,15 @@ export default class Helper {
return keys;
}
+ static async recordVisit(data) {
+ try {
+ await agentTrackEvents(data);
+ } catch (e) {
+ console.log('AgentTrackEvents error', e);
+ }
+ return 'ok'
+ }
+
static async multiSet(data = []) {
await AsyncStorage.multiSet(data);
}
@@ -73,7 +81,6 @@ export default class Helper {
}
static fromToNow(time) {
- console.log('time', time);
return dayjs(time).locale('zh-cn').format();
}
diff --git a/src/utils/index.js b/src/utils/index.js
index 2bc1890e..82fb42f9 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -11,3 +11,7 @@ export const TransFormType = item => {
return '';
}
};
+
+export const ScaleDistance = (distance = '') => {
+ return distance ? (distance > 1000 ? `${(distance / 1000).toFixed(1)}km` : `${distance}m`) : '';
+};
diff --git a/src/utils/load_more.js b/src/utils/load_more.js
deleted file mode 100644
index 4ee724e0..00000000
--- a/src/utils/load_more.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// import Taro from "@tarojs/taro/types/index"
-
-export function pagination (headers = {}){
- // console.log('xxxxxxx', headers)
- const currentPage = parseInt(headers['x-current-page']);
- const perPage = parseInt(headers['x-per-page'] || headers['X-Page-Items']);
- const total = parseInt(headers['x-total']);
- const hasMore = currentPage * perPage < total;
- const nextPage = hasMore ? currentPage + 1 : currentPage;
- return { hasMore: hasMore, nextPage: nextPage, page: currentPage, total: total}
-}