From b07d5f16634fc4a695fa8e6f6b18c33806f2b05a Mon Sep 17 00:00:00 2001
From: xuxy <1059738716@qq.com>
Date: 星期五, 28 六月 2024 16:28:32 +0800
Subject: [PATCH] update 合伙人的功能
---
pages/login/supplier-login.vue | 105 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 75 insertions(+), 30 deletions(-)
diff --git a/pages/login/farmer-login.vue b/pages/login/supplier-login.vue
similarity index 79%
rename from pages/login/farmer-login.vue
rename to pages/login/supplier-login.vue
index 240cf10..1de3831 100644
--- a/pages/login/farmer-login.vue
+++ b/pages/login/supplier-login.vue
@@ -1,8 +1,10 @@
<template>
<view class="main-container login-container img100 relative" style="margin-top: 0rpx;">
- <!-- background-image:url('@/static/images/farmer/login/bg.png') -->
+ <!-- background-image:url('@/static/images/supplier/login/bg.png') -->
- <image class="component-bg" src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png" mode="scaleToFill" />
+ <image class="component-bg"
+ src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png"
+ mode="scaleToFill" />
<view class="t-login top-bg">
<view class="nav-title">登录</view>
<view class="login">
@@ -18,12 +20,12 @@
<input type="text" :password="true" name="password" placeholder="请输入密码" v-model="password" />
</view>
<view class="t-a input" v-if="loginType=='code'">
+
+
+ <input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" />
<view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">
{{getCodeText}}
</view>
-
- <input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" />
-
</view>
@@ -49,6 +51,17 @@
// import gzmzApi from '@/api/gzmzApi.js'
// import myCache from '@/utils/myCache.js'
export default {
+ props: {
+ // apitype: 'loginSupplier',
+ apitype: {
+ type:String,
+ default(){
+ return 'loginSupplier'
+
+ // return 'loginPartner'
+ }
+ },
+ },
data() {
return {
openId: '-1',
@@ -70,32 +83,44 @@
};
},
methods: {
- getCode() {
+ async getCode() {
uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。
if (this.getCodeisWaiting) {
return;
}
if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) { //校验手机号码是否有误
- uni.showToast({
- title: '请填写正确手机号码',
- icon: "none"
- });
+ this.$message.showToast('请填写正确手机号码')
return false;
}
this.getCodeText = "发送中..." //发送验证码
this.getCodeisWaiting = true;
- this.getCodeBtnColor = "rgba(255,255,255,0.5)" //追加样式,修改颜色
+ this.getCodeBtnColor = "#000" //追加样式,修改颜色
//示例用定时器模拟请求效果
//setTimeout(()用于在指定的毫秒数后调用函数或计算表达式
- setTimeout(() => {
+ const {
+ code
+ } = await this.$http.request('post', '/api/sms/send/code', {
+ data: {
+ tel: this.phoneNumber,
+ userType: 'supplier'
+ }
+ })
+ if (code == 0) {
uni.showToast({
title: '验证码已发送',
icon: "none"
- }); //弹出提示框
- //示例默认1234,生产中请删除这一句。
- // this.code = '1234'; //发送验证码,进行填入
+ });
this.setTimer(); //调用定时器方法
- }, 1000)
+ }
+ // setTimeout(() => {
+ // uni.showToast({
+ // title: '验证码已发送',
+ // icon: "none"
+ // }); //弹出提示框
+ // //示例默认1234,生产中请删除这一句。
+ // // this.code = '1234'; //发送验证码,进行填入
+ // this.setTimer(); //调用定时器方法
+ // }, 1000)
},
//setTimer: 需要每隔一段时间执行一件事的的时候就需要使用SetTimer函数
setTimer() {
@@ -120,7 +145,7 @@
// url: '/pages/index/index'
// })
uni.redirectTo({
- url: '/sub_pages/farmer/farmer-reg/farmer-reg'
+ url: '/sub_pages/supplier/supplier-reg/supplier-reg'
})
},
@@ -132,19 +157,37 @@
title: '登陆中'
});
var that = this;
- if (!that.userName) {
- uni.showToast({
- title: '请输入用户名',
- icon: 'none'
- });
- return;
+ if (this.loginType == 'pwd') {
+ if (!that.userName) {
+ uni.showToast({
+ title: '请输入用户名',
+ icon: 'none'
+ });
+ return;
+ }
+ if (!that.password) {
+ uni.showToast({
+ title: '请输入密码',
+ icon: 'none'
+ });
+ return;
+ }
}
- if (!that.password) {
- uni.showToast({
- title: '请输入密码',
- icon: 'none'
- });
- return;
+ if (this.loginType == 'code') {
+ if (!that.tel) {
+ uni.showToast({
+ title: '请输入手机号',
+ icon: 'none'
+ });
+ return;
+ }
+ if (!that.smsCode) {
+ uni.showToast({
+ title: '请输入手机验证码',
+ icon: 'none'
+ });
+ return;
+ }
}
// if (this.pcfvalue == undefined) {
// util.showMyToast('必须勾选《用户服务协议》及《隐私政策》');
@@ -153,12 +196,14 @@
let post = {
username: this.userName,
password: this.password,
+ tel: this.phoneNumber,
+ smsCode: this.smsCode
// openId: '123456789'
}
// const {
// code
// } = await this.$http.request('get', '/api/login/admin')
- const resp = await this.$store.dispatch('loginSupplier', post);
+ const resp = await this.$store.dispatch(this.apitype, post);
// uni.hideLoading()
if (resp.code == 0) {
--
Gitblit v1.9.3