<?php

/* ========================================================================
 * $Id: modify.php 1085 2020-07-05 17:04:38Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# edit
#请求数据
if($MODE=='$post'){
  $id=onez()->gp('id');
  $action=onez()->gp('action');
  if($action=='data'){
    $ac=onez()->gp('ac');
    if($ac=='submit'){
      if(!$G['userid']){
        return $this->error('请先登录');
      }
      $nickname=onez()->gp('nickname');
      if(!$nickname){
        return $this->error('昵称不能为空');
      }
      $item=array();
      $item['nickname']='nickname';
      onez('db')->open('member')->update($item,"userid='$G[userid]'");
      return $this->ok('修改成功','reload');
    }
    
    $A['pagedata']['nickname']=$G['user']['nickname'];
  }
  return;
}
?>
<van-form @submit="onSubmit" :show-error-message="false" v-if="$pagedata">
  <van-field
    v-model="pagedata.nickname"
    name="nickname"
    label="昵称"
    placeholder="昵称"
    :rules="[{ required: true, message: '请填写用户名' }]"
  />
  <div style="margin: 16px;">
    <van-button round block type="info" native-type="submit">
      保存修改
    </van-button>
  </div>
</van-form>