Browse Source

2021-7-08

cmy 3 years ago
parent
commit
5c83d14abf

+ 1 - 3
App.vue

@@ -3,7 +3,7 @@
  * vuex管理登陆状态,具体可以参考官方登陆模板示例
  */
 import { mapMutations } from 'vuex';
-import { weixindata, setRouter } from './utils/wxAuthorized';
+import { weixindata } from './utils/wxAuthorized';
 export default {
 	data() {
 		return {
@@ -29,8 +29,6 @@ export default {
 				}
 			});
 		}
-		// 保存路由对象
-		setRouter(this.$router);
 		//判断是否已经缓存浏览器
 		let bool = uni.getStorageSync('weichatBrowser') || '';
 		if (bool === '') {

+ 32 - 0
api/tp.js

@@ -7,3 +7,35 @@ export function ptDetail(data) {
 		data
 	});
 }
+//投票 
+export function ptPush(data,uid) {
+	return request({
+		url: '/api/vote/'+uid,
+		method: 'post',
+		data
+	});
+}
+// 投票活动详情
+export function ptJoin(data) {
+	return request({
+		url: '/api/vote/join/1',
+		method: 'get',
+		data
+	});
+}
+// 我要报名
+export function pushJoin(data) {
+	return request({
+		url: '/api/vote/join/1',
+		method: 'post',
+		data
+	});
+}
+// 公众号充值
+export function rechargeWechat(data) {
+	return request({
+		url: '/api/recharge/wechat',
+		method: 'post',
+		data
+	});
+}

+ 66 - 0
components/upImg.vue

@@ -0,0 +1,66 @@
+<template>
+	<u-upload :max-count="maxCount" :action="requertUrl" :header="header" :auto-upload="autoUpload" @on-uploaded="getImg"></u-upload>
+	<!-- <u-upload max-count="1" :action="upUrl" :header="upHeader" ref="uUpload" @on-uploaded="setImg"></u-upload> -->
+</template>
+
+<script>
+import { mapState } from 'vuex';
+export default {
+	props: {
+		
+		// 是否自动上传
+		autoUpload: {
+			type: Boolean,
+			default: true
+		},
+		// 最大上传数量
+		maxCount: {
+			type: Number | String,
+			default: 1
+		},
+		// 请求地址
+		action: {
+			default: ''
+		},
+		// 请求头
+		header: {
+			type: Object,
+			default: function() {
+				return {
+					'Authori-zation': 'Bearer ' + uni.getStorageSync('token') || ''
+				};
+			}
+		}
+	},
+	data() {
+		return {
+			refName:''
+		};
+	},
+	computed: {
+		...mapState(['baseURL']),
+		// 默认请求地址
+		requertUrl() {
+			if (!this.action) {
+				return this.baseURL + '/api/upload/image';
+			} else {
+				return this.action;
+			}
+		},
+		getImg(e) {
+			console.log(e);
+			// this.$emit('on-uploaded', e);
+		},
+		// 手动上传
+		upload(){
+			this.$refs.upLoad.upload()
+		}
+	},
+	created() {
+		console.log(this);
+	},
+	methods: {}
+};
+</script>
+
+<style></style>

+ 1 - 1
manifest.json

@@ -73,7 +73,7 @@
         "devServer" : {
             "proxy" : {
                 "/api" : {
-                    "target" : "http://192.168.0.101/api",
+                    "target" : "http://vote.frp.liuniu946.com/api",
                     // "changeOrigin": true,
                     "pathRewrite" : {
                         "/api" : "" // rewrite path

+ 25 - 3
pages.json

@@ -7,12 +7,28 @@
 			"style": {
 				"navigationBarTitleText": "投票",
 				"app-plus": {
-					"titleNView": {
-						"type": "transparent"
-					}
+					"titleNView": false
 				}
 			}
 		},
+		{
+				"path": "pages/recharge/pay",
+				"style": {
+					"navigationBarTitleText": "金币充值"
+				}
+			},
+		{
+			"path": "pages/addTp/user",
+			"style": {
+				"navigationBarTitleText": "个人参赛"
+			}
+		},
+		{
+			"path": "pages/addTp/company",
+			"style": {
+				"navigationBarTitleText": "企业参赛"
+			}
+		},
 		{
 			"path": "pages/public/wxLogin",
 			"style": {
@@ -63,6 +79,12 @@
 					}
 				}
 			}
+		},
+		{
+			"path": "pages/activity/index",
+			"style": {
+				"navigationBarTitleText": "活动规则"
+			}
 		}
 
 	],

+ 33 - 0
pages/activity/index.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="box"><rich-text :nodes="data"></rich-text></view>
+</template>
+<script>
+import { ptDetail, ptJoin } from '@/api/tp.js';
+export default {
+	data() {
+		return {
+			data: ''
+		};
+	},
+	onLoad(res) {
+		this.ptDetail();
+	},
+	methods: {
+		// 请求返回项目数据
+		ptDetail() {
+			ptDetail()
+				.then(e => {
+					this.data = e.data.detail;
+				})
+				.catch(e => {
+					console.log();
+				});
+		}
+	}
+};
+</script>
+<style lang="scss">
+.box {
+	padding: 0 30rpx;
+}
+</style>

+ 138 - 0
pages/addTp/company.vue

@@ -0,0 +1,138 @@
+<template>
+	<view class="box">
+		<view class="fromData">
+			<u-form :model="form" ref="uForm">
+				<u-form-item label="姓名"><u-input placeholder="请输入姓名" v-model="form.name" /></u-form-item>
+				<u-form-item label="电话"><u-input placeholder="请输入手机号码"  v-model="form.phone" /></u-form-item>
+				<u-form-item label="地址"><u-input placeholder="请输入详细地址"  v-model="form.address" /></u-form-item>
+				<u-form-item label="企业"><u-input placeholder="请输入企业名称"  v-model="form.company" /></u-form-item>
+				<u-form-item label="职业"><u-input v-model="form.occupation" type="select" :select-open="showOccupation" @click="showOccupation = !showOccupation" /></u-form-item>
+				<u-form-item label="简介"><u-input placeholder="请输入简介"  maxlength='200' type="textarea" v-model="form.detail" /></u-form-item>
+				<u-form-item label="头像"><u-upload max-count="1" :action="upUrl" :header="upHeader" @on-uploaded="setImg"></u-upload></u-form-item>
+			</u-form>
+		</view>
+		<u-action-sheet :list="occupationList" v-model="showOccupation" @click="changeOccupation"></u-action-sheet>
+		<view class="upButtom" @click="submit">提交申请</view>
+	</view>
+</template>
+
+<script>
+import { pushJoin } from '@/api/tp.js';
+import { mapState } from 'vuex';
+export default {
+	data() {
+		return {
+			form: {
+				name: '', //姓名
+				phone: '', //联系方式
+				address: '', //地址
+				occupation: '产康师', //职业
+				upImg: '' ,//上传头像
+				detail:'',//简介
+				company:''//企业
+			},
+			// 是否显示职业选择弹窗
+			showOccupation: false,
+			//职业类型选择
+			occupationList: [
+				{
+					text: '产康师'
+				},
+				{
+					text: '母乳喂养指导师'
+				}
+			],
+			fileList: [
+				{
+					url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg'
+				}
+			]
+		};
+	},
+	computed: {
+		...mapState(['baseURL']),
+		// 上传图片地址
+		upUrl() {
+			return this.baseURL + '/api/upload/image';
+		},
+		upHeader() {
+			return {
+				'Authori-zation': 'Bearer ' + uni.getStorageSync('token') || ''
+			};
+		}
+	},
+	onLoad() {},
+	onShow() {},
+	methods: {
+		// 选中切换
+		changeOccupation(e) {
+			console.log(this.occupationList[e].text);
+			this.form.occupation = this.occupationList[e].text
+			console.log(e);
+		},
+		submit() {
+			uni.showLoading({
+				title: '提交报名中...',
+				mask: true
+			});
+			const data = this.form
+			pushJoin({
+				type: 2,
+				job:data.occupation ,
+				name:data.name ,
+				phone:data.phone ,
+				address:data.address ,
+				avatar:data.upImg ,
+				detail:data.detail ,
+				company:data.company
+			})
+				.then(e => {
+					uni.hideLoading();
+					uni.showToast({
+						title: '报名成功'
+					});
+					uni.showModal({
+						title: '提示',
+						content: '是否返回活动页?',
+						success: res => {
+							if(res.confirm){
+								uni.navigateBack()
+							}
+						},
+					});
+					console.log(e);
+				})
+				.catch(e => {
+					uni.hideLoading();
+					console.log(e);
+				});
+		},
+		setImg(data, index, lists, name) {
+			console.log(data);
+			this.form.upImg = data[0].response.data.url;
+			console.log(this.form.upImg);
+		}
+	}
+};
+</script>
+
+<style>
+.fromData {
+	background-color: #ffffff;
+	border-radius: 10rpx;
+	margin: 30rpx;
+	padding: 0 20rpx;
+}
+.upButtom {
+	background: #d7272b;
+	color: #ffffff;
+	font-size: 32rpx;
+	font-weight: bold;
+	text-align: center;
+	padding: 20rpx 0;
+	position: fixed;
+	bottom: 0;
+	left: 0;
+	right: 0;
+}
+</style>

+ 135 - 0
pages/addTp/user.vue

@@ -0,0 +1,135 @@
+<template>
+	<view class="box">
+		<view class="fromData">
+			<u-form :model="form" ref="uForm">
+				<u-form-item label="姓名"><u-input placeholder="请输入姓名" v-model="form.name" /></u-form-item>
+				<u-form-item label="电话"><u-input placeholder="请输入手机号码"  v-model="form.phone" /></u-form-item>
+				<u-form-item label="地址"><u-input placeholder="请输入详细地址"  v-model="form.address" /></u-form-item>
+				<u-form-item label="职业"><u-input v-model="form.occupation" type="select" :select-open="showOccupation" @click="showOccupation = !showOccupation" /></u-form-item>
+				<u-form-item label="简介"><u-input placeholder="请输入简介" maxlength='200' type="textarea" v-model="form.detail" /></u-form-item>
+				<u-form-item label="头像"><u-upload max-count="1" :action="upUrl" :header="upHeader" @on-uploaded="setImg"></u-upload></u-form-item>
+			</u-form>
+		</view>
+		<u-action-sheet :list="occupationList" v-model="showOccupation" @click="changeOccupation"></u-action-sheet>
+		<view class="upButtom" @click="submit">提交申请</view>
+	</view>
+</template>
+
+<script>
+import { pushJoin } from '@/api/tp.js';
+import { mapState } from 'vuex';
+export default {
+	data() {
+		return {
+			form: {
+				name: '', //姓名
+				phone: '', //联系方式
+				address: '', //地址
+				occupation: '产康师', //职业
+				upImg: '' ,//上传头像
+				detail:''//简介
+			},
+			// 是否显示职业选择弹窗
+			showOccupation: false,
+			//职业类型选择
+			occupationList: [
+				{
+					text: '产康师'
+				},
+				{
+					text: '母乳喂养指导师'
+				}
+			],
+			fileList: [
+				{
+					url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg'
+				}
+			]
+		};
+	},
+	computed: {
+		...mapState(['baseURL']),
+		// 上传图片地址
+		upUrl() {
+			return this.baseURL + '/api/upload/image';
+		},
+		upHeader() {
+			return {
+				'Authori-zation': 'Bearer ' + uni.getStorageSync('token') || ''
+			};
+		}
+	},
+	onLoad() {},
+	onShow() {},
+	methods: {
+		// 选中切换
+		changeOccupation(e) {
+			console.log(this.occupationList[e].text);
+			this.form.occupation = this.occupationList[e].text
+			console.log(e);
+		},
+		submit() {
+			uni.showLoading({
+				title: '提交报名中...',
+				mask: true
+			});
+			const data = this.form
+			pushJoin({
+				type: 1,
+				job:data.occupation ,
+				name:data.name ,
+				phone:data.phone ,
+				address:data.address ,
+				avatar:data.upImg ,
+				detail:data.detail ,
+			})
+				.then(e => {
+					uni.hideLoading();
+					uni.showToast({
+						title: '报名成功'
+					});
+					uni.showModal({
+						title: '提示',
+						content: '是否返回活动页?',
+						success: res => {
+							if(res.confirm){
+								uni.navigateBack()
+							}
+						},
+					});
+					console.log(e);
+				})
+				.catch(e => {
+					uni.hideLoading();
+					console.log(e);
+				});
+		},
+		setImg(data, index, lists, name) {
+			console.log(data);
+			this.form.upImg = data[0].response.data.url;
+			console.log(this.form.upImg);
+		}
+	}
+};
+</script>
+
+<style>
+.fromData {
+	background-color: #ffffff;
+	border-radius: 10rpx;
+	margin: 30rpx;
+	padding: 0 20rpx;
+}
+.upButtom {
+	background: #d7272b;
+	color: #ffffff;
+	font-size: 32rpx;
+	font-weight: bold;
+	text-align: center;
+	padding: 20rpx 0;
+	position: fixed;
+	bottom: 0;
+	left: 0;
+	right: 0;
+}
+</style>

+ 749 - 60
pages/index.vue

@@ -1,58 +1,189 @@
 <template>
 	<view class="container">
+		<image class="topImg" src="../static/img/img02.png" mode="widthFix"></image>
 		<view class="contentBox">
 			<view class="btoomBg"></view>
 			<view class="topBg">
-				<view class="tpRight"><view class="textBox">活动规则</view></view>
-				<view class="tpTitle">评选活动</view>
-				<view class="endTextBox flex">
-					<view class="leftLine"><view class="roundness"></view></view>
-					<view class="textLine">距离投票结束还有</view>
-					<view class="rightLine"><view class="roundness"></view></view>
-				</view>
-				<view class="down">
-					<u-count-down
-						separator="zh"
-						font-size="32"
-						separator-color="#666666"
-						separator-size="32"
-						bg-color="#D7272B"
-						color="#FFFFFF"
-						:show-border="false"
-						:timestamp="timestamp"
-					></u-count-down>
-				</view>
-				<view class="tjContent flex">
-					<view class="tjItem">
-						<view class="topText">
-							{{ item.pepole }}
-							<text class="iconTip">人</text>
+				<image class="leftIcon" src="../static/img/img06.png" mode="widthFix"></image>
+				<image class="topImg" src="../static/img/img08.png" mode="widthFix"></image>
+				<view class="tpConent">
+					<view class="tpRight"><view class="textBox" @click="nextTo('/pages/activity/index')">活动规则</view></view>
+					<view class="tpTitle">评选活动</view>
+					<view class="endTextBox flex">
+						<view class="leftLine"><view class="roundness"></view></view>
+						<view class="textLine">距离投票结束还有</view>
+						<view class="rightLine"><view class="roundness"></view></view>
+					</view>
+					<view class="down">
+						<u-count-down
+							separator="zh"
+							font-size="32"
+							separator-color="#666666"
+							separator-size="32"
+							bg-color="#D7272B"
+							color="#FFFFFF"
+							:show-border="false"
+							:timestamp="timestamp"
+							@end="stopTime"
+						></u-count-down>
+					</view>
+					<view class="tjContent flex">
+						<view class="tjItem">
+							<view class="topText">
+								{{ item.pepole }}
+								<text class="iconTip">人</text>
+							</view>
+							<view class="bottomText">参与者</view>
+						</view>
+						<view class="tjItem">
+							<view class="topText">
+								{{ item.votes }}
+								<text class="iconTip">票</text>
+							</view>
+							<view class="bottomText">投票数</view>
+						</view>
+						<view class="tjItem">
+							<view class="topText">
+								{{ item.count }}
+								<text class="iconTip">次</text>
+							</view>
+							<view class="bottomText">浏览量</view>
 						</view>
-						<view class="bottomText">参与者</view>
 					</view>
-					<view class="tjItem">
-						<view class="topText">
-							{{ item.votes }}
-							<text class="iconTip">票</text>
+					<view class="input flex">
+						<u-input
+							type="select"
+							v-model="input.value"
+							confirm-type="search"
+							@confirm="searchProduct"
+							placeholder="请输入选手姓名和编号"
+							:height="input.height"
+							:type="input.type"
+						/>
+						<u-icon color="#999999" class="iconT" @click="searchProduct" name="search"></u-icon>
+					</view>
+					<view class="tabsBox"><u-tabs :list="list" active-color="#D7272B" :is-scroll="false" :current="rank" @change="changeRank"></u-tabs></view>
+					<!-- 最新 -->
+					<view v-if="rank == 0" class="itemList flex">
+						<view class="itemData" v-for="item in userlist.list">
+							<view class="itemContentBox">
+								<view class="itemImgbox">
+									<view class="iconBox">
+										<view>{{ item.sub_id }}</view>
+										<view>号</view>
+									</view>
+									<image class="itemImg" :src="item.avatar" mode="scaleToFill"></image>
+									<view class="itemAddress clamp" v-if="item.address">{{ item.address }}</view>
+								</view>
+								<view class="itemNameBox flex">
+									<view class="itemName">{{ item.name }}</view>
+									<view class="itemVote">{{ item.vote }}票</view>
+								</view>
+							</view>
+							<view class="itemBottom" @click="chargeConfirm(item)">投票</view>
 						</view>
-						<view class="bottomText">投票数</view>
 					</view>
-					<view class="tjItem">
-						<view class="topText">
-							{{ item.count }}
-							<text class="iconTip">次</text>
+					<u-loadmore v-if="rank == 0" :status="userlist.loadingType" />
+					<!-- 产康师排行 -->
+					<view class="phItemList" v-if="rank == 1">
+						<view class="phItem flex" v-for="(item, ind) in phlist.list">
+							<view class="icon">
+								<image v-if="ind == 0" class="tipImg" src="../static/img/rank1.png" mode="widthFix"></image>
+								<image v-if="ind == 1" class="tipImg" src="../static/img/rank2.png" mode="widthFix"></image>
+								<image v-if="ind == 2" class="tipImg" src="../static/img/rank3.png" mode="widthFix"></image>
+								<view class="tipText" v-if="ind > 2">{{ ind }}</view>
+							</view>
+							<view class="flex phRightBox">
+								<view class="avatarBox"><image class="avatarImg" :src="item.avatar" mode="scaleToFill"></image></view>
+								<view class="phTextBox">
+									<view class="phTtemName">{{ item.name }}</view>
+									<view class="phItemAddress">{{ item.address }}</view>
+								</view>
+								<view class="phRight flex">
+									<text class="textVote">{{ item.vote }}</text>
+									<image class="phTipImg" src="../static/img/level.png" mode="widthFix"></image>
+								</view>
+							</view>
 						</view>
-						<view class="bottomText">浏览量</view>
 					</view>
+					<u-loadmore v-if="rank == 1" :status="phlist.loadingType" />
+					<!-- 母乳喂养排行 -->
+					<view class="phItemList" v-if="rank == 2">
+						<view class="phItem flex" v-for="(item, ind) in mrlist.list">
+							<view class="icon">
+								<image v-if="ind == 0" class="tipImg" src="../static/img/rank1.png" mode="widthFix"></image>
+								<image v-if="ind == 1" class="tipImg" src="../static/img/rank2.png" mode="widthFix"></image>
+								<image v-if="ind == 2" class="tipImg" src="../static/img/rank3.png" mode="widthFix"></image>
+								<view class="tipText" v-if="ind > 2">{{ ind }}</view>
+							</view>
+							<view class="flex phRightBox">
+								<view class="avatarBox"><image class="avatarImg" :src="item.avatar" mode="scaleToFill"></image></view>
+								<view class="phTextBox">
+									<view class="phTtemName">{{ item.name }}</view>
+									<view class="phItemAddress">{{ item.address }}</view>
+								</view>
+								<view class="phRight flex">
+									<text class="textVote">{{ item.vote }}</text>
+									<image class="phTipImg" src="../static/img/level.png" mode="widthFix"></image>
+								</view>
+							</view>
+						</view>
+					</view>
+					<u-loadmore v-if="rank == 2" :status="mrlist.loadingType" />
 				</view>
-				<view class="input flex"><u-input type="select" v-model="input.value" confirm-type='search'  @confirm='searchProduct' placeholder="请输入选手姓名和编号" :height="input.height" :type="input.type"/><u-icon color="#999999" class="iconT" @click="searchProduct" name="search">
-				</u-icon></view>
 			</view>
 		</view>
+		<view class="addUser"  @click="pushUserData">我要参与</view>
+		<u-popup border-radius="20" width="540" v-model="showAlert" mode="center">
+			<view class="alertBox">
+				<image class="titleImg" src="../static/img/alertbg.png" mode="widthFix"></image>
+				<view class="title">参赛类型</view>
+				<view class="titleTip">请选择您的参赛身份类型</view>
+				<view class="lxTtem flex" @click="csType = 0">
+					<view class="leftTitle flex">
+						<image class="leftImgTip" src="../static/img/user.png" mode="heightFix"></image>
+						<text>个人参赛</text>
+					</view>
+					<view class="rightTip flex"><view v-if="csType == 0" class="xzTip"></view></view>
+				</view>
+				<view class="lxTtem flex" @click="csType = 1">
+					<view class="leftTitle flex">
+						<image class="leftImgTip" src="../static/img/userAll.png" mode="heightFix"></image>
+						<text>企业参赛(我有所属企业)</text>
+					</view>
+					<view class="rightTip flex"><view v-if="csType == 1" class="xzTip"></view></view>
+				</view>
+
+				<view class="pushtyle" @click="pushBm">确认</view>
+			</view>
+		</u-popup>
+
+		<u-popup border-radius="20" v-model="showCharge" mode="bottom">
+			<view class="alertChargeBox">
+				<view class="alertCharge flex">
+					<view class="chargeItem" :class="{ actionCharge: ind == moneyIndex }" v-for="(ls, ind) in 8" @click="moneyIndex = ind">
+						<view class="chargeImgIcon">{{ (ind + 1) * numCharge }}票</view>
+						<view class="chargeImgBox"><image class="chargeImg" :src="'../static/img/chargeIcon' + (ind + 1) + '.png'" mode="widthFix"></image></view>
+						<view class="chargeTextBox flex">
+							<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
+							<text>{{ (ind + 1) * numCharge }}</text>
+						</view>
+					</view>
+				</view>
+				<view class="flex chargeButtom">
+					<view class="left flex">
+						<image class="chargeIcon" src="../static/img/moneyIcon.png" mode="scaleToFill"></image>
+						<text class="num">¥{{ (moneyIndex + 1) * numCharge * priceBl }}</text>
+						<text class="tip">可为选手加{{ (moneyIndex + 1) * numCharge }}票</text>
+					</view>
+					<view class="right" @click="commitCharge">赠送</view>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 <script>
-import { ptDetail } from '@/api/tp.js';
+import { ptDetail, ptJoin,ptPush } from '@/api/tp.js';
 export default {
 	data() {
 		return {
@@ -67,57 +198,412 @@ export default {
 			input: {
 				value: '',
 				type: 'text',
-				height:60
-			}
+				height: 60
+			},
+			// 最新列表
+			userlist: {
+				list: [],
+				page: 1,
+				limit: 10,
+				loadingType: 'loadmore'
+			},
+			// 产康师排行
+			phlist: {
+				list: [],
+				page: 1,
+				limit: 10,
+				loadingType: 'loadmore'
+			},
+			// 产康师排行
+			mrlist: {
+				list: [],
+				page: 1,
+				limit: 10,
+				loadingType: 'loadmore'
+			},
+			/* 选中的类型0为最新1为排行 */
+			rank: 0,
+			// 切换列表
+			list: [
+				{
+					name: '最新'
+				},
+				{
+					name: '产康师排行'
+				},
+				{
+					name: '母乳喂养师排行'
+				}
+			],
+			//参赛类型
+			csType: 0, //0个人 1企业
+			showAlert: false, //显示参赛弹窗
+			showCharge: false, //显示投票弹窗
+			moneyIndex: 0, //当前选中的投票对象
+			numCharge:10,//默认对应翻倍比例
+			priceBl: 1 ,//默认1票对应金额投票比例
+			chargeUserItem:{},//当前选中的投票对象
+			timeStop:false,//判断倒计时是否结束
 		};
 	},
-	onLoad() {
+	watch: {
+		rank(newValue, oldValue) {
+			let data = {};
+			let rank = 0;
+			let job = '';
+			// 判断是否为最新
+			if (newValue == 0) {
+				data = this.userlist;
+				rank = 0;
+			} else {
+				rank = 1;
+			}
+			// 判断是否为产康师排行
+			if (newValue == 1) {
+				data = this.phlist;
+				job = '产康师';
+			}
+			// 判断是否为母乳喂养排行
+			if (newValue == 2) {
+				data = this.mrlist;
+				job = '母乳喂养指导师';
+			}
+			this.getData(data, rank, job);
+		},
+	},
+	onShow() {
 		this.ptDetail();
+		this.ptJoin();
+	},
+	// 页面下拉到底部加载
+	onReachBottom() {
+		this.ptJoin();
 	},
 	methods: {
+		// 倒计时结束
+		stopTime(){
+			this.timeStop= true;
+		},
+		//开始投票 
+		commitCharge(){
+			uni.showLoading({
+				title:"投票中",
+				mask:true
+			})
+			ptPush({
+				num:this.numCharge*(this.moneyIndex+1),
+				payType:'yue'
+			},this.chargeUserItem.id).then((e) => {
+				uni.hideLoading()
+				if(e.msg =='余额支付成功'){
+					uni.showToast({
+						title:'投票成功!'
+					})
+					window.reload()
+				}else{
+					this.showCharge = false;
+					uni.showModal({
+						title: '错误',
+						content: '余额不足请充值',
+						success: res => {
+							if(res.confirm){
+								uni.navigateTo({
+									url:'/pages/recharge/pay'
+								})
+							}
+						},
+						fail: () => {},
+						complete: () => {}
+					});
+				}
+				
+			}).catch((e) => {
+				uni.hideLoading()
+			})
+		},
+		// 投票弹窗
+		chargeConfirm(item) {
+			if(this.timeStop){
+				uni.showModal({
+					title: '提示',
+					content: '投票已结束!',
+					showCancel: false,
+				});
+				return
+			};
+			this.showCharge = true;
+			// 保存当前选中的投票对象
+			this.chargeUserItem = item
+		},
+		// 确认报名
+		pushBm() {
+			this.showAlert = false;
+			if (this.csType == 0) {
+				uni.navigateTo({
+					url: '/pages/addTp/user'
+				});
+			}
+
+			if (this.csType == 1) {
+				uni.navigateTo({
+					url: '/pages/addTp/company'
+				});
+			}
+		},
+		// 切换当前选中的查询
+		changeRank(index) {
+			this.rank = index;
+		},
+		//获取用户列表
+		ptJoin() {
+			// 获取项目对象
+			let navItem = this.userlist;
+			// 获取最新数据
+			this.getData(navItem, 0);
+		},
+		// 请求返回项目数据
 		ptDetail() {
 			ptDetail()
 				.then(e => {
-					console.log(e);
+					const data = e.data;
+					this.timestamp = data.end_time - new Date().getTime() / 1000;
+					this.item.pepole = data.join_num;
+					this.item.votes = data.vote_num;
+					this.item.count = data.visit;
+					this.priceBl = +data.price;
 				})
 				.catch(e => {
 					console.log();
 				});
 		},
-		searchProduct(e){
-			console.log(e);
+		// 查询报名数据
+		searchProduct(e) {
+			// 初始化数据
+			const data = {
+				list: [],
+				page: 1,
+				limit: 10,
+				loadingType: 'loadmore'
+			};
+			// 判断是否为最新
+			if (this.rank == 0) {
+				this.userlist = data;
+			}
+			// 判断是否为排行
+			if (this.rank == 1) {
+				this.phlist = data;
+			}
+			this.getData(data, this.rank);
+		},
+		// 页面跳转
+		nextTo(url) {
+			console.log(url, '跳转地址');
+			uni.navigateTo({
+				url,
+				fail: e => {
+					console.log(e);
+				}
+			});
+		},
+		// 报名
+		pushUserData() {
+			if(this.timeStop){
+				uni.showModal({
+					title: '提示',
+					content: '投票已结束!',
+					showCancel: false,
+				});
+				return
+			};
+			this.showAlert = true;
+		},
+		// 请求用户数据
+		getData(navItem, rank, job) {
+			// 获取项目对象
+			if (navItem.loadingType === 'loading') {
+				//防止重复加载
+				return;
+			}
+			if (navItem.loadingType === 'nomore') {
+				//防止重复加载
+				return;
+			}
+			// 修改当前对象状态为加载中
+			navItem.loadingType = 'loading';
+			ptJoin({
+				page: navItem.page,
+				limit: navItem.limit,
+				key_word: this.input.value,
+				rank: rank,
+				job: job
+			})
+				.then(e => {
+					const data = e.data.data;
+					navItem.list = navItem.list.concat(data);
+					navItem.page++;
+					if (navItem.limit == data.length) {
+						//判断是否还有数据, 有改为 more, 没有改为noMore
+						navItem.loadingType = 'loadmore';
+						return;
+					} else {
+						//判断是否还有数据, 有改为 more, 没有改为noMore
+						navItem.loadingType = 'nomore';
+					}
+					this.$set(navItem, 'loaded', true);
+				})
+				.catch(e => {
+					navItem.loadingType = 'loadmore';
+					console.log(e);
+				});
 		}
 	}
 };
 </script>
 <style lang="scss">
-page {
-	height: 100%;
+page,
+.container {
+	height: auto;
+	min-height: 100%;
 	background-color: #ff9ba7;
 }
+.container {
+	padding-bottom: 22rpx;
+	position: relative;
+}
+.alertChargeBox {
+	.alertCharge {
+		justify-content: flex-start;
+		flex-wrap: wrap;
+		padding: 30rpx;
+		.chargeItem {
+			width: 25%;
+			text-align: center;
+			position: relative;
+			height: 180rpx;
+			padding: 40rpx;
+			margin: 20rpx 0;
+			&.actionCharge {
+				border: 1px solid #d7272b;
+				border-radius: 10rpx;
+			}
+			.chargeImgIcon {
+				position: absolute;
+				top: 10rpx;
+				right: 10rpx;
+				font-size: 18rpx;
+				font-weight: bold;
+				color: #ffffff;
+				border-top-right-radius: 90rpx;
+				border-top-left-radius: 90rpx;
+				border-bottom-right-radius: 90rpx;
+				padding: 5rpx 15rpx;
+				background-color: #d7272b;
+			}
+			.chargeTextBox {
+				position: absolute;
+				bottom: 10rpx;
+				right: 0;
+				left: 0;
+				justify-content: center;
+				color: #223438;
+				font-size: 24rpx;
+				text-align: center;
+				.chargeIcon {
+					width: 35rpx;
+					height: 35rpx;
+					margin-right: 10rpx;
+				}
+			}
 
+			.chargeImgBox {
+				.chargeImg {
+					width: 77rpx;
+				}
+			}
+		}
+	}
+	.chargeButtom {
+		padding: 30rpx;
+		background-color: #fff6f6;
+		.left {
+			font-weight: bold;
+			flex-grow: 1;
+			justify-content: flex-start;
+			.chargeIcon {
+				width: 40rpx;
+				height: 40rpx;
+			}
+			.num {
+				margin-left: 10rpx;
+				color: #16363a;
+				font-size: 30rpx;
+			}
+			.tip {
+				margin-left: 10rpx;
+				color: #d82a2e;
+				font-size: 24rpx;
+			}
+		}
+		.right{
+			background-color: #D7272B;
+			color: #ffffff;
+			border-radius: 99rpx;
+			padding: 5rpx 40rpx;
+			font-size: 26rpx;
+		}
+	}
+}
+.addUser {
+	clear: both;
+	background: #d7272b;
+	border: 1px solid #170911;
+	border-radius: 7px;
+	margin: 0 40rpx;
+	line-height: 1;
+	font-size: 31rpx;
+	font-weight: bold;
+	color: #ffffff;
+	text-align: center;
+	padding: 30rpx;
+	line-height: 24rpx;
+	margin-top: 50rpx;
+}
+.topImg {
+	width: 100%;
+}
 .contentBox {
 	position: relative;
 	width: 0px;
 	min-width: 100%;
-	padding-top: 32rpx;
+	margin-bottom: 32rpx;
 	.btoomBg {
 		background-color: #ffffff;
-		margin-left: 42rpx;
-		margin-right: 30rpx;
 		min-height: 50vh;
+		height: 100%;
+		position: absolute;
+		top: 32rpx;
+		right: 30rpx;
+		left: 42rpx;
 	}
 	.topBg {
-		position: absolute;
-		top: 0;
-		width: 678rpx;
-		min-height: 50vh;
+		position: relative;
 		margin-left: 30rpx;
 		margin-right: 42rpx;
-		background: #ffffff;
 		box-shadow: 3px 5rpx 3rpx 0rpx rgba(4, 0, 0, 0.15);
-		padding-top: 23rpx;
-		line-height: 1;
+		line-height: 0;
+		.leftIcon {
+			position: absolute;
+			top: 30rpx;
+			left: -30rpx;
+			width: 100rpx;
+		}
+		.tpConent {
+			background: #ffffff;
+			line-height: 1;
+			min-height: 50vh;
+			padding-top: 28rpx;
+			padding-bottom: 20rpx;
+		}
 		.down {
 			text-align: center;
 		}
@@ -195,12 +681,151 @@ page {
 				padding: 0 20rpx;
 			}
 		}
-		.input{
-			padding:0 30rpx ;
-			margin: 50rpx 30rpx ;
-			background: #EBEBEB;
+		.input {
+			padding: 0 30rpx;
+			margin: 50rpx 30rpx;
+			margin-bottom: 20rpx;
+			background: #ebebeb;
 			border-radius: 30rpx;
 		}
+		.tabsBox {
+			padding-bottom: 20rpx;
+			border-bottom: 1px solid #ebebeb;
+			margin-bottom: 50rpx;
+		}
+		.itemList {
+			flex-wrap: wrap;
+			justify-content: start;
+			padding: 0 15rpx;
+			.itemData {
+				width: 50%;
+				flex-grow: 0;
+				flex-shrink: 0;
+				padding: 0 15rpx;
+				margin-bottom: 30rpx;
+				.itemContentBox {
+					padding: 0 15rpx;
+					.itemImgbox {
+						width: 100%;
+						padding-top: calc(100% - 30rpx);
+						position: relative;
+						margin-bottom: 20rpx;
+						.itemAddress {
+							position: absolute;
+							bottom: 0;
+							left: 0;
+							right: 0;
+							background: #262626;
+							opacity: 0.6;
+							color: #ffffff;
+							font-size: 24rpx;
+							padding: 10rpx 0;
+							text-align: center;
+						}
+						.itemImg {
+							position: absolute;
+							top: 0;
+							left: 0;
+							width: 100%;
+							height: 100%;
+						}
+						.iconBox {
+							padding-top: 10rpx;
+							position: absolute;
+							top: -18rpx;
+							left: -18rpx;
+							height: 73rpx;
+							width: 62rpx;
+							z-index: 99;
+							background-image: url(../static/img/img07.png);
+							background-size: 100% 100%;
+							color: #ffffff;
+							font-size: 24rpx;
+							text-align: center;
+						}
+					}
+					.itemNameBox {
+						margin-bottom: 20rpx;
+						font-size: 30rpx;
+						font-weight: bold;
+						.itemName {
+							color: #333333;
+						}
+						.itemVote {
+							color: #d7272b;
+						}
+					}
+				}
+				.itemBottom {
+					background: #ffc103;
+					color: #ffffff;
+					font-size: 30rpx;
+					padding: 15rpx;
+					text-align: center;
+				}
+			}
+		}
+		.phItemList {
+			padding: 0 30rpx;
+			margin-top: -50rpx;
+			.phItem {
+				padding: 20rpx 0;
+				.icon {
+					flex-shrink: 0;
+					width: 50rpx;
+					.tipImg {
+						width: 42rpx;
+					}
+					.tipText {
+						color: #d7272b;
+						font-size: 36rpx;
+						font-weight: bold;
+					}
+				}
+				.phRightBox {
+					flex-grow: 1;
+					border-bottom: 1px solid #ebebeb;
+					padding: 20rpx 0;
+					.avatarBox {
+						flex-shrink: 0;
+						.avatarImg {
+							width: 96rpx;
+							height: 96rpx;
+							border-radius: 99rpx;
+							margin-left: 10rpx;
+						}
+					}
+					.phTextBox {
+						flex-grow: 1;
+						margin-left: 15rpx;
+						.phTtemName {
+							color: #333333;
+							font-size: 32rpx;
+						}
+						.phItemAddress {
+							color: #999999;
+							font-size: 24rpx;
+							margin-top: 10rpx;
+						}
+					}
+					.phRight {
+						flex-shrink: 0;
+						text-align: right;
+						justify-content: right;
+						.textVote {
+							color: #ffbb17;
+							font-size: 36rpx;
+							font-weight: bold;
+							margin-right: 13rpx;
+						}
+						.phTipImg {
+							width: 23rpx;
+							height: 39rpx;
+						}
+					}
+				}
+			}
+		}
 	}
 }
 /deep/ .u-countdown-item {
@@ -208,4 +833,68 @@ page {
 	border-radius: 8rpx;
 	overflow: hidden;
 }
+.alertBox {
+	padding-bottom: 40rpx;
+	.titleImg {
+		width: 100%;
+		z-index: -1;
+	}
+	.title {
+		text-align: center;
+		font-size: 36rpx;
+		font-weight: bold;
+		color: #333333;
+		margin-top: -80rpx;
+	}
+	.titleTip {
+		text-align: center;
+		font-size: 24rpx;
+		font-weight: bold;
+		color: #808080;
+	}
+	.lxTtem {
+		margin: 0 40rpx;
+		padding: 30rpx 0;
+		border-bottom: 1px solid #ebebeb;
+		.leftTitle {
+			justify-content: start;
+			width: 43rpx;
+			flex-grow: 1;
+			color: #333333;
+			font-size: 28rpx;
+			.leftImgTip {
+				flex-shrink: 0;
+				// width: 30rpx;
+				height: 30rpx;
+				margin-right: 20rpx;
+			}
+		}
+		.rightTip {
+			border: 1px solid #d7272b;
+			opacity: 0.5;
+			border-radius: 50%;
+			width: 32rpx;
+			height: 32rpx;
+			justify-content: center;
+			.xzTip {
+				width: 20rpx;
+				height: 20rpx;
+				border-radius: 99rpx;
+				background-color: #d7272b;
+			}
+		}
+	}
+	.pushtyle {
+		background: #d7272b;
+		box-shadow: 0px 16rpx 16rpx 0px rgba(215, 39, 43, 0.5);
+		border-radius: 10rpx;
+		color: #ffffff;
+		font-size: 28rpx;
+		font-weight: bold;
+		text-align: center;
+		padding: 20rpx 0;
+		margin: 0 40rpx;
+		margin-top: 40rpx;
+	}
+}
 </style>

+ 2 - 2
pages/public/login.vue

@@ -6,11 +6,11 @@
 		<view class="loginTitle"><text>登录</text></view>
 		<view class="login_text">
 			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img03.png"></image></view>
+				<view class="login_img"><image src="/static/img/img03.png"></image></view>
 				<view class="login_name"><input class="uni-input" v-model="username" focus placeholder="请输入手机号" /></view>
 			</view>
 			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img04.png"></image></view>
+				<view class="login_img"><image src="/static/img/img04.png"></image></view>
 				<view class="login_name"><input class="uni-input" type="password" v-model="passward" focus placeholder="请输入密码" /></view>
 			</view>
 			<view><button type="green" class="uni-button uni-button-green" @click="toLogin">登录</button></view>

+ 3 - 3
pages/public/register.vue

@@ -21,13 +21,13 @@
 				<view class="login_img"><image src="/static/icon/img07.png"></image></view>
 				<view class="login_name"><input class="uni-input" type="text" v-model="invitation" focus placeholder="请输入邀请码" /></view>
 			</view>
-			<!-- <view class="login_input flex">
+			<view class="login_input flex">
 				<view class="login_img"><image src="/static/icon/img06.png"></image></view>
 				<view class="login_name flex">
 					<input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
 					<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
 				</view>
-			</view> -->
+			</view>
 			<view><button type="green" @click="register" class="uni-button uni-button-green">注册账号</button></view>
 			<view><button class="uni-button uni-button-green uni-button-green-plain" type="green" plain="true" hover-class="none" @click="login">返回登录</button></view>
 		</view>
@@ -93,7 +93,7 @@ export default {
 			// }
 			register({
 				account: obj.phone, //账号
-				// captcha: obj.code, //验证码
+				captcha: obj.code, //验证码
 				password: obj.password ,//密码
 				spread:this.invitation//上级推广人
 			}).then(function(e) {

+ 214 - 0
pages/recharge/pay.vue

@@ -0,0 +1,214 @@
+<template>
+	<view class="content">
+		<view class="banner flex">
+			<view class="moneyBox">
+				<view class="money">{{ userInfo.now_money }}</view>
+				<view class="moneyText">我的剩余金币</view>
+			</view>
+		</view>
+		<view class="recharge">
+			<view class="itemBox flex">
+				<view class="item" :class="{ action: ls.num == money }" @click="money = ls.num" v-for="ls in moneyList">{{ ls.num }}元</view>
+			</view>
+			<u-form ref="uForm" label-width="180">
+				<u-form-item label="金额"><u-input type="number" placeholder="请输入充值金额" v-model="money" /></u-form-item>
+				<u-form-item left-icon='weixin-fill' :left-icon-style='{color:"#5dbc7c"}' label="微信支付">
+					<view class="checkedBox flex"><image class="checked" src="../../static/img/checkedIcon.png" mode="scaleToFill"></image></view>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="buttom" @click="confirm">
+			充值
+		</view>
+	</view>
+</template>
+
+<script>
+import { rechargeWechat } from '@/api/tp.js';
+import { getUserInfo } from '@/api/login.js';
+import { mapState, mapMutations } from 'vuex';
+export default {
+	data() {
+		return {
+			type: 'weixin',
+			money: '', //充值金额
+			payLoding: false, //是否加载中
+			moneyList: [
+				{
+					num: 10
+				},
+				{
+					num: 20
+				},
+				{
+					num: 30
+				},
+				{
+					num: 50
+				},
+				{
+					num: 100
+				},
+				{
+					num: 200
+				},
+				{
+					num: 500
+				},
+				{
+					num: 1000
+				}
+			]
+		};
+	},
+	onLoad(options) {
+		console.log(this.userInfo);
+	},
+	computed: {
+		...mapState(['weichatObj']),
+		...mapState('user', ['userInfo'])
+	},
+	methods: {
+		...mapMutations('user',['setUserInfo']),
+		getUserInfo(){
+			
+			getUserInfo().then((e) => {
+				this.setUserInfo(e.data)
+			}).catch((e) => {
+				console.log(e);
+			})
+		},
+		// 跳转
+		navTo(url) {
+			uni.navigateTo({
+				url: url
+			});
+		},
+		// 切换选中对象
+		tabRadio(e) {
+			this.type = e;
+		},
+		// 提交
+		confirm() {
+			if(!this.money){
+				uni.showToast({
+					title: '请填写金额!'
+				});
+				return
+			}
+			let obj = this;
+			if(obj.payLoding ){
+				return
+			};
+			obj.payLoding = true;
+			rechargeWechat({ price: this.money, from: this.type })
+				.then(e => {
+					let da = e.data.data;
+					obj.weichatObj.chooseWXPay({
+						timestamp: da.timestamp,
+						nonceStr: da.nonceStr,
+						package: da.package,
+						signType: da.signType,
+						paySign: da.paySign,
+						success: function(res) {
+							uni.showToast({
+								title: '充值成功',
+								duration: 2000,
+								position: 'top'
+							});
+							obj.getUserInfo()
+							uni.showModal({
+								title: '充值成功',
+								content: '是否返回活动',
+								success: res => {
+									if(res.confirm){
+										uni.navigateTo({
+											url:'/pages/index'
+										})
+									}
+								},
+							});
+						}
+					});
+					obj.payLoding = false;
+				})
+				.catch(e => {
+					obj.payLoding = false;
+					console.log(e);
+				});
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+page,
+.content {
+	height: 100%;
+	background-color: #ffffff;
+}
+.buttom{
+	position:fixed;
+	left: 0;
+	bottom: 30rpx;
+	right: 0;
+	margin: 0 30rpx;
+	padding: 15rpx;
+	background-color: #D7272B;
+	color: #FFFFFF;
+	text-align: center;
+	font-size: 36rpx;
+	font-weight:bold;
+	border-radius: 10rpx ;
+}
+.banner {
+	background-color: #ff9ba7;
+	justify-content: center;
+	padding: 50rpx;
+	padding-bottom: 150rpx;
+	.moneyBox {
+		color: #ffffff;
+		text-align: center;
+		.money {
+			font-size: 74rpx;
+			font-weight: bold;
+			color: #ffffff;
+		}
+	}
+}
+.recharge {
+	border-top-right-radius: 50rpx;
+	border-top-left-radius: 50rpx;
+	margin-top: -100rpx;
+	background-color: #ffffff;
+	padding: 0 30rpx;
+	.checkedBox {
+		justify-content: flex-end;
+		width: 100%;
+		.checked {
+			width: 36rpx;
+			height: 36rpx;
+		}
+	}
+	.itemBox {
+		padding-top: 50rpx;
+		flex-wrap: wrap;
+		color: #ffffff;
+		font-weight: bold;
+		.item {
+			border-radius: 10rpx;
+			width: 20%;
+			margin: 10rpx;
+			color: #ff9ba7;
+			background-color: #ffffff;
+			border: 1px solid #ff9ba7;
+			padding: 10rpx;
+			text-align: center;
+			&.action {
+				color: #ffffff;
+				background-color: #ff9ba7;
+			}
+		}
+	}
+}
+</style>

BIN
static/img/alertbg.png


BIN
static/img/chargeIcon1.png


BIN
static/img/chargeIcon2.png


BIN
static/img/chargeIcon3.png


BIN
static/img/chargeIcon4.png


BIN
static/img/chargeIcon5.png


BIN
static/img/chargeIcon6.png


BIN
static/img/chargeIcon7.png


BIN
static/img/chargeIcon8.png


BIN
static/img/chargeIconRight.png


BIN
static/img/checkedIcon.png


BIN
static/img/img01.png


BIN
static/img/img02.png


BIN
static/img/img03.png


BIN
static/img/img04.png


BIN
static/img/img05.png


BIN
static/img/img06.png


BIN
static/img/img07.png


BIN
static/img/img08.png


BIN
static/img/level.png


BIN
static/img/moneyIcon.png


BIN
static/img/rank1.png


BIN
static/img/rank2.png


BIN
static/img/rank3.png


BIN
static/img/user.png


BIN
static/img/userAll.png


BIN
static/img/图层 9@2x.png


+ 1 - 1
store/index.js

@@ -6,7 +6,7 @@ Vue.use(Vuex)
 const store = new Vuex.Store({
 	state: {
 		// baseURL:"http://yrh.liuniu946.com",//'http://eb.shuibo.net',//请求地址配置 
-		baseURL:'http://base.liuniu946.com',//请求地址配置 
+		baseURL:'http://vote.frp.liuniu946.com',//请求地址配置 
 		urlFile:'/index',//项目部署所在文件夹
 		userInfo: {}, //登录信息
 		loginInterceptor:false,//是否打开强制登录