|
|
@@ -1,6 +1,38 @@
|
|
|
<template>
|
|
|
<view class="app-main app-content">
|
|
|
- <loginModel @comfirm="loginFun" @mobileLogin="mobileLogin"></loginModel>
|
|
|
+ <view class="model">
|
|
|
+ <view class="experFrame">
|
|
|
+ <view>
|
|
|
+ <view style="text-align:center;margin-bottom:20upx;">
|
|
|
+ <image :src="`${constant.imgUrl}/logo3.png`" class="logo" mode="widthFix"></image>
|
|
|
+ </view>
|
|
|
+ <view style="color:#666666;text-align:center;margin-bottom:50upx;font-size:35upx;">销花宝</view>
|
|
|
+ <view>
|
|
|
+ <input @focus="mobile=''" v-model="mobile" class="experInput" placeholder="手机号" type="number" />
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <input @focus="password=''" v-model="password" class="experInput" placeholder="密码" type="password" />
|
|
|
+ </view>
|
|
|
+ <view style="margin-top:50upx;">
|
|
|
+ <button class="admin-button-com small default buttonText" @click="loginFun">登陆</button>
|
|
|
+ </view>
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
+ <view style="margin-top:35upx;">
|
|
|
+ <button class="admin-button-com small buttonText" style="background-color:#2BA245;border-color:#2BA245;color:white;"
|
|
|
+ open-type="getPhoneNumber" @getphonenumber="wxPhoneLogin">微信手机号一键登录</button>
|
|
|
+ </view>
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <view style="margin-top:35upx;">
|
|
|
+ <button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
|
|
|
+ </view>
|
|
|
+ <!-- #endif -->
|
|
|
+ <view style="margin-top:60upx;color:#999999;width:88%;font-size:30upx;">
|
|
|
+ <text style="float:right;" @click="pageTo({url: '/pagesClient/official/apply',type:2})">注册帐号</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -10,7 +42,7 @@ import loginModel from "@/components/login-model";
|
|
|
import {appLogin} from '@/api/common'
|
|
|
import { getDictionaries } from '@/api/mini'
|
|
|
import { replaceClientId } from '@/api/admin'
|
|
|
-import { phoneLogin } from "@/api/auth";
|
|
|
+import { phoneLogin,wxMobileLogin } from "@/api/auth";
|
|
|
export default {
|
|
|
name: "login",
|
|
|
components: {
|
|
|
@@ -19,12 +51,58 @@ export default {
|
|
|
mixins: [],
|
|
|
data() {
|
|
|
return {
|
|
|
+ mobile:'',
|
|
|
+ password:''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['setUserShopAll']),
|
|
|
+ wxPhoneLogin(e){
|
|
|
+ let that = this
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
|
+ wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
|
|
|
+ let token = subRes.data.token || ''
|
|
|
+ uni.hideLoading()
|
|
|
+ if (that.$util.isEmpty(token)) {
|
|
|
+ that.$msg('请先注册')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
+ if(subRes.code == 1){
|
|
|
+ if (that.$util.isEmpty(subRes)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.setStorageSync('token', subRes.data.token)
|
|
|
+ uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
+ getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
+ if (that.$util.isEmpty(res)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
+ that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
+ })
|
|
|
+ that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
+ getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
+ that.setUserShopAll()
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ //保存安卓的clientId
|
|
|
+ let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
|
|
|
+ const clientInfo = plus.push.getClientInfo()
|
|
|
+ let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
+ if(hasClientId == '' || hasClientId != currentClientId){
|
|
|
+ replaceClientId({id:currentClientId})
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$msg("登录失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
mobileLogin(){
|
|
|
let that = this
|
|
|
uni.showLoading({mask:true})
|
|
|
@@ -96,8 +174,22 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- loginFun(mobile,password){
|
|
|
+ loginFun(){
|
|
|
let that = this
|
|
|
+ let mobile = this.mobile
|
|
|
+ let password = this.password
|
|
|
+ if (that.$util.isEmpty(mobile)) {
|
|
|
+ this.$msg('请输入手机号')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.$util.checkMobile(mobile) == false){
|
|
|
+ this.$msg('请输入正确手机号')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.$util.isEmpty(password)) {
|
|
|
+ this.$msg('请输入密码')
|
|
|
+ return false
|
|
|
+ }
|
|
|
uni.showLoading({mask:true})
|
|
|
//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
appLogin({mobile,password}).then(subRes=>{
|
|
|
@@ -136,4 +228,73 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
+.model {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 9999;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+ color: #fff;
|
|
|
+ overflow: hidden;
|
|
|
+ text-align: center;
|
|
|
+ & > .noData_img {
|
|
|
+ width: 318upx;
|
|
|
+ height: 318upx;
|
|
|
+ margin: 332upx auto 0;
|
|
|
+ }
|
|
|
+ & > .no_data_text {
|
|
|
+ font-size: 32upx;
|
|
|
+ color: #ffffff;
|
|
|
+ text-align: center;
|
|
|
+ margin: 50upx 0;
|
|
|
+ }
|
|
|
+ & > .freeApply {
|
|
|
+ width: 376upx;
|
|
|
+ height: 88upx;
|
|
|
+ line-height: 88upx;
|
|
|
+ background: linear-gradient(90deg, #3385ff, #33b0ff);
|
|
|
+ border-radius: 44upx;
|
|
|
+ margin: 0 auto;
|
|
|
+ font-size: 32upx;
|
|
|
+ color: #ffffff;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ &>.experience{
|
|
|
+ margin-top: 40upx;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 30upx;
|
|
|
+ }
|
|
|
+ &>.experFrame{
|
|
|
+ margin-top: 90upx;
|
|
|
+ height: 50upx;
|
|
|
+ .experInput{
|
|
|
+ height: 80upx;
|
|
|
+ width: 80%;
|
|
|
+ margin-bottom:38upx;
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: middle;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ border:none;
|
|
|
+ border-bottom: 1px solid #CCCCCC;
|
|
|
+ color: #666;
|
|
|
+ padding-left: 20upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ .buttonText{
|
|
|
+ display: inline-block;
|
|
|
+ line-height:92upx;
|
|
|
+ padding: 0 20upx;
|
|
|
+ vertical-align: middle;
|
|
|
+ font-size: 32upx;
|
|
|
+ width: 80%;
|
|
|
+ height:90upx;
|
|
|
+ }
|
|
|
+ .logo{
|
|
|
+ width:180upx;
|
|
|
+ margin:0 auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|