Commit 28d87042 by 李伟康

commit 修改img

1 parent 87f7f087
import http from '../request/http' import http from '../request/http'
module.exports = { module.exports = {
getSmsCode (data) { /**获取短信 */
getSmsCode (data = {}) {
data.projectName = 'boutique' data.projectName = 'boutique'
return http.fetch('dj.api.smartcarlife.sms.get.code', data) 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 \ No newline at end of file
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
<image <image
:src="imagePath" :src="imagePath"
:mode="mode" :mode="mode"
:webp="webp||isWebp"
lazy-load
/> />
</template> </template>
...@@ -22,7 +20,6 @@ export default { ...@@ -22,7 +20,6 @@ export default {
type: null, type: null,
default: '' default: ''
}, },
webp: Boolean
}, },
name: 'GlsxImage', name: 'GlsxImage',
data () { data () {
...@@ -53,4 +50,9 @@ export default { ...@@ -53,4 +50,9 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
image{
width: 100%;
height: 100%;
vertical-align: top;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
import Vue from 'vue' // import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/) // const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => { // componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default // const component = componentsFiles(path).default
Vue.component(component.name, component) // // Vue.component(component.name, component)
}) // })
\ No newline at end of file \ No newline at end of file
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
const index = 2 const index = 1
/** /**
* *
0本地 0本地
......
...@@ -4,7 +4,8 @@ import config from '@/config.js' ...@@ -4,7 +4,8 @@ import config from '@/config.js'
import store from '@/store'; import store from '@/store';
import api from './api/index' import api from './api/index'
import { Storage } from './utils/cache/index' import { Storage } from './utils/cache/index'
import 'components' import GlsxImage from './components/GlsxImage'
Vue.component('GlsxImage', GlsxImage)
uni.$api = api uni.$api = api
uni.$storage = new Storage() uni.$storage = new Storage()
Vue.config.productionTip = false Vue.config.productionTip = false
......
...@@ -12,7 +12,17 @@ ...@@ -12,7 +12,17 @@
maxlength="11" maxlength="11"
/> />
<template v-if="mobile"> <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> </template>
</view> </view>
<view class="input"> <view class="input">
...@@ -23,15 +33,31 @@ ...@@ -23,15 +33,31 @@
maxlength="4" maxlength="4"
/> />
<template v-if="code"> <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> </template>
<!-- :class="['code-btn', { 'code-disabled': count }]" -->
<view <view
:class="['code-btn', { 'code-disabled': count }]"
@click="getSmsCode" @click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view >{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
>
</view> </view>
<button class="btn" :disabled="!mobile || !code">登录</button> <button
class="btn"
:disabled="!mobile || !code"
@click="login"
>
登录
</button>
</view> </view>
</view> </view>
</template> </template>
...@@ -39,28 +65,27 @@ ...@@ -39,28 +65,27 @@
<script> <script>
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
export default { export default {
data() { data () {
return { return {
mobile: '', mobile: '15626599738',
code: '', code: '8888',
count: '', count: '',
}; };
}, },
onLoad(options) { onLoad (options) {
uni.hideLoading();
}, },
methods: { methods: {
/**获取验证码 */ /**获取验证码 */
async getSmsCode() { async getSmsCode () {
const { mobile, count } = this; const { mobile, count } = this;
try { try {
if (!mobile) throw '请输入手机号'; if (!mobile) throw '请输入手机号';
if (!phoneRex.test(mobile)) throw '请输入正确的手机号'; if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (count) throw '验证码发送过于频繁,请稍后在试'; if (count) throw '验证码发送过于频繁,请稍后在试';
this.countDown(60); this.countDown(60);
uni.showLoading() uni.showLoading();
const { code, message } = await uni.$api.userApi.getSmsCode({mobile}); const { code, message } = await uni.$api.userApi.getSmsCode({ mobile });
uni.hideLoading() uni.hideLoading();
if (code == '0') { if (code == '0') {
uni.showToast({ uni.showToast({
title: '验证码已发送', title: '验证码已发送',
...@@ -69,15 +94,15 @@ export default { ...@@ -69,15 +94,15 @@ export default {
this.countDown(60); this.countDown(60);
} else throw message || '发送验证码失败'; } else throw message || '发送验证码失败';
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading();
uni.showToast({ uni.showToast({
title: error, title: error,
icon: 'none', icon: 'none',
}) });
} }
}, },
/**验证码倒计时 */ /**验证码倒计时 */
countDown(countDown) { countDown (countDown) {
if (countDown) this.count = countDown; if (countDown) this.count = countDown;
setTimeout(() => { setTimeout(() => {
let { count } = this; let { count } = this;
...@@ -86,18 +111,117 @@ export default { ...@@ -86,18 +111,117 @@ export default {
else this.count = null; else this.count = null;
}, 1e3); }, 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.a{
width: 500px;
height: 200px;
}
.bg { .bg {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
left: 0; left: 0;
top: 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%; background-size: 100% 100%;
} }
.login { .login {
...@@ -124,7 +248,7 @@ export default { ...@@ -124,7 +248,7 @@ export default {
border-radius: 56rpx; border-radius: 56rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 40rpx; padding-left: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
input { input {
...@@ -135,6 +259,10 @@ export default { ...@@ -135,6 +259,10 @@ export default {
.icon { .icon {
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
display: flex;
align-items: center;
padding: 0 40rpx;
height: 100%;
} }
.code-btn { .code-btn {
font-weight: 500; font-weight: 500;
...@@ -142,6 +270,7 @@ export default { ...@@ -142,6 +270,7 @@ export default {
color: #2c66f7; color: #2c66f7;
flex-shrink: 0; flex-shrink: 0;
border: none; border: none;
margin-right: 40rpx;
} }
.code-disabled { .code-disabled {
color: #9b9b9e; color: #9b9b9e;
...@@ -160,7 +289,7 @@ export default { ...@@ -160,7 +289,7 @@ export default {
color: #ffffff; color: #ffffff;
} }
.btn[disabled]:not([type]), .btn[disabled]:not([type]),
.btn[disabled][type='default'] { .btn[disabled][type="default"] {
background: #c9c9c9 !important; background: #c9c9c9 !important;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!