Skip to content

Commit

Permalink
Merge pull request #55 from 2remote/dev
Browse files Browse the repository at this point in the history
修复线上bug,保证生产环境所有功能可用
  • Loading branch information
yangyunxin committed Nov 25, 2015
2 parents e28de35 + b8bc636 commit 94031ae
Show file tree
Hide file tree
Showing 11 changed files with 545 additions and 103 deletions.
5 changes: 3 additions & 2 deletions app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ let DOMAIN = DEV_ENV;

//获取当前网站的根目录
var Local_Host = window.location.host;
var Local_Href = window.location.href;

//根据local host切换api
function hasHost(host) {
return host.length > 0;
}

function isDevHost(host) {
const re = /dev\.|192\.|localhost/i;
const re = /dev\.|192\.|localhost|0\./i;
const founds = host.match(re);
if (founds != null) {
return true;
Expand Down Expand Up @@ -44,7 +45,7 @@ var API_CONST = {
verifyTelResetPassWord: API_URL + 'User.VerifyTelResetPassWord',
receiveTelResetPassWord: API_URL + 'User.ReceiveTelResetPassWord',
logout: API_URL + "User.Logout",
weixin_login: API_URL + "openuser.login&serviceid=weixin&redirecturl=" + Local_Host,
weixin_login: API_URL + "openuser.login&serviceid=weixin&redirecturl=" + Local_Href,
current_user: API_URL + 'User.CurrentUser',
currentUserDetail: API_URL + 'User.CurrentUserDetail',
changeAvatar: API_URL + 'User.ChangeAvatar',
Expand Down
59 changes: 0 additions & 59 deletions app/components/Index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,6 @@ var Index = React.createClass({
<DocumentTitle title="YAOPAI:一个全球预约摄影师平台">
<div className="index">
<HamburgMenu />
<div className="sliderBox" >
<ReactSwipe
continuous={true}
auto={3000}
speed={500}
stopPropagation={false}
callback = {this.updateSliderButtons}
transitionEnd = {this.autoNextPageOnSwiped} >
{ImgNodes}
</ReactSwipe>
<div className="sliderButtonsLine" >
<div className="sliderButtons" >
{sliderButtons}
</div>
</div>
</div>

<div className="indexContent">
<div className="spliterWork" >
Expand Down Expand Up @@ -170,49 +154,6 @@ var Index = React.createClass({

<ImageVerticalGrid works={this.state.recommendGraphers}/>

<div className="spliterInterview" >
<img
src="imgs/indexPage/icon-interview.png"
srcSet="imgs/indexPage/icon-interview@2X.png 2x" />
<div className="splitLine" >
<img
src="imgs/common/spliter-line.png"
srcSet="imgs/common/spliter-line@2X.png 2x" />
</div>
<div className="splitContent">
<div>访谈</div>
<div>INTERVIEW</div>
</div>
</div>

<div className="imageRectGrid">
<img
src="imgs/indexPage/interview-demo.jpg"
srcSet="imgs/indexPage/interview-demo@2X.jpg 2x" />
</div>

<div className="spliterActivity" >
<img
src="imgs/indexPage/icon-activity.png"
srcSet="imgs/indexPage/icon-activity@2X.png 2x" />
<div className="splitLine" >
<img
src="imgs/common/spliter-line.png"
srcSet="imgs/common/spliter-line@2X.png 2x" />
</div>
<div className="splitContent">
<div>活动</div>
<div>ACTIVITY</div>
</div>
</div>

<div className="imageCircleGrid">
<img
src="imgs/indexPage/activity-demo.jpg"
srcSet="imgs/indexPage/activity-demo@2X.jpg 2x" />
</div>

<Footer />

</div>

Expand Down
20 changes: 0 additions & 20 deletions app/components/SidePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ var style={
loginBox: {
position: 'relative',
},
logoutIcon:{
// float: 'left',
// margin: '2px -73px 0 33px'
},
logout:{
position: 'absolute',
top: '58px',
Expand Down Expand Up @@ -88,7 +84,6 @@ var SidePage = React.createClass({
render: function() {
var accountContent = '';
if(this.props.userData && this.props.userData.isLogin){
//这个link应该指向用户中心
accountContent = (
<div className="loginBox" style={style.loginBox}>
<Link style={style.link} to={this.props.userData.userType==0?"/user_center":"/grapher_center"}>
Expand Down Expand Up @@ -123,7 +118,6 @@ var SidePage = React.createClass({
}
return(
<div
// style={style.menu}
className="menu">
<div className={(this.state.visible ? "visible " : "") + 'left'}>
<div
Expand All @@ -145,20 +139,6 @@ var SidePage = React.createClass({
<div>摄影师</div>
</Link>
<div style={style.spliterLine} className="spliterLine" />
<div style={style.link}>
<img style={style.commonIcon} ref="interviewIcon"
src="imgs/sidePage/interview-icon.png"
srcSet="imgs/sidePage/interview-icon@2X.png 2x" />
<div>访谈</div>
</div>
<div style={style.spliterLine} className="spliterLine" />
<div style={style.link}>
<img style={style.commonIcon} ref="activityIcon"
src="imgs/sidePage/activity-icon.png"
srcSet="imgs/sidePage/activity-icon@2X.png 2x" />
<div>活动</div>
</div>
<div style={style.spliterLine} className="spliterLine" />
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/stores/AlbumsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var AlbumsStore = Reflux.createStore({
this.listenTo(AlbumsActions.search.failed,this.onFailed);
this.listenTo(AlbumsActions.getMyAlbums.success,this.onGetMyAlbumsSuccess);
this.listenTo(AlbumsActions.getMyAlbums.failed,this.onFailed);
this.listenTo(AlbumsActions.getCategories.success,this.onGetCategoiesSuccess);
this.listenTo(AlbumsActions.getCategories.success,this.onGetCategoriesSuccess);
this.listenTo(AlbumsActions.getCategories.failed,this.onFailed);
this.listenTo(AlbumsActions.onSale.success,this.onSaleSuccess);
this.listenTo(AlbumsActions.onSale.failed,this.onFailed);
Expand All @@ -39,7 +39,7 @@ var AlbumsStore = Reflux.createStore({
},
onFailed : function(res){
this.data.hintMessage = '网络错误';
this.data.flag == 'failed';
this.data.flag = 'failed';
this.trigger(this.data);
},
onAddSuccess : function(res){
Expand Down Expand Up @@ -107,7 +107,7 @@ var AlbumsStore = Reflux.createStore({
this.data.flag = 'getMyAlbums';
this.trigger(this.data);
},
onGetCategoiesSuccess : function(res){
onGetCategoriesSuccess : function(res){
if(res.Success){
this.data.categories = res.Result;
this.hintMessage = '';
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function karmaConfig (config) {
config.set({
frameworks: [
// Set framework to mocha
'mocha'
'mocha', 'sinon'
],

reporters: [
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"karma-coverage": "^0.5.3",
"karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^0.2.1",
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.6",
"karma-spec-reporter": "0.0.22",
"karma-tap": "^1.0.3",
Expand All @@ -60,6 +61,7 @@
"phantomjs": "^1.9.18",
"phantomjs-polyfill": "0.0.1",
"react-hot-loader": "^1.3.0",
"sinon": "^1.17.2",
"style-loader": "^0.13.0",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.1",
Expand Down
24 changes: 6 additions & 18 deletions tests/apiSwitch_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,18 @@ describe('API switch', () => {
'dev.manage.aiyaopai.com',
'localhost:8080',
'192.168.3.2:5000/#/login_page',
'http://yaopai-mobile-dev.herokuapp.com/'
'http://yaopai-mobile-dev.herokuapp.com/',
'http://0.0.0.0:5000',
'dev.p.aiyaopai.com'
];

const prodHosts = [
'm.aiyaopai.com/',
'manage.aiyaopai.com',
'http://yaopai-mobile.herokuapp.com/'
'http://yaopai-mobile.herokuapp.com/',
'p.aiyaopai.com'
];

it('will get right local host', () => {
const dev_host = 'http://yaopai-mobile-dev.heroku.com/#/work?_k=gn36vo';
const pro_host = 'http://yaopai-mobile.heroku.com/#/work?_k=gn36vo';

const re = /dev\.|192\.|localhost/i;
expect(dev_host).to.match(re);
expect(pro_host).to.not.match(re);
expect('m.aiyaopai.com/').to.not.match(re);
expect('dev.m.aiyaopai.com/').to.match(re);
expect('dev.manage.aiyaopai.com').to.match(re);
expect('manage.aiyaopai.com').to.not.match(re);
expect('localhost:8080').to.match(re);
expect('192.168.3.2:5000/#/login_page').to.match(re);
});

it('has hosts', () => {
devHosts.forEach((host, i) => {
expect(hasHost(host)).to.equal(true);
Expand Down Expand Up @@ -82,7 +70,7 @@ function isProdHost(host) {
}

function isDevHost(host) {
const re = /dev\.|192\.|localhost/i;
const re = /dev\.|192\.|localhost|0\./i;
const founds = host.match(re);
if (founds != null) {
return true;
Expand Down
Loading

0 comments on commit 94031ae

Please sign in to comment.