1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

修改小程序目录,删除示例小程序

This commit is contained in:
2022-11-24 00:01:57 +08:00
parent abd8f20716
commit 396cbdb95d
200 changed files with 24 additions and 5690 deletions

View File

@@ -0,0 +1,85 @@
<template>
<!--pages/login/login.wxml-->
<view class="container">
<view class="login-icon">
<image class="login-img" src="../../image/icon/login-background.svg"></image>
</view>
<view class="login-from">
<view class="inputView">
<!--账号-->
<input v-model="username" class="inputText" placeholder="账号" />
<!--密码-->
<input v-model="password" class="inputText" placeholder="密码" password="true" />
</view>
<view class="loginBtnView">
<!--按钮-->
<button class="loginBtn" type="primary" @tap="login">登录</button>
<button class="loginBtn" type="secondary" bindtap="visitor">访客申请</button>
</view>
</view>
</view>
</template>
<script>
import Taro from '@tarojs/taro'
import './login.css'
export default {
data() {
return {
...Taro.getApp().globalData,
username: '',
password: ''
}
},
methods: {
login() {
if (this.username == '' || this.password == '') {
Taro.showToast({
title: "请完善登录信息",
icon: 'error',
duration: 2000
})
} else {
Taro.request({
url: `${this.baseUrl}/user/login`,
data: {
username: this.username,
password: this.password,
},
success: function (d) {
let data = d.data;
if (data.code == 200) {
if (data.status == "success") {
Taro.setStorageSync("userInfo", data.userInfo);
console.log("userInfo", Taro.getStorageSync("userInfo"))
Taro.showToast({
title: "登录成功",
icon: 'success',
success: function () {
Taro.redirectTo({
url: '/pages/index/index'
})
}
})
} else {
Taro.showToast({
title: data.msg,
icon: 'error'
})
}
} else {
Taro.showToast({
title: data.msg,
icon: 'error',
duration: 2000
})
}
}
})
}
}
}
}
</script>