提交 3e17c6a8 authored 作者: 吴强's avatar 吴强

init commit

上级 c9b2978e
......@@ -25,13 +25,13 @@ const resource_proxy = {
const V4_proxy = {
//"http://106.ihuyi.cn/webservice/sms.php?method=Submit
"target": "http://106.ihuyi.cn/",
"target": "http://JTWeiXin.free.ngrok.cc",
"changeOrigin": true,
"headers":{
"host":"106.ihuyi.cn"
"host":"JTWeiXin.free.ngrok.cc"
},
"pathRewrite": {
"^/V4": ""
"^/V4": "V4"
}
};
module.exports = {
......
......@@ -20,7 +20,7 @@
"weui": "^1.1.0"
},
"devDependencies": {
"babel-plugin-dva-hmr": "^0.3.2",
"babel-plugin-dva-hmr": "^0.4.1",
"babel-plugin-import": "^1.6.6",
"eslint": "^4.14.0",
"eslint-config-umi": "^0.1.1",
......
import React from 'react';
import styles from './CardViewStyles.less';
import {
Badge,
Card,
WhiteSpace,
Flex,
WingBlank,
} from 'antd-mobile';
class MyTopCard extends React.Component{
render(){
return(
<div>
<WhiteSpace size="lg" />
<WhiteSpace size="lg" style={{background:"#eee"}} />
<Card full>
<Card.Header
title={
<div width="30px">
<span style={ {"padding-right":"15px",color:'#38c5b8'}}>总证数</span>
<div style={{fontSize:"0.85rem"}}>
<span style={ {paddingRight:"0.75rem",color:'#38c5b8',fontWeight:"600"}}>总证数</span>
<span >18162</span>
</div>
}
style={ {padding:"1.2rem 1.3rem",color:'#38c5b8'}}
/>
<Card.Body>
<Flex>
<Flex.Item><Badge className={styles.mybadge} text={
<div>
<span style={ {"padding-right":"15px"}}>证均成本</span>
<span >3544940.25</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>证均成本</span>
<span >3544940.25</span>
</div>
}/></Flex.Item>
</Flex>
<Flex>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>安置房套数</span>
<span >16955</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>面积成本</span>
<span >16955</span>
</div>
}/></Flex.Item>
</Flex>
<Flex>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>产权调换比例</span>
<span >50.35%</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>货币补偿比例</span>
<span >3544940.25</span>
</div>
}/></Flex.Item>
</Flex>
<Card.Body style={{padding:"0 1.5rem",fontSize:"0.7rem"}}>
<Flex style={{padding:"1rem 0"}}>
<Flex.Item style={{marginRight:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>已签约证数</div>
<div>16955</div>
</Flex>
</Flex.Item>
<Flex.Item style={{marginLeft:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>证均成本</div>
<div>3544940.25</div>
</Flex>
</Flex.Item>
</Flex>
<Flex style={{padding:"1rem 0"}}>
<Flex.Item style={{marginRight:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>安置房套数</div>
<div>18473</div>
</Flex>
</Flex.Item>
<Flex.Item style={{marginLeft:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>面积成本</div>
<div>123131.87</div>
</Flex>
</Flex.Item>
</Flex>
<Flex style={{padding:"1rem 0"}}>
<Flex.Item style={{marginRight:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>产权调换比例</div>
<div>52.35%</div>
</Flex>
</Flex.Item>
<Flex.Item style={{marginLeft:"0.75rem"}}>
<Flex style={{justifyContent:"space-between"}}>
<div>货币补偿比例</div>
<div>3544940.25</div>
</Flex>
</Flex.Item>
</Flex>
<WhiteSpace size="lg" />
</Card.Body>
</Card>
......
差异被折叠。
......@@ -12,66 +12,71 @@ class MyBodyCard extends React.Component{
const arrayData=this.props.data;
console.info(arrayData);
if(arrayData!==null){
return(
<div className={styles.myDiv}>
{
arrayData.map((item)=>{
return (
<div><WhiteSpace size="lg" />
<Card full>
<Card.Header
title={
<div>
<div className={styles.left}>{item.index}</div>
<div className={styles.center}><span style={ {color:'#38c5b8'}}>{item.JDName}</span></div>
</div>
}
extra={<Badge className={styles.mybadge} text={
<div>
<span style={ {"padding-right":"2px"}}>总证数</span>
<span >{item.xiangMuZongHuShu}</span>
</div>
}
/>}
/>
<Card.Body>
<Flex>
<Flex.Item><Badge className={styles.mybadgetwo} text={
<div>
<span style={ {"padding-right":"15px"}}>已签约总数</span>
<span >{item.yiQianYueHuShu}</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>签约比例</span>
<span >3544940.25</span>
</div>
}/></Flex.Item>
</Flex>
<Flex>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>产权调换比例</span>
<span >16955</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge text={
<div>
<span style={ {"padding-right":"15px"}}>货币补偿比例</span>
<span >16955</span>
</div>
}/></Flex.Item>
</Flex>
<WhiteSpace size="lg" />
</Card.Body>
</Card>
</div>
);
})
}
</div>
);
return(
<div className={styles.myDiv}>
{
arrayData.map((item,index)=>{
return (
<div key={index}>
<Card full>
<Card.Header style={ {padding:"0",color:'#38c5b8',fontSize:"0.85rem"}}
title={
<div style={ {padding:"1.2rem 1.3rem",color:'#38c5b8',width:"100%"}}>
<Flex style={{justifyContent:"space-between",alignItems:"flex-start"}}>
<Flex.Item>
<Flex style={{alignItems:"flex-start"}}>
<p style={ {paddingRight:"0.75rem",color:'#666',fontWeight:"500"}}>{item.index>=10?item.index:`0${item.index}`}</p>
<p style={{color:"#000"}}>{item.jDName}</p>
</Flex>
</Flex.Item>
<Flex.Item style={{textAlign:"right"}}>
<div style={{width:"6rem",display:"inline-block",borderRadius:"0.6rem",background:"#caf6f0",textAlign:"center",fontSize:"0.7rem"}}>
<span style={ {paddingRight:"0.75rem",color:'#000',fontWeight:"500"}}>总证数</span>
<span style={{color:"#000"}}>{item.xiangMuZongHuShu}</span>
</div>
</Flex.Item>
</Flex>
</div>
}
/>
<Card.Body>
<Flex>
<Flex.Item><Badge className={styles.mybadgetwo} style={{background:"none"}} text={
<div style={{color:"#333"}}>
<span style={ {paddingRight:"15px"}}>已签约总数</span>
<span >{item.yiQianYueHuShu}</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge style={{background:"none"}} text={
<div style={{color:"#333"}}>
<span style={ {paddingRight:"0.75rem"}}>签约比例</span>
<span >{item.qianYueHuShuBiLi}</span>
</div>
}/></Flex.Item>
</Flex>
<Flex>
<Flex.Item><Badge style={{background:"none"}} text={
<div style={{color:"#333"}}>
<span style={ {paddingRight:"0.75rem"}}>产权调换比例</span>
<span >{item.qianYueHuShuBiLi}</span>
</div>
}/></Flex.Item>
<Flex.Item><Badge style={{background:"none"}} text={
<div style={{color:"#333"}}>
<span style={ {paddingRight:"0.75rem"}}>货币补偿比例</span>
<span >{item.huoBiBuChangBiLi}</span>
</div>
}/></Flex.Item>
</Flex>
</Card.Body>
</Card>
<WhiteSpace size="lg" style={{background:"#eee"}} />
</div>
);
})
}
</div>
);
}else{
return(
<div className={styles.myDiv}>
......
......@@ -10,5 +10,8 @@
}
}
.left { float: left;width: 10px;}
.center{margin-left:20px;}
.left { float: left;width: 0.5rem;}
.center{margin-left:1rem;}
.justify_between{
justify-content: space-between;
}
import dva from 'dva';
import createBrowserHistory from 'history/createBrowserHistory'
import './index.css';
console.log('index.js');
// 1. Initialize
const app = dva();
const app = dva({
history: createBrowserHistory(),
});
// 2. Plugins
// app.use({});
......@@ -11,6 +14,7 @@ const app = dva();
// 3. Model
app.model(require('./models/login').default);
app.model(require('./models/Home/home').default);
app.model(require('./models/middleselect').default);
// 4. Router
app.router(require('./router').default);
......
......@@ -43,21 +43,24 @@ export default {
}catch (erroer){
console.info(erroer);
}
// 这是以后放到服务器时候用的代码,因为现在要测试,所以要先注释
// const { pNumber } = payload;
// const coordinate = {
// containerType: 'module',
// containerName: 'QueryJiDiModule',
// datasourceName: 'QueryDistrictName',
// };
// try {
// const resultss = yield call(getData, coordinate, { pst: 0, psz: 10 ,params:{pNumber:pNumber}});
// console.info('查询的结果');
// console.info(resultss);
// yield put({ type: 'setSummaryData',payload:{resultss} });
// }catch (erroer){
// console.info(erroer);
// }
},
*getSummary({ payload }, { take, put, call, select }) {
const payloads = { userName:'admin',password:'admin', type: 'userName', authType: 'password' };
try{
const result = yield call(login, payloads);
console.info(result);
const { tokenId } = result;
yield call(setToken, tokenId);// 这里的yield ,跟C#中的await一样
}
catch (erroer) {
console.info(erroer);
}
const { pNumber } = payload;
const coordinate = {
containerType: 'module',
......
import request from "../utils/request";
import {sendMsg} from "../services/datasource";
import {fetch} from "../utils/polyfill";
const sendMsg = async (phoneNumber) => {
return fetch(`V4/GetAuthenticationCode(${phoneNumber})`,{
method: 'GET',
mode: 'cors',
credentials:'include',
})
.then((response) => response.json())
.then((text) => {
return text
});
};
const checkYanZhengMa = async (phoneNumber,yanZhengMa) => {
return fetch(`V4/CheckIdentity(${phoneNumber})/(${yanZhengMa})`,{
method: 'GET',
mode: 'cors',
credentials:'include',
})
.then((response) => response.json())
.then((text) => {
return text
});
};
export default {
namespace: 'login',
state: {
telnum:null,
RadomNumber:123456,
YanZhengMa:null,
errormsg: null,
showToptips: false,
},
......@@ -23,10 +46,20 @@ export default {
yield put({ type: 'save' });
},
*checkNumber({ payload }, { call, put ,select}) { // eslint-disable-line
const { telnum,RadomNumber } = yield select(state => state.login);
const postData=`account=cf_proland&password=proland2015&mobile=${telnum}&content=您的验证码是:${RadomNumber}。请不要把验证码泄露给其他人。`;
console.info(this)
yield call(sendMsg,postData);
const { telnum } = yield select(state => state.login);
console.info(telnum);
const wuqiang=yield call(sendMsg,telnum);
},
*checkYanZhengMa({ payload }, { call, put ,select}) { // eslint-disable-line
const { telnum,YanZhengMa } = yield select(state => state.login);
console.info(telnum);
const wuqiang=yield call(checkYanZhengMa,telnum,YanZhengMa);
if(wuqiang==="sucess")
{
document.location="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3dcfb1de089346b3&redirect_uri=http%3a%2f%2fv4.free.ngrok.cc%2f&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
}else{
alert("登陆失败");
}
},
},
......@@ -36,6 +69,9 @@ export default {
},
setTelnum(state,{payload}){
return {...state,telnum:payload.telNum};
},
setYanZhengMa(state,{payload}){
return {...state,YanZhengMa:payload.YanZhengMa};
}
},
......
import request from "../utils/request";
import { routerRedux } from 'dva/router';
import {setToken} from "../utils/auth";
const fetchToken = async (url) => {
return fetch(`V4/GetWXUserInfo/${url}`,{
method: 'GET',
mode: 'cors',
credentials:'include',
})
.then((response) => response.json())
.then((text) => {
return text
});
};
export default {
namespace: 'middleSelect',
state: {
tokenId:null,
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
*checkOpenID({ payload }, { call, put,select }) { // eslint-disable-line
console.info(window.location.search);
let url = window.location.search; //获取url中"?"符后的字串
const { telnum } = yield select(state => state.login);
console.info(`输出获取的参数${telnum}`);
console.info(`输出获取的参数${url}`);
let tokenId = yield call(fetchToken, url);
//tokenId=yield call(getUserFromV4,{},{},false);
if(tokenId!==null&&tokenId!==""&&tokenId!=='无内容'&&tokenId!=='用户未注册')
{
console.log(tokenId);
yield call(setToken, tokenId);// 这里的yield ,跟C#中的await一样
yield put(routerRedux.push('/Home'));
}else
{
yield put(routerRedux.push('/Login'));
}
},
},
reducers: {
setShowToptips(state,{payload}){
return {...state,showToptips:payload.ShowToptips,errormsg:payload.errormsg};
},
},
};
import React from 'react';
import { BrowserRouter, Route, Switch } from 'dva/router';
import { Router, Route, Switch } from 'dva/router';
import dynamic from 'dva/dynamic';
import MiddleSelectPage from "./routes/MiddleSelectPage";
function RouterConfig({ history, app }) {
const IndexPage = dynamic({
......@@ -12,12 +13,13 @@ function RouterConfig({ history, app }) {
component: () => import('./routes/Home/HomePage'),
}) ;
return (
<BrowserRouter>
<div>
<Route path="/" exact component={IndexPage} />
<Router history={history}>
<Switch>
<Route path="/" exact component={MiddleSelectPage} />
<Route path="/Home" exact component={HomePage} />
</div>
</BrowserRouter>
<Route path="/Login" exact component={IndexPage} />
</Switch>
</Router>
);
}
......
......@@ -8,6 +8,7 @@ import {
Page,
Badge,
CellBody,
Form,
} from 'react-weui';
//import styles
import 'weui';
......@@ -19,11 +20,18 @@ class HomePage extends React.Component{
const { dispatch } = this.props;
dispatch({ type: 'home/getSummaryData',payload: { pNumber:'浦东新区' }});
}
onChange=(value)=>{
console.info("改变了");
const { dispatch } = this.props;
let objS = document.getElementById("pid");
let district = objS.options[objS.selectedIndex].value;
dispatch({ type: 'home/getSummaryData',payload: { pNumber:district }});
};
render(){
return (
<Page>
<span className={styles.myspan}>
<Select data={[
<Select id="pid" data={[
{
value: '杨浦区',
label: '杨浦区'
......@@ -36,7 +44,7 @@ class HomePage extends React.Component{
value: '徐汇区',
label: '徐汇区'
}
]}/>
]} onChange={this.onChange}/>
</span>
<MyTopCard/>
<MyBodyCard data={this.props.home.SummaryData}/>
......
......@@ -25,7 +25,6 @@ class IndexPage extends React.Component{
//手机号判断
telCheck=(event)=>{
const tel=event.target.value;
console.log(tel);
var reg=/^1[34578]\d{9}$/;
if(reg.test(tel)==false){
this.props.dispatch({ type: 'login/setShowToptips', payload: { ShowToptips:true,errormsg:"请输入正确的手机号" } });
......@@ -34,12 +33,25 @@ class IndexPage extends React.Component{
this.props.dispatch({ type: 'login/setTelnum', payload: { telNum:tel } });
}
};
//验证码判断
telYanZhengMa=(event)=>{
const tel=event.target.value;
var reg=/\d{4}$/;
if(reg.test(tel)==false){
this.props.dispatch({ type: 'login/setShowToptips', payload: { ShowToptips:true,errormsg:"请输入正确的验证码" } });
window.setTimeout(e=> this.props.dispatch({ type: 'login/setShowToptips', payload: { ShowToptips:false } }), 2000)
}else{
this.props.dispatch({ type: 'login/setYanZhengMa', payload: { YanZhengMa:tel } });
}
};
//发送验证码
sendCheckNum = () => {
// 1.检验改手机号是否存在系统中,如果不存在,无法注册
this.props.dispatch({type:'login/checkNumber',payload:{}})
//2.如果手机号存在,发送验证码
const PostUrl = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";
};
// 注册
registerClick=()=>{
this.props.dispatch({ type: 'login/checkYanZhengMa', payload: {} });
};
render(){
return (
......@@ -52,7 +64,7 @@ class IndexPage extends React.Component{
</CellHeader>
<CellBody>
<Icon value="warn" />
<Input type="tel" placeholder="输入手机号码" onBlur={(event)=>this.telCheck(event)}/>
<Input type="tel" placeholder={this.props.login.telnum} onBlur={(event)=>this.telCheck(event)}/>
</CellBody>
</FormCell>
<FormCell vcode>
......@@ -60,7 +72,7 @@ class IndexPage extends React.Component{
<Label>验证码</Label>
</CellHeader>
<CellBody>
<Input type="tel" placeholder=""/>
<Input type="tel" placeholder="" onBlur={(event)=>this.telYanZhengMa(event)}/>
</CellBody>
<CellFooter>
<Button type="vcode" onClick={this.sendCheckNum}>发送</Button>
......@@ -70,12 +82,7 @@ class IndexPage extends React.Component{
<ButtonArea>
<Button
//button to display toptips
onClick={ e=> {
if(this.props.login.showToptips) return;
this.props.dispatch({ type: 'login/setShowToptips', payload: { ShowToptips:true,errormsg:"用户名有误" } });
window.setTimeout(e=> this.props.dispatch({ type: 'login/setShowToptips', payload: { ShowToptips:false } }), 2000)
}
}>
onClick={ this.registerClick}>
注册
</Button>
</ButtonArea>
......@@ -96,9 +103,10 @@ class IndexPage extends React.Component{
IndexPage.propTypes = {
login: PropTypes.object,
middleSelect:PropTypes.object,
};
// 指定订阅数据,这里关联了 login
function mapStateToProps({ login }) {
return {login};
function mapStateToProps({ login, middleSelect }) {
return {login, middleSelect};
}
export default connect(mapStateToProps)(IndexPage);
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'dva';
class MiddleSelectPage extends React.Component{
componentDidMount() {
const { dispatch } = this.props;
console.info(this.props);
dispatch({ type: 'middleSelect/checkOpenID',payload: {}});
}
render(){
return (
<div>加载中</div>
);
}
}
MiddleSelectPage.propTypes = {
middleSelect: PropTypes.object,
};
// 指定订阅数据,这里关联了 login
function mapStateToProps({ middleSelect }) {
return {middleSelect};
}
export default connect(mapStateToProps)(MiddleSelectPage);
......@@ -167,9 +167,6 @@ export async function getModuleDatasourceMeta(mdName, dsName) {
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/meta`);
}
export async function getUserFromV4(params = {}) {
return request(`${config.apiContextPath}/`);
}
export async function sendMsg(data) {
return post(`${config.apiContextPath}/V4/webservice/sms.php`,data,{method:'Submit'});
return request(`${config.apiContextPath}/V4/GetWXUserInfo`);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论