Ver código fonte

리스트 조회 추가 / 폰트 어썸 5 추가 (이미있는 데 react-native-elements 에서 지원 하지 않아 C.Icon5 로 따로 등록함. )

자유해결사 5 anos atrás
pai
commit
b6411a3f4d
7 arquivos alterados com 75 adições e 39 exclusões
  1. 2 0
      App.js
  2. 8 8
      src/data/dummy.js
  3. 7 5
      src/pages/_1_Login.js
  4. 2 0
      src/pages/_2_AcceptTerms.js
  5. 3 3
      src/pages/_5_Root.js
  6. 39 13
      src/pages/_7_List.js
  7. 14 10
      src/provider/Net.js

+ 2 - 0
App.js

@@ -33,6 +33,7 @@ import {SafeAreaView} from 'react-navigation'
 import H from './src/components/Header' 
 import SwitchNavigator from './src/navigation/SwitchNavigator'
 import C from 'rn-class'
+import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
 
 
 C.addComp(RN);
@@ -40,6 +41,7 @@ C.addComp(EL, "EL", null);
 C.addComp({Header : H}, "Comp" );
 C.addComp({SafeAreaView:SafeAreaView}, "Comp");  
 C.addComp(RN.Picker.Item, "PickerItem")
+C.addComp(FontAwesome5, "Icon5")
 
 const App = () => {
  

+ 8 - 8
src/data/dummy.js

@@ -2,17 +2,17 @@ export {BTNS, BTNS_ORG};
 
 const BTNS_ORG = [
   [
-      {title: "行" ,subtitle : "working \nmeditation" , contensTitle : "행선" , contensSubTitle : "" , contens:"하루 20분 정도 걸으면서 하는 행선은 좌선 1시간 이상의 효과를 가져옵니다.", img : require("../res/Working_meditation.png")},
-      {title: "住" ,subtitle : "standing \nmeditation", contensTitle : "주선" , contensSubTitle : "" , contens:"일상생활 속에 잠시 머무름은 인생에서 쉬어가는 의미를 가집니다. 바쁜 일상 속에서 잠시 머무름을 가지고 짧게 마음의 고요함을 찾으시길 바랍니다.", img : require("../res/Standing_meditation.png")},
-      {title: "坐" ,subtitle : "seat and \nmeditation", contensTitle : "좌선" , contensSubTitle : "" , contens:"가부좌가 아니더라도 일상생활 속에서 편한 자세로 앉아서 정신을 집중하여 무념무상의 상태로 들어가는 선수행을 말합니다.", img : require("../res/Seatand_meditation.png")},
-      {title: "卧" ,subtitle : "Lying \nmeditation"   , contensTitle : "와선" , contensSubTitle : "" , contens:"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", img : require("../res/Lying_meditation.png")},
+      {title: "行" ,subtitle : "working \nmeditation" ,  type: "body" , section : "work", contensTitle : "행선" , contensSubTitle : "" , contens:"하루 20분 정도 걸으면서 하는 행선은 좌선 1시간 이상의 효과를 가져옵니다.", img : require("../res/Working_meditation.png")},
+      {title: "住" ,subtitle : "standing \nmeditation",  type: "body" , section : "stand", contensTitle : "주선" , contensSubTitle : "" , contens:"일상생활 속에 잠시 머무름은 인생에서 쉬어가는 의미를 가집니다. 바쁜 일상 속에서 잠시 머무름을 가지고 짧게 마음의 고요함을 찾으시길 바랍니다.", img : require("../res/Standing_meditation.png")},
+      {title: "坐" ,subtitle : "seat and \nmeditation",  type: "body" , section : "seat", contensTitle : "좌선" , contensSubTitle : "" , contens:"가부좌가 아니더라도 일상생활 속에서 편한 자세로 앉아서 정신을 집중하여 무념무상의 상태로 들어가는 선수행을 말합니다.", img : require("../res/Seatand_meditation.png")},
+      {title: "卧" ,subtitle : "Lying \nmeditation"       ,  type: "body" , section : "lying", contensTitle : "와선" , contensSubTitle : "" , contens:"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", img : require("../res/Lying_meditation.png")},
       {title: "身" ,subtitle : "body"                 },  
   ],
   [
-      {title:"사랑", subtitle : "Love",     contensTitle : "사랑" , contensSubTitle : "(애별리고)" , contens:"우리는 우리와 가까운, 우리가 원하는, 우리가 좋아하는, 우리를 편리하게 해 주고 행복하게 해 주던 많은 것들과 이별을 해야 하는 괴로움을 버려야 합니다.", img : require("../res/Working_meditation.png")},
-      {title:"미움", subtitle : "Hate",     contensTitle : "미움" , contensSubTitle : "(원증회고)" , contens:"싫어하는 것을 해야 하는 것, 싫어하는 사람과 함께 있는 것이란 얼마나 큰 괴로움인가. 이는 가장 큰 괴로움이며 여기서 벗어나야 합니다.", img : require("../res/Standing_meditation.png")},
-      {title:"탐욕", subtitle : "Avarice",  contensTitle : "탐욕" , contensSubTitle : "(구부득고)" , contens:"좋아하는 사람, 물건, 재산, 명예, 권력, 지위, 출세, 행복, 건강 등 얻고자 하고 바라지만 마음대로 구할 수 없는데서 괴로움은 시작된다.", img : require("../res/Seatand_meditation.png")},
-      {title:"탐식", subtitle : "Voracity", contensTitle : "탐식" , contensSubTitle : "(구부득고)" , contens:"현대사회에서 물질적 풍요와 상반되게 정신적 빈곤으로 인한 강박장애, 불안장애 같은 정신적 증상은 얻고자 하는 욕심으로 인하여 나타나는 화병의 일환", img : require("../res/Lying_meditation.png")},
+      {title:"사랑", subtitle : "Love"                                  , type: "mind" , section : "work",     contensTitle : "사랑" , contensSubTitle : "(애별리고)" , contens:"우리는 우리와 가까운, 우리가 원하는, 우리가 좋아하는, 우리를 편리하게 해 주고 행복하게 해 주던 많은 것들과 이별을 해야 하는 괴로움을 버려야 합니다.", img : require("../res/Working_meditation.png")},
+      {title:"미움", subtitle : "Hate"                                  , type: "mind" , section : "stand",contensTitle : "미움" , contensSubTitle : "(원증회고)" , contens:"싫어하는 것을 해야 하는 것, 싫어하는 사람과 함께 있는 것이란 얼마나 큰 괴로움인가. 이는 가장 큰 괴로움이며 여기서 벗어나야 합니다.", img : require("../res/Standing_meditation.png")},
+      {title:"탐욕", subtitle : "Avarice"                             , type: "mind" , section : "seat",  contensTitle : "탐욕" , contensSubTitle : "(구부득고)" , contens:"좋아하는 사람, 물건, 재산, 명예, 권력, 지위, 출세, 행복, 건강 등 얻고자 하고 바라지만 마음대로 구할 수 없는데서 괴로움은 시작된다.", img : require("../res/Seatand_meditation.png")},
+      {title:"탐식", subtitle : "Voracity"                           , type: "mind" , section : "lying", contensTitle : "탐식" , contensSubTitle : "(구부득고)" , contens:"현대사회에서 물질적 풍요와 상반되게 정신적 빈곤으로 인한 강박장애, 불안장애 같은 정신적 증상은 얻고자 하는 욕심으로 인하여 나타나는 화병의 일환", img : require("../res/Lying_meditation.png")},
       {title: "心" , subtitle : "Mind"},  
   ]
 ]

+ 7 - 5
src/pages/_1_Login.js

@@ -4,6 +4,7 @@ import Auth ,{LM} from '../provider/Auth'
 
 import C from 'rn-class'
 import Net from '../provider/Net'
+import AsyncStorage from '@react-native-community/async-storage';
 
  
 C.addColor("#03cf5d", "color-naver");
@@ -16,13 +17,14 @@ export default (props)=>{
         // LM.logout();   
     }, [])
     let onlogin = async (loginInfo, bfirst )=>{
-        console.log(loginInfo)
+        // console.log(loginInfo)
         Net.login(loginInfo) 
-        Net.meditation() 
-        if(bfirst){
-        //   props.navigation.navigate('AcceptTerms');
+        let bTerms = JSON.parse(await AsyncStorage.getItem("@terms"))
+
+        if(bfirst || !bTerms){   
+          props.navigation.navigate('AcceptTerms');
         }else{   
-        //   props.navigation.navigate('Root'); 
+          props.navigation.navigate('Root'); 
         } 
     }
     return (

+ 2 - 0
src/pages/_2_AcceptTerms.js

@@ -29,11 +29,13 @@ export default (props)=>{
         setAccptArr(_.map(accptArr)) 
     }
     const agreeAgree = () => {
+        AsyncStorage.setItem("@terms" , "true");
         props.navigation.navigate('Guide1');
     }
     const agreeNoagree = async () => {
         await LM.logout(); 
         Alert.alert("모든 약관에 동의 하셔야 이용이 가능합니다.");
+        AsyncStorage.removeItem("@terms" );
         props.navigation.navigate('Login'); 
     }
 

+ 3 - 3
src/pages/_5_Root.js

@@ -8,13 +8,13 @@ import Player from "../components/Player";
 //import Player from "./PlayerGesture"; 
 import { PlayerConextProvider } from '../components/PlayerReducer'
 C.addColor("#d7d7d7", "color-listbg");
-import {BTNS} from '../data/dummy';
+import {BTNS_ORG as BTNS} from '../data/dummy';
 
 const tabPosition = {x:0, y:0, w:0, h:0};
 
 export default (props)=>{
-    const [ sel_idx, setsel_Idx ] =  useState(0);
-    const [ targetIdx, setTargetIdx ] =  useState(0);
+    const [ sel_idx, setsel_Idx ] =  useState(-1);
+    const [ targetIdx, setTargetIdx ] =  useState(-1);
     
     const [ bPlay, setbPlay] =  useState(false); 
     const [ curPlayInfo, setCurPlayInfo] =  useState({});

+ 39 - 13
src/pages/_7_List.js

@@ -1,11 +1,13 @@
-import React from 'react';
+import React , {useEffect, useState} from 'react';
 
 import C from 'rn-class'
+import Net from '../provider/Net';
 
 C.addColor("#d7d7d7", "color-listbg");
 
 
 export default (props)=>{ 
+    let [list, setList ] = useState([]);
     let onClickPlay = (p)=>{ 
         // props.navigation.push('Player');
         const tmp = props;
@@ -13,6 +15,19 @@ export default (props)=>{
         tmp.Pages.playerData.contents = tmp.Pages.playerData.contents + tmp.Pages.contens;
         props.startPlay(tmp);
     }
+
+    let getData = async (p)=>{
+        let {Pages : {type  :type } , Pages : {section  :section }    } = p ;
+        let {result} = await Net.meditation({size : 20, page	: 1 ,section : section , type : type});
+        console.log(" >>>: " , result )  
+        setList(result);
+        // console.log({size : 20, page	: 1 ,section : section , type : type});
+    }   
+    
+    useEffect((a)=>{
+        getData(props) 
+    }, [props.Pages]);
+
     return (
         <C.View cls="flx1 bgc-color-white"> 
             <C.View cls="w100% ai-c flx1">     
@@ -35,11 +50,11 @@ export default (props)=>{
                         <Imgs onClickPlay={onClickPlay} ></Imgs>
                         <Imgs onClickPlay={onClickPlay} ></Imgs>
                         <Imgs onClickPlay={onClickPlay} ></Imgs> */}
-                        {
-                            props.Pages.children.map((v,i) => {
-                                return (<Imgs key={`i${v.title}`} soundDuration={v.soundDuration} onClickPlay={()=>{
+                        {  
+                            list.map((v,i) => {
+                                return (<Imgs key={`i${v.title}`}  {...v} soundDuration={v.soundDuration} onClickPlay={()=>{
                                     onClickPlay(v)
-                                }} />);
+                                }} />); 
                             })
                         }
                  </C.View>
@@ -59,24 +74,35 @@ export default (props)=>{
 
 
 const Imgs = (props)=>{
+    console.log(props);
     return (
-        <C.View cls="w45">
+        <C.View cls="w45 br3">
                 <C.ImageBackground 
-                    source={{uri : `https://picsum.photos/630/300?r=${(new Date).getTime()+Math.random()}` }}
-                    cls="h20 mh2 mt2"  
+                    source={{uri : `http://133.186.211.179/api/v3/meditation/${props.poster}` }}
+                    cls="h20 mh2 mt2 "
+                    imgcls="br3"    
                     // resizeMode="contain"
                 >
-                    <C.View cls="flx1 bgc-rgba-black-0_3 jc-c">
-                        <C.View cls="ai-e po-full">
-                            <C.EL.Icon type="entypo" name="lock" ccls="ma2" {...C.n2cls("color-white")}/>
+                    <C.View cls="flx1 bgc-rgba-black-0_3 jc-sb br3">
+                        <C.View cls="ai-e">
+                            {
+                                props.charge == 0 || props.charge ==  null ? (  
+                                    <C.Icon5  name="lock-open" cls="ma2 f2.3" {...C.n2cls("color-white")}/>
+                                ):  <C.Icon5  name="lock" cls="ma2 f2.3" {...C.n2cls("color-white")}/>
+                            }
                         </C.View>
-                        <C.View cls="ai-c">
+                        <C.View cls="ai-c ">
                             <C.EL.Icon type="entypo" name="controller-play" ccls="ma2" {...C.n2cls("color-white")}  {...C.n2cls("size10")} onPress={props.onClickPlay}/>
                         </C.View>
+                        <C.View cls="w100% jc-c ai-c flx0.7  bgc-rgba-black-0_4 br-tl3 br-tr3">
+                            <C.Text cls="f2 color-white">  
+                                {props.title} 
+                            </C.Text>
+                        </C.View>
                     </C.View>
 
                     
-                </C.ImageBackground>
+                </C.ImageBackground >
                 <C.View cls="flx1 ai-e mh2">  
                     <C.Text> 
                         {props.soundDuration}

+ 14 - 10
src/provider/Net.js

@@ -12,7 +12,7 @@ axios.interceptors.request.use(config =>{
     if(config.url == "/me"){ config.url += `?token=${meToken}`;}
     if(config.url == "/meditation"){config.headers.interfaceId = 'meditation';}
     // if(config.url == "/bbs"){config.headers.interfaceId = 'bbs';}
-    console.log(config);
+    
     config.headers.timestamp = moment().format('YYYYMMDDHHmmssSSS');
     return config;  
 })  
@@ -44,19 +44,23 @@ class Net {
             size : 20,
             page	: 1,
             type : 'body',
-            section : 'stand' 
+            // section : 'stand' 
         } );  
+        return data;
         // console.log(" :::: " , data);       
     }
-    async bbs(){
+    async notice(){
         // 아직 잘 모름 
-        
-        // let {data} =    await axios.post("/meditation",{
-        //     size : 20,
-        //     page	: 1,
-        //     type : 'body',
-        //     section : 'stand' 
-        // } );  
+
+        let {data} =    await axios.get("/bbs/notice");  
+        console.log(data);
+    }
+
+    async faq(){
+        // 아직 잘 모름 
+
+        let {data} =    await axios.get("/bbs/faq");  
+        console.log(data);
     }
  
 }