123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <view class="content">
- <view class="title">
- <text class="thing" style="width: 100rpx;"></text>
- <text class="name">用户登录</text>
- <text class="thing" style="width: 300rpx;"></text>
- </view>
- <view class="form-box">
- <view class="row-input">
- <u-icon name="account" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>
- <input v-model="account" placeholder="请输入用户账号" maxlength="18" clearable />
- </view>
- <view class="row-input">
- <u-icon name="lock" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>
- <input v-model="password" placeholder="登陆密码" clearable :password="!isShowPassword" />
- <u-icon name="eye-fill" color="#2979ff" size="50" style="padding-right:20rpx" v-if="isShowPassword"
- @click="showOrHide"></u-icon>
- <u-icon name="eye-off" color="#2979ff" size="50" style="padding-right:0rpx" v-else @click="showOrHide">
- </u-icon>
- </view>
- <!-- <view class="rowinputcaptcha">
- <u-icon name="hourglass" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>
- <input class="captchainput" v-model="captcha" placeholder="验证码"/>
- <u--image :showLoading="true" :src="captchaPath" width="150px" height="35px" @click="getCaptcha"></u--image>
- </view> -->
- <view class="menu-link">
- <text @click="forget">找回密码</text>
- </view>
- <view class="login-btn" @click="loginbtn">登录</view>
- <view class="tip-link">
- 还没有账号?<text @click="register">注册</text>
- </view>
- </view>
- <u-toast ref="uToast" />
-
- </view>
- </template>
- <script>
-
-
-
-
-
-
-
- export default {
-
- data() {
- return {
- isShowPassword: false,
- account: '',
- password: '',
- captcha: '',
- uuid: '',
- captchaPath: '',
- }
- },
- onLoad() {
-
- },
- onUnload() {
-
- uni.$emit('ly-show-watermark');
- },
- methods: {
-
-
-
-
-
- loginbtn() {
- if (this.account == '') {
- this.$refs.uToast.show({
- type: 'error',
- message: "请输入账号",
- })
-
-
-
-
-
- } else if (this.password == '') {
- this.$refs.uToast.show({
- type: 'error',
- message: "请输入密码",
- })
- }
- let formData = {
- username: this.account,
- password: this.password,
-
-
- }
-
- this.$api.post('/login', formData)
- .then(res => {
- if (res.data.code == 0) {
- uni.setStorageSync('tokendata', res.data.data.token);
- uni.setStorageSync('Userinformation', formData);
-
- Promise.all([this.getpermissions(), this.getDictList(), this.getuserInfo(), ]).then(() => {
-
-
-
-
-
-
- uni.navigateTo({
- url: '/pages/index/index'
- })
- });
- } else {
- this.$refs.uToast.show({
- type: 'error',
- message: "账号或者密码错误,请重新输入",
- })
- }
- })
- },
- getpermissions() {
- console.log('权限功能', )
-
- return new Promise((resolve, reject) => {
- this.$api.get('/menu/permissions', {}).then((res) => {
- uni.setStorageSync('ButtonPermissions', res.data.data);
- resolve(res);
-
- }).catch(e => {
- reject(e)
- })
- });
-
-
-
-
- },
- getDictList() {
-
- return new Promise((resolve, reject) => {
- this.$api.get('/all', {}).then((res) => {
- uni.setStorageSync('getDictDataList', res.data.data);
- resolve(res);
-
- }).catch(e => {
- reject(e)
- })
- });
-
-
-
-
-
- },
- getuserInfo() {
-
- return new Promise((resolve, reject) => {
- this.$api.get('/user/userInfo', {}).then((res) => {
- uni.setStorageSync('getuserInfo', res.data.data);
- resolve(res);
-
- }).catch(e => {
- reject(e)
- })
- });
-
-
-
-
-
- },
-
- showOrHide() {
- this.isShowPassword = !this.isShowPassword
- },
-
- forget() {
- uni.navigateTo({
- url: '/pages/login/forget',
- success: res => {},
- fail: () => {},
- complete: () => {},
- })
- },
-
- register() {
- uni.navigateTo({
- url: '/pages/login/register',
- success: res => {},
- fail: () => {},
- complete: () => {},
- })
- }
- }
- }
- </script>
- <style lang="scss">
-
-
- page {
- background-color: #0b0c14;
- }
- .content {
- padding: 100rpx 40rpx;
- }
- .title {
- display: flex;
- flex-direction: column;
- height: 200rpx;
- .thing {
- height: 8rpx;
- background-image: linear-gradient(to right, #3feaea, #0168e6);
- }
- .name {
- font-weight: bold;
- font-size: 50rpx;
- line-height: 120rpx;
- background: linear-gradient(to right, #3feaea, blue);
- background-clip: text;
- color: transparent;
- letter-spacing: 5rpx;
- }
- }
- .form-box {
- .rowinputcaptcha {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- height: 110rpx;
-
- border-radius: 8rpx;
- margin-bottom: 50rpx;
- input {
- width: 300rpx;
- font-size: 30rpx;
- color: #a1a2a3;
- }
- }
- .row-input {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- height: 110rpx;
- background-color: #2b2f41;
- border-radius: 8rpx;
- margin-bottom: 50rpx;
- image {
- margin: 0 30rpx;
- flex-shrink: 0;
- width: 38rpx;
- height: 38rpx;
- }
- input {
- width: 460rpx;
- font-size: 30rpx;
- color: #a1a2a3;
- }
- }
- .menu-link {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- font-size: 28rpx;
- color: #676c7f;
- }
- .login-btn {
- margin-top: 60rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 35rpx;
- letter-spacing: 15rpx;
- color: #FFFFFF;
- height: 110rpx;
- border-radius: 8rpx;
- background-image: linear-gradient(to right, #3feaea, #0168e6);
- }
- .tip-link {
- position: fixed;
- letter-spacing: 4rpx;
- bottom: 50rpx;
- left: 40rpx;
- font-size: 28rpx;
- color: #a1a2a3;
- text {
- padding-left: 10rpx;
- color: #226ef0;
- }
- }
- }
- .captchainput {
- width: 300rpx;
- }
- </style>
|