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} +// +// +// +// +//