Merge remote-tracking branch 'origin/develop' into develop

dev_home
杨树明 6 years ago
commit ce6450316e

@ -2,7 +2,7 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController
before_action :require_prize_team_leader!
def update
Competitions::SavePrizeTeamAccountService.call(current_competition, current_user, update_params)
Competitions::SavePrizeTeamAccountService.call(current_competition, current_prize_user, update_params)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
@ -13,8 +13,8 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController
def require_prize_team_leader!
prize_user = current_competition.competition_prize_users.joins(:competition_prize)
.where(competition_prizes: { category: :bonus })
.find_by(leader: true, user_id: current_user.id)
return if prize_user.present?
.find_by(leader: true, user_id: current_prize_user.id)
return if prize_user.present? && (current_user.admin_or_business? || current_user.id == current_prize_user.id)
render_forbidden
end
@ -22,4 +22,8 @@ class Competitions::PrizeLeaderAccountsController < Competitions::BaseController
def update_params
params.permit(:bank, :second_bank, :card_no)
end
def current_prize_user
@_current_prize_user ||= User.find(params[:user_id])
end
end

@ -40,12 +40,48 @@ class Bankcardnumberverification extends Component {
}
}
componentDidUpdate = (prevProps) => {
if (prevProps.bank_account != this.props.bank_account) {
console.log("componentDidUpdate");
console.log(this.props);
console.log(prevProps);
////console.log("Registration");
////console.log("componentDidUpdate");
////console.log(this.props.user.admin);
try {
if(this.props.bank_account){
this.props.form.setFieldsValue({
openingbank: this.props.bank_account.bank,
subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no,
})
}
}catch (e) {
}
try {
if(prevProps.bank_account){
this.props.form.setFieldsValue({
openingbank:prevProps.bank_account.bank,
subbranch: prevProps.bank_account.second_bank,
subbranchs: prevProps.bank_account.card_no,
})
}
}catch (e) {
}
}
}
yhBankstrue = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`;
axios.patch(url, {
user_id:this.props.userdata.id,
bank: values.openingbank,
second_bank: values.subbranchs,
card_no: values.subbranch
@ -152,7 +188,7 @@ class Bankcardnumberverification extends Component {
>
{getFieldDecorator('openingbank', {
rules: [{
// initialValue: this.state.cityDefaultValue,
initialValue: this.state.openingbank&&this.state.openingbank,
required: true,
message: '请输入开户行',
}],
@ -167,7 +203,7 @@ class Bankcardnumberverification extends Component {
>
{getFieldDecorator('subbranch', {
rules: [{
// initialValue: this.state.cityDefaultValue,
initialValue: this.props.subbranch&&this.props.subbranch,
required: true,
message: '请输入支行',
}],
@ -182,7 +218,7 @@ class Bankcardnumberverification extends Component {
>
{getFieldDecorator('subbranchs', {
rules: [{
// initialValue: this.state.cityDefaultValue,
initialValue: this.props.subbranchs&&this.props.subbranchs,
required: true,
message: '请输入账号',
}],

@ -288,6 +288,7 @@ class CompetitionContentspdfpeopledata extends Component {
if (!err) {
let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`;
axios.patch(url, {
user_id:this.state.userdata.id,
bank: values.openingbank,
second_bank: values.subbranchs,
card_no: values.subbranch
@ -296,7 +297,7 @@ class CompetitionContentspdfpeopledata extends Component {
try {
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.props.showNotification(`提交成功成功`);
this.props.showNotification(`提交成功`);
this.getdata(this.state.userdata.id);
this.GetawardinformationAPI();
}
@ -321,11 +322,19 @@ class CompetitionContentspdfpeopledata extends Component {
//撤销认证
Cancellationofapplication = (index) => {
let userid;
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
if(types[1]===undefined){
userid=this.props.user&&this.props.user.user_id;
}else{
userid=types[1];
}
let url = ""
if (index === 1) {
url = `/users/accounts/${this.props.user.user_id}/authentication_apply.json`;
url = `/users/accounts/${userid}/authentication_apply.json`;
} else if (index === 2) {
url = `/users/accounts/${this.props.user.user_id}/professional_auth_apply.json`;
url = `/users/accounts/${userid}/professional_auth_apply.json`;
}
axios.delete(url)
.then((response) => {
@ -336,7 +345,11 @@ class CompetitionContentspdfpeopledata extends Component {
} else if (index === 2) {
this.props.showNotification('撤销职业认证成功')
}
this.getdata(this.state.userdata.id);
try {
this.getdata(this.state.userdata.id);
}catch (e) {
}
}
} catch (e) {
@ -515,6 +528,7 @@ class CompetitionContentspdfpeopledata extends Component {
<div>
{
bank_account_editable === true ?
<Bankcardnumberverifications {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}

@ -47,7 +47,7 @@ class Phonenumberverification extends Component {
}).then((result) => {
if (result) {
this.props.showNotification("手机号码绑定成功!");
this.props.hideUpdating()
this.props.hideUpdating(1)
this.props.getdata(id);
}
}).catch((error) => {

Loading…
Cancel
Save