Pārlūkot izejas kodu

Merge branch 'master' of http://git.zthymaoyi.com/wangchao/businessCard

高敬炎 2 gadi atpakaļ
vecāks
revīzija
36657c15a6
1 mainītis faili ar 243 papildinājumiem un 228 dzēšanām
  1. 243 228
      xiaochengxu/pages/cardHolder/cardHolder.vue

+ 243 - 228
xiaochengxu/pages/cardHolder/cardHolder.vue

@@ -35,10 +35,12 @@
 				@down="downCallback">
 				<view v-for='(item,index) in cardHolderList' @longpress="longpress" class="item flex">
 					<!-- <view class="card-list-item" style="background:red"> -->
-					<view class="card-list-item" :style="'background:url('+item.currentBackground+');background-size:100% 100%'">
+					<view class="card-list-item"
+						:style="'background:url('+item.currentBackground+');background-size:100% 100%'">
 						<view class="card-content style1" v-if="item.cuttentTemplate==0">
 							<view class="left">
-								<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle"></u--image>
+								<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
+									shape="circle"></u--image>
 							</view>
 							<view class="right">
 								<view class="row1">
@@ -49,10 +51,12 @@
 									{{item.companyName}}
 								</view>
 								<view class="row3 flex">
-									<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
+									<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
+										color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
 								</view>
 								<view class="row4 flex">
-									<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
+									<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
+										color="#5e6d82"></uni-icons>{{ item.phone }}
 								</view>
 								<!-- <view class="">
 									备注
@@ -69,47 +73,33 @@
 									{{item.companyName}}
 								</view>
 								<view class="row3 flex">
-									<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
+									<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
+										color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
 								</view>
 								<view class="row4 flex">
-									<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
+									<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
+										color="#5e6d82"></uni-icons>{{ item.phone }}
 								</view>
 								<!-- <view class="">
 									备注
 								</view> -->
 							</view>
 							<view class="left">
-								<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
-								<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
+								<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
+									shape="circle" v-if="item.headSculpture"></u--image>
+								<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
+									height="66px" shape="circle" v-else></u--image>
 							</view>
 						</view>
 						<view class="card-content style2" v-if="item.cuttentTemplate==2">
-								<view class="top">
-									<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
-									<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
-								</view>
-								<view class="bottom flex">
-									<view class="left">
-										<view class="row1">
-											<text class="name">{{item.name}}</text>
-											<text class="post">{{item.post}}</text>
-										</view>
-										<view class="row2">
-											{{item.companyName}}
-										</view>
-									</view>
-									<view class="right">
-										<view class="row1 flex">
-											<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
-										</view>
-										<view class="row2 flex">
-											<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
-										</view>
-									</view>
-								</view>
-						</view>
-						<view class="card-content style2" v-if="item.cuttentTemplate==3">
-								<view class="top">
+							<view class="top">
+								<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
+									shape="circle" v-if="item.headSculpture"></u--image>
+								<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
+									height="66px" shape="circle" v-else></u--image>
+							</view>
+							<view class="bottom flex">
+								<view class="left">
 									<view class="row1">
 										<text class="name">{{item.name}}</text>
 										<text class="post">{{item.post}}</text>
@@ -117,37 +107,66 @@
 									<view class="row2">
 										{{item.companyName}}
 									</view>
-									
 								</view>
-								<view class="bottom flex">
-									<view class="left">
-									<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
-									<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
+								<view class="right">
+									<view class="row1 flex">
+										<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
+											color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
 									</view>
-									<view class="right">
-										<view class="row1 flex">
-											<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
-										</view>
-										<view class="row2 flex">
-											<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
-										</view>
+									<view class="row2 flex">
+										<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
+											color="#5e6d82"></uni-icons>{{ item.phone }}
 									</view>
 								</view>
+							</view>
+						</view>
+						<view class="card-content style2" v-if="item.cuttentTemplate==3">
+							<view class="top">
+								<view class="row1">
+									<text class="name">{{item.name}}</text>
+									<text class="post">{{item.post}}</text>
+								</view>
+								<view class="row2">
+									{{item.companyName}}
+								</view>
+
+							</view>
+							<view class="bottom flex">
+								<view class="left">
+									<u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px"
+										shape="circle" v-if="item.headSculpture"></u--image>
+									<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png"
+										width="66px" height="66px" shape="circle" v-else></u--image>
+								</view>
+								<view class="right">
+									<view class="row1 flex">
+										<uni-icons type="map-filled" size="20" style="margin-right: 20rpx;"
+											color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
+									</view>
+									<view class="row2 flex">
+										<uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;"
+											color="#5e6d82"></uni-icons>{{ item.phone }}
+									</view>
+								</view>
+							</view>
 						</view>
 						<view class="car-bottom flex">
 							<view class="left">
-								<image src="../../static/imgs/card/home.png" mode="widthFix" style="width: 32rpx;" @click="toHome(item)"></image>
-								<text @click='switchType(item)' style="color: #fff;">{{item.classify?item.classifyName:'默'}}</text>
-								<image src="../../static/imgs/card/share.png" mode="widthFix" style="width: 35rpx;" @click="share(item)"></image>
+								<image src="../../static/imgs/card/home.png" mode="widthFix" style="width: 32rpx;"
+									@click="toHome(item)"></image>
+								<text @click='switchType(item)'
+									style="color: #fff;">{{item.classify?item.classifyName:'默'}}</text>
+								<image src="../../static/imgs/card/share.png" mode="widthFix" style="width: 35rpx;"
+									@click="share(item)"></image>
 							</view>
 							<view class="right">
-								
+
 							</view>
 						</view>
 					</view>
-					
-					
-					
+
+
+
 					<!-- <view class="left">
 						<view class="top flex-row-center">
 							<image :src="item.headSculpture" mode="widthFix" class="img"></image>
@@ -251,6 +270,7 @@
 		},
 		data() {
 			return {
+				canReset: false,
 				poster: '',
 				canvasData: [],
 				searchVal: '',
@@ -276,7 +296,11 @@
 		onShow() {
 			if (uni.getStorageSync("userInfo")) {
 				this.userInfo = uni.getStorageSync("userInfo")
-				this.init()
+				this.$nextTick(function() {
+					this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页  
+					this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题  
+					this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
+				});
 			} else {
 				this.login()
 			}
@@ -642,50 +666,12 @@
 				}
 				this.isShowType = false
 			},
-			init() {
-				this.getList()
-				this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
-					page: 1,
-					limit: 9999,
-					commonId: uni.getStorageSync("userInfo").id
-				}, failres => {
-					console.log('res+++++', failres.errmsg)
-					this.$refs.uToast.show({
-						type: 'error',
-						message: failres.errmsg,
-					})
-				}).then(res => {
-					this.typeColumns = [res.data.items]
-					this.mescroll.resetUpScroll()
-					console.log(this.typeColumns)
-				})
-			},
-			getList() {
-				this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
-					receiveId: uni.getStorageSync("userInfo").id,
-				}, failres => {
-					console.log('res+++++', failres.errmsg)
-					this.$refs.uToast.show({
-						type: 'error',
-						message: failres.errmsg,
-					})
-				}).then(res => {
-					this.noticeList = res.data.items
-					if (this.noticeList.length > 0) {
-						var data = this.noticeList.filter((item) => {
-							return item.newsFlag == 0
-						})
-						this.unread = data ? data.length : 0
-					}
-					console.log(this.unread)
-				})
-			},
-			upCallback(page) {
+			async upCallback(page) {
 				var that = this
 				uni.showLoading({
 					title: '数据加载中'
 				})
-				this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
+				await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
 					page: page.num,
 					limit: page.size,
 					commonId: uni.getStorageSync("userInfo").id,
@@ -710,41 +696,45 @@
 					}
 					this.cardHolderList = res.data.items
 					this.loading = false
-					// if(res.data.items.length>0){
-					// 	for(var i=0;i<res.data.items.length;i++){
-					// 	res.data.items[i].name=res.data.items[i].circleName[0]
-					// 	}
-					// 	var itemIndex=res.data.items.findIndex((item)=>{return item.topMarking==1})
-
-					// 	if(itemIndex!=-1){
-					// 		var data=res.data.items.splice(itemIndex,1)
-					// 		if(page.num==1){
-					// 			data.push({circleName:'默认分类',name:'默'})	
-					// 		}
-					// 		res.data.items=data.concat(res.data.items)
-					// 	}else{
-					// 		if(page.num==1){
-					// 			res.data.items=[{circleName:'默认分类',name:'默'}].concat(res.data.items)	
-					// 		}
-					// 	}
-					// 	this.cardTypeList=this.cardTypeList.concat(res.data.items)
-					// }else{
-					// 	if(page.num==1){
-					// 		this.cardTypeList=[{circleName:'默认分类',name:'默'}]
-					// 	 }
-					// }
-
-
 					this.$nextTick(() => {
-						console.log(that)
-						// mescroll.endSuccess(data.result);
 						that.mescroll.endBySize(curPageLen, totalPage)
 					});
 
-					// if (res.errno == 200) {
 					uni.hideLoading()
+				})
 
-					// }
+				await this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
+					page: 1,
+					limit: 9999,
+					commonId: uni.getStorageSync("userInfo").id
+				}, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+				}).then(res => {
+					this.typeColumns = [res.data.items]
+					console.log(this.typeColumns)
+				})
+
+				await this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
+					receiveId: uni.getStorageSync("userInfo").id,
+				}, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+				}).then(res => {
+					this.noticeList = res.data.items
+					if (this.noticeList.length > 0) {
+						var data = this.noticeList.filter((item) => {
+							return item.newsFlag == 0
+						})
+						this.unread = data ? data.length : 0
+					}
+					console.log(this.unread)
 				})
 			},
 			login() {
@@ -915,168 +905,193 @@
 		// padding:0 20rpx;
 		position: relative;
 		top: -170rpx;
-		.style1{
+
+		.style1 {
 			display: flex;
 			padding: 20rpx 30rpx;
 			width: 85%;
 			margin-bottom: 90rpx;
-			.left{
+
+			.left {
 				width: 132rpx;
 				height: 132rpx;
 				border-radius: 50%;
 			}
-			.right{
+
+			.right {
 				margin-left: 40rpx;
-				.row1{
-					.name{
+
+				.row1 {
+					.name {
 						font-size: 38rpx;
 						font-weight: bold;
 						color: #040000;
 						margin-right: 20rpx;
 					}
-					.post{
+
+					.post {
 						font-size: 26rpx;
 						font-weight: 500;
 						color: #666666;
 					}
 				}
-				.row2{
+
+				.row2 {
 					margin-top: 20rpx;
 					font-size: 24rpx;
 					font-weight: bold;
 					color: #323333;
 				}
-				.row3{
+
+				.row3 {
 					margin-top: 30rpx;
 					font-size: 24rpx;
 					font-weight: 500;
 					color: #323333;
-					
+
 				}
 			}
 		}
-		.style2{
-				padding:30rpx;
-				margin-bottom: 100rpx;
-				.top{
-					.row1{
-						.name{
+
+		.style2 {
+			padding: 30rpx;
+			margin-bottom: 100rpx;
+
+			.top {
+				.row1 {
+					.name {
+						font-size: 38rpx;
+						font-weight: bold;
+						color: #040000;
+						margin-right: 20rpx;
+					}
+
+					.post {
+						font-size: 26rpx;
+						font-weight: 500;
+						color: #666666;
+					}
+				}
+
+				.row2 {
+					margin-top: 20rpx;
+					font-size: 24rpx;
+					font-weight: bold;
+					color: #323333;
+				}
+			}
+
+			.bottom {
+				margin-top: 48rpx;
+
+				.left {
+					margin-right: 40rpx;
+
+					.row1 {
+						.name {
 							font-size: 38rpx;
 							font-weight: bold;
 							color: #040000;
 							margin-right: 20rpx;
 						}
-						.post{
+
+						.post {
 							font-size: 26rpx;
 							font-weight: 500;
 							color: #666666;
 						}
 					}
-					.row2{
+
+					.row2 {
 						margin-top: 20rpx;
 						font-size: 24rpx;
 						font-weight: bold;
 						color: #323333;
 					}
 				}
-				.bottom{
-					margin-top: 48rpx;
-					.left{
-						margin-right: 40rpx;
-						.row1{
-							.name{
-								font-size: 38rpx;
-								font-weight: bold;
-								color: #040000;
-								margin-right: 20rpx;
-							}
-							.post{
-								font-size: 26rpx;
-								font-weight: 500;
-								color: #666666;
-							}
-						}
-						.row2{
-							margin-top: 20rpx;
-							font-size: 24rpx;
-							font-weight: bold;
-							color: #323333;
-						}
+
+				.right {
+
+					.row1,
+					.row2 {
+						font-size: 24rpx;
+						font-weight: 500;
+						color: #323333;
 					}
-					.right{
-						.row1,.row2{
-							font-size: 24rpx;
-							font-weight: 500;
-							color: #323333;
-						}
-						.row2{
-							margin-top: 20rpx;
-						}
+
+					.row2 {
+						margin-top: 20rpx;
 					}
 				}
-				
-		}
-	.card-list-item {
-		width: calc(100%);
-		// left:-20rpx;
-		position: relative;
-		border-radius: 30rpx;
-		padding: 40rpx;
-		box-sizing: border-box;
-		.car-bottom{
-			position: absolute;
-			bottom: 63rpx;
-			left:20rpx;
-			// width: calc(100% - 40rpx);
-			.left{
-				// top: -40rpx;
-				position: absolute;
-				padding: 20rpx 0;
-				width: 70vw;
-				height: 80rpx;
-				box-sizing: border-box;
-				display: flex;
-				align-items: center;
-				justify-content: space-evenly;
-				background: url("../../static/imgs/card/bgc1.png") no-repeat center;
-				background-size: 100% 100%;
-			}
-			.right{
-				position: absolute;
-				left: 65vw;
-				height: 80rpx;
-				width: 30vw;
-				background: url("../../static/imgs/card/right-bgc.png") no-repeat center;
-				background-size: 100% 100%;
 			}
+
 		}
-		.left {
-			width: 30%;
-	
-			.top {
-	
-				margin-bottom: 20rpx;
+
+		.card-list-item {
+			width: calc(100%);
+			// left:-20rpx;
+			position: relative;
+			border-radius: 30rpx;
+			padding: 40rpx;
+			box-sizing: border-box;
+
+			.car-bottom {
+				position: absolute;
+				bottom: 63rpx;
+				left: 20rpx;
+
+				// width: calc(100% - 40rpx);
+				.left {
+					// top: -40rpx;
+					position: absolute;
+					padding: 20rpx 0;
+					width: 70vw;
+					height: 80rpx;
+					box-sizing: border-box;
+					display: flex;
+					align-items: center;
+					justify-content: space-evenly;
+					background: url("../../static/imgs/card/bgc1.png") no-repeat center;
+					background-size: 100% 100%;
+				}
+
+				.right {
+					position: absolute;
+					left: 65vw;
+					height: 80rpx;
+					width: 30vw;
+					background: url("../../static/imgs/card/right-bgc.png") no-repeat center;
+					background-size: 100% 100%;
+				}
 			}
-	
-			.img {
-				width: 80%;
+
+			.left {
+				width: 30%;
+
+				.top {
+
+					margin-bottom: 20rpx;
+				}
+
+				.img {
+					width: 80%;
+				}
+
+				.bottom {}
 			}
-	
-			.bottom {}
-		}
-	
-		.right {
-			.row1 {
-				.line {
-					width: 1px;
-					height: 20px;
-					margin: 0 20rpx;
-					background: black;
+
+			.right {
+				.row1 {
+					.line {
+						width: 1px;
+						height: 20px;
+						margin: 0 20rpx;
+						background: black;
+					}
 				}
 			}
 		}
-	}
-		
+
 	}
 
 	.slot-content {