This commit is contained in:
zmj 2024-06-22 19:21:24 +08:00
parent 710cf5abc7
commit e5406af13b
4 changed files with 142 additions and 11 deletions

View File

@ -132,4 +132,9 @@ export const getUserShip = (data) => {
export const getCreateLists = (data) => { export const getCreateLists = (data) => {
return request.get('/store/store/create_lists', data); return request.get('/store/store/create_lists', data);
}
export const getloginSms = (data) => {
return request.post('/user/user/login_sms', data);
} }

View File

@ -11,7 +11,6 @@
<uni-data-select v-model="Role" :localdata="range" :clear='false'></uni-data-select> <uni-data-select v-model="Role" :localdata="range" :clear='false'></uni-data-select>
</up-form-item> </up-form-item>
</up-form> </up-form>
</view> </view>
</up-modal> </up-modal>
</view> </view>
@ -22,7 +21,6 @@
<text @click="currentTab=2,getCount(),getLists()" :class="{actText:currentTab==2}"> 已开通列表</text> <text @click="currentTab=2,getCount(),getLists()" :class="{actText:currentTab==2}"> 已开通列表</text>
<view class="lines" :class="{actLine:currentTab==2}" /> <view class="lines" :class="{actLine:currentTab==2}" />
</view> </view>
<!-- tabs1 --> <!-- tabs1 -->
<block v-if='currentTab==1'> <block v-if='currentTab==1'>
<view class="card card1"> <view class="card card1">
@ -259,7 +257,8 @@
auth_code: "", auth_code: "",
address: "", address: "",
label_name: "", label_name: "",
label_id: "" label_id: "",
user_ship: ''
}) })
const conformRole = (e) => { const conformRole = (e) => {
@ -376,6 +375,7 @@
success: function(res) { success: function(res) {
formData.auth_code = res.result formData.auth_code = res.result
formData.recharge_type = 'INDUSTRYMEMBERS' formData.recharge_type = 'INDUSTRYMEMBERS'
formData.user_ship = 1
vipRechargeApi(formData).then(res => { vipRechargeApi(formData).then(res => {
uni.$u.toast('操作成功'); uni.$u.toast('操作成功');
currentTab.value = 2 currentTab.value = 2
@ -383,6 +383,13 @@
formData.mobile = '' formData.mobile = ''
formData.address = '' formData.address = ''
formData.label_name = '' formData.label_name = ''
formData.city = ''
formData.area = ''
formData.street = ''
formData.village = ''
formData.brigade = ''
currentAddressIndex.value = 0
tabsList.forEach(item => { tabsList.forEach(item => {
item.name = '请选择' item.name = '请选择'
}) })
@ -395,6 +402,7 @@
} else { } else {
delete formData.recharge_type delete formData.recharge_type
delete formData.auth_code delete formData.auth_code
formData.user_ship = 4
vipRechargeApi(formData).then(res => { vipRechargeApi(formData).then(res => {
uni.$u.toast('操作成功'); uni.$u.toast('操作成功');
currentTab.value = 2 currentTab.value = 2
@ -402,6 +410,12 @@
formData.mobile = '' formData.mobile = ''
formData.address = '' formData.address = ''
formData.label_name = '' formData.label_name = ''
formData.city = ''
formData.area = ''
formData.street = ''
formData.village = ''
formData.brigade = ''
currentAddressIndex.value = 0
tabsList.forEach(item => { tabsList.forEach(item => {
item.name = '请选择' item.name = '请选择'
}) })

View File

@ -31,7 +31,7 @@
}, { }, {
"path": "pages/login/test", "path": "pages/login/test",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "账号登录",
"enablePullDownRefresh": false "enablePullDownRefresh": false
// "navigationStyle": "custom" // "navigationStyle": "custom"
} }

View File

@ -1,8 +1,41 @@
<template> <template>
<view class="" style="padding: 100rpx;"> <view class="content">
<up-input :customStyle="{height: '100%'}" v-model="zh" placeholderClass="place" placeholder="请输入手机号" /> <view style="text-align: center;">
<up-button @click="submit" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff" <image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
size="28"></up-icon></up-button> </image>
<view class="tips">欢迎登录惠农批发</view>
</view>
<view class='card'>
<view style="display: flex;align-items: center;">
<text>手机号</text> <up-input v-model="formData.account" placeholder="请输入手机号"></up-input>
</view>
<view style="margin: 30rpx 0;">
</view>
<view style="display: flex;justify-content: space-between;align-items: center;">
<text style="margin-right: 20rpx;">验证码:</text>
<up-input v-model="formData.code" placeholder="请输入验证码" type='number'></up-input>
<view class="code-btn">
<view style="margin: 0 20rpx;">
<up-line color="grey" direction="col" length="30rpx"></up-line>
</view>
<text class='btn-text' style="color: grey;" v-if='cutDown'>重新获取({{cutDown}})</text>
<text @click="getCode" class='btn-text' v-else> {{flag?'获取验证码':'重新获取' }} </text>
</view>
</view>
</view>
<view class="submit-btn">
<up-button @click="submit" color="#20B128" size="large">
登录</up-button>
</view>
</view> </view>
</template> </template>
@ -10,13 +43,51 @@
import { import {
userLoginApi, userLoginApi,
userInfoApi, userInfoApi,
getStoreInfo getStoreInfo,
getloginSms
} from "@/api/user.js"; } from "@/api/user.js";
import { import {
ref ref,
reactive
} from "vue" } from "vue"
import useUserStore from "@/store/user"; import useUserStore from "@/store/user";
const userStore = useUserStore(); const userStore = useUserStore();
const formData = reactive({
account: "",
code: "",
terminal: 1,
scene: 2
})
//
const cutDown = ref(0)
const flag = ref(true)
const code = ref('')
const checkPhone = (phone) => {
const regex = /^1[3-9]\d{9}$/;
return regex.test(phone) ? true : false
}
const getCode = async () => {
if (!checkPhone(formData.account)) return uni.$u.toast('请输入正确的手机号')
await getloginSms({
account: formData.account
})
flag.value = false
cutDown.value = 60
let timer = setInterval(() => {
cutDown.value--
if (cutDown.value <= 0) clearInterval(timer)
}, 1000)
}
//
const zh = ref("") const zh = ref("")
const submit = () => { const submit = () => {
@ -48,5 +119,46 @@
} }
</script> </script>
<style> <style lang='scss'>
.content {
background-color: white;
height: 100vh;
box-sizing: border-box;
padding-top: 15vh;
.logo {
height: 152rpx;
width: 152rpx;
}
.tips {
color: #444444;
font-size: 28rpx;
margin: 30rpx 0;
}
}
.card {
padding: 50rpx;
background-color: white;
margin-bottom: 30rpx;
padding-bottom: 30rpx;
}
.submit-btn {
position: absolute;
bottom: 100rpx;
width: 710rpx;
left: 50%;
transform: translateX(-50%);
}
.code-btn {
display: flex;
align-items: center;
}
.btn-text {
color: #20B128;
}
</style> </style>