| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544 |
- <template>
- <view class="border-box">
- <view class="content x-c">
- <!-- <image class="backImg" @tap="goBack()" src="../../static/images/icon_close.png"></image> -->
- <view class="pageTop x-c">
- <view class="loginBox">
- <view class="logo">
- <image src="/static/logo_icon2.png"></image>
- </view>
- <view class="head-title">御君方门店系统</view>
- <view class="login-item">
- <view class="input-account" :class="{'input-active': accountActive }">
- <input v-model="account" placeholder="账号" type="text" @focus="changeText('accountActive',true)" @blur="changeText('accountActive',false)"/>
- </view>
- </view>
- <view class="login-item">
- <view class="input-pwd" :class="{'input-active': pwdActive }">
- <input v-model="password" placeholder="密码" ref="input" type="text" :password="isClose" @focus="changeText('pwdActive',true)" @blur="changeText('pwdActive',false)"/>
- <view class="close-pwd" @click="closePwd">
- <image :src="isClose?'/static/image/device/eye_close_icon36.png':'/static/image/device/eye_open_icon36.png'"></image>
- </view>
- </view>
- </view>
- <view class="login-item flexCenter">
- <view class="input-code" :class="{ 'input-active': codeActive }">
- <input v-model="code" placeholder="验证码" type="text" @focus="changeText('codeActive',true)" @blur="changeText('codeActive',false)"/>
- </view>
- <view class="input-yzcode">
- <image :src="codeImg" @click="getCode"></image>
- </view>
- </view>
- <view class="checkbox">
- <!-- <view class="checkbox-icon" @tap="handleAgree">
- <image src="../../static/image/login/radio_default.png" v-show="!agree"></image>
- <image src="../../static/image/login/radio_choose.png" v-show="agree"></image>
- </view>
- <view>记住密码</view> -->
- <checkbox-group @tap="handlePwd">
- <label>
- <checkbox borderColor="#E0E3EE" iconColor="#8F6726" v-model="agree" :checked="agree" />
- 记住密码
- </label>
- </checkbox-group>
- </view>
- <view class="btns">
- <view class="login-btn" @click="login">登录</view>
- </view>
- </view>
- </view>
-
- <!-- <view class="pageBottom" v-if="isApp && isAgreePrivacy">
- <view class="tips y-f"> — 快捷登录 — </view>
- <view class="menu x-ac">
- <view v-if="wxIsInstalled" @tap="loginWeixin" ><image src="/static/image/login/weixin.png"></image></view>
- <view v-if="isIos" @tap="quickAppleLogin" ><image src="/static/image/login/apple.png"></image></view>
- <view><image src="/static/image/login/qq.png"></image></view>
- <view><image src="/static/image/login/weibo.png"></image></view>
- </view>
- </view> -->
- <!-- <view class="checkbox">
- <view class="checkbox-icon" @tap="handleAgree">
- <image src="../../static/image/login/radio_default.png" v-show="!agree"></image>
- <image src="../../static/image/login/radio_choose.png" v-show="agree"></image>
- </view>
- <view>我已阅读并同意<text @tap="goToWeb(0)">《用户协议》</text><text @tap="goToWeb(1)">《隐私政策》</text> 并使用本机号码登录</view>
- </view> -->
- </view>
- </view>
- </template>
- <script>
- import { login, loginByWeChat, getUserInfo, loginByApple, setPhone, getCode } from '@/api/user';
- export default {
- data() {
- return {
- isClose:true,
- userName: '测试企业',
- account: '测试企业',
- password: 'admin1122..',
- registrationID: '',
- unionid: '',
- userPhone: '',
- loginType: 0,
- isApp: false,
- agree: false,
- isAgreePrivacy: false,
- isIos: false,
- from: '',
- source: '',
- appleKey: '',
- wxIsInstalled: false,
- code: '',
- codeImg: '',
- uuid: '',
- // 激活状态变量
- accountActive: false,
- pwdActive: false,
- codeActive: false
- };
- },
- onLoad(option) {
- var token=uni.getStorageSync('AppToken');
- if(token){
- var user=JSON.parse(uni.getStorageSync('userInfo'));
- this.account=user.userName
- this.password=uni.getStorageSync('password');
- }
-
-
- },
- onShow() {
- this.getCode();
-
- },
- onUnload() {
- uni.$off('getRegistrationID');
- },
- mounted() {
-
- },
- methods: {
- getCode(){
- getCode().then(res => {
- console.log('code')
- uni.hideLoading();
- if(res.code==200){
- // console.log('code',res)
- this.codeImg='data:image/png;base64,'+res.img
- this.uuid=res.uuid
- }
- else{
- uni.showToast({title: res.msg,icon: 'none'});
- }
- },
- (rej) => {
- uni.hideLoading();
- console.log('qxj rej:' + JSON.stringify(rej));
- }
- );
- },
- initUniverify() {
- const callback = (res) => {
- // 获取一键登录弹框协议勾选状态
- univerifyManager.getCheckBoxState({
- success(res) {
- if (res.state) {
- // 关闭一键登录弹框
- univerifyManager.close();
- }
- }
- });
- };
- // 订阅自定义按钮点击事件
- univerifyManager.onButtonsClick(callback);
- // 取消订阅自定义按钮点击事件
- univerifyManager.offButtonsClick(callback);
- },
- changeText(val,value){
- this[val]=value
- },
- closePwd(){
- this.isClose=!this.isClose
- },
- handlePwd(){
- this.agree=!this.agree
- },
- login() {
- if (this.$isEmpty(this.account)) {
- uni.showToast({
- title: '请输入帐号',
- icon: 'none'
- });
- return;
- }
- if (this.$isEmpty(this.password)) {
- uni.showToast({
- title: '请输入密码',
- icon: 'none'
- });
- return;
- }
- if (this.$isEmpty(this.code)) {
- uni.showToast({
- title: '请输入验证码',
- icon: 'none'
- });
- return;
- }
-
- var data = {
- account: this.account,
- password: this.password,
- uuid: this.uuid,
- code: this.code
- };
- var that = this;
- uni.showLoading({
- title: '处理中...'
- });
- login(data).then(
- (res) => {
- uni.hideLoading();
- if (res.code == 200) {
- uni.setStorageSync('AppToken', res.data.token);
- uni.setStorageSync('userInfo', JSON.stringify(res.data.user));
- if (this.agree) {
- uni.setStorageSync('password', data.password);
- } else {
- uni.setStorageSync('password', null);
- }
-
- uni.redirectTo({
- url: '/pages/index/index'
- });
- } else {
- uni.showToast({ title: res.msg, icon: 'none' });
- this.code = '';
- this.getCode();
- }
- },
- (rej) => {
- uni.hideLoading();
- console.log('qxj rej:' + JSON.stringify(rej));
- }
- );
- },
- goToRegister() {
- this.$navTo('./register');
- },
- goToFindPass() {
- this.$navTo('./findpass');
- }
- }
- };
- </script>
- <style scoped lang="scss">
- page {
- background-color: #ffffff;
- }
- .border-box {
- width: 100vw;
- height: 100vh;
- background-image: url(/static/image/device/ipad_yjf_boder.png);
- background-repeat: no-repeat;
- position: relative;
- background-size: 100% 100%;
- box-sizing: border-box;
- padding: 10px;
- }
- .content {
- display: flex;
- width: 100%;
- height: 100%;
- background-image: url(/static/image/device/ipad_yjf_bg.png);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- position: relative;
- }
- .backImg {
- position: absolute;
- left: 30px;
- top: 40px;
- height: 30px;
- width: 30px;
- }
- .pageTop {
- flex: 1;
- display: flex;
- flex-direction: column;
- width: 100%;
- }
- .content .head {
- text-align: center;
- width: 100%;
- height: 100px;
- // background:url(/static/image/login/top_bg.png) no-repeat 0 center;
- background-size: cover;
- box-sizing: border-box;
- font-size: 36px;
- font-weight: bold;
- color: #666;
- }
- .content .head image {
- width: 150px;
- height: 150px;
- border-radius: 10px;
- box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
- }
- .title {
- color: #141414;
- margin: 50upx 0upx 30upx 0px;
- font-size: 38px;
- font-weight: 500;
- }
- .desc {
- color: #686866;
- padding: 0 0 30px 0px;
- font-size: 28px;
- }
- .logo {
- width: 110px;
- height: 110px;
- background: #8f6726;
- border-radius: 150%;
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- z-index: 10;
- top: -60px;
- left: 50%;
- transform: translateX(-50%);
- image {
- width: 74px;
- height: 74px;
- }
- }
- .head-title {
- font-family: Source Han Serif CN, Source Han Serif CN;
- font-weight: bold;
- font-size: 36px;
- color: #222222;
- text-align: center;
- font-style: normal;
- margin-bottom: 30px;
- }
- .flexCenter {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .loginBox {
- padding: 67px 44px 44px;
- // width: calc(60%);
- background: #fdfdfd;
- z-index: 10;
- position: relative;
- border-radius: 24px;
- .login-item {}
- .login-item p {
- text-align: left;
- }
- .line {
- height: 0.5px;
- background-color: #efefef;
- margin-top: 10px;
- }
-
- input {
- margin-left: 80px;
- height: 52px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 18px;
- color: #a8aaac;
- text-align: left;
- line-height: 52px;
- }
-
- .input-account {
- margin-top: 10px;
- margin-bottom: 0px;
- border-radius: 12px;
- border: 1px solid #e0e3ee;
- height: 52px;
- width: 100%;
- background: url(/static/image/device/user_icon36.png) no-repeat 0 center;
- background-size: 27px 27px;
- background-position: 27px;
-
-
- }
- .input-pwd {
- margin-top: 20px;
- // margin-bottom: 20px;
- border-radius: 12px;
- border: 1px solid #e0e3ee;
- height: 52px;
- width: 100%;
- background: url(/static/image/device/password_icon36.png) no-repeat 0 center;
- background-size: 27px 27px;
- background-position: 27px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .close-pwd{
- margin-right: 40px;
- display: flex;
- align-items: center;
- justify-content: center;
- // margin-top: 10px;
- image{
- width: 27px;
- height: 27px;
- }
-
- }
- }
-
- .input-code {
- margin-top: 20px;
- margin-right: 20px;
- margin-bottom: 20px;
- border-radius: 12px;
- border: 1px solid #e0e3ee;
- height: 52px;
- width: 100%;
- background: url(/static/image/device/code_icon36.png) no-repeat 0 center;
- background-size: 27px 27px;
- background-position: 27px;
- }
- .input-yzcode {
- margin-top: 20px;
- margin-bottom: 20px;
- width: 200px;
- height: 52px;
- image {
- width: 100%;
- height: 100%;
- }
-
- }
-
- .reg-box {
- padding-bottom: 20px;
- margin: 0 10px;
- .reg-btn {
- font-size: 16px;
- color: #ff5c03;
- }
- }
- }
- /* 激活状态样式(核心) */
- .input-active {
- border:1px solid #8F6726 !important; /* 激活时边框色(示例:蓝色) */
- }
- .input-active input {
- caret-color: #8F6726; /* 激活时光标色(与边框色一致) */
- }
- .btns {
- margin-top: 30rpx;
- }
- .login-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 65px;
- background: #8f6726;
- border-radius: 12px;
- font-size: 24px;
- font-family: PingFang SC;
- font-weight: 500;
- color: rgba(255, 255, 255, 1);
- }
- .pageBottom {
- height: 220px;
- width: 75%;
- display: flex;
- flex-direction: column;
- position: absolute;
- bottom: 100px;
- }
- .tips {
- color: #999;
- font-size: 32px;
- }
- .menu {
- margin-top: 30px;
- image {
- width: 96px;
- height: 96px;
- }
- }
- .checkbox {
- // margin: 20px;
- margin-top: 20px;
- display: flex;
- // flex-direction: row;
- align-items: center;
- // justify-content: flex-start;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 18px;
- color: #999999;
- // line-height: 38px;
- text-align: left;
- .uni-label-pointer{
- display: flex;
- // flex-direction: row;
- align-items: center;
- }
- text {
- color: #8f6726;
- }
- &-icon {
- flex-shrink: 0;
- margin-right: 15px;
- image {
- height: 24px;
- width: 24px;
- }
- }
- }
- // 响应式适配 - 针对不同屏幕尺寸调整
- // 小屏手机
- @media (max-width: 412px) {
- .login-panel {
- padding: 80px 30px 40px;
- .head-title {
- font-size: 40px;
- margin-bottom: 40px;
- }
- }
- $spacing: 20px;
- $input-height: 80px;
-
-
- .loginBox {
- padding: 90px 60px 60px;
- width: calc(80%);
- }
-
- }
- </style>
|