Pārlūkot izejas kodu

commit-m 5月小需求

zhengjinyi 4 gadi atpakaļ
vecāks
revīzija
a4861f04c0

+ 33 - 31
pages/login/bindOperator.vue

@@ -116,7 +116,7 @@
 			})	
 		},
 		methods:{
-			...mapMutations(['login','logout']),
+			...mapMutations(['login','logout','wxLogin']),
 			async getWxAuthorize(){
 				const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
 				const getUserInfo = await authorize.getUserInfo('weixin');
@@ -170,15 +170,7 @@
 					this.$util.msg('验证码格式不正确',2000)
 					return
 				}
-				authorize.getSetting().then(res =>{
-					console.log('用户是否授权过',res)
-					if(res == 1){
-						this.bindingWechatLogin()
-					}else{
-						console.log(new Date +'用户未授权微信信息')
-						this.$api.navigateTo('/pages/authorization/authorization')
-					}
-				})
+				this.GetUserProfile()
 			},
 			getVerificationCode(){//图形验证
 				this.PublicService.GetImgVerifyCode().then(res => {
@@ -233,29 +225,39 @@
 						this.isMobileDisabled = false;
 					})
 			},
-			
-			bindingWechatLogin(){//获取用户基本信息登录
-				wx.getUserInfo({
-					success: res => {
-						this.wxUserInfo = res.userInfo;
-						let params ={
-								userId:uni.getStorageSync('bind_id'),
-								mobile:this.bindMobile,
-								linkName:this.bindLinkName,
-								smsCode:this.mobildeCode,
-								unionId:uni.getStorageSync('unionId'),
-								nickName:this.wxUserInfo.nickName,
-								avatarUrl:this.wxUserInfo.avatarUrl,
-						}
-						this.UserService.BindingWechat(params).then(response =>{
-							this.login(response.data)
-							this.$api.switchTabTo('/pages/tabBar/home/index')
-						}).catch(error =>{
-							this.$util.msg(error.msg,2000)
-							this.isUserInfo = true
-						})			
+			GetUserProfile(){//获取用户微信个人信息
+				const self = this
+				wx.getUserProfile({
+					desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+					success(res) {
+						console.log('微信获取用户信息新API',res)	
+						self.wxLogin(res.userInfo)	
+						self.wxUserInfo.nickName = res.userInfo.nickName
+						self.wxUserInfo.avatarUrl = res.userInfo.avatarUrl
+						self.BindingWechat()
+					},
+					fail() {
+						self.$util.msg('授权失败', 2000)
 					}
 				})
+			},
+			BindingWechat(){//绑定微信并登录
+				let params ={
+						userId:uni.getStorageSync('bind_id'),
+						mobile:this.bindMobile,
+						linkName:this.bindLinkName,
+						smsCode:this.mobildeCode,
+						unionId:uni.getStorageSync('unionId'),
+						nickName:this.wxUserInfo.nickName,
+						avatarUrl:this.wxUserInfo.avatarUrl,
+				}
+				this.UserService.BindingWechat(params).then(response =>{
+					this.login(response.data)
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+					this.isUserInfo = true
+				})	
 			}
 		},
 		onShow() {

+ 56 - 38
pages/login/bindwechat.vue

@@ -89,6 +89,8 @@
 				count: '',				//倒计时
 				mobileCodeText: '获取验证码',
 				codeTime: null,
+				nickName:'',
+				avatarUrl:'',
 			}
 		},
 		onLoad(option) {
@@ -98,7 +100,7 @@
 			...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
 		},
 		methods:{
-			...mapMutations(['login']),
+			...mapMutations(['login','wxLogin']),
 			bindWechatInfo(){
 				if( this.bindLinkName == ''){
 					this.$util.msg('请输入姓名',2000)
@@ -120,7 +122,59 @@
 					this.$util.msg('验证码格式不正确',2000)
 					return
 				}
-				this.bindingWechatLogin()
+				this.isUserInfo = false;
+				this.GetUserProfile()
+			},
+			GetUserProfile(){//获取用户微信个人信息
+				const self = this
+				wx.getUserProfile({
+					desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+					success(res) {
+						console.log('微信获取用户信息新API',res)	
+						self.wxLogin(res.userInfo)	
+						self.nickName = res.userInfo.nickName
+						self.avatarUrl = res.userInfo.avatarUrl
+						self.BindingWechat()
+					},
+					fail() {
+						self.$util.msg('授权失败', 2000)
+					}
+				})
+			},
+			BindingWechat(){//绑定微信并登陆
+				this.UserService.BindingWechat(
+					{
+						userId:this.userId,
+						mobile:this.bindLinkPhone,
+						linkName:this.bindLinkName,
+						smsCode:this.smsCode,
+						unionId:this.unionId,
+						nickName:this.nickName,
+						avatarUrl:this.avatarUrl,
+					}
+				)
+				.then(response =>{
+					if(this.userIdentity === 3){
+						this.$api.navigateTo('/supplier/pages/index/index')
+					}else{
+						switch(this.isLoginType){
+							case 9:
+								this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
+								break;
+							case 8:
+								this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
+								break;
+							case 7:
+								this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
+								break;
+							default:
+								this.$api.switchTabTo('/pages/tabBar/user/user')
+						}
+					}
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})	
 			},
 			getVerificationCode(){//图形验证
 				this.PublicService.GetImgVerifyCode().then(res => {
@@ -175,42 +229,6 @@
 						this.isMobileDisabled = false;
 					})
 			},
-			bindingWechatLogin(){//获取用户基本信息登录
-				const userInfo = uni.getStorageSync('wechatUserInfo')
-				this.isUserInfo = false;
-				let params ={
-						userId:this.userId,
-						mobile:this.bindLinkPhone,
-						linkName:this.bindLinkName,
-						smsCode:this.smsCode,
-						unionId:this.unionId,
-						nickName:userInfo.nickName,
-						avatarUrl:userInfo.avatarUrl,
-				}
-				this.UserService.BindingWechat(params)
-					.then(response =>{
-						if(this.userIdentity === 3){
-							this.$api.navigateTo('/supplier/pages/index/index')
-						}else{
-							switch(this.isLoginType){
-								case 9:
-									this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
-									break;
-								case 8:
-									this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
-									break;
-								case 7:
-									this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
-									break;
-								default:
-									this.$api.switchTabTo('/pages/tabBar/user/user')
-							}
-						}
-					})
-					.catch(error =>{
-						this.$util.msg(error.msg,2000)
-					})							
-			},
 			//关闭未授权用户授权提示弹窗
 			hideModel(){
 				this.isUserInfo = false;

+ 30 - 12
pages/login/logincode.vue

@@ -6,7 +6,7 @@
 		</view>
 		<view class="login-input">
 			<input type="number" 
-				   v-model="invitationCode"  
+				   v-model="params.invitationCode"  
 				   maxlength="6" 
 				   class="input" 
 				   placeholder="请输入邀请码"
@@ -25,8 +25,12 @@
 	export default{
 		data() {
 			return{
-				invitationCode:'',  //获取用户登录的邀请码
-				unionId:'',
+				params:{
+					invitationCode:'',//获取用户登录的邀请码
+					unionId:0,
+					nickName:'',
+					avatarUrl:'',
+				},
 			}
 		},
 		onLoad(option) {
@@ -36,20 +40,34 @@
 			...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
 		},
 		methods:{
-			...mapMutations(['login']),
-			goLogin() {
-				const userInfo = uni.getStorageSync('wechatUserInfo')
-				if( this.invitationCode == ''){
+			...mapMutations(['login','wxLogin']),
+			goLogin(){
+				if( this.params.invitationCode == ''){
 					this.$util.msg('请输入邀请码',2000)
 					return
 				}
 				this.isUserInfo = false
-				this.UserService.InvitationCodeLogin({
-						invitationCode:this.invitationCode,
-						nickName:userInfo.nickName,
-						avatarUrl:userInfo.avatarUrl,
-						unionId:uni.getStorageSync('unionId')
+				this.params.unionId = uni.getStorageSync('unionId')
+				this.GetUserProfile()
+			},
+			GetUserProfile(){//获取用户微信个人信息
+				const self = this
+				wx.getUserProfile({
+					desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+					success(res) {
+						console.log('微信获取用户信息新API',res)	
+						self.wxLogin(res.userInfo)	
+						self.params.nickName = res.userInfo.nickName
+						self.params.avatarUrl = res.userInfo.avatarUrl
+						self.BindingWechat(self.params)
+					},
+					fail() {
+						self.$util.msg('授权失败', 2000)
+					}
 				})
+			},
+			BindingWechat(params){//邀请码登录并绑定微信
+				this.UserService.InvitationCodeLogin(params)
 				.then(response =>{
 					wxLogin.wxLoginAuthorize()
 					if(response.data.userIdentity === 3){

+ 24 - 9
pages/login/register.vue

@@ -117,7 +117,7 @@
 			...mapState(['isWxAuthorize'])
 		},
 		methods:{
-			...mapMutations(['login']),
+			...mapMutations(['login','wxLogin']),
 			hanldNavigateBack(){
 				this.$util.modal('','注册尚未完成,确定放弃注册吗?','确定','取消',true,() =>{
 					uni.navigateBack({
@@ -125,10 +125,8 @@
 					});
 				})
 			},
+			
 			registerStepsfirst(){
-				const userInfo = uni.getStorageSync('wechatUserInfo')
-				this.params.nickName = userInfo.nickName
-				this.params.avatarUrl = userInfo.avatarUrl
 				if( this.params.userName == ''){
 					this.$util.msg('请输入联系人名称',2000);
 					return
@@ -169,14 +167,34 @@
 					this.$util.msg('请勾选同意协议',2000);
 					return
 				}
-				this.UserService.UserRegisterClub(this.params).then(response =>{
+				this.params.unionId = uni.getStorageSync('unionId')
+				this.GetUserProfile()
+			},
+			GetUserProfile(){//获取用户微信个人信息
+				const self = this
+				wx.getUserProfile({
+					desc: '采美采购商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+					success(res) {
+						console.log('微信获取用户信息新API',res)	
+						self.wxLogin(res.userInfo)	
+						self.params.nickName = res.userInfo.nickName
+						self.params.avatarUrl = res.userInfo.avatarUrl
+						self.UserRegisterClub(self.params)
+					},
+					fail() {
+						self.$util.msg('授权失败', 2000)
+					}
+				})
+			},
+			UserRegisterClub(params){
+				this.UserService.UserRegisterClub(params).then(response =>{
 					wxLogin.wxLoginAuthorize()
 					setTimeout(() =>{
 						this.$api.switchTabTo('/pages/tabBar/user/user')
 					},2000)
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000);
-				})		
+				})	
 			},
 			storeUpdataeStatus(data){
 				uni.setStorageSync('token',data.token)
@@ -243,9 +261,6 @@
 			}
 		},
 		onShow() {
-			this.$api.getStorage().then((resolve) =>{
-				this.params.unionId = resolve.unionId
-			})
 			this.InitAuthorize()
 		}
 	}

+ 11 - 11
second/pages/form/form-seller.vue

@@ -137,13 +137,13 @@
 						<view class="label-im">身份验证照片</view>
 						<view class="label-em">(个人请上传身份证正面照片;机构请上传营业执照照片)</view>
 						<view class="release-input upload image uploadGoodsImages" >
-							<view class="upload-file" v-if="secondParams.userImage == ''">
+							<view class="upload-file" v-if="secondParams.authenticationImage == ''">
 								<i class="iconfont icon-shangchuantupian"></i>
 								<text class="add-text">验证照片</text>
 								<view ref="goodsImages" class="input-file"  @click="uploadUserImageFn"></view>
 							</view>
 							<view class="upload-file" v-else>
-								<image :src="secondParams.userImage" alt="" class="upload-img" ></image>
+								<image :src="secondParams.authenticationImage" alt="" class="upload-img" ></image>
 								<i class=" del iconfont icon-shanchu1" @click="removeUserImageFn"></i>
 							</view>
 						</view>
@@ -221,14 +221,14 @@
 							<view class="label-im">二手出让承诺函图片</view>
 							<view class="label-em">(若不方便上传承诺函文件,可对承诺函进行拍照或者截图,再上传图片)</view>
 							<view class="release-input upload image uploadGoodsImages" >
-								<view class="upload-file" v-if="secondParams.userImage == ''">
+								<view class="upload-file" v-if="secondParams.commitmentImage == ''">
 									<i class="iconfont icon-shangchuantupian"></i>
 									<text class="add-text">承诺函图片</text>
-									<view ref="goodsImages" class="input-file"  @click="uploadUserImageFn"></view>
+									<view ref="goodsImages" class="input-file"  @click="uploadCommitmentImageFn"></view>
 								</view>
 								<view class="upload-file" v-else>
-									<image :src="secondParams.userImage" alt="" class="upload-img" ></image>
-									<i class=" del iconfont icon-shanchu1" @click="removeUserImageFn"></i>
+									<image :src="secondParams.commitmentImage" alt="" class="upload-img" ></image>
+									<i class=" del iconfont icon-shanchu1" @click="removeCommitmentImageFn"></i>
 								</view>
 							</view>
 						</view>
@@ -333,7 +333,7 @@
 					productQuality:'',//商品成色
 					contactName:'',//联系人
 					contactMobile:'',//联系方式
-					userImage:'',
+					authenticationImage:'',//身份验证照片
 					dockingPeopleName:'',//采美对接人姓名
 					dockingPeopleMobile:'',//采美对接人手机号
 					secondProductType:'',//
@@ -342,7 +342,7 @@
 					image:'',//图片
 					file:'',
 					productDetails:'',//商品详细信息
-					source:2
+					source:4//二手发布来源.1:WWW,2:小程序,3:后台,4:协销
 				 },
 				 addressData:{
 					address:'请选择所在地区',
@@ -415,9 +415,9 @@
 					 this.secondParams.image =this.GoodsImagesList.toString()+',';
 				})
 			},
-			 uploadUserImageFn(event){//上传身份图片
+			 uploadUserImageFn(event){//上传身份验证图片
 				uploadFileImage().then(res =>{
-					 this.secondParams.userImage= JSON.parse(res.data).data;
+					 this.secondParams.authenticationImage= JSON.parse(res.data).data;
 				})
 			},
 			uploadCommitmentFile(){//上传承诺函文件
@@ -434,7 +434,7 @@
 				this.secondParams.image =this.GoodsImagesList.toString()+',';
 			},
 			removeUserImageFn(index){//删除身份图片
-				this.secondParams.userImage = ''
+				this.secondParams.authenticationImage = ''
 			},
 			getProductType(e){
 			  this.secondParams.secondProductType = e.target.value ;

+ 1 - 1
second/pages/form/form.vue

@@ -341,7 +341,7 @@
 					image:'',//图片
 					file:'',
 					productDetails:'',//商品详细信息
-					source:2
+					source:2//二手发布来源.1:WWW,2:小程序,3:后台,4:协销
 				 },
 				 addressData:{
 					address:'请选择所在地区',

+ 2 - 2
services/ajax.env.js

@@ -5,8 +5,8 @@ if(process.env.NODE_ENV === 'development'){
 	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
 	// URL_CONFIG = 'http://192.168.2.81:8008'
 	// URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
-    // URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
-	URL_CONFIG = 'https://spi.caimei365.com'
+    URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
+	// URL_CONFIG = 'https://spi.caimei365.com'
 }else{
     // 生产环境
 	URL_CONFIG = 'https://spi-b.caimei365.com'

+ 2 - 2
services/config.env.js

@@ -3,8 +3,8 @@ if(process.env.NODE_ENV === 'development'){
     // 开发环境
     // URL_CONFIG = 'http://192.168.2.75:18002'	 //超超联调地址
 	// URL_CONFIG = 'http://192.168.2.67:18002'	 //裴裴联调地址
-	// URL_CONFIG = 'https://core-b.caimei365.com'
-	URL_CONFIG = 'https://core.caimei365.com'
+	URL_CONFIG = 'https://core-b.caimei365.com'
+	// URL_CONFIG = 'https://core.caimei365.com'
 }else{
     // 生产环境
 	URL_CONFIG = 'https://core-b.caimei365.com'

+ 1 - 1
services/public.service.js

@@ -13,7 +13,7 @@ export default class PublicService {
 		return this.AjaxService.get({ 
 			url:'/club/address', 
 			data, 
-			isLoading: true ,
+			isLoading: false ,
 		})
 	}
 	/**