完成登录的基本流程
This commit is contained in:
@ -346,7 +346,7 @@ try {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-image/u-image */ "components/uview-ui/components/u-image/u-image").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-image/u-image.vue */ 120))
|
||||
},
|
||||
uIcon: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-icon/u-icon */ "components/uview-ui/components/u-icon/u-icon").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-icon/u-icon.vue */ 141))
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-icon/u-icon */ "components/uview-ui/components/u-icon/u-icon").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-icon/u-icon.vue */ 155))
|
||||
},
|
||||
uButton: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-button/u-button */ "components/uview-ui/components/u-button/u-button").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-button/u-button.vue */ 127))
|
||||
|
||||
@ -109,8 +109,11 @@ try {
|
||||
uCheckbox: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-checkbox/u-checkbox */ "components/uview-ui/components/u-checkbox/u-checkbox").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-checkbox/u-checkbox.vue */ 134))
|
||||
},
|
||||
mploginPopup: function () {
|
||||
return __webpack_require__.e(/*! import() | components/mplogin-popup/mplogin-popup */ "components/mplogin-popup/mplogin-popup").then(__webpack_require__.bind(null, /*! @/components/mplogin-popup/mplogin-popup.vue */ 215))
|
||||
mplogin: function () {
|
||||
return __webpack_require__.e(/*! import() | components/mplogin/mplogin */ "components/mplogin/mplogin").then(__webpack_require__.bind(null, /*! @/components/mplogin/mplogin.vue */ 141))
|
||||
},
|
||||
mobileLogin: function () {
|
||||
return __webpack_require__.e(/*! import() | components/mobile-login/mobile-login */ "components/mobile-login/mobile-login").then(__webpack_require__.bind(null, /*! @/components/mobile-login/mobile-login.vue */ 148))
|
||||
},
|
||||
}
|
||||
} catch (e) {
|
||||
@ -141,7 +144,10 @@ var render = function () {
|
||||
}
|
||||
if (!_vm._isMounted) {
|
||||
_vm.e0 = function ($event) {
|
||||
_vm.loginPopup = false
|
||||
_vm.mpLoginPopup = false
|
||||
}
|
||||
_vm.e1 = function ($event) {
|
||||
_vm.mobilePopup = false
|
||||
}
|
||||
}
|
||||
_vm.$mp.data = Object.assign(
|
||||
@ -210,13 +216,14 @@ var _default = {
|
||||
allow: false
|
||||
},
|
||||
loginData: {},
|
||||
loginPopup: false
|
||||
mpLoginPopup: false,
|
||||
mobilePopup: false
|
||||
};
|
||||
},
|
||||
onLoad: function onLoad() {},
|
||||
methods: _objectSpread(_objectSpread(_objectSpread({}, (0, _vuex.mapMutations)(['LOGIN', 'LOGOUT'])), (0, _vuex.mapActions)(['getUser'])), {}, {
|
||||
// 小程序快捷登录
|
||||
fastLogin: function fastLogin() {
|
||||
mpLogin: function mpLogin() {
|
||||
var _this = this;
|
||||
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
||||
var _yield$getUserInfo, _yield$getUserInfo$us, avatarUrl, nickName, gender, wxCode, _yield$authLogin, code, data, msg;
|
||||
@ -265,7 +272,7 @@ var _default = {
|
||||
if (code == 1) {
|
||||
if (data.is_new_user) {
|
||||
uni.hideLoading();
|
||||
_this.loginPopup = true;
|
||||
_this.mpLoginPopup = true;
|
||||
_this.loginData = data;
|
||||
} else {
|
||||
_this.loginHandle(data);
|
||||
@ -308,16 +315,48 @@ var _default = {
|
||||
}, _callee2);
|
||||
}))();
|
||||
},
|
||||
// 登录结果处理
|
||||
loginHandle: function loginHandle(data) {
|
||||
// 手机登录
|
||||
mobileLogin: function mobileLogin() {
|
||||
if (!this.form.allow) {
|
||||
return this.$toast({
|
||||
title: "请您先阅读并同意服务协议和隐私政策"
|
||||
});
|
||||
}
|
||||
this.mobilePopup = true;
|
||||
},
|
||||
// 更新新注册的用户信息
|
||||
handleSubmitMobile: function handleSubmitMobile(e) {
|
||||
var _this3 = this;
|
||||
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
||||
var inviteCode;
|
||||
return _regenerator.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_this3.LOGIN(data);
|
||||
(0, _app.mobileLogin)({
|
||||
mobile: e.mobile
|
||||
}).then(function (res) {
|
||||
if (res.code == 1) {
|
||||
_this3.loginHandle(res.data);
|
||||
}
|
||||
});
|
||||
case 1:
|
||||
case "end":
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3);
|
||||
}))();
|
||||
},
|
||||
// 登录结果处理
|
||||
loginHandle: function loginHandle(data) {
|
||||
var _this4 = this;
|
||||
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
||||
var inviteCode;
|
||||
return _regenerator.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
case 0:
|
||||
_this4.LOGIN(data);
|
||||
uni.hideLoading();
|
||||
inviteCode = _cache.default.get('INVITE_CODE');
|
||||
if (inviteCode) {
|
||||
@ -336,16 +375,11 @@ var _default = {
|
||||
});
|
||||
case 5:
|
||||
case "end":
|
||||
return _context3.stop();
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3);
|
||||
}, _callee4);
|
||||
}))();
|
||||
},
|
||||
mobileLogin: function mobileLogin() {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/login/mobileLogin'
|
||||
// })
|
||||
}
|
||||
}),
|
||||
computed: _objectSpread({}, (0, _vuex.mapGetters)(['appConfig']))
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"u-image": "/components/uview-ui/components/u-image/u-image",
|
||||
"u-button": "/components/uview-ui/components/u-button/u-button",
|
||||
"u-checkbox": "/components/uview-ui/components/u-checkbox/u-checkbox",
|
||||
"mplogin-popup": "/components/mplogin-popup/mplogin-popup"
|
||||
"mplogin": "/components/mplogin/mplogin",
|
||||
"mobile-login": "/components/mobile-login/mobile-login"
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<view class="login"><view class="u-flex u-row-center logo"><u-image vue-id="35a7246c-1" src="{{cloudPath+'img/login-logo.png'}}" width="574rpx" height="432rpx" bind:__l="__l"></u-image></view><view class="u-text-center text-gray"><view>小程序需要登录注册才能使用相关功能,申请获取以下权限</view><view class="u-margin-top-20">获得你的公开信息(昵称、头像、手机号码等)</view></view><view class="u-margin-top-56"><view class="u-margin-bottom-32"><u-button vue-id="35a7246c-2" hover-class="none" customStyle="{{({backgroundColor:themeColor,color:'#fff',border:'none',padding:'16rpx 0'})}}" hair-line="{{false}}" shape="circle" data-event-opts="{{[['^click',[['fastLogin']]]]}}" bind:click="__e" bind:__l="__l" vue-slots="{{['default']}}">快捷登录</u-button></view><view><u-button vue-id="35a7246c-3" hover-class="none" customStyle="{{$root.a0}}" plain="{{true}}" hair-line="{{false}}" shape="circle" data-event-opts="{{[['^click',[['mobileLogin']]]]}}" bind:click="__e" bind:__l="__l" vue-slots="{{['default']}}">手机号登录/注册</u-button></view></view><view class="u-margin-top-32 u-flex u-row-center"><view><u-checkbox bind:input="__e" vue-id="35a7246c-4" shape="circle" active-color="{{themeColor}}" value="{{form.allow}}" data-event-opts="{{[['^input',[['__set_model',['$0','allow','$event',[]],['form']]]]]}}" bind:__l="__l" vue-slots="{{['default']}}"><view class="sm row-start">已阅读并同意</view></u-checkbox></view><view class="u-flex protocol"><navigator style="{{'color:'+(themeColor)+';'}}" hover-class="none" url="/pages/server_explan/server_explan?type=0">《服务协议》</navigator>和<navigator style="{{'color:'+(themeColor)+';'}}" hover-class="none" url="/pages/server_explan/server_explan?type=1">《隐私政策》</navigator></view></view><mplogin-popup bind:close="__e" bind:update="__e" bind:input="__e" vue-id="35a7246c-5" value="{{loginPopup}}" data-event-opts="{{[['^close',[['e0']]],['^update',[['handleSubmitInfo']]],['^input',[['__set_model',['','loginPopup','$event',[]]]]]]}}" bind:__l="__l"></mplogin-popup></view>
|
||||
<view class="login"><view class="u-flex u-row-center logo"><u-image vue-id="35a7246c-1" src="{{cloudPath+'img/login-logo.png'}}" width="574rpx" height="432rpx" bind:__l="__l"></u-image></view><view class="u-text-center text-gray"><view>小程序需要登录注册才能使用相关功能,申请获取以下权限</view><view class="u-margin-top-20">获得你的公开信息(昵称、头像、手机号码等)</view></view><view class="u-margin-top-56"><view class="u-margin-bottom-32"><u-button vue-id="35a7246c-2" hover-class="none" customStyle="{{({backgroundColor:themeColor,color:'#fff',border:'none',padding:'16rpx 0'})}}" hair-line="{{false}}" shape="circle" data-event-opts="{{[['^click',[['mpLogin']]]]}}" bind:click="__e" bind:__l="__l" vue-slots="{{['default']}}">快捷登录</u-button></view><view><u-button vue-id="35a7246c-3" hover-class="none" customStyle="{{$root.a0}}" plain="{{true}}" hair-line="{{false}}" shape="circle" data-event-opts="{{[['^click',[['mobileLogin']]]]}}" bind:click="__e" bind:__l="__l" vue-slots="{{['default']}}">手机号登录/注册</u-button></view></view><view class="u-margin-top-32 u-flex u-row-center"><view><u-checkbox bind:input="__e" vue-id="35a7246c-4" shape="circle" active-color="{{themeColor}}" value="{{form.allow}}" data-event-opts="{{[['^input',[['__set_model',['$0','allow','$event',[]],['form']]]]]}}" bind:__l="__l" vue-slots="{{['default']}}"><view class="sm row-start">已阅读并同意</view></u-checkbox></view><view class="u-flex protocol"><navigator style="{{'color:'+(themeColor)+';'}}" hover-class="none" url="/pages/server_explan/server_explan?type=0">《服务协议》</navigator>和<navigator style="{{'color:'+(themeColor)+';'}}" hover-class="none" url="/pages/server_explan/server_explan?type=1">《隐私政策》</navigator></view></view><mplogin bind:close="__e" bind:update="__e" bind:input="__e" vue-id="35a7246c-5" value="{{mpLoginPopup}}" data-event-opts="{{[['^close',[['e0']]],['^update',[['handleSubmitInfo']]],['^input',[['__set_model',['','mpLoginPopup','$event',[]]]]]]}}" bind:__l="__l"></mplogin><mobile-login bind:close="__e" bind:update="__e" bind:input="__e" vue-id="35a7246c-6" value="{{mobilePopup}}" data-event-opts="{{[['^close',[['e1']]],['^update',[['handleSubmitMobile']]],['^input',[['__set_model',['','mobilePopup','$event',[]]]]]]}}" bind:__l="__l"></mobile-login></view>
|
||||
@ -101,16 +101,16 @@ var components
|
||||
try {
|
||||
components = {
|
||||
uForm: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-form/u-form */ "components/uview-ui/components/u-form/u-form").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-form/u-form.vue */ 148))
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-form/u-form */ "components/uview-ui/components/u-form/u-form").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-form/u-form.vue */ 162))
|
||||
},
|
||||
uFormItem: function () {
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-form-item/u-form-item */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-form-item/u-form-item")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-form-item/u-form-item.vue */ 155))
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-form-item/u-form-item */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-form-item/u-form-item")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-form-item/u-form-item.vue */ 169))
|
||||
},
|
||||
uInput: function () {
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-input/u-input */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-input/u-input")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-input/u-input.vue */ 166))
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-input/u-input */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-input/u-input")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-input/u-input.vue */ 180))
|
||||
},
|
||||
uVerificationCode: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-verification-code/u-verification-code */ "components/uview-ui/components/u-verification-code/u-verification-code").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-verification-code/u-verification-code.vue */ 173))
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-verification-code/u-verification-code */ "components/uview-ui/components/u-verification-code/u-verification-code").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-verification-code/u-verification-code.vue */ 187))
|
||||
},
|
||||
uButton: function () {
|
||||
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-button/u-button */ "components/uview-ui/components/u-button/u-button").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-button/u-button.vue */ 127))
|
||||
|
||||
@ -101,7 +101,7 @@ var components
|
||||
try {
|
||||
components = {
|
||||
uParse: function () {
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-parse/u-parse */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-parse/u-parse")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-parse/u-parse.vue */ 180))
|
||||
return Promise.all(/*! import() | components/uview-ui/components/u-parse/u-parse */[__webpack_require__.e("common/vendor"), __webpack_require__.e("components/uview-ui/components/u-parse/u-parse")]).then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-parse/u-parse.vue */ 194))
|
||||
},
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user