| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <view>
- <view style="padding: 77rpx 77rpx 0rpx;box-sizing: border-box;">
- <!--pages/authorize/authorize.wxml-->
- <block>
- <view class="authorize-title">
- <view>您好,</view>
- <view>欢迎使用皮小电商家版</view>
- </view>
- <view style="margin-top: 50rpx;">
- <view class="input-box">
- <input v-model="userName" placeholder="请输入账号"/>
- </view>
- <view class="input-box ddflex">
- <input v-model="passWord" type="text" class="fflex" :password="!showPassword" placeholder="请输入密码" value="" />
- <view style="padding: 10rpx;">
- <image v-if="showPassword" @click="showPassword=false" style="width: 34rpx;height: 15rpx;margin-left: 10rpx;" src="../../static/pages/images/close-eyes.png"></image>
- <image v-else @click="showPassword=true" style="width: 31rpx;height: 23rpx;margin-left: 10rpx;" src="../../static/pages/images/open-eyes.png"></image>
- </view>
- </view>
- </view>
-
- <button class="login" @click="submitLogin()">授权登录</button>
-
- </block>
-
- </view>
- <view class="dflex" style="margin: 0 77rpx 0 47rpx;">
- <view v-if='agree' class="agree-icon" @click="agree=false">
- <image style="width: 100%;height: 100%;" src="../../static/pages/images/agree_h.png" ></image>
- </view>
- <view v-else class="agree-icon" @click="agree=true">
- <image style="width: 100%;height: 100%;" src="../../static/pages/images/agree.png" ></image>
- </view>
- <view hover-class="none" class="xieyi fflex">
- 已阅读并同意
- <text @click="jump('/mine/page/page?title=用户协议&isXieyi=true')">《皮小电用户服务协议》</text>
- 与
- <text @click="jump('/mine/page/page?title=隐私声明&isYinsi=true')">《皮小电隐私协议》</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- // pages/authorize/authorize.js
- const app = getApp();
- const req = require('../../utils/request.js');
- export default {
- data() {
- return {
- showPassword:false,
- agree:false,
- userName:'',
- passWord:''
- };
- },
- components: {},
- props: {},
- onLoad: function(options) {
- this.userName = req.getStorage('userName')?req.getStorage('userName'):'';
- this.passWord = req.getStorage('passWord')?req.getStorage('passWord'):'';
- },
- onShow: function() {
- },
- onUnload: function() {
-
- },
- methods: {
- jump(url) {
- uni.navigateTo({
- url: url
- });
- },
- submitLogin(){
- if(!this.userName) return req.msg('请输入账号')
- if(!this.passWord) return req.msg('请输入密码')
- if(!this.agree) return req.msg('请阅读以下协议')
-
- let dataP = {
- account:this.userName,
- password:this.passWord
- }
-
- req.postRequest('/admin/v2/login',dataP,res=>{
- let params = res;
- req.setStorage('userInfo', params);
- req.setStorage('AUTH_TOKEN', params.token);
- console.log(params.token)
- req.msg('登陆成功')
- req.setStorage('userName', this.userName);
- req.setStorage('passWord', this.passWord);
- uni.$emit('reSetLogin',true)
- setTimeout(()=>{
- uni.navigateBack()
- },500)
- })
- }
- }
- };
- </script>
- <style>
- @import './authorize.css';
- </style>
|