Bladeren bron

功能实现

lianghanqiang 4 jaren geleden
bovenliggende
commit
e20a611f1c
4 gewijzigde bestanden met toevoegingen van 145 en 70 verwijderingen
  1. 2 2
      assets/http/service.js
  2. 1 1
      components/alert/pointAuth.vue
  3. 38 67
      components/alert/smsAlert.vue
  4. 104 0
      components/alert/voteSuccess.vue

+ 2 - 2
assets/http/service.js

@@ -1,8 +1,8 @@
 import Request from 'luch-request'
 
 // let baseURL = 'http://192.168.1.91:2888'
-let baseURL = 'http://192.168.1.168:2888'
-// let baseURL = 'https://vote.guosen-fumao.cn/api'
+// let baseURL = 'http://192.168.1.168:2888'
+let baseURL = 'https://vote.guosen-fumao.cn/api'
 
 
 let tokenUrl = baseURL +

+ 1 - 1
components/alert/pointAuth.vue

@@ -28,7 +28,7 @@
 		name: "pointAuth",
 		data() {
 			return {
-				show: true,
+				show: false,
 				popupStyle: {
 					'u-mode-center-box': 'red'
 				},

+ 38 - 67
components/alert/smsAlert.vue

@@ -1,40 +1,33 @@
 <template>
-	<view class="">
-		<u-popup v-model="show" mode="center" width="80%" border-radius="15" :closeable="true">
-			<view class="sms-alert-container">
-				<view class="title">短信验证</view>
-				<view class="info-msg">验证码已发送至{{phoneInfo}}</view>
-				<view class="input-box">
-					<u-input class="input-content" type="number" maxlength="6" placeholder="请输入验证码" v-model="code" />
-					<view class="code-button">
-						<view v-if="sending==true">
-							<u-loading mode="circle"></u-loading>
-						</view>
-						<view v-else-if="seconds > 0"><span class="text-red">{{seconds+'s '}} </span>可重发</view>
-						<view v-else>
-							<u-button @click="$u.debounce(sendMessage, 500)" plain size="mini">重新发送</u-button>
-						</view>
+	<u-popup v-model="show" mode="center" width="80%" border-radius="15" :closeable="true">
+		<view class="sms-alert-container">
+			<view class="title">短信验证</view>
+			<view class="info-msg">验证码已发送至{{phoneInfo}}</view>
+			<view class="input-box">
+				<u-input class="input-content" type="number" maxlength="6" placeholder="请输入验证码" v-model="code"/>
+				<view class="code-button">
+					<view v-if="sending==true">
+						<u-loading mode="circle"></u-loading>
 					</view>
+					<view v-else-if="seconds > 0"><span class="text-red">{{seconds+'s '}} </span>可重发</view>
+					<view v-else><u-button @click="$u.debounce(sendMessage, 500)" plain size="mini">重新发送</u-button></view>
 				</view>
-				<u-button @click="$u.debounce(exchange, 500)" :custom-style="customStyle" shape="circle">确认</u-button>
 			</view>
-		</u-popup>
-		<loading ref="loading" type="3"/>
-		<toast ref="toast" ></toast>
-	</view>
+			<u-button @click="$u.debounce(validateCode, 500)" :custom-style="customStyle" shape="circle" >确认</u-button>
+		</view>
+	</u-popup>
 </template>
 
 <script>
 	export default {
-		name: "smsAlert",
+		name:"smsAlert",
 		data() {
 			return {
 				show: false,
 				sending: true,
-				phone: '19124812874',
+				phone: '13126058204',
 				code: '',
 				seconds: -1,
-				smsParams: {},
 				customStyle: {
 					color: 'white',
 					background: "#E72226",
@@ -42,92 +35,70 @@
 				}
 			};
 		},
-		computed: {
-			phoneInfo() {
-				return this.phone.substr(0, 4) + "****" + this.phone.substr(7, this.phone.length);
+		computed:{
+			phoneInfo(){
+				return this.phone.substr(0,4)+"****"+this.phone.substr(7,this.phone.length);
 			}
 		},
 		methods: {
-			async showSmsAndSend(params) {
-				this.$refs.loading.showLoading()
-				this.smsParams = params
-				let phone = params.mobile
-				if (!this.$u.test.mobile(phone)) {
+			async showSmsAndSend(phone){
+				if(this.$u.test.mobile(phone)){
 					uni.showToast({
-						title: '手机号码格式错误',
-						icon: 'none'
+					    title: '手机号码格式错误',
+					    icon: 'none'
 					});
 					return;
 				}
 				this.phone = phone;
-				await this.sendMessage();
+				await sendMessage();
 				this.show = true;
-				this.$refs.loading.hide()
 			},
-			hideSms() {
+			hideSms(){
 				this.show = false;
 			},
-			async sendMessage() {
+			async sendMessage(){
 				this.sending = true;
-				let res = await this.$api.order.sendCmccSms(this.smsParams)
-				if (!res.data.success) {
-					this.$refs.toast.error(res.data.msg)
-					this.hideSms()
-				}
 				//发送验证码
-				this.sending = false;
+				this.sending= false;
 			},
-			exchange() {
-				if (this.$isEmpty(this.code)) {
-					this.$u.toast('请输入验证码')
-					return
-				}
-				let params=this.$u.deepClone(this.smsParams)
-				params.smsCode=this.code
-				params.mobile=this.phone
-				this.$emit("exchange", params)
+			validateCode(){
+				this.$emit("validateResult",{result: true})
 			},
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
-	.sms-alert-container {
+	.sms-alert-container{
 		padding: 50rpx;
-
-		.title {
+		.title{
 			width: 100%;
 			text-align: center;
-			padding: 0rpx 10rpx 50rpx 10rpx;
+			 padding:  0rpx 10rpx 50rpx 10rpx ;
 			font-weight: 500;
 			color: #353535;
 			letter-spacing: 2rpx;
 			font-size: 30rpx;
 		}
-
-		.info-msg {
+		.info-msg{
 			padding: 5rpx 5rpx 20rpx 5rpx;
 			color: #353535;
 		}
-
-		.input-box {
+		.input-box{
 			display: flex;
 			align-items: center;
 			justify-content: left;
 			border: 1rpx solid #DDDDDD;
 			border-radius: 10rpx;
 			margin: 0 0 50rpx 0;
-			padding: 5rpx 5rpx 5rpx 30rpx;
+			padding:  5rpx 5rpx 5rpx 30rpx;
 		}
-
-		.input-content {
+		.input-content{
 			width: 66%;
 		}
-
-		.code-button {
+		.code-button{
 			width: 34%;
-			border-left: 1rpx solid #DDDDDD;
-			text-align: center;
+			border-left: 1rpx solid #DDDDDD;text-align: center;
 		}
 	}
 </style>

+ 104 - 0
components/alert/voteSuccess.vue

@@ -0,0 +1,104 @@
+<template>
+	<view>
+		<u-popup :custom-style="popupStyle" class="auth-point" v-model="show" mode="center" width="70%" border-radius="25" >
+			<view class="auth-bg">
+				<image style="width: 100%;" src="../../static/poster/votesuccess.png" mode="widthFix"></image>
+				<view class="avatar-vote flex justify-center align-center">
+					<u-avatar size="159" :src="avatar"></u-avatar>
+				</view>
+				<view class="info-box">
+					<view class="main-info">移动为您发动了{{voteCount}}人助力</view>
+					<view class="sub-info">获取{{pointNum}}普法积分,可用于积分商城兑换</view>
+					<view class="flex justify-center align-center">
+						<u-button @click="show=false" shape="circle" :custom-style="customStyle">继续投票</u-button>
+						<u-button  shape="circle" :custom-style="customStyle">为TA拉票</u-button>
+					</view>
+				</view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default {
+		name:"voteSuccess",
+		data() {
+			return {
+				show: false,
+				voteCount: 1,
+				pointNum: 1,
+				avatar: 'https://thirdwx.qlogo.cn/mmopen/vi_32/9UQvP3rrVDeMwwjSaaeXIJ2NBdKAB1SpVP8ozRxWiaDDHGJFSp0iaibclAlBeSKGMSOEVvGTia404po8yQ4ibDutO3A/132',
+				popupStyle: {
+					'u-mode-center-box': 'red'
+				},
+				customStyle: {
+					color: 'white',
+					background: "#E72226",
+					width: '220rpx',
+					margin: '15rpx'
+				}
+			};
+		},
+
+		methods: {
+			showAuth(avatar,voteCount,pointNum){
+				this.avatar = avatar;
+				this.voteCount = voteCount;
+				this.pointNum = pointNum;
+				this.show = true;
+			},
+			hide(){
+				this.show = false;
+			},
+			toAuth(){
+				let params={
+					url:encodeURIComponent(this.authUrl),
+					title:'移动积分授权'
+				}
+				this.$jump('/pages/webview/webview'+this.$u.queryParams(params));
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.auth-bg{
+		width: 100%;
+		background: transparent;
+	}
+	.auth-msg{
+		padding: 40rpx 40rpx 20rpx 40rpx;
+		display: flex;
+		align-items: center;
+		justify-content: left;
+	}
+	.avatar-vote{
+		position: absolute;
+		width: 200rpx;
+		height: 200rpx;
+		top: 100rpx;
+		left: calc(50% - 100rpx);
+		border: 2px dashed #E8E8E8;
+		border-radius: 50%;
+	}
+	.info-box{
+		position: absolute;
+		width: 100%;
+		height: auto;
+		top: 380rpx;
+		left: 0;
+		.main-info{
+			margin: 10rpx;
+			font-size: 30rpx;
+			color: #353535;
+			font-weight: 800;
+			text-align: center;
+		}
+		.sub-info{
+			margin: 15rpx auto 40rpx auto;
+			text-align: center;
+			color: #AAAAAA;
+			font-size: 22rpx;
+		}
+	}
+</style>