Commit 28d87042 by 李伟康

commit 修改img

1 parent 87f7f087
import http from '../request/http'
module.exports = {
getSmsCode (data) {
/**获取短信 */
getSmsCode (data = {}) {
data.projectName = 'boutique'
return http.fetch('dj.api.smartcarlife.sms.get.code', data)
},
/**手机验证码登录 */
smsLogin (data = {}) {
data.projectName = 'boutique'
data.source = 'MINIAPP'
data.productCode = 'PC00c2'
return http.fetch('dj.api.smartcarlife.sms.login', data)
},
/**获取当前登录账号能查看的园区店列表 */
getYQList () {
return http.fetch('dj.api.smartcarlife.serviceMerchant.curYqList')
},
}
\ No newline at end of file
......@@ -2,8 +2,6 @@
<image
:src="imagePath"
:mode="mode"
:webp="webp||isWebp"
lazy-load
/>
</template>
......@@ -22,7 +20,6 @@ export default {
type: null,
default: ''
},
webp: Boolean
},
name: 'GlsxImage',
data () {
......@@ -53,4 +50,9 @@ export default {
</script>
<style scoped lang='scss'>
image{
width: 100%;
height: 100%;
vertical-align: top;
}
</style>
\ No newline at end of file
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
Vue.component(component.name, component)
})
// import Vue from 'vue'
// const componentsFiles = require.context(`./`, true, /.vue$/)
// componentsFiles.keys().forEach(path => {
// const component = componentsFiles(path).default
// // Vue.component(component.name, component)
// })
\ No newline at end of file
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
const index = 2
const index = 1
/**
*
0本地
......
......@@ -4,7 +4,8 @@ import config from '@/config.js'
import store from '@/store';
import api from './api/index'
import { Storage } from './utils/cache/index'
import 'components'
import GlsxImage from './components/GlsxImage'
Vue.component('GlsxImage', GlsxImage)
uni.$api = api
uni.$storage = new Storage()
Vue.config.productionTip = false
......
......@@ -12,7 +12,17 @@
maxlength="11"
/>
<template v-if="mobile">
<text class="icon" @click="mobile = ''">X</text>
<view
class="icon"
@click="mobile = ''"
>
<icon
type="clear"
size="16"
color="#000"
>
</icon>
</view>
</template>
</view>
<view class="input">
......@@ -23,15 +33,31 @@
maxlength="4"
/>
<template v-if="code">
<text class="icon" @click="code = ''">X</text>
<view
class="icon"
@click="code = ''"
>
<icon
type="clear"
size="16"
color="#000"
>
</icon>
</view>
</template>
<!-- :class="['code-btn', { 'code-disabled': count }]" -->
<view
:class="['code-btn', { 'code-disabled': count }]"
@click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view
>
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
</view>
<button class="btn" :disabled="!mobile || !code">登录</button>
<button
class="btn"
:disabled="!mobile || !code"
@click="login"
>
登录
</button>
</view>
</view>
</template>
......@@ -39,28 +65,27 @@
<script>
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
export default {
data() {
data () {
return {
mobile: '',
code: '',
mobile: '15626599738',
code: '8888',
count: '',
};
},
onLoad(options) {
uni.hideLoading();
onLoad (options) {
},
methods: {
/**获取验证码 */
async getSmsCode() {
async getSmsCode () {
const { mobile, count } = this;
try {
if (!mobile) throw '请输入手机号';
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (count) throw '验证码发送过于频繁,请稍后在试';
this.countDown(60);
uni.showLoading()
const { code, message } = await uni.$api.userApi.getSmsCode({mobile});
uni.hideLoading()
uni.showLoading();
const { code, message } = await uni.$api.userApi.getSmsCode({ mobile });
uni.hideLoading();
if (code == '0') {
uni.showToast({
title: '验证码已发送',
......@@ -69,15 +94,15 @@ export default {
this.countDown(60);
} else throw message || '发送验证码失败';
} catch (error) {
uni.hideLoading()
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
})
});
}
},
/**验证码倒计时 */
countDown(countDown) {
countDown (countDown) {
if (countDown) this.count = countDown;
setTimeout(() => {
let { count } = this;
......@@ -86,18 +111,117 @@ export default {
else this.count = null;
}, 1e3);
},
async login () {
const { mobile, code: smsCode } = this;
try {
uni.showLoading();
const { code, data, message } = await uni.$api.userApi.smsLogin({
mobile,
code: smsCode,
noSignIn: false,
});
console.log(code, data, message);
uni.hideLoading();
if (code == 0) {
let {
loginUserInfoList,
sessionId,
noSignInUuid,
needSelectAccount,
} = data;
if (loginUserInfoList.length) {
const loginUserObj =
loginUserInfoList.filter(
(val) =>
val.subLoginUser && Object.keys(val.subLoginUser)?.length
)[0] || {};
uni.$storage.set('sessionId', sessionId);
console.log(loginUserObj)
// getYQList();
// noSignInUuid ? setNoSignInUuid(noSignInUuid) : rmNoSignInUuid();
// 记录登录信息 已选园区店、4s店和场景
if (!needSelectAccount && Object.keys(loginUserObj)?.length && loginUserObj?.shopMerchantId && !((loginUserObj?.sceneType ?? '') === '')) {
this.getYqMerchantSceneConfig(loginUserObj, 0);
} else if (!needSelectAccount && Object.keys(loginUserObj)?.length && loginUserObj?.shopMerchantId && (loginUserObj?.sceneType ?? '') === '') {
// 已选园区店、4s店
this.getYqMerchantSceneConfig(loginUserObj, 1);
} else if (!needSelectAccount) {
// 仅选择园区店
this.getYqMerchantSceneConfig(loginUserObj, 2);
} else {
// 未记录到登录信息
this.getAccountLoginList(loginUserInfoList);
}
} else wx.$router.reLaunch('pages.nothing');
} else
uni.showModal({
title: '温馨提示',
content: message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#347BFF',
});
} catch (error) {
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
});
}
},
async getYqMerchantSceneConfig (loginUserObj, num) {
// let checkAgreeClient = await this.checkAgreeClient(loginUserObj)
// if (!checkAgreeClient) return wx.$router.go('pages.accountItems')
// num 0已选园区店、4s店和场景 1已选园区店、4s店 2仅选择园区店
let pageUrl = ['pages.loading', 'pages.sceneIndex', 'pages.merchantList']
let { shopMerchantId, shopMerchantName } = loginUserObj
wx.$util.setUserInfo(loginUserObj)
if (num == 2) {
this.get4SStoreList(loginUserObj, pageUrl[num])
} else {
// 兼容除精品升级外场景 已选门店数据
wx.$util.setUserInfo({
...wx.$util.getUserInfo(),
default4SStoreInfo: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
},
default4SStoreInfo_crowdFunding: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
},
default4SStoreInfo_newCarConversion: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
}
})
if (num == 0) wx.$router.reLaunch(pageUrl[num])
else wx.$router.go(pageUrl[num])
this.setData({ jumpPageFlag: false })
}
},
// 获取登录账号下园区店列表
getAccountLoginList (loginUserInfoList) {
if (loginUserInfoList?.length == 1) this.getYqMerchantSceneConfig(loginUserInfoList[0], 2)
else wx.$router.go('pages.accountItems')
},
},
};
</script>
<style lang="scss" scoped>
.a{
width: 500px;
height: 200px;
}
.bg {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-image: url('https://img02.glsx.com.cn/weapp/resource/app-tape/login/bg.png');
background-image: url("https://img02.glsx.com.cn/weapp/resource/app-tape/login/bg.png");
background-size: 100% 100%;
}
.login {
......@@ -124,7 +248,7 @@ export default {
border-radius: 56rpx;
margin-bottom: 40rpx;
box-sizing: border-box;
padding: 0 40rpx;
padding-left: 40rpx;
display: flex;
align-items: center;
input {
......@@ -135,6 +259,10 @@ export default {
.icon {
margin-left: auto;
flex-shrink: 0;
display: flex;
align-items: center;
padding: 0 40rpx;
height: 100%;
}
.code-btn {
font-weight: 500;
......@@ -142,6 +270,7 @@ export default {
color: #2c66f7;
flex-shrink: 0;
border: none;
margin-right: 40rpx;
}
.code-disabled {
color: #9b9b9e;
......@@ -160,7 +289,7 @@ export default {
color: #ffffff;
}
.btn[disabled]:not([type]),
.btn[disabled][type='default'] {
.btn[disabled][type="default"] {
background: #c9c9c9 !important;
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!