Browse Source

商户登录

master
yangrz 2 years ago
parent
commit
4d92b1eeea
  1. 15
      agentApp/common/api.js
  2. 4
      agentApp/package.json
  3. 157
      agentApp/pages/merchant-login/index.vue

15
agentApp/common/api.js

@ -59,6 +59,21 @@ export const userWithdraw = (params) => http.post(baseUrl + '/api/user/withdraw'
export const userWithdrawList = (params) => http.post(baseUrl + '/api/user/withdrawList', params, userConfig())
// 带上商户token
const merchantConfig = function() {
return {
header: {
'Merchant-Token': uni.getStorageSync('merchant_token')
}
}
}
export const merchantSmsLogin = (params) => http.post(baseUrl + '/api/merchant/smsLogin', params)
export const merchantAccountInfo = (params) => http.post(baseUrl + '/api/merchant/accountInfo', params, merchantConfig())
export const publicSysConfig = (params) => http.post(baseUrl + '/api/public/sysConfig', params)
export const publicSendSms = (params) => http.post(baseUrl + '/api/public/sendSms', params)

4
agentApp/package.json

@ -3,7 +3,9 @@
"scripts": {
"test": "eslint . --fix"
},
"dependencies": {},
"dependencies": {
"js-md5": "^0.8.3"
},
"devDependencies": {
"eslint": "^8.2.0",
"eslint-config-airbnb": "^19.0.0"

157
agentApp/pages/merchant-login/index.vue

@ -6,18 +6,17 @@
</view>
<view class="login-main">
<view class="login-item">
<input type="text" class="log-phone" placeholder="请输入手机号"/>
<input type="tel" class="log-phone" placeholder="请输入手机号" v-model="phone" />
</view>
<view class="login-item">
<input type="text" class="log-phone log-code" placeholder="请输入验证码"/>
<input type="number" class="log-phone log-code" placeholder="请输入验证码" v-model="sms_code" />
<view class="getCode" @click="getCode">
获取验证码
</view>
</view>
<view class="login-btn">
<button size="default" type="default" @click="btnLogin"
style="color:#ffffff;backgroundColor:#F52F3E;borderColor:#F52F3EF;border-radius: 50rpx;height: 88rpx;line-height: 88rpx;"
>登录</button>
style="color:#ffffff;backgroundColor:#F52F3E;borderColor:#F52F3EF;border-radius: 50rpx;height: 88rpx;line-height: 88rpx;">登录</button>
</view>
<view class="login-sign">
<u-radio-group v-model="value">
@ -38,20 +37,38 @@
</template>
<script>
import {
publicSendSms,
merchantSmsLogin
} from '../../common/api.js'
import md5 from 'js-md5'
export default {
data() {
return {
phone: '',
sms_code: '',
bgColor: '#bgColor',
value: 1,
show:false,
title:'',
content:''
show: false,
title: '',
content: ''
};
},
methods: {
getCode() {
this.$refs.uToast.show({
message: '短信已发送'
let phone = this.phone
let nonce_str = md5(Math.random() + '');
let sign = md5(md5(phone) + md5(nonce_str) + nonce_str)
publicSendSms({
phone,
nonce_str,
sign,
type: 1
}).then(() => {
this.$refs.uToast.show({
message: '短信已发送'
})
})
},
handlerApply() {
@ -68,81 +85,87 @@
this.show = false;
},
btnLogin() {
uni.navigateTo({
url: '/pages/merchant-index/index'
});
merchantSmsLogin({
phone: this.phone,
sms_code: this.sms_code
}).then(data => {
uni.setStorageSync('merchant_token', data.token)
uni.navigateTo({
url: '/pages/merchant-index/index'
});
})
}
}
}
</script>
<style lang="scss">
.login-content {
width: 100%;
height: 1600rpx;
padding-left: 30rpx;
padding-right: 30rpx;
background: url(../../static/login/merchant-bg.png) no-repeat center center;
background-size: cover;
box-sizing: border-box;
.login-content {
width: 100%;
height: 1600rpx;
padding-left: 30rpx;
padding-right: 30rpx;
background: url(../../static/login/merchant-bg.png) no-repeat center center;
background-size: cover;
box-sizing: border-box;
.login-font {
width: 364rpx;
height: 200rpx;
padding-top: 80rpx;
}
.login-font {
width: 364rpx;
height: 200rpx;
padding-top: 80rpx;
}
.login-main {
margin-top: 120rpx;
.login-main {
margin-top: 120rpx;
.login-item {
position: relative;
margin-top: 40rpx;
.login-item {
position: relative;
margin-top: 40rpx;
.log-phone {
width: 100%;
height: 88rpx;
line-height: 88rpx;
padding-left: 50rpx;
border-radius: 44rpx;
border: none;
box-sizing: border-box;
background-color: #fff;
font-size: 16px;
color: #454545;
}
.log-phone {
width: 100%;
height: 88rpx;
line-height: 88rpx;
padding-left: 50rpx;
border-radius: 44rpx;
border: none;
box-sizing: border-box;
background-color: #fff;
font-size: 16px;
color: #454545;
}
.getCode {
position: absolute;
right: 50rpx;
top: 30rpx;
font-size: 12px;
color: #454545;
cursor: pointer;
.getCode {
position: absolute;
right: 50rpx;
top: 30rpx;
font-size: 12px;
color: #454545;
cursor: pointer;
}
}
}
.login-btn {
margin-top: 80rpx;
}
.login-btn {
margin-top: 80rpx;
}
.login-sign {
display: flex;
justify-content: flex-start;
margin-top: 30rpx;
padding-left: 20rpx;
.login-sign {
display: flex;
justify-content: flex-start;
margin-top: 30rpx;
padding-left: 20rpx;
.u-radio-group {
flex-grow: 0;
margin-right: 60rpx;
}
.u-radio-group {
flex-grow: 0;
margin-right: 60rpx;
}
.log-link {
height: 40rpx;
line-height: 40rpx;
font-size: 12px;
.log-link {
height: 40rpx;
line-height: 40rpx;
font-size: 12px;
}
}
}
}
}
</style>
Loading…
Cancel
Save