| | |
| | | </u-form-item>
|
| | |
|
| | | <u-form-item label="密码" prop="password" borderBottom ref="item1">
|
| | | <u-input v-model="model.password" placeholder="请输入密码" border="none" clearable></u-input>
|
| | | <u-input type="password" v-model="model.password" placeholder="请输入密码" border="none" clearable>
|
| | | </u-input>
|
| | | </u-form-item>
|
| | |
|
| | | </view>
|
| | |
| | | };
|
| | | },
|
| | | onLoad() {
|
| | | const account = uni.getStorageSync('account');
|
| | | if (account) {
|
| | | this.model = account
|
| | | }
|
| | |
|
| | | },
|
| | |
|
| | | methods: {
|
| | | submit() { |
| | | |
| | | forget() {
|
| | | uni.navigateTo({
|
| | | url: "/pages/tabBar/demo"
|
| | | })
|
| | | },
|
| | | submit() {
|
| | |
|
| | | this.$refs.form.validate().then(res => {
|
| | | uni.$u.toast('校验通过')
|
| | | //this.login() |
| | | uni.switchTab({ |
| | | url:'/pages/tabBar/general' |
| | | })
|
| | | this.login()
|
| | |
|
| | | }).catch(errors => {
|
| | | uni.$u.toast('校验失败')
|
| | | })
|
| | | },
|
| | | login() {
|
| | | this.$api.test({
|
| | | id: 4
|
| | | }).then((res) => {
|
| | | |
| | | console.log('request success', res)
|
| | | uni.showToast({
|
| | | title: '请求成功',
|
| | | icon: 'success',
|
| | | mask: true
|
| | | }); |
| | | |
| | | uni.switchTab({ |
| | | url:'/pages/tabBar/general' |
| | | })
|
| | | this.$api.login(this.model).then((res) => {
|
| | | if (res.success) {
|
| | |
|
| | | console.log('request success', res)
|
| | | uni.showToast({
|
| | | title: '登录成功',
|
| | | icon: 'success',
|
| | | mask: true
|
| | | });
|
| | |
|
| | | uni.setStorageSync('account', this.model);
|
| | | uni.setStorageSync('userinfo', res.result.userInfo);
|
| | | uni.setStorageSync('token', res.result.token);
|
| | |
|
| | | uni.switchTab({
|
| | | url: '/pages/tabBar/general'
|
| | | })
|
| | | }else {
|
| | | uni.showToast({
|
| | | title: res.message,
|
| | | icon: 'none',
|
| | | mask: true
|
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | }).catch((err) => {
|
| | | |
| | |
|
| | | console.log('request fail', err);
|
| | | })
|
| | | },
|