| | |
| | | data() {
|
| | | return {
|
| | | model: {
|
| | | username: "",
|
| | | password: ""
|
| | | username: "tongjitang",
|
| | | password: "123456"
|
| | | },
|
| | | rules: {
|
| | | 'username': {
|
| | |
| | | },
|
| | |
|
| | | methods: {
|
| | | |
| | | forget() {
|
| | | uni.navigateTo({
|
| | | url: "/pages/tabBar/demo"
|
| | | })
|
| | | },
|
| | | submit() {
|
| | |
|
| | | if (this.model.username.startsWith("http")) {
|
| | | uni.setStorageSync('baseurl', this.model.username);
|
| | | this.model.username = null
|
| | |
| | | this.$api.login(this.model).then((res) => {
|
| | | if (res.success) {
|
| | |
|
| | |
|
| | | console.log('request success', res)
|
| | | uni.showToast({
|
| | | title: '登录成功',
|
| | |
| | | uni.setStorageSync('userinfo', res.result.userInfo);
|
| | | uni.setStorageSync('token', res.result.token);
|
| | |
|
| | |
|
| | | uni.switchTab({
|
| | | url: '/pages/tabBar/general'
|
| | | })
|