Browse Source

동의 부분 체크 하는 로직 추가.

자유해결사 6 years ago
parent
commit
90795be6e6
3 changed files with 33 additions and 10 deletions
  1. 26 7
      src/pages/_2_AcceptTerms.js
  2. 2 2
      src/pages/_5_Root.js
  3. 5 1
      src/pages/_7_List.js

+ 26 - 7
src/pages/_2_AcceptTerms.js

@@ -1,8 +1,10 @@
-import React from 'react';
- 
+import React, {useState, useEffect} from 'react';
+import {Alert} from 'react-native';
+import Auth ,{LM} from '../provider/Auth'
 import i18n from  "i18n-js";
 
 import C from 'rn-class'
+import _ from 'lodash'
 import AsyncStorage from '@react-native-community/async-storage';
 
 C.addColor("#03cf5d", "color-naver");
@@ -14,12 +16,28 @@ C.addColor("#c87320" , "color-not_agreeBtn");
 export default (props)=>{
     // 다국어 처리 영역 
     let {termsTitle, agree , not_agree}  = i18n.t("AcceptTerms");
-
-    const agreeNoagree = () => {
+    //변수선언 영역 
+    let [accptArr , setAccptArr ] = useState([]);
+    useEffect(()=>{
+        termsTitle.map(()=>{
+            accptArr.push(false);
+        }) 
+    },[]);
+
+    let onAccpt = (idx)=>{
+        accptArr[idx] = !accptArr[idx] 
+        setAccptArr(_.map(accptArr)) 
+    }
+    const agreeAgree = () => {
         props.navigation.navigate('Guide1');
     }
+    const agreeNoagree = async () => {
+        await LM.logout(); 
+        Alert.alert("모든 약관에 동의 하셔야 이용이 가능합니다.");
+        props.navigation.navigate('Login'); 
+    }
 
-    return (
+    return ( 
         <C.View cls="flx1 bgc-color-white"> 
              <C.Comp.Header  {...props}/>
             {/* body */}
@@ -44,9 +62,10 @@ export default (props)=>{
                                         name="popup"
                                         type="entypo"
                                         color="white"
+                                        
                                         />
                                     }/>
-                                <C.EL.CheckBox title='동의합니다' ccls="bgc-color-transparent bw0"/>
+                                <C.EL.CheckBox title='동의합니다' ccls="bgc-color-transparent bw0"  checked={accptArr[idx]} onPress={onAccpt.bind(this, idx)}/>
                             </C.View> 
 
                         )
@@ -54,7 +73,7 @@ export default (props)=>{
                 }
                 </C.View>
                 <C.View cls="flx0.2 ai-c w100% flx-row jc-c"> 
-                    <C.EL.Button onPress={agreeNoagree} title={agree} ccls="w40% mr3" btncls="bgc-color-agreeBtn"/>
+                    <C.EL.Button onPress={ agreeAgree} title={agree} ccls="w40% mr3" btncls="bgc-color-agreeBtn"/>
                     <C.EL.Button onPress={agreeNoagree} title={not_agree} ccls="w40%" btncls="bgc-color-not_agreeBtn"/> 
                 </C.View>
 

+ 2 - 2
src/pages/_5_Root.js

@@ -65,10 +65,10 @@ export default (props)=>{
     return (
         <C.View cls="flx1 bgc-color-white"> 
             <C.Comp.Header  {...props}/>
-            <Page   {...props} Pages={sel_idx == -1 ? {} : BTNS[targetIdx][sel_idx]}  startPlay={startPlay}/>
+            <Page   {...props} Pages={sel_idx == -1 ? {} : BTNS[targetIdx][sel_idx]}  startPlay={startPlay} bPlay={bPlay}/>
             
             {bPlay ? <Player {...props} Pages={curPlayInfo} tabPosition={tabPosition} closePlayer={()=>setbPlay(false)}/>  : null}
-            {bPlay ? <C.View cls="flx0.1"/>  : null}
+            {/* {bPlay ? <C.View cls="flx0.1"/>  : null} */}
 
             <TabBar setTabPosition={setTabPosition} onTabPress={onTabPress} BTNS={BTNS}/>  
         </C.View> 

+ 5 - 1
src/pages/_7_List.js

@@ -34,7 +34,11 @@ export default (props)=>{
                         <Imgs onClickPlay={onClickPlay} ></Imgs>
                         <Imgs onClickPlay={onClickPlay} ></Imgs>
                  </C.View>
-                <C.View cls="h20" />
+                 {
+                     props.bPlay ? 
+                     <C.View cls="h10" /> : null
+
+                 }
                 </C.ScrollView>
             </C.View>