| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <view class="login">
- <image src="../../static/logo.png" mode="" class="pictures"></image>
- <view class="form">
- <van-field label="用户名" :value="userName" placeholder="请输入用户名" @change="getName" />
- <van-field label="密码" type="password" :value="passWord" placeholder="请输入密码" @change="getWord" />
- <view class="btn">
- <van-button type="danger" @click.native="goHome">注册用户</van-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- toRegister
- } from '@/api/user.js';
- import {
- encrypto
- } from '@/utils/cryptojs.js';
- export default {
- data() {
- return {
- userName: '',
- passWord: ''
- }
- },
- methods: {
- getName(event) {
- this.userName = event.detail;
- },
- getWord(event) {
- this.passWord = event.detail;
- },
- goHome() {
- console.log(this.userName, this.passWord)
- toRegister({
- userName: this.userName,
- passWord: encrypto(this.passWord)
- }).then(res => {
- if(res.code = '00000') {
- uni.navigateTo({
- url:"/pages/login/login"
- })
- }
- }).catch(err => {
- console.log(err, '失败')
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .login {
- width: 100%;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- .pictures {
- width: 300rpx;
- height: 300rpx;
- margin: 200rpx 0 100rpx;
- }
- ::v-deep .van-button--normal {
- width: 100%;
- margin: 50rpx 0;
- }
- }
- </style>
|