Преглед изворни кода

fix:修改用户头像,二维码添加时间戳,删除规则添加提示,登录保存账号密码,屏蔽微信浏览器验证

zhanghui пре 2 година
родитељ
комит
5bddd944dc

+ 4 - 4
App.vue

@@ -17,10 +17,10 @@
             if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                 console.log('这是微信浏览器');
             }else {
-                uni.showModal({
-                    title:'温馨提示',
-                    content:'请在手机微信客户端打开连接',
-                })
+                // uni.showModal({
+                //     title:'温馨提示',
+                //     content:'请在手机微信客户端打开连接',
+                // })
             }
 			console.log('App Launch')
 		},

+ 2 - 2
common/js/env.js

@@ -1,8 +1,8 @@
 "use strict";
 
 // let baseUrl = `https://jje.admin.xinyuekj.com.cn`
-// let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
-let baseUrl = `http://65i1sxopd9qp.ngrok.xiaomiqiu123.top`
+let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
+// let baseUrl = `http://65i1sxopd9qp.ngrok.xiaomiqiu123.top`
 // let baseUrl = `http://47.108.114.127:10888`
 // let baseUrl = `https://jje.xinyuekj.com.cn/prod-api`
 

+ 9 - 0
common/js/user.js

@@ -8,5 +8,14 @@ export default {
             url: '/member/wechat/getUser',
             method: 'GET'
         })
+    },
+
+    //修改用户头像
+    updateUserInfo(data) {
+        return request({
+            url: '/member/wechat/updateUserInfo',
+            method: 'POST',
+            data:data
+        })
     }
 }

+ 1 - 1
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "jje_spread_uniapp",
+    "name" : "娇骄儿拓客",
     "appid" : "__UNI__0AD3309",
     "description" : "",
     "versionName" : "1.0.0",

+ 3 - 2
pages/index/attach/attach.vue

@@ -82,7 +82,7 @@
 			return {
 				roleBindRuleList:[],
 				userInfo:{},
-				qrcodeUrl:this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}',
+				qrcodeUrl:this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}&timestamp={timestamp}',
 				options: {
 					// 指定二维码前景,一般可在中间放logo
 					foregroundImagePadding:2,
@@ -118,7 +118,8 @@
 			createQrCode(){
 				let data = {
 					expandUserId:this.userInfo.id,
-					ruleId:''
+					ruleId:'',
+					timestamp:new Date().getTime() + (5 * 60 * 1000)
 				};
 				this.roleBindRuleList.forEach(item=>{
 					if (item.select){

+ 17 - 16
pages/index/index.vue

@@ -2,7 +2,7 @@
 	<view class="page">
 		<manager :height="height" v-if="userInfo.isManager === 1"></manager>
 		<attach :height="height" v-if="userInfo.isManager === 0 && userInfo.roleTag == '0'"></attach>
-		<view  v-if="userInfo.isManager === 0 && userInfo.roleTag == '1'">
+		<view v-if="userInfo.isManager === 0 && userInfo.roleTag == '1'">
 			<text>合作伙伴</text>
 		</view>
 	</view>
@@ -12,40 +12,41 @@
 	import manager from "./manager/manager";
 	import attach from "./attach/attach"
 	export default {
-		components:{
-			manager,attach
+		components: {
+			manager,
+			attach
 		},
 		data() {
 			return {
-				height:'',
-				ruleList:[],
-				roleList:[],
-				roleBindRuleParam:{},
-				userInfo:{}
+				height: '',
+				ruleList: [],
+				roleList: [],
+				roleBindRuleParam: {},
+				userInfo: {}
 			}
 		},
 		onLoad() {
 			let sysInfo = uni.getSystemInfoSync()
-			this.height = sysInfo.windowHeight  + 'px'
-
+			this.height = sysInfo.windowHeight + 'px'
 		},
-		onShow(){
+		onShow() {
 			this.userInfo = uni.getStorageSync('spreadUserInfo')
+			console.log('时间戳',new Date().getTime())
 		},
 		methods: {
 			// 微信支付
-			wechatPay(){
+			wechatPay() {
 				const that = this;
 				// 用户信息
 				this.$api.service.wechatPay({
-					orderNo:'CZ20240223125943175'
-				}).then((res)=>{
+					orderNo: 'CZ20240223125943175'
+				}).then((res) => {
 					var param = res.data.data;
 					uni.requestPayment({
 						appId: param.appid,
-						timeStamp: param.timestamp+"",
+						timeStamp: param.timestamp + "",
 						nonceStr: param.noncestr,
-						package: "prepay_id="+param.prepayid,
+						package: "prepay_id=" + param.prepayid,
 						signType: "RSA",
 						paySign: param.sign,
 						success: res => {

+ 26 - 10
pages/index/manager/manager.vue

@@ -14,7 +14,7 @@
 			<view class="flex-row justify-center">
 				<image class="dataNullImage" src="/static/zhanwu.png"></image>
 			</view>
-			<text class="roleName1">{{roleList[confirmRoleIndex].name}}<text class="roleHint">角色没有拓客规则,点击下方“添加规则”按钮可添加拓客规则</text></text>
+			<text v-if="roleList[confirmRoleIndex]" class="roleName1">{{roleList[confirmRoleIndex].name}}<text class="roleHint">角色没有拓客规则,点击下方“添加规则”按钮可添加拓客规则</text></text>
 		</view>
 
 		<view v-else class="scroll-Y">
@@ -177,7 +177,7 @@
 				roleNoBindRuleList:[], //角色没有绑定的规则
 				roleBindRuleParam:{},
 				value: 1,
-				qrcodeUrl:this.$tkUrl+'?roleId={roleId}&parentId={parentId}',
+				qrcodeUrl:this.$tkUrl+'?roleId={roleId}&parentId={parentId}&timestamp={timestamp}',
 				options: {
 					// 指定二维码前景,一般可在中间放logo
 					foregroundImagePadding:2,
@@ -193,13 +193,28 @@
 		methods: {
 
 			deleteRule(item){
-				this.$api.service.cancelRoleBindRule({
-					roleId:this.roleList[this.confirmRoleIndex].id,
-					ruleIds:[item.id]
-				}).then(res=>{
-					this.getRuleByRoleId(this.roleList[this.confirmRoleIndex].id)
-					this.getNewRules(this.roleList[this.confirmRoleIndex].id)
-				})
+
+				let  that =this
+				uni.showModal({
+					title: '温馨提示',
+					content: '是否确认删除该规则!',
+					success: function (res) {
+						if (res.confirm) {
+							console.log('用户点击确定');
+							that.$api.service.cancelRoleBindRule({
+								roleId:that.roleList[that.confirmRoleIndex].id,
+								ruleIds:[item.id]
+							}).then(res=>{
+								that.getRuleByRoleId(that.roleList[that.confirmRoleIndex].id)
+								that.getNewRules(that.roleList[that.confirmRoleIndex].id)
+							})
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+
+
 			},
 
 			selectRule(item,index){
@@ -266,7 +281,8 @@
 
 				let data = {
 					roleId:this.roleList[this.confirmRoleIndex].id,
-					parentId:this.userInfo.id
+					parentId:this.userInfo.id,
+					timestamp:new Date().getTime() + (5 * 60 * 1000)
 				};
 				for (let key in data) {
 					let regexp = new RegExp("{" + key + "}"); // 构造正则表达式

+ 13 - 2
pages/login/login.vue

@@ -89,9 +89,14 @@
 		onShow(){
 			this.form.username = uni.getStorageSync('username')
 			this.form.password = uni.getStorageSync('password')
-			this.savePassword = uni.getStorageSync('savePassword')
+
+			if (uni.getStorageSync('savePassword')){
+				this.savePassword = uni.getStorageSync('savePassword')
+			}
+
 		},
 		onLoad(e){
+
 			console.log('重定向获取到的参数',e)
 			console.log('重定向的url',location.href)
 			let code = this.getUrlCode('code')
@@ -136,11 +141,15 @@
 
 			login() {
 
+				console.log('savePassword', this.savePassword)
+
+
 				if (this.requestStatus){
 					return
 				}
 				this.requestStatus=true
 				this.$refs.uForm.validate().then(res => {
+					console.log('savePassword', this.savePassword)
 					if (this.savePassword){
 						uni.setStorageSync('savePassword', this.savePassword)
 						uni.setStorageSync('username', this.form.username)
@@ -160,7 +169,9 @@
 						this.requestStatus=false
 						uni.setStorageSync('accessToken', res.data.data.access_token)
 						this.$api.user.getUserInfo().then(res=>{
-
+							if (res.data.data.img){
+								res.data.data.img = res.data.data.img.replace(/^http:/, "https:")
+							}
 							this.userInfo = res.data.data
 							uni.setStorageSync('spreadUserInfo', this.userInfo)
 							uni.showToast({

+ 2 - 2
pages/my/my.vue

@@ -2,7 +2,7 @@
 	<view class="page" :style="{height:height}">
 		<view class="flex-row use">
 			<view class="avatar" @click="goUserInfo">
-				<image :src="userInfo.selfPhotoUrl || '/static/ud4.png'"></image>
+				<image :src="userInfo.img || '/static/ud4.png'"></image>
 			</view>
 			<view class="flex-col justify-evenly useMsg">
 				<view class="flex-row">
@@ -91,7 +91,7 @@
 
 		onShow() {
 			this.userInfo = uni.getStorageSync('spreadUserInfo')
-			this.getImgUrlByOssId(this.userInfo.img)
+			// this.getImgUrlByOssId(this.userInfo.img)
 			this.exStatistics()
 		},
 

+ 36 - 0
pages/register/register.vue

@@ -66,6 +66,8 @@
 	export default {
 		data() {
 			return {
+
+				qrCodeInvalid:false,//二维码是否无效标识
 				requestStatus:false,
 				disabled1:false,
 				showBirthday:false,
@@ -182,6 +184,26 @@
 				this.form.parentId = e.parentId
 				console.log('获取到的name',e.parentId)
 			}
+			if (e.timestamp){
+				console.log('获取到的时间戳',e.timestamp,new Date().getTime() > e.timestamp)
+				if (new Date().getTime() > e.timestamp){
+					this.qrCodeInvalid = true
+
+					uni.showModal({
+						title: '温馨提示',
+						content: ' 当前二维码已过期,请重新扫码',
+						showCancel:false,
+						success: function (res) {
+							if (res.confirm) {
+								console.log('用户点击确定');
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					});
+
+				}
+			}
 		},
 		methods: {
 			idCardAndName(){
@@ -244,6 +266,20 @@
 				console.log(e)
 			},
 			expandRegister(){
+				if (this.qrCodeInvalid){
+					uni.showModal({
+						title: '温馨提示',
+						content: ' 当前二维码已过期,请重新扫码',
+						success: function (res) {
+							if (res.confirm) {
+								console.log('用户点击确定');
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					});
+					return;
+				}
 				console.log(this.form)
 				if (this.requestStatus){
 					return

+ 5 - 1
pages/userInfo/userInfo.vue

@@ -135,7 +135,11 @@
 								console.log('+++++++++++++++++chooseavatar+++++++++++++++++++++++',uploadFileRes.data)
 								that.userInfo.img = res.data.url.replace(/^http:/, "https:")
 
-								//todo  更新头像的接口
+								that.$api.user.updateUserInfo({
+									img:res.data.url
+								}).then(res1=>{
+									console.log(res1)
+								})
 
 								uni.setStorageSync('spreadUserInfo', that.userInfo)