Prechádzať zdrojové kódy

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

# Conflicts:
#	xiaochengxu/pages.json
achao 2 rokov pred
rodič
commit
6808bdd7ee

+ 12 - 1
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CircleCardInfoServiceImpl.java

@@ -84,7 +84,18 @@ public class CircleCardInfoServiceImpl implements ICircleCardInfoService {
     @Override
     public Boolean update(CircleCardInfo circleCardInfo) throws ServiceException {
         Date now = new Date();
-        circleCardInfo.setGmtUpdate(now);
+        //更换圈子内名片
+        CircleCardInfo circleCardInfo1 = new CircleCardInfo();
+        circleCardInfo1.setCommonId(circleCardInfo.getCommonId());
+        circleCardInfo1.setCircleId(circleCardInfo.getCircleId());
+        circleCardInfo1.setDeleteFlag(0l);
+        CircleCardInfo circleCardInfo2 = circleCardInfoMapper.selectOne(circleCardInfo1);
+        //我加入该圈子的名片
+        if (circleCardInfo2 != null) {
+            circleCardInfo2.setCardId(circleCardInfo.getCardId());
+            circleCardInfo2.setGmtUpdate(now);
+            circleCardInfoMapper.updateById(circleCardInfo2);
+        }
         return circleCardInfoMapper.updateById(circleCardInfo) > 0;
     }
 

+ 2 - 2
unimall-launcher/src/main/resources/application.properties

@@ -86,8 +86,8 @@ oss.aliyun.oss.basekUrl=https://taohaoliang.oss-cn-beijing.aliyuncs.com/
 ########################################################
 ### 微信 小程序、APP、H5信息
 ########################################################
-com.iotechn.unimall.wx.mini.app-id=wx4505a6ea6f703e17
-com.iotechn.unimall.wx.mini.app-secret=a707ec774f069a020257317803b656ce
+com.iotechn.unimall.wx.mini.app-id=wx5d8906c2208c899f
+com.iotechn.unimall.wx.mini.app-secret=cbb2ea3ee48bb0b0f5baa9f6c51473c1
 
 com.iotechn.unimall.wx.app.app-id=wxe3c17ca92931512d
 com.iotechn.unimall.wx.app.app-secret=049151cd78f6671a27704be472832ff1

+ 71 - 57
xiaochengxu/pages.json

@@ -4,6 +4,21 @@
 	},
 	"pages": [
 		{
+			"path": "pages/circle/circle",
+			"style": {
+				"navigationBarTitleText": "圈子",
+				"enablePullDownRefresh": false
+			}
+		
+		}, 
+		{
+			"path": "pages/mySet/mySet",
+			"style": {
+				"navigationBarTitleText": "我的",
+				"enablePullDownRefresh": false
+			}
+		
+		}, {
 			"path": "pages/cardHolder/cardHolder",
 			"style": {
 				"navigationBarTitleText": "电子名片",
@@ -24,32 +39,7 @@
 
 			}
 
-		}, 
-		{
-			"path": "pages/mySet/myHome",
-			"style": {
-				"navigationBarTitleText": "主页信息",
-				"enablePullDownRefresh": false
-			}
-		
-		},{
-			"path": "pages/circle/circle",
-			"style": {
-				"navigationBarTitleText": "圈子",
-				"enablePullDownRefresh": false
-			}
-
-		},
-		{
-			"path": "pages/mySet/mySet",
-			"style": {
-				"navigationBarTitleText": "我的",
-				"enablePullDownRefresh": false
-			}
-
-		},
-
-		{
+		}, {
 			"path": "pages/cardHolder/map",
 			"style": {
 				"navigationBarTitleText": "地图",
@@ -102,13 +92,21 @@
 			"path": "pages/mySet/myCard",
 			"style": {
 				"navigationBarTitleText": "我的证件",
+				"enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+			}
+
+		}, {
+			"path": "pages/mySet/myHome",
+			"style": {
+				"navigationBarTitleText": "",
 				"enablePullDownRefresh": false
 			}
 
 		}, {
 			"path": "pages/mySet/cardType",
 			"style": {
-				"navigationBarTitleText": "名片分类",
+				"navigationBarTitleText": "",
 				"enablePullDownRefresh": false
 			}
 
@@ -150,36 +148,52 @@
 
 		}
 
-		, {
-			"path": "pages/mySet/newCard",
-			"style": {
-				"navigationBarTitleText": "新增名片",
-				"enablePullDownRefresh": false
-			}
-
-		}, {
-			"path": "pages/mySet/editHome",
-			"style": {
-				"navigationBarTitleText": "主页信息",
-				"enablePullDownRefresh": false
-			}
-
-		}, {
-			"path": "pages/mySet/editCard",
-			"style": {
-				"navigationBarTitleText": "编辑名片",
-				"enablePullDownRefresh": false
-			}
-
-		}, {
-			"path": "pages/mySet/lookCard",
-			"style": {
-				"navigationBarTitleText": "证件分享",
-				"enablePullDownRefresh": false
-			}
-
-		}
-	],
+	    ,{
+            "path" : "pages/mySet/newCard",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "新增名片",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/mySet/editHome",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "主页信息",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/mySet/editCard",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "编辑名片",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/mySet/lookCard",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "证件分享",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/cardHolder/scancode",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "扫码添加",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"tabBar": {
 		"custom": false,
 		"color": "#656765",

+ 235 - 14
xiaochengxu/pages/cardHolder/cardHolder.vue

@@ -34,8 +34,18 @@
 			    title
 				:loading='loading'
 			></u-skeleton> -->
+			<view v-if='islongPress'>
+				<view @click="del">删除</view>
+				<view @click='islongPress=false'>取消</view>
+				<u-checkbox-group placement="column"
+				@change="checkboxChange($event,'')">
+					<u-checkbox :checked='checked' name='全部' :customStyle="{marginBottom: '8px'}">
+					</u-checkbox>
+				</u-checkbox-group>
+			</view>
+			
 		<mescroll-body v-if='cardHolderList'  :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback">
-		<view v-for='item in cardHolderList' class="content3 flex">
+		<view v-for='(item,index) in cardHolderList' @longpress="longpress" class="content3 flex">
 			<view class="left">
 				<view class="top flex-row-center">
 					<image :src="item.cardManagementInfo.headSculpture" mode="widthFix" class="img"></image>
@@ -43,7 +53,7 @@
 				<view class="bottom flex flex-evenly">
 					<uni-icons type="home" size="20"></uni-icons>
 					<text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
-					<uni-icons  type="redo" size="20"></uni-icons>
+					<uni-icons @click='share(item)'  type="redo" size="20" color=''></uni-icons>
 				</view>
 			</view>
 			<view class="right">
@@ -51,6 +61,11 @@
 					<text>{{item.cardManagementInfo.name}}</text>
 					<text class="line"></text>
 					<text>{{item.cardManagementInfo.post}}</text>
+					<u-checkbox-group v-if='islongPress' placement="column"
+						@change="checkboxChange($event,index)">
+						<u-checkbox :name='index+1' :checked='item.checked' :customStyle="{marginBottom: '8px'}">
+						</u-checkbox>
+					</u-checkbox-group>
 				</view>
 				<view class="row2">
 					{{item.cardManagementInfo.companyName}}
@@ -63,9 +78,9 @@
 					<uni-icons type="redo" size="20"></uni-icons>
 					<text>{{item.cardManagementInfo.phone}}</text>
 				</view>
-				<view class="row3">
+				<view @click='remarkEdit(item)' class="row3">
 					<uni-icons type="redo" size="20"></uni-icons>
-					<text>我是备注</text>
+					<text >{{item.remark?item.remark:'单击添加备注'}}</text>
 				</view>
 			</view>
 		</view>
@@ -75,6 +90,49 @@
 		<lyuan-tx-asr ref="asr" :uploadMethod="uploadFile" @change="asrChange" @fileChange="fileChange" appId=""
 			secretId="" secretKey=""></lyuan-tx-asr>
 		<u-toast ref="uToast"></u-toast>
+		<u-modal :show="delShow" title="提示" showCancelButton='true' @cancel="delShow=false" @confirm="delConfirm" :content='"已选中"+this.checkedList.length+"张名片,确定删除?"'></u-modal>
+		<u-modal :show="modalShow" @confirm='remarkConfirm' :confirmColor="remark?'#2979ff':'#ccc'" showCancelButton='true' title="备注" >
+			<view class="slot-content">
+				<u--textarea v-model="remark" placeholder="输入备注,不超过150个字" ></u--textarea>
+			</view>
+		</u-modal>
+		<view v-if='qrcodeShow' class="shade">
+			<view class='qrCode'>
+				<view style='text-align:right;'>
+					<uni-icons @click='qrcodeShow=false' type="close" size="20"></uni-icons>
+				</view>
+				<image :src="currectData.cardManagementInfo.qrCode" mode=""></image>
+			</view>
+			
+		</view>
+		<u-popup :show="popupshow" mode="bottom">
+			<view>
+				<view class="share-to">
+					<text>分享到</text>
+				</view>
+				<view class="content">
+					
+					<view class="block" @click="toUrl()">
+						<button class="moment">
+							<text class="iconfont icon-weixin"></text>
+							<!-- <image src="/static/img/moment.png" mode="aspectFill"></image>					 -->
+							<text>扫码分享</text>
+						</button>
+					</view>
+					<view class="block">
+						<button class="wechat" open-type="share">
+							<text class="iconfont icon-pengyouquan"></text>
+							<!-- <image src="/static/img/wechat.png" mode="aspectFill"></image> -->
+							<button class="shareBtn" type="default" data-name="shareBtn">
+								分享给微信好友</button>
+						</button>
+					</view>
+				</view>
+				<view class="cancel" @click.stop="handleHiddenShare">
+					<text>取消</text>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -91,7 +149,15 @@
 				typeColumns: [],
 				cardHolderList:[],
 				currectData:[],
-				type:1
+				type:1,
+				popupshow:false,
+				modalShow:false,
+				remark:'',
+				islongPress: false,
+				checked:false,
+				checkedList:[],
+				delShow:false,
+				qrcodeShow:false,
 			};
 		},
 		onShow() {
@@ -103,16 +169,143 @@
 			}
 			this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
 		},
+		onShareAppMessage(res) {
+			debugger
+			let that = this;
+			let imageUrl = that.shareUrl || '';
+			if (res.from === 'button') {
+			//这块需要传参,不然链接地址进去获取不到数据
+				let path = `/` + that.$scope.route + `?item=` + that.$scope.options.item;
+				return {
+					title: '名片夹',
+					path: path,
+					imageUrl: imageUrl
+				};
+			}
+			// if (res.from === 'menu') {
+			// 	return {
+			// 		title: '商通线上商城',
+			// 		path: '/pages/tabBarPro/index/index',
+			// 		imageUrl: imageUrl
+			// 	};
+			// }
+		},
 		methods: {
+			toUrl(){
+				console.log(this.currectData)
+				this.popupshow=false
+				this.qrcodeShow=true
+			},
+			share(item){
+				this.currectData=item
+				this.popupshow=true
+			},
+			async delConfirm(){
+				uni.showLoading({
+					title: '数据加载中',
+					mask:true
+				})
+				
+				for(var i=0;i<this.checkedList.length;i++){
+					await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'delete',{
+						id:this.checkedList[i].data.id,
+					}, failres => {
+						console.log('res+++++', failres.errmsg)
+						this.$refs.uToast.show({
+							type: 'error',
+							message: failres.errmsg,
+						})
+					}).then(res => {
+						console.log(i,this.checkedList.length-1)
+						if(i==this.checkedList.length-1){
+							uni.hideLoading()
+							this.$refs.uToast.show({
+								type: 'success',
+								message: '删除成功',
+							})
+							this.delShow=false
+							this.islongPress=false
+							this.mescroll.resetUpScroll()
+						}
+					})
+				}
+			},
+			del(){
+				this.delShow=true
+				
+			},
+			
+			longpress(){
+			    console.log("长按事件",1111111111);
+			    this.islongPress = true;
+				
+			},
+			checkboxChange(e, i) {
+				console.log(e,i,111111111)
+				if(i===''){
+					console.log(this.checked)
+					this.checked = !this.checked;
+					this.cardHolderList.map(item => item.checked = this.checked);
+					this.$forceUpdate()
+					var checkList = this.cardHolderList.filter((item) => {
+							return item.checked == true
+						})
+					var data=checkList.map((item,index) => {return {index:index,data:item}})
+					this.checkedList = JSON.parse(JSON.stringify(data))
+				}else{
+					if (e[0]) {
+						this.checkedList.push({index:i,data:this.cardHolderList[i]})
+					} else {
+						var index = this.checkedList.findIndex((item) => {
+							return item.index == i
+						})
+						this.checkedList.splice(index, 1)
+					}
+					if(this.checkedList.length!=this.cardHolderList.length){
+						this.checked=false
+					}
+				}
+				
+				// for(var i=0;i<this.cardList.length;i++){
+				// 	console.log(this.cardList[i].checked)
+				// 	// if(this.cardList[i].checkedList.length>0){
+				// 	// 	this.checkedList.push(i)
+				// 	// }
+				// }
+				console.log(this.checkedList)
+			},
+			remarkConfirm(){
+				if(this.remark){
+					this.currectData.remark=this.remark
+					this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update',{
+						cardHolderInfo:JSON.stringify(this.currectData),
+					}, failres => {
+						console.log('res+++++', failres.errmsg)
+						this.$refs.uToast.show({
+							type: 'error',
+							message: failres.errmsg,
+						})
+					}).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							message: '修改备注成功',
+						})
+						this.modalShow=false
+						this.mescroll.resetUpScroll()
+					})
+				}
+			},
+			remarkEdit(item){
+				this.currectData=item
+				this.modalShow=true
+			},
 			switchType(item){
 				this.type=2
 				this.currectData=item
 				this.isShowType=true
-				
 			},
 			typeConfirm(e){
 				if(this.type==2){
-
 					this.currectData.classify=e.value[0].circleName
 					this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update',{
 						cardHolderInfo:JSON.stringify(this.currectData),
@@ -123,6 +316,10 @@
 							message: failres.errmsg,
 						})
 					}).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							message: '修改分类成功',
+						})
 						this.mescroll.resetUpScroll()
 					})
 				}else{
@@ -131,7 +328,6 @@
 				this.isShowType = false
 			},
 			init(){
-
 				this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list',{
 					page:1,
 					limit:9999,
@@ -170,6 +366,7 @@
 					let curPageLen = res.data.items.length;
 					let totalPage = res.data.total;
 					for (var i = 0; i < res.data.items.length; i++) {
+						res.data.items[i].checked=false
 						if(res.data.items[i].classify){
 							res.data.items[i].classifyName=res.data.items[i].classify[0]
 						}
@@ -322,15 +519,20 @@
 			},
 			selectType() {
 				this.isShowType = true
+				this.type=1
 			},
 			scan() {
 				// console.log(1)
-				uni.scanCode({
-					success: function(res) {
-						console.log('条码类型:' + res.scanType);
-						console.log('条码内容:' + res.result);
-					}
-				});
+				uni.navigateTo({
+					url: "/pages/cardHolder/scancode"
+				})
+				// uni.scanCode({
+				// 	success: function(res) {
+				// 		console.log('条码类型:' + res.scanType);
+				// 		console.log('条码内容:' + res.result);
+						
+				// 	}
+				// });
 			},
 			toMap() {
 				uni.navigateTo({
@@ -409,4 +611,23 @@
 			}
 		}
 	}
+	.slot-content{
+		width:100%;
+	}
+	.shade{
+		background:rgba(0,0,0,0.2);
+		width:100%;height:100vh;
+		position:fixed;
+		top:0;
+		left:0;
+	}
+	.qrCode{
+		position:absolute;
+		top:50%;
+		left:0;
+		right:0;
+		transform: translateY(-50%);
+		text-align:center;
+	}
+	
 </style>

+ 206 - 0
xiaochengxu/pages/cardHolder/scancode.vue

@@ -0,0 +1,206 @@
+<template>
+	<view>
+		 
+		 
+		 <!-- 扫描框 -->
+		 <view class="scanBox" >
+		     <camera class="camera" mode="scanCode" @scancode="scancode" :flash='flashBtn'>
+		         <image class="coverImg" :src="iconScanBgGif"></image>
+		     </camera>
+		     <view style="text-align: center;margin: 80rpx 0 40rpx 0;">
+		         <button class="cu-btn scancodePic" bindtap="changeflashBtn">
+		             <!-- <image :src="flashBtn=='on'?scancodeOpen:scancodeClose"></image> -->
+		         </button>
+		     </view>
+		     <view class="scanTip">{{status==1?'请':'请扫描二维码'}}</view>
+		     <!-- 关闭扫码页面 -->
+		     <view class='scan-left' @click="scanClick(0)">扫码添加名片</view>
+			 <view class='scan' @click="scanClick(1)">名片识别</view>
+			 <div class="000"></div>
+		 </view>
+	</view>
+</template>
+
+<script>
+// import { iconScanBgGif,scancodeOpen,scancodeClose } from "../../../utils/imgUrl/index";
+// const permisson = require("../../../utils/tools/permisson"); // 权限校验封装
+const userCameraName = "scope.camera"; // 摄像头权限
+const userCameraZhName = "手机摄像头"; // 摄像头权限对应的中文名称
+export default {
+  data() {
+    return {
+		iconScanBgGif:'/static/imgs/code.gif',
+		// iconScanBgGif,scancodeOpen,scancodeClose,
+		canScan: false, // 是否显示自定义扫码界面
+        flashBtn: 'off', // off关闭   on  打开手电筒
+        scanResult: '', // 扫描结果
+		isShow:false,
+		status:0
+    };
+  },
+  mounted() {
+	  var that = this
+  	    //需要获得现在的授权信息
+  		uni.getSetting({
+  			success(res){
+  			    //如果相机访问权限没有授权
+  				if (!res.authSetting['scope.camera']) {
+  				    //访问授权
+  					uni.authorize({
+  						scope: 'scope.camera',
+  						success(){
+  							uni.showToast({
+  								title:'授权成功',
+  							})
+  							that.isShow = true
+  						},
+  						//拒绝后第二次访问授权默认进入fail,询问用户“检测到您没打开获取相机功能权限,是否去设置打开”
+  						fail(){
+  							uni.showModal({
+  								content: '检测到您没打开获取相机功能权限,是否去设置打开?',
+  								confirmText: "确认",
+  								cancelText: '取消',
+  								success: (res)=>{
+  									if (res.confirm) {
+  									//打开设置页面,让用户授权
+  										uni.openSetting({
+  											success: ()=>{
+  												uni.showModal({
+  													title: '授权后请重新打开此页面',
+  													icon: 'none',
+  													success: function(){
+  													// 刷新
+  														uni.navigateTo({
+  															url: '/pages/cardHolder/scancode',
+  														});
+  													}
+  												})
+  											}
+  										})
+  									}
+  								}
+  							})
+  						}
+  					})
+  				}else{
+  				  that.isShow = true
+  				}
+  			}
+  					
+  		})
+  	},
+  methods: {
+     changeflashBtn(){
+           this.flashBtn=this.data.flashBtn=='off'?'on':'off'
+       },
+       // 显示扫码界面(扫一扫)
+       scanShowClick(){
+		   console.log('扫码',111111)
+           // 校验权限, 必须开启摄像头权限
+           // wx.getSetting({
+           //     success:async(res)=> {
+           //         if(!res.authSetting['scope.camera']) {
+                       // 权限封装
+                       // permisson.permission_request(userCameraName, userCameraZhName);
+    
+                       // 也可自己写,通过 wx.authorize 打开有关授权=>官方链接https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html
+                   // } else {
+                       this.canScan=true
+                       // 顶部标题栏背景变黑
+                       uni.setNavigationBarColor({
+                           backgroundColor: '#000000',
+                           frontColor: '#ffffff',
+                       });
+           //         }
+           //     }
+           // })
+       },
+       // 隐藏扫码界面
+       scanClick(status){
+		   uni.scanCode({
+		   		scanType: ['barCode', 'qrCode'],
+		   		success: function(res) {
+					
+				}
+		    })
+          // this.status=status
+       },
+       // 扫一扫返回数据
+       scancode(e) {
+           console.log(e.detail)
+			uni.scanCode({
+		   			scanType: ['barCode', 'qrCode'],
+		   			success: function(res) {
+						
+					}
+			})
+
+           // const {result:scanResult} = e.detail; 
+           // if(result) {
+           //     this.scanResult,canScan=false
+           //     // 顶部标题栏背景变白
+           //     uni.setNavigationBarColor({
+           //         backgroundColor: '#ffffff',
+           //         frontColor: '#000000'
+           //     });
+           // }
+       }
+  },
+};
+</script>
+<style lang="scss" scoped>
+.scanBox {
+    position: fixed;
+    top: 0;
+    width: 100%;
+    height: 100vh;
+    background-color: #000000;
+}
+
+.camera {
+    position: relative;
+    width: 70vw;
+    height: 70vw;
+    margin: 20vh auto 0;
+}
+.coverImg{
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    z-index: 99999;
+}
+.scanTip {
+    padding: 20rpx 0 0 0;
+    font-size: 32rpx;
+    text-align: center;
+    color: #fff;
+}
+
+/* 开关手电筒 */
+.scancodePic{
+    background: transparent !important;
+    width: 100rpx;
+    height: 100rpx;
+    padding: 0 !important;
+}
+.scancodePic>image{
+    width: 100%;
+    height: 100%;
+}
+/* 关闭按钮 */
+.scan,.scan-left{
+    position: absolute;
+    bottom: 0;
+    padding: 20rpx 30rpx;
+    z-index: 99999;
+    background: #fff;
+}
+.scan{
+	right:0;
+}
+.scan-left{
+	left:0;
+}
+</style>

+ 2 - 1
xiaochengxu/pages/circle/circle.vue

@@ -21,7 +21,7 @@
 				<view class="left flex title">
 					<view class="line"></view>
 					<view class="text-title">
-						我圈子
+						我圈子
 					</view>
 				</view>
 				<!-- <view class="right">
@@ -122,6 +122,7 @@
 					commonId: this.userInfo.id,
 					page: page.num,
 					limit: page.size,
+					status:1
 				}
 				if (this.searchVal) {
 					_data.circleName = this.searchVal

+ 4 - 1
xiaochengxu/pages/circle/detail.vue

@@ -223,15 +223,18 @@
 					uni.hideLoading()
 				}).then(res => {
 					this.isShowCard = false
+					this.show = false
 					this.$refs.uToast.show({
 						type: 'success',
 						message: "加入成功!",
 					})
-
+					
 				})
 			},
 			addCircle() {
 				if (this.cardList[0].length == 1) {
+					// console.log(this.cardList[0])
+					this.cardId=this.cardList[0][0].id
 					this.show = true
 				} else if (this.cardList[0].length > 1) {
 					this.isShowCard = true

+ 1 - 1
xiaochengxu/pages/mySet/mySet.vue

@@ -13,7 +13,7 @@
 			</view>
 		</view>
 		<view class="content2">
-			<view class="row flex flex-between" v-for="item in menuList" @click="menuClick(item.type)">
+			<view class="row flex flex-between" v-for="(item,index) in menuList" :key='index' @click="menuClick(item.type)">
 				<view class="flex">
 					<image :src="item.src" mode="widthFix" class="nav-img"></image>
 					<button class="left-btn" v-if='item.type=="contactCustomer"' open-type='contact'>{{item.name}}</button>

+ 21 - 1
xiaochengxu/pages/mySet/newCard.vue

@@ -175,7 +175,27 @@
 						type: 'success',
 						message: '提交成功!',
 					})
-					uni.navigateBack()
+					this.$request.baseRequest('admin.unimall.personalHomepageInfo', 'list',{
+						page:1,
+						limit:10,
+						commonId:uni.getStorageSync("userInfo").id
+					}, failres => {
+						console.log('res+++++', failres.errmsg)
+						this.$refs.uToast.show({
+							type: 'error',
+							message: failres.errmsg,
+						})
+						uni.hideLoading()
+					}).then(res => {
+						if(res.data.items.length>0){
+							uni.navigateBack()
+						}else{
+							uni.navigateTo({
+								url: '/pages/mySet/myHome'
+							})
+						}
+					})
+					
 				})
 			},
 			submit() {

BIN
xiaochengxu/static/imgs/code.gif


+ 27 - 0
xiaochengxu/util/util.js

@@ -37,3 +37,30 @@ export function parseTime(time, pattern) {
   })
   return time_str
 }
+/**
+ * 防止小程序多次点击跳转
+ * @param {*} obj 
+ * @returns 
+ */
+export function throttle(fn, gapTime) {
+    if (gapTime == null || gapTime == undefined) {
+        gapTime = 1500
+    }
+ 
+    let _lastTime = null
+ uni.scanCode({
+ 	success: function(res) {
+ 		console.log('条码类型:' + res.scanType);
+ 		console.log('条码内容:' + res.result);
+ 		
+ 	}
+ });
+    // 返回新的函数
+    return function () {
+        let _nowTime = + new Date()
+        if (_nowTime - _lastTime > gapTime || !_lastTime) {
+            fn.apply(this, arguments)   //将this和参数传给原函数
+            _lastTime = _nowTime
+        }
+    }
+}