Procházet zdrojové kódy

工会搜索,手机号修改

wkyy před 3 roky
rodič
revize
a13ce7594b
5 změnil soubory, kde provedl 167 přidání a 18 odebrání
  1. 2 1
      apis/login.js
  2. 121 11
      pages/login/change.vue
  3. 13 4
      pages/login/index.vue
  4. 4 1
      pages/login/register.vue
  5. 27 1
      pages/login/search.vue

+ 2 - 1
apis/login.js

@@ -1,5 +1,6 @@
  import requestWhite from '../utils/requestWhite.js';
 import Qs from 'qs';
+import request from '../utils/request.js';
 
  
 export function findByOpenId(data) {
@@ -51,7 +52,7 @@ export function register(data) {
 
 export function changePhone(data) {
 	 
-	return requestWhite({
+	return request({
 		method: 'post',
 		data: data,
 		url: '/mobile/regUser/changePhone'

+ 121 - 11
pages/login/change.vue

@@ -9,46 +9,156 @@
 				<u-form :model="form" ref="uForm">
 					<view class="jpLogin-input" style="margin-top:60px;">
 						<u-icon custom-prefix="custom-icon" name="cellphone-fill" class="jpLogin-icon"></u-icon>
-						<u-form-item><u-input v-model="form.name" placeholder="请填写手机号" /></u-form-item>
+						<u-form-item><u-input v-model="form.oldPhone" placeholder="请填写手机号" /></u-form-item>
 					</view>
 					<view class="jpLogin-input">
 						<u-icon custom-prefix="custom-icon" name="message-3-fill" class="jpLogin-icon"></u-icon>
-						<u-form-item><u-input v-model="form.name" placeholder="请输入验证码" /></u-form-item>
+						<u-form-item><u-input v-model="form.verifyCode" placeholder="请输入验证码" /></u-form-item>
 					</view>
 					<view class="jpLogin-link">
 						<view class="jpLogin-link-l">
 						</view>
-						<span>获取验证码</span>
+						<span @click="getCode">获取验证码</span>
 					</view>
 					<view class="jpLogin-input" style="margin-top:40px;">
 						<u-icon custom-prefix="custom-icon" name="cellphone-fill" class="jpLogin-icon"></u-icon>
-						<u-form-item><u-input v-model="form.name" placeholder="请填写新手机号" /></u-form-item>
+						<u-form-item><u-input v-model="form.newPhone" placeholder="请填写新手机号" /></u-form-item>
 					</view>
 				</u-form>
 			</view>
 			<view style="margin-top: 60px;">
-				<u-button type="error" shape="circle" :custom-style="customStyle">完成绑定</u-button>
+				<u-button type="error" shape="circle" :custom-style="customStyle" @click="finish">完成绑定</u-button>
 			</view>
+			<u-verification-code :seconds="sendMsgSecond" ref="uCode" @change="codeChange" @end="end" @start="start">
+			</u-verification-code>
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as loginApi from '@/apis/login.js'
+	import {
+		checkPhone
+	} from '@/utils'
+	
 	export default {
 		data() {
 			return {
 				form: {
-					name: '',
+					oldPhone: '',
+					verifyCode: '',
+					newPhone: '',
 				},
 				value:'0',
 				customStyle:{
 					background: '#FF5E5E'
-				}
-			}
-			methods: {
-
+				},
+				isSendMsgIng: false,
+				sendMsgSecond: 60 * 2,
 			}
-
+		},
+		methods: {
+			codeChange(text) {
+				this.codeTips = text;
+			},
+			start() {
+				if (!this.isSendMsgIng) {
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					loginApi.getVerifyCode(this.form.oldPhone).then((response) => {
+						uni.hideLoading();
+						this.carhelp.set("getvcodetime", new Date().getTime());
+			
+						if (!"") {
+							//倒计时
+							uni.showToast({
+								title: "发送成功"
+							})
+						} else {
+							uni.showToast({
+								title: "您的验证码已经发送[5分钟有效],请勿重复点击"
+							})
+						}
+					}).catch(error => {
+						uni.showToast({
+							title: error,
+							icon: "none"
+						})
+					})
+				}
+			},
+			//倒计时
+			end() {
+				this.sendMsgSecond = 2 * 60;
+				this.isSendMsgIng = false;
+			},
+			// 获取验证码
+			getCode() {
+				if (this.$refs.uCode.canGetCode) {} else {
+					uni.showToast({
+						title: '倒计时结束后再发送',
+						icon: "none"
+					})
+					return
+				}
+			
+				var checkPhoneResult = checkPhone(this.form.oldPhone);
+			
+				if (false && checkPhoneResult !== true) {
+					uni.showToast({
+						title: checkPhoneResult,
+					})
+					return;
+				}
+				this.$refs.uCode.start();
+			},
+			finish() {
+				if (!this.carhelp.getOpenId()) {
+					uni.showToast({
+						title: "请使用“微信”访问本系统登录"
+					})
+					return
+				}
+				if (!this.form.oldPhone) {
+					uni.showToast({
+						title: "请输入原手机号"
+					})
+					return
+				}
+				if (!this.form.verifyCode) {
+					uni.showToast({
+						title: "请输入验证码"
+					})
+					return
+				}
+				if (!this.form.newPhone) {
+					uni.showToast({
+						title: "请输入新手机号"
+					})
+					return
+				}
+			
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				loginApi.changePhone({
+					oldPhone: this.form.oldPhone,
+					verifyCode: this.form.verifyCode,
+					newPhone: this.form.newPhone
+				}).then((response) => {				
+					uni.redirectTo({
+						url: '/pages/login/index'
+					});
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 		}
 	}
 </script>

+ 13 - 4
pages/login/index.vue

@@ -38,13 +38,13 @@
 				<u-button type="error" shape="circle" :custom-style="customStyle" @click="finish">登录</u-button>
 			</view>
 			<view class="jpLogin-radio">
-				<u-radio-group v-model="value">
-					<u-radio activeColor="#ff5e5e">
+				<u-checkbox -group v-model="value" @change="checkboxChange">
+					<u-checkbox  activeColor="#ff5e5e">
 						<view class="u-flex">
 							<p>已阅读并同意</p><span @click="getAgreement">《会员服务协议》</span>
 						</view>
-					</u-radio>
-				</u-radio-group>
+					</u-checkbox >
+				</u-checkbox -group>
 			</view>
 			<u-verification-code :seconds="sendMsgSecond" ref="uCode" @change="codeChange" @end="end" @start="start">
 			</u-verification-code>
@@ -75,6 +75,9 @@
 			}
 		},
 		methods: {
+			checkboxChange() {
+				console.log(this.value)
+			},
 			getRegister() {
 				uni.redirectTo({
 					url: '/pages/login/register'
@@ -166,6 +169,12 @@
 					})
 					return
 				}
+				if (!this.value) {
+					uni.showToast({
+						title: "请勾选会员服务协议"
+					})
+					return
+				}
 			
 				uni.showLoading({
 					title: "加载中",

+ 4 - 1
pages/login/register.vue

@@ -98,12 +98,15 @@
 				this.form.orgName = item.name;
 				this.form.orgId = item.id;
 			}		
+		},
+		onLoad(op){
+			
 		},
 		methods: {
 			getSearch() {
 				uni.navigateTo({
 					url: '/pages/login/search'
-				});
+				})
 			},
 			getLogin() {
 				uni.redirectTo({

+ 27 - 1
pages/login/search.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<view class="search">
-			<u-search placeholder="输入关键字查询工会" v-model="keyword" :action-style="actionStyle"></u-search>
+			<u-search placeholder="输入关键字查询工会" v-model="keyword" :action-style="actionStyle" @custom="searchQrg" @search="searchQrg"></u-search>
 		</view>
 		<view class="searchList">		
 			<list>
@@ -63,6 +63,32 @@
 					})
 				})
 			},
+			searchQrg() {			
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				loginApi.orgList({
+					pageIndex: this.pageIndex,
+					pageSize: this.pageSize,
+					orgName: this.keyword
+				}).then((response) => {
+					var jsonData = response.data.data;
+					if(jsonData.length == 0) {
+						uni.redirectTo({
+							url: '/pages/login/searchNone'
+						});
+					} else {
+						this.orgResult = jsonData;
+						uni.hideLoading()
+					}				
+				})
+				.catch((error) => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
 			onReady() {
 				this.getList();
 			}