index.tsx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import { View, Text } from "@tarojs/components";
  2. import { Plus, User } from "@nutui/icons-react-taro";
  3. import { getStorageSync, navigateTo } from "@tarojs/taro";
  4. import PostList from "../../components/post-list";
  5. import "./index.scss";
  6. import { Image } from "@nutui/nutui-react-taro";
  7. import { useEffect, useState } from "react";
  8. import { getCircleInfoApi } from "../../api/circle";
  9. import config from "../../config";
  10. function Index() {
  11. const [circleData, setCircleData] = useState<any>(null);
  12. const [userInfo, setUserInfo] = useState<any>(null);
  13. const getUserInfo = () => {
  14. const userInfo = getStorageSync("User");
  15. setUserInfo(userInfo);
  16. };
  17. useEffect(() => {
  18. getCircleInfoApi({ id: 1 }).then((res: any) => {
  19. setCircleData(res.data);
  20. });
  21. getUserInfo();
  22. }, []);
  23. return (
  24. <View className="index">
  25. <View
  26. className="index-header fixed top-0 left-0 right-0 z-20 h-[60px] w-full flex items-center justify-between px-[10px]"
  27. style={{ backgroundImage: `url(${circleData?.icon_url})` }}
  28. >
  29. <View className="flex items-center relative z-40">
  30. <View className="w-[50px] h-[50px] bg-[#fff] rounded-[10px] overflow-hidden">
  31. <Image
  32. src={circleData?.icon_url}
  33. width="100%"
  34. height="100%"
  35. mode="aspectFill"
  36. />
  37. </View>
  38. <Text className="text-[16px] font-[800] text-[#fff] ml-[10px]">
  39. {circleData?.name}
  40. </Text>
  41. </View>
  42. {/* <View
  43. className="flex items-center relative z-40"
  44. onClick={() => {
  45. navigateTo({ url: "/pages/self/index" });
  46. }}
  47. >
  48. <User size={24} />
  49. </View> */}
  50. </View>
  51. <View className="index-content absolute top-[60px] left-0 right-0 bottom-0 z-20 rounded-[30px] overflow-hidden">
  52. <View className="h-25 p-[10px] flex ">
  53. {userInfo?.is_vip ? (
  54. <>
  55. <View
  56. className="w-[22%] pt-[10px] mr-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]"
  57. onClick={() => {
  58. // window.location.href = `${config.TARO_ACT_HOST}/jifen/exchange?vip_code=${userInfo?.vip_code}`;
  59. navigateTo({ url: "/pages/act/index" });
  60. }}
  61. >
  62. <View className="text-[14px] font-[800] text-[#333]">
  63. 福利中心
  64. </View>
  65. <View className="text-[12px] text-[#949494]">登录领奖</View>
  66. </View>
  67. </>
  68. ) : (
  69. <></>
  70. )}
  71. {/* <View className="w-[22%] pt-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]">
  72. <View className="text-[14px] font-[800] text-[#333]">游戏攻略</View>
  73. <View className="text-[12px] text-[#949494]">最新资讯</View>
  74. </View>
  75. <View className="w-[22%] pt-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]">
  76. <View className="text-[14px] font-[800] text-[#333]">组队开黑</View>
  77. <View className="text-[12px] text-[#949494]">寻找队友</View>
  78. </View> */}
  79. <View
  80. className="w-[22%] pt-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]"
  81. onClick={() => {
  82. navigateTo({ url: "/pages/self/index" });
  83. }}
  84. >
  85. <View className="text-[14px] font-[800] text-[#333]">个人中心</View>
  86. <View className="text-[12px] text-[#949494]">我的信息</View>
  87. </View>
  88. </View>
  89. <PostList />
  90. {/* <TabbarCom /> */}
  91. <View
  92. className="fixed bottom-[50px] right-[20px] w-[50px] h-[50px] bg-[#6069d9] rounded-[50%] z-10 justify-center items-center flex "
  93. onClick={() => {
  94. navigateTo({ url: "/pages/publish/index" });
  95. }}
  96. >
  97. <Plus color="#fff" size={50} style={{ marginLeft: "-2px" }} />
  98. </View>
  99. </View>
  100. </View>
  101. );
  102. }
  103. export default Index;