lhl vor 1 Jahr
Ursprung
Commit
f996c66e3e
5 geänderte Dateien mit 326 neuen und 584 gelöschten Zeilen
  1. 9 9
      pages.json
  2. 0 510
      pages/cart/cart.vue
  3. 59 51
      pages/user/model/model.vue
  4. 94 14
      pages/user/model/modelrz.vue
  5. 164 0
      utils/twelve.js

+ 9 - 9
pages.json

@@ -21,15 +21,15 @@
 				"navigationBarTitleText": "邀好友赚佣金"
 			}
 		},
-		{
-			"path": "pages/cart/cart",
-			"style": {
-				// #ifndef MP-WEIXIN
-				"navigationStyle": "custom",
-				// #endif
-				"navigationBarTitleText": "购物车"
-			}
-		},
+		// {
+		// 	"path": "pages/cart/cart",
+		// 	"style": {
+		// 		// #ifndef MP-WEIXIN
+		// 		"navigationStyle": "custom",
+		// 		// #endif
+		// 		"navigationBarTitleText": "购物车"
+		// 	}
+		// },
 		{
 			"path": "pages/userhome/user",
 			"style": {

+ 0 - 510
pages/cart/cart.vue

@@ -1,510 +0,0 @@
-<template>
-	<view class="container">
-		<!-- 空白页 -->
-		<view v-if="!hasLogin || empty === true" class="empty">
-			<image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
-			<view v-if="hasLogin" class="empty-tips">
-				空空如也
-				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛>
-				</navigator>
-			</view>
-			<view v-else class="empty-tips">
-				空空如也
-				<view class="navigator" @click="navToLogin">去登陆></view>
-			</view>
-		</view>
-		<view v-else>
-			<!-- 列表 -->
-			<view class="cart-list">
-				<block v-for="(item, index) in cartList" :key="item.id">
-					<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
-						<view class="flex padding-r-20" @click="item.checked=!item.checked">
-							<image v-if='item.checked' class="checkedGoods" src="../../static/icon/addressIconXz.png"
-								mode="scaleToFill">
-							</image>
-							<view v-else class="icon-checked-box">
-
-							</view>
-						</view>
-						<image class="image-wrapper" :src="item.productInfo.image" :class="[item.loaded]"
-							mode="aspectFill" lazy-load @load="onImageLoad('cartList', index)"
-							@error="onImageError('cartList', index)"></image>
-						<view class="item-right">
-							<view class="clamp title">{{ item.productInfo.store_name }}</view>
-							<view class="attr">{{ item.productInfo.attrInfo.suk }}</view>
-							<view class="flex">
-								<text class="price">¥{{ item.productInfo.price }}</text>
-								<uni-number-box class="step" :min="1" :max="item.productInfo.stock"
-									:value="item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num"
-									:isMax="item.cart_num >= item.productInfo.stock ? true : false"
-									:isMin="item.cart_num === 1" :index="index" @eventChange="numberChange">
-								</uni-number-box>
-							</view>
-							<view class="server" v-if="item.day>0">
-								(服务费:{{item.day_deducted}} 服务天数:{{item.day}})
-							</view>
-						</view>
-						<image class="del-btn" src="../../static/icon/goodsExit.png" @click="deleteCartItem(index)"
-							mode="scaleToFill"></image>
-					</view>
-				</block>
-			</view>
-			<!-- 底部菜单栏 -->
-			<view class="action-section">
-				<view class="flex leftBox">
-					<view class="checkbox" @click="check('all')">
-						<image class="icon-checked-box icon-checked" v-if='allChecked'
-							src="../../static/icon/addressIconXz.png" mode="scaleToFill"></image>
-						<view v-else class="icon-checked-box"></view>
-					</view>
-					<view class="margin-l-20">
-						全选
-					</view>
-				</view>
-				<view class="total-box">
-					<view class="font-size-base">
-						<text>合计:</text>
-						<text class="price">¥{{ total }}</text>
-
-					</view>
-					<view class="coupon">
-						共{{checkedNum}}件商品
-					</view>
-				</view>
-				<button type="primary" class="no-border confirm-btn" @click="createOrder">立即购买</button>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-	import {
-		getCartList,
-		getCartNum,
-		cartDel
-	} from '@/api/user.js';
-	import {
-		mapState
-	} from 'vuex';
-	import {
-		saveUrl,
-		interceptor
-	} from '@/utils/loginUtils.js';
-	export default {
-		data() {
-			return {
-				total: 0, //总价格
-				allChecked: false, //全选状态  true|false
-				empty: false, //空白页现实  true|false
-				cartList: []
-			};
-		},
-		onShow() {
-			uni.setTabBarStyle({
-				backgroundColor: '#FFFFFF'
-			})
-			// 只有登录时才加载数据
-			if (this.hasLogin) {
-				this.loadData();
-			}
-		},
-		watch: {
-			//显示空白页
-			cartList(e) {
-				let empty = e.length === 0 ? true : false;
-				if (this.empty !== empty) {
-					this.empty = empty;
-				}
-			}
-		},
-		computed: {
-			...mapState('user', ['hasLogin']),
-			...mapState('shop', ['shopDetail']),
-			checkedNum() {
-				let num = 0;
-				for (var i = 0; i < this.cartList.length; i++) {
-					if (this.cartList[i].checked) {
-						num++
-					}
-				}
-				return num
-			},
-		},
-		methods: {
-			//请求数据
-			async loadData() {
-				let obj = this;
-				getCartList({
-					store_id:obj.shopDetail.id
-				})
-					.then(function(e) {
-						// 获取当前购物车物品增加数量
-						let nub = obj.cartList.length;
-						// 获取之前对象数组
-						let aArray = obj.cartList.reverse();
-						// 获取返回数据对象数组
-						let bArray = e.data.valid.reverse();
-						obj.cartList = bArray
-							.map((item, ind) => {
-								// 设置返回数据默认为勾选状态
-								item.checked = true;
-								// 获取相同数组之前对象的数据
-								let carlist = aArray[ind];
-								// 判断之前是否已经加载完毕
-								if (carlist && carlist.loaded == 'loaded') {
-									item.loaded = 'loaded';
-								}
-								return item;
-							})
-							.reverse();
-						obj.calcTotal(); //计算总价
-					})
-					.catch(function(e) {
-						console.log(e);
-					});
-			},
-			//监听image加载完成
-			onImageLoad(key, index) {
-				// 修改载入完成后图片class样式
-				this.$set(this[key][index], 'loaded', 'loaded');
-			},
-			//监听image加载失败
-			onImageError(key, index) {
-				this[key][index].image = '/static/error/errorImage.jpg';
-			},
-			// 跳转到登录页
-			navToLogin() {
-				// 保存地址
-				saveUrl();
-				// 登录拦截
-				interceptor();
-			},
-			//选中状态处理
-			check(type, index) {
-				if (type === 'item') {
-					this.cartList[index].checked = !this.cartList[index].checked;
-				} else {
-					const checked = !this.allChecked;
-					const list = this.cartList;
-					list.forEach(item => {
-						item.checked = checked;
-					});
-					this.allChecked = checked;
-				}
-				this.calcTotal(type);
-			},
-			//数量
-			numberChange(data) {
-				let arr = this.cartList[data.index];
-				arr.cart_num = data.number;
-				getCartNum({
-						id: arr.id,
-						number: data.number
-					})
-					.then(e => {
-						console.log(e);
-					})
-					.catch(function(e) {
-						console.log(e);
-					});
-				this.calcTotal();
-			},
-			//删除
-			deleteCartItem(index) {
-				let list = this.cartList;
-				let row = list[index];
-				let id = row.id;
-				uni.showModal({
-					title: '提示',
-					content: '是否删除'+row.productInfo.store_name,
-					success: res => {
-						if(res.confirm){
-							cartDel({
-								ids: id
-							});
-							this.cartList.splice(index, 1);
-							uni.hideLoading();
-							this.calcTotal();
-						}
-					}
-				});
-				
-			},
-			//清空
-			// clearCart() {
-			// 	uni.showModal({
-			// 		content: '清空购物车?',
-			// 		success: e => {
-			// 			if (e.confirm) {
-			// 				let st = this.cartList.map(e => {
-			// 					return e.id;
-			// 				});
-			// 				cartDel({
-			// 					ids: st.join(',')
-			// 				}).then(e => {
-			// 					console.log(e);
-			// 				});
-			// 				this.cartList = [];
-			// 			}
-			// 		}
-			// 	});
-			// },
-			//计算总价
-			calcTotal() {
-				let list = this.cartList;
-				if (list.length === 0) {
-					this.empty = true;
-					return;
-				}
-				let total = 0;
-				let checked = true;
-				list.forEach(item => {
-					if (item.checked === true) {
-						total += item.productInfo.price * item.cart_num;
-					} else if (checked === true) {
-						checked = false;
-					}
-				});
-				this.allChecked = checked;
-				this.total = Number(total.toFixed(2));
-			},
-			//创建订单
-			createOrder() {
-				let list = this.cartList;
-				let goodsData = [];
-				list.forEach(item => {
-					if (item.checked) {
-						goodsData.push(item.id);
-					}
-				});
-
-				uni.navigateTo({
-					url: '/pages/order/createOrder?id=' + goodsData.join(',')
-				});
-			}
-		}
-	};
-</script>
-
-<style lang="scss">
-	.container {
-		padding-bottom: 134rpx;
-		background-color: $page-color-base;
-		/* #ifdef MP-WEIXIN || H5 */
-		padding-top: 30rpx;
-		/* #endif */
-		/* #ifdef APP */
-		padding-top: var(--status-bar-height);
-		/* #endif */
-		/* 空白页 */
-		.empty {
-			position: fixed;
-			left: 0;
-			top: 0;
-			width: 100%;
-			height: 100vh;
-			padding-bottom: 100rpx;
-			display: flex;
-			justify-content: center;
-			flex-direction: column;
-			align-items: center;
-			background: #fff;
-
-			.emptyImg {
-				width: 300rpx;
-				height: 250rpx;
-				margin-bottom: 30rpx;
-			}
-
-			.empty-tips {
-				display: flex;
-				font-size: $font-sm + 2rpx;
-				color: $font-color-disabled;
-
-				.navigator {
-					color: $uni-color-primary;
-					margin-left: 16rpx;
-				}
-			}
-		}
-	}
-
-	/* 购物车列表项 */
-	.cart-list {
-		padding: 0 30rpx;
-	}
-
-	.cart-item {
-		display: flex;
-		position: relative;
-		padding: 20rpx;
-		background-color: #FFFFFF;
-		margin-bottom: 20rpx;
-		border-radius: 20rpx;
-
-		.icon-checked-box {
-			width: 37rpx;
-			height: 37rpx;
-			z-index: 5;
-			border: 1px solid $font-color-light;
-			border-radius: 99rpx;
-		}
-
-		.checkedGoods {
-			width: 37rpx;
-			height: 37rpx;
-		}
-
-		.image-wrapper {
-			width: 170rpx;
-			height: 170rpx;
-			flex-shrink: 0;
-			position: relative;
-			border-radius: 20rpx;
-		}
-
-		.checkbox {
-			position: absolute;
-			left: -16rpx;
-			top: -16rpx;
-			z-index: 8;
-			font-size: 44rpx;
-			line-height: 1;
-			padding: 4rpx;
-			color: $font-color-disabled;
-			background: #fff;
-			border-radius: 50px;
-		}
-
-		.item-right {
-			overflow: hidden;
-			position: relative;
-			padding-left: 30rpx;
-			flex-grow: 1;
-
-			.title,
-			.price {
-				font-size: $font-base;
-				color: $font-color-dark;
-			}
-
-			.attr {
-				font-size: 24rpx;
-				color: $font-color-light;
-				height: 40rpx;
-				line-height: 40rpx;
-			}
-
-			.server {
-				font-size: 24rpx;
-				color: $font-color-light;
-				margin-top: 10rpx;
-			}
-
-			.price {
-				font-size: 30rpx;
-				color: $color-green;
-			}
-		}
-
-		.del-btn {
-			flex-shrink: 0;
-			height: 40rpx;
-			width: 40rpx;
-		}
-	}
-
-	/* 底部栏 */
-	.action-section {
-		/* #ifdef H5 */
-		margin-bottom: 100rpx;
-		/* #endif */
-		position: fixed;
-		left: 0rpx;
-		bottom: 0rpx;
-		z-index: 95;
-		display: flex;
-		align-items: center;
-		width: 750rpx;
-		height: 100rpx;
-		padding: 0 30rpx;
-		background: rgba(255, 255, 255, 0.9);
-
-		.leftBox {
-			padding-right: 30rpx;
-			border-right: 1px solid $font-color-disabled;
-		}
-
-		.checkbox {
-			line-height: 1;
-			font-size: 30rpx;
-
-			.icon-checked-box {
-				width: 37rpx;
-				height: 37rpx;
-				z-index: 5;
-				border: 1px solid $font-color-light;
-				border-radius: 99rpx;
-			}
-
-			.icon-checked {
-				border: none;
-				color: $base-color;
-			}
-		}
-
-		.clear-btn {
-			position: absolute;
-			left: 26rpx;
-			top: 0;
-			z-index: 4;
-			width: 0;
-			height: 52rpx;
-			line-height: 52rpx;
-			padding-left: 38rpx;
-			font-size: $font-base;
-			color: #fff;
-			background: $font-color-disabled;
-			border-radius: 0 50px 50px 0;
-			opacity: 0;
-			transition: 0.2s;
-
-			&.show {
-				opacity: 1;
-				width: 120rpx;
-			}
-		}
-
-		.total-box {
-			flex-grow: 1;
-			padding-left: 30rpx;
-			font-size: 30rpx;
-
-			.price {
-				color: $color-green;
-			}
-
-			.coupon {
-				font-size: 24rpx;
-				color: $font-color-light;
-			}
-		}
-
-		.confirm-btn {
-			padding: 0 70rpx;
-			margin: 0;
-			border-radius: 100px;
-			height: 70rpx;
-			line-height: 70rpx;
-			font-size: 24rpx;
-			background: $color-yellow;
-			color: #714D01;
-		}
-	}
-
-	/* 复选框选中状态 */
-	.action-section .checkbox.checked,
-	.cart-item .checkbox.checked {
-		color: $base-color;
-	}
-</style>

+ 59 - 51
pages/user/model/model.vue

@@ -204,16 +204,13 @@
 				look: true,
 			}
 		},
-		computed: {
-			...mapState(['baseURL']),
-			...mapState('user', ['userInfo'])
-		},
 		onLoad(opt) {
 			// #ifndef MP
 			if (opt.spread) {
 				// 存储其他邀请人
 				uni.setStorageSync('spread', opt.spread);
 			}
+
 			// #endif
 			// #ifdef MP
 			if (opt.scene) {
@@ -224,54 +221,65 @@
 				});
 			}
 			// #endif
-			
-			this.mtype = opt.mtype
-			uni.hideShareMenu();
 			
-			if(opt.look2) {
-				
-			}
-			if (opt.look && opt.look == 1) {
-				uni.showShareMenu();
-				this.look = false
-			}
-			if (opt.uid) {
-				this.shareId = opt.uid
-				this.getCommonUserCardInfo(opt.uid)
-			} else {
-				this.getShowTemplateItem()
-			}
-
-		},
-		onShow() {
-			this.getUser()
-		},
-		onShareAppMessage(options) {
-			// 设置菜单中的转发按钮触发转发事件时的转发内容
-			let pages = getCurrentPages(); //获取加载的页面
-			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
-			let url = currentPage.route; //当前页面url
-			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
-			let shareObj = {}
-			shareObj = {
-				title: this.cardInfo.name + '母婴界数字名片', // 默认是小程序的名称(可以写slogan等)
-				path: url + '?uid=' + this.userInfo.uid + '&mtype=' + this.mtype, // 默认是当前页面,必须是以‘/’开头的完整路径
-				imageUrl: '',
-				success: function(res) {
-					// 转发成功之后的回调
-					if (res.errMsg == 'shareAppMessage:ok') {}
-				},
-				fail: function() {
-					// 转发失败之后的回调
-					if (res.errMsg == 'shareAppMessage:fail cancel') {
-						// 用户取消转发
-					} else if (res.errMsg == 'shareAppMessage:fail') {
-						// 转发失败,其中 detail message 为详细失败信息
-					}
-				}
-			};
-			console.log(shareObj)
-			return shareObj;
+			// this.getUserCardInfo()
+			this.mtype = opt.mtype
+			uni.hideShareMenu();
+			if (opt.look && opt.look == 1) {
+				uni.showShareMenu();
+				this.look = false
+			}
+			if (opt.uid) {
+				this.shareId = opt.uid
+				this.getCommonUserCardInfo(opt.uid)
+			} else {
+				this.getShowTemplateItem()
+			}
+
+		},
+		computed: {
+			...mapState(['baseURL']),
+			...mapState('user', ['userInfo'])
+		},
+		onShow() {
+			this.getUser()
+		},
+		onShareAppMessage(options) {
+			// 设置菜单中的转发按钮触发转发事件时的转发内容
+			let pages = getCurrentPages(); //获取加载的页面
+			let currentPage = pages[pages.length - 1]; //获取当前页面的对象
+			let url = currentPage.route; //当前页面url
+			let item = currentPage.options; //如果要获取url中所带的参数可以查看options
+			let shareObj = {}
+			shareObj = {
+				title: this.cardInfo.name + '母婴界数字名片', // 默认是小程序的名称(可以写slogan等)
+				path: url + '?uid=' + this.userInfo.uid + '&mtype=' + this.mtype, // 默认是当前页面,必须是以‘/’开头的完整路径
+				imageUrl: '',
+				success: function(res) {
+					// 转发成功之后的回调
+					if (res.errMsg == 'shareAppMessage:ok') {}
+				},
+				fail: function() {
+					// 转发失败之后的回调
+					if (res.errMsg == 'shareAppMessage:fail cancel') {
+						// 用户取消转发
+					} else if (res.errMsg == 'shareAppMessage:fail') {
+						// 转发失败,其中 detail message 为详细失败信息
+					}
+				}
+			};
+			console.log(shareObj)
+			return shareObj;
+		},
+		onUnload() {
+			let pages = getCurrentPages(); //获取加载的页面
+			let currentPage = pages[pages.length - 2]; //获取当前页面的对象
+			// console.log(currentPage.route)
+			if (currentPage.route == 'pages/public/wxLogin') {
+				uni.switchTab({
+					url: '/pages/index/index'
+				})
+			}
 		},
 		onUnload() {
 			let pages = getCurrentPages(); //获取加载的页面

+ 94 - 14
pages/user/model/modelrz.vue

@@ -228,7 +228,14 @@
 				</view>
 			</view>
 		</view>
-		<view class="base-buttom" :class="{ 'bg-gray': loding }" @click="loding ? '' : confirm()">提交</view>
+		<view class="base-buttom flex">
+			<view class="updata flex flex-center" :class="{ 'bg-gray': loding }" @click="loding ? '' : confirm()">
+				提交
+			</view>
+			<view class="ylan flex flex-center" @click="look">
+				预览
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -240,10 +247,14 @@
 		getUserWorkTypeList,
 		getUserCardInfo
 	} from '@/api/model.js';
-
 	import {
 		isCardNo
 	} from '@/utils/rocessor.js';
+	import {
+		getAstro,
+		getShengXiao,
+		IdCard
+	} from '@/utils/twelve.js';
 	import {
 		mapState
 	} from "vuex"
@@ -289,15 +300,18 @@
 				timeTypeList: [], //时间类型
 				workTypeList: [], //工作类型
 				loding: false, //是否载入中
-				type: 0, //0为新增,1为修改
-				userModelData: {} //保存获取的用户模板
-
+				type: 0, //0为新增,1为修改2为商品页进入注册
+				userModelData: {}, //保存获取的用户模板
+				modelid: '', //保存要预览的模板id
 			};
 		},
 		async onLoad(options) {
 			if (options.type == 1) {
 				this.type = 1;
 				await this.getUserCardInfo()
+			} else if (options.type == 2) {
+				this.type = 2
+				this.modelid = options.modelid
 			}
 			this.init()
 		},
@@ -338,16 +352,16 @@
 					(res) => {
 						that.typeList = res.data.list
 						if (that.type == 1) {
-							console.log(that.userModelData.service_project_ar,'that.userModelData.service_project');
 							for (let i = 0; i < that.userModelData.service_project_ar.length; i++) {
 								for (let a = 0; a < that.typeList.length; a++) {
 									if (+that.typeList[a].id == +that.userModelData.service_project_ar[i].id) {
 										that.typeList[a].checked = true;
+										that.updata.checkedType.push(''+that.typeList[a].id)
 									}
 								}
 							}
 						}
-						console.log(res,'服务');
+						console.log(res, '服务');
 					}
 				).catch(
 					(res) => {
@@ -360,10 +374,9 @@
 						that.workTypeList = res.data.list
 						if (that.type == 0) {
 							that.updata.word = that.workTypeList[0];
-
 						} else if (that.type == 1) {
 							for (let i = 0; i < that.workTypeList.length; i++) {
-								console.log(that.userModelData.user_work_type_id,'word',that.workTypeList[i].id);
+								console.log(that.userModelData.user_work_type_id, 'word', that.workTypeList[i].id);
 								if (that.workTypeList[i].id == that.userModelData.user_work_type_id) {
 									that.updata.word = that.workTypeList[i];
 									break
@@ -377,9 +390,60 @@
 					}
 				)
 			},
+			// 跳转查看预览页面
+			look() {
+				const that = this;
+				const birthday = IdCard('' + that.updata.cardId, 1);
+				// 复制选中的服务数组
+				let arr = [...that.updata.checkedType]
+				let pushar=[];
+				that.typeList.forEach(
+					(re) => {
+						for (let i = 0; i < arr.length; i++) {
+							console.log(arr[i],'循环');
+							if (+arr[i] == +re.id) {
+								// 删除已选中的对象
+								arr.splice(i, 1)
+								pushar.push(re)
+								break
+							}
+						}
+					}
+				)
+				
+				let data = {
+					name: that.updata.name,
+					avatar: that.updata.avatar,
+					age: IdCard(that.updata.cardId, 3),
+					twelve: getShengXiao(birthday),
+					work_year: that.updata.work_year,
+					constellation: getAstro(...(birthday.split('-'))),
+					ancestral_place: that.updata.ancestral_place,
+					minority: that.updata.minority,
+					education: that.updata.education,
+					service_area_all: that.updata.onCity.map(
+						(item) => {
+							return item.province + item.city + item.district
+						}
+					),
+					service_min_price: that.updata.minMoney,
+					service_max_price: that.updata.maxMoney,
+					service_time_type_title: that.updata.timetype.title,
+					service_intro_content: that.updata.mymask,
+					service_intro_imgs: that.updata.service_imgs,
+					service_audit_imgs: that.updata.service_audit_imgs,
+					service_project_ar: pushar,
+					is_type_audit: 1
+				}
+				uni.setStorageSync('modeldata',data)
+				uni.navigateTo({
+					url: '/pages/user/model/model?mtype=' + that.modelid + '&look=2'
+				})
+			},
+			// 获取用户提交数据
 			getUserCardInfo() {
 				const that = this;
-				return new Promise((resolve,reject) => {
+				return new Promise((resolve, reject) => {
 					getUserCardInfo().then(
 						(data) => {
 							const res = data.data;
@@ -405,12 +469,12 @@
 								ancestral_place: res.ancestral_place, //籍贯
 								education: res.education, //学历
 								minority: res.minority, //民族
-					
+
 								work_year: res.work_year, //从业时长
 								service_audit_imgs: res.service_audit_imgs, //我的证书
 								service_imgs: res.service_imgs, //服务展示
 							})
-							console.log(that.updata,'that.updata');
+							console.log(that.updata, 'that.updata');
 							resolve('初始化数据成功')
 						}
 					).catch(
@@ -419,7 +483,7 @@
 						}
 					)
 				})
-				
+
 			},
 			// 选中的服务类型
 			checkTypeChange(type) {
@@ -819,8 +883,24 @@
 
 	.base-buttom {
 		position: fixed;
-		bottom: 30rpx;
+		bottom: 0rpx;
 		right: 0rpx;
 		left: 0rpx;
+		margin: 0;
+		padding: 0;
+		height: 100rpx;
+		border-radius: 0;
+
+		.updata,
+		.ylan {
+			width: 50%;
+			height: 100%;
+			justify-content: center;
+		}
+
+		.ylan {
+			background-color: #FFF;
+			color: $font-color-dark;
+		}
 	}
 </style>

+ 164 - 0
utils/twelve.js

@@ -0,0 +1,164 @@
+/***************************************************************************
+ * 计算生肖
+ * 
+ * 支持简写生日,比如01,转换为2001,89转换为1989; 支持任何可以进行时间转换的格式,比如'1989/01/01','1989 01'等
+ * 
+ */
+export function getShengXiao(birth) {
+	birth += '';
+	var len = birth.length;
+	if (len < 4 && len != 2) {
+		return "";
+	}
+	if (len == 2) {
+		birth - 0 > 30 ? birth = '19' + birth : birth = '20' + birth;
+	}
+	var year = (new Date(birth)).getFullYear();
+	var arr = ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊'];
+	return /^\d{4}$/.test(year) ? arr[year % 12] : "";
+}
+
+/***************************************************************************
+ * 计算星座
+ * 
+ * 
+ */
+export function getAstro(y, m, d) {
+	var constellations = [{
+		"Start": 121,
+		"End": 220,
+		"Name": "水平座"
+	}, {
+		"Start": 221,
+		"End": 320,
+		"Name": "双鱼座"
+	}, {
+		"Start": 321,
+		"End": 420,
+		"Name": "白羊座"
+	}, {
+		"Start": 421,
+		"End": 520,
+		"Name": "金牛座"
+	}, {
+		"Start": 521,
+		"End": 620,
+		"Name": "双子座"
+	}, {
+		"Start": 621,
+		"End": 720,
+		"Name": "巨蟹座"
+	}, {
+		"Start": 721,
+		"End": 820,
+		"Name": "狮子座"
+	}, {
+		"Start": 821,
+		"End": 920,
+		"Name": "处女座"
+	}, {
+		"Start": 921,
+		"End": 1020,
+		"Name": "天秤座"
+	}, {
+		"Start": 1021,
+		"End": 1120,
+		"Name": "天蝎座"
+	}, {
+		"Start": 1121,
+		"End": 1220,
+		"Name": "射手座"
+	}];
+	/*
+	 * 判断日期有效性 1,3,5,7,8,10,12为31天 2月润年29,非润年28 4,6,9,11为30天
+	 */
+	var daysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+
+	// 检测年份
+	if (y < 1970 || y > 2099)
+		return "";
+
+	// 检测月份
+	if (m < 1 || m > 12)
+		return "";
+
+	// 检测日期
+	var mDays = daysInMonth[m - 1];
+	// 如果是二月,要根据年份计算天数,不是二月时略过此计算
+	if (m == 2) {
+		mDays = GetSpecialDays(y)
+	}
+
+	// 判断日数据是不是在月份的有效天范围
+	if (d < 0 || d > mDays)
+		return "";
+
+	// 好了,走到这一步,说明上面的验证都TM过了。
+	// 这才判断是哪一个星座
+	// 星座座标等于m*100 + d
+	var pos = parseInt(m * 100) + parseInt(d);
+	for (var i in constellations) {
+		if (pos >= constellations[i].Start && pos <= constellations[i].End) {
+			return constellations[i].Name;
+		}
+	}
+}
+// 根据年份计算二月天数
+export function GetSpecialDays(y) {
+	if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0))
+		return 29;
+	return 28;
+}
+
+/***************************************************************************
+ * 计算年龄
+ * 
+ * 支持传递["yyyy-MM-dd"]等格式的字符串
+ * 
+ */
+export function getAge(str) {
+	var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
+	if (r == null)
+		return false;
+	var d = new Date(r[1], r[3] - 1, r[4]);
+	if (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3] &&
+		d.getDate() == r[4]) {
+		var Y = new Date().getFullYear();
+		return (Y - r[1]);
+	}
+	return "";
+}
+
+ 
+ /*
+    * 当type=1时获取出生日期,type=2时获取性别,type=3时获取年龄
+    * */
+export  function IdCard(IdCard, type) {
+        if (type === 1) {
+            //获取出生日期
+            let birthday = IdCard.substring(6, 10) + "-" + IdCard.substring(10, 12) + "-" + IdCard.substring(12, 14)
+            return birthday
+        }
+        if (type === 2) {
+            //获取性别
+            if (parseInt(IdCard.substr(16, 1)) % 2 === 1) {
+                return "男"
+            } else {
+                return "女"
+            }
+        }
+        if (type === 3) {
+            //获取年龄
+            var ageDate = new Date()
+            var month = ageDate.getMonth() + 1
+            var day = ageDate.getDate()
+            var age = ageDate.getFullYear() - IdCard.substring(6, 10) - 1
+            if (IdCard.substring(10, 12) < month || IdCard.substring(10, 12) === month && IdCard.substring(12, 14) <= day) {
+                age++
+            }
+            if (age <= 0) {
+                age = 1
+            }
+            return age
+        }
+    }