|
@@ -338,7 +338,7 @@ export default {
|
|
|
},
|
|
|
//获取验证码
|
|
|
get_verify_code() {
|
|
|
- let $reg = /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/
|
|
|
+ let $reg = /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d|19\d)\d{8}/
|
|
|
if ($reg.test($this.phone) == false) {
|
|
|
Toast.fail('请输入正确手机号')
|
|
|
return false;
|
|
@@ -371,38 +371,44 @@ export default {
|
|
|
$params['portrait'] = $this._userinfo.avatarUrl
|
|
|
$params['sex'] = $this._userinfo.gender
|
|
|
// }
|
|
|
-
|
|
|
- if ($this.title == "注册") {
|
|
|
- userRegister($params).then((res) => {
|
|
|
- console.log(res)
|
|
|
- wx.setStorageSync("is_first", true)
|
|
|
- let $data = res.data
|
|
|
- if (!$data['code']) {
|
|
|
- Toast.clear()
|
|
|
- $this.login_success($data)
|
|
|
- } else {
|
|
|
- Toast.fail($data['errmsg'])
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log(err)
|
|
|
+ mpvue.login({
|
|
|
+ success($res) {
|
|
|
+ let $js_code = $res.code
|
|
|
+ $params['js_code'] = $js_code
|
|
|
+ if ($this.title == "注册") {
|
|
|
+ userRegister($params).then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ wx.setStorageSync("is_first", true)
|
|
|
+ let $data = res.data
|
|
|
+ if (!$data['code']) {
|
|
|
+ Toast.clear()
|
|
|
+ $this.login_success($data)
|
|
|
+ } else {
|
|
|
+ Toast.fail($data['errmsg'])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ } else if ($this.title == "登录") {
|
|
|
+ userLogin($params).then((res) => {
|
|
|
+ wx.setStorageSync("is_first", false)
|
|
|
+ let $data = res.data
|
|
|
+ Toast.clear()
|
|
|
+ if ($data['code'] == 0) {
|
|
|
+ $this.login_success($data)
|
|
|
+ } else {
|
|
|
+ Toast.fail($data['errmsg'])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
}
|
|
|
- )
|
|
|
- } else if ($this.title == "登录") {
|
|
|
- userLogin($params).then((res) => {
|
|
|
- wx.setStorageSync("is_first", false)
|
|
|
- let $data = res.data
|
|
|
- Toast.clear()
|
|
|
- if ($data['code'] == 0) {
|
|
|
- $this.login_success($data)
|
|
|
- } else {
|
|
|
- Toast.fail($data['errmsg'])
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
//登录成功
|