yuwenjun 4 vuotta sitten
vanhempi
commit
31a5d71e1b

+ 76 - 75
common/config/utilsTools.js

@@ -24,9 +24,9 @@ const caimeiApi = {
 			success: (response) => {
 				if(response.statusCode !== 200){
 					uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
-					callback(response.statusCode);
+					callback(response.statusCode)
 				}else{
-					callback(response.data);
+					callback(response.data)
 				}
 			},
 			fail: (error) => {
@@ -34,7 +34,7 @@ const caimeiApi = {
 					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
 				}
 			}
-		 });
+		 })
 	},
 	/**
 	 * @封装公共get数据请求方法有加载动画
@@ -42,7 +42,7 @@ const caimeiApi = {
 	 * @自定义请求头信息
 	 */
 	lodingGet:function(url,data,callback){
-		 uni.showLoading({mask: true,title:'加载中~',});
+		 uni.showLoading({mask: true,title:'加载中~',})
 		 uni.request({
 			url: requestUrl + url,
 			data:data,
@@ -56,9 +56,9 @@ const caimeiApi = {
 			success: (response) => {
 				if(response.statusCode !== 200){
 					uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
-					callback(response.statusCode);
+					callback(response.statusCode)
 				}else{
-					callback(response.data);
+					callback(response.data)
 				}
 			},
 			fail: (error) => {
@@ -68,16 +68,17 @@ const caimeiApi = {
 			},
 			complete: () => {
 				setTimeout(function () {
-					uni.hideLoading();
-				}, 250);
+					uni.hideLoading()
+				}, 250)
 			}
-		 });
+		 })
 	},
 	/**
 	 * @封装公共post数据请求方法
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 */
 	post:function(url,data,loadingStatus,callback){
+		console.info(data)
 		if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
 		uni.request({
 			url: requestUrl+url,
@@ -85,11 +86,11 @@ const caimeiApi = {
 			header: {
 				'Accept': 'application/json',
 				'Content-Type': 'application/x-www-form-urlencoded',
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
+				// 'Content-Type': 'application/json',
 			},
 			method: 'POST',
 			success: (response) => {
+				console.log(response)
 				if(loadingStatus){uni.hideLoading()}
 				const result = response.data
 				callback(result)
@@ -107,13 +108,13 @@ const caimeiApi = {
 			uni.getStorage({
 				key: key,
 				success: function (res){
-					resolve(res.data);
+					resolve(res.data)
 				},
 				fail: function(res){
 					reject(false)
 				}
 			})
-		});
+		})
 	},
 	setStorage:function(key,data){// 存储本地Storage
 		return new Promise(function(resolve,reject) {
@@ -123,30 +124,30 @@ const caimeiApi = {
 				success: function (res){
 				}
 			})
-		});
+		})
 	},
 	getStorage:function(){// 获取本地userInfo
 		return new Promise(function(resolve,reject) {
 			uni.getStorage({
 				key: 'userInfo',
 				success: function (res){
-					resolve(res.data);
+					resolve(res.data)
 				},
 				fail: function(res){
 					reject(false)
 				}
 			})
-		});
+		})
 	},
 	getStorageAddressKey:function(){// 获取本地地址信息
 		return new Promise(function(resolve,reject) {
 			uni.getStorage({
 				key: 'address_key',
 				success: function (res){
-					resolve(res.data);
+					resolve(res.data)
 				}
 			})
-		});
+		})
 	},
 	loginStatus:function(){
 	// 获取用户是否登陆 1:已登陆,否则未登陆
@@ -155,20 +156,20 @@ const caimeiApi = {
 				key: 'userInfo',
 				success: function (res){
 					if(res.data.code == '1'){
-						resolve(true);
+						resolve(true)
 					} else {
-						resolve(false);
+						resolve(false)
 					}
 				}
 			})
-		});
+		})
 	},
 	navToListPage:function({type,value,id,lType} = {}){	
 	// 跳转到列表页
 		if(lType=='4'){
-			const pages = getCurrentPages();
-			const prevPage = pages[pages.length-2];
-			prevPage.refresh = true;
+			const pages = getCurrentPages()
+			const prevPage = pages[pages.length-2]
+			prevPage.refresh = true
 			prevPage.listData = {
 				type: type,
 				from: value,
@@ -186,9 +187,9 @@ const caimeiApi = {
 	navigateToGoods:function({type,value,id,lType} = {}){
 	// 跳转到列表页
 		if(lType=='4'){
-			const pages = getCurrentPages();
-			const prevPage = pages[pages.length-2];
-			prevPage.refresh = true;
+			const pages = getCurrentPages()
+			const prevPage = pages[pages.length-2]
+			prevPage.refresh = true
 			prevPage.listData = {
 				type: type,
 				from: value,
@@ -229,21 +230,21 @@ const caimeiApi = {
 					4:`/h5/pages/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
 				 	5:`/pages/goods/product?id=${pros.linkParam.id}`,
 				 	7:`/supplier/pages/user/my-shop?shopId=${pros.linkParam.id}`,
-				 	8:`/h5/pages/activity/activity-list`,
-				 	9:`/second/pages/form/introduce`,
-				 	10:`/second/pages/product/product-list`,
-				 	11:`/second/pages/form/form`,
+				 	8:'/h5/pages/activity/activity-list',
+				 	9:'/second/pages/form/introduce',
+				 	10:'/second/pages/product/product-list',
+				 	11:'/second/pages/form/form',
 				 	12:`/search/pages/search/search?keyWord=${pros.linkParam.keyword}`,
 				 	13:`/h5/pages/article/path?link=${pros.link}`,
 				 	14:`/h5/pages/article/path?link=${pros.link}`,
 				 	15:`/h5/pages/article/path?link=${pros.link}`,
-				 	17:`/pages/login/register-select`,
+				 	17:'/pages/login/register-select',
 				 	18:`/h5/pages/article/path?link=${pros.link}`,
 				 	19:`/search/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`,
-					21:`/h5/pages/activity/meobohui`
+					21:'/h5/pages/activity/meobohui'
 					
 				}
-				const url = typeMap[pros.linkType];
+				const url = typeMap[pros.linkType]
 				uni.navigateTo({
 				  	url:url
 				})
@@ -258,20 +259,20 @@ const caimeiApi = {
 				4:`/h5/pages/activity/activity?id=${linkId}`,
 				5:`/pages/goods/product?id=${linkId}`,
 				7:`/supplier/pages/user/my-shop?shopId=${linkId}`,
-				8:`/h5/pages/activity/activity-list`,
-				9:`/second/pages/form/introduce`,
-				10:`/second/pages/product/product-list`,
-				11:`/second/pages/form/form`,
+				8:'/h5/pages/activity/activity-list',
+				9:'/second/pages/form/introduce',
+				10:'/second/pages/product/product-list',
+				11:'/second/pages/form/form',
 				12:`/search/pages/search/search?keyWord=${keyword}`,
 				13:`/h5/pages/article/path?link=${linkHref}`,
 				14:`/h5/pages/article/path?link=${linkHref}`,
 				15:`/h5/pages/article/path?link=${linkHref}`,
-				17:`/pages/login/register-select`,
+				17:'/pages/login/register-select',
 				18:`/h5/pages/article/path?link=${linkHref}`,
 				19:`/search/pages/search/search-supplier?keyWord=${keyword}`,
-				21:`/h5/pages/activity/meobohui`
+				21:'/h5/pages/activity/meobohui'
 			}
-			const url = typeMap[linkType];
+			const url = typeMap[linkType]
 			uni.navigateTo({
 			 	url:url
 			})
@@ -296,8 +297,8 @@ const caimeiApi = {
 		})
 	},
 	isNumber:function(value){//验证是否为数字
-	    var patrn = /^(-)?\d+(\.\d+)?$/;
-	    if (patrn.exec(value) == null || value == "") {
+	    var patrn = /^(-)?\d+(\.\d+)?$/
+	    if (patrn.exec(value) == null || value == '') {
 	         return false
 	    } else {
 	         return true  
@@ -305,8 +306,8 @@ const caimeiApi = {
 	},
 	getWindowHeight:function(){
 		// 获取窗口高度
-		const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
-		return windowHeight;
+		const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
+		return windowHeight
 	},
 	adaptRichTextImg:function(res){
 		/**
@@ -315,34 +316,34 @@ const caimeiApi = {
 		 */ 
 		const html = res.replace(/<img[^>]*>/gi,function(match,capture){			
 			let match1 = match.replace(/<img*/gi, '<img style="width:100% !important;height:auto !important;float:left !important;"'),
-				results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"');
-			return results;
+				results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"')
+			return results
 		})
-		return html;	
+		return html	
 	},
 	FormatMoney:function(num){
 		// 金额千分位
 		return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
 			return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
-				return $1 + ",";
-			});
-		});
+				return $1 + ','
+			})
+		})
 	},
 	formatDate:function(){
 		//获取当前时间
-		let date = new Date();
-		let y = date.getFullYear();
-		let MM = date.getMonth() + 1;
-		MM = MM < 10 ? ('0' + MM) : MM;
-		let d = date.getDate();
-		d = d < 10 ? ('0' + d) : d;
-		let h = date.getHours();
-		h = h < 10 ? ('0' + h) : h;
-		let m = date.getMinutes();
-		m = m < 10 ? ('0' + m) : m;
-		let s = date.getSeconds();
-		s = s < 10 ? ('0' + s) : s;
-	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
+		let date = new Date()
+		let y = date.getFullYear()
+		let MM = date.getMonth() + 1
+		MM = MM < 10 ? ('0' + MM) : MM
+		let d = date.getDate()
+		d = d < 10 ? ('0' + d) : d
+		let h = date.getHours()
+		h = h < 10 ? ('0' + h) : h
+		let m = date.getMinutes()
+		m = m < 10 ? ('0' + m) : m
+		let s = date.getSeconds()
+		s = s < 10 ? ('0' + s) : s
+	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
 	},
 	regexSets:function() {
 		let sets = {
@@ -350,19 +351,19 @@ const caimeiApi = {
 			'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
 			'bankNum': /^([1-9]{1})(\d{18})$/,
 			'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
-		};
-		return sets;
+		}
+		return sets
 	},
 	timestampToTime:function(timestamp) {
 		// 时间戳转日期
-	   let date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
-	   let Y = date.getFullYear() + '-';
-	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
-	   let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
-	   let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
-	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
-	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
-	   return `${Y}${M}${D}${h}${m}${s}`;
+	   let date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
+	   let Y = date.getFullYear() + '-'
+	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
+	   let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '
+	   let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'
+	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'
+	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())
+	   return `${Y}${M}${D}${h}${m}${s}`
 	}
 }
 
@@ -392,4 +393,4 @@ module.exports = {
 	timestampToTime: caimeiApi.timestampToTime,
 	BannerNavigateTo:caimeiApi.BannerNavigateTo,
 	FlooryNavigateTo:caimeiApi.FlooryNavigateTo 
-};
+}

+ 48 - 44
common/config/wxLogin.js

@@ -1,57 +1,61 @@
 import store from '@/store/index.js'
 import authorize from '@/common/config/authorize.js'
-import { userInfoLogin } from "@/services/use.js"
+import {
+	userInfoLogin
+} from '@/services/user.service.js'
 // 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-const wxLoginAuthorize = function(){
-	authorize.getCode('weixin').then(wechatcode =>{
-		authorize.getUserInfo('weixin').then(wxResponse =>{
-			userInfoLogin({code:wechatcode,encryptedData:wxResponse.encryptedData,iv:wxResponse.iv}).then(response =>{
-				store.commit('updateStatus',response.data)
-				store.commit('login',response.data);
-				store.commit('wxLogin',wxResponse.userInfo);
-				uni.setStorageSync('token',response.data.token)
-				uni.removeStorageSync('sessionid')
-				uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
-			}).catch(error =>{
-				uni.removeStorageSync('sessionid')
-				uni.setStorageSync('sessionid','JSESSIONID='+error.data)
-				store.commit('logout',error.data)
-				store.commit('updateStatus',error.data)
-				store.commit('wxLogin',wxResponse.userInfo);
+const wxLoginAuthorize = function() {
+	authorize.getCode('weixin').then(wechatcode => {
+		console.log('code:' + wechatcode)
+		authorize.getUserInfo('weixin').then(wxResponse => {
+			userInfoLogin({
+				code: wechatcode
+			}).then(response => {
+				store.commit('updateStatus', response.data)
+				store.commit('login', response.data)
+			}).catch(error => {
+				console.log(error)
+				store.commit('logout', error.data)
+				store.commit('updateStatus', error.data)
 			})
 		})
 	})
 }
-const wxLoginQuick = function(){// 根据微信的code获取用户登录状态:1已登录过 -1未登录过跳转
-		authorize.getCode('weixin').then(wechatcode =>{
-			// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-			authorize.getUserInfo('weixin').then(wxResponse =>{
-				userInfoLogin({code:wechatcode,encryptedData:wxResponse.encryptedData,iv:wxResponse.iv}).then(response =>{
-					console.log(response)
-					store.commit('updateStatus',response.data)
-					store.commit('login',response.data);
-					store.commit('wxLogin',wxResponse.userInfo);
-					uni.setStorageSync('token',response.data.token)
-					uni.removeStorageSync('sessionid')
-					uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
-					if(response.data.userIdentity ==1){
-						uni.navigateTo({url:'/seller/pages/index/index'})
-					}else if(response.data.userIdentity === 3){
-						uni.navigateTo({url:'/supplier/pages/index/index'})
-					}else{
-						uni.switchTab({url:'/pages/tabBar/user/user'})
-					}
-				}).catch(error =>{
-					uni.removeStorageSync('sessionid')
-					uni.setStorageSync('sessionid','JSESSIONID='+error.data)
-					store.commit('logout',error.data)
-					store.commit('updateStatus',error.data)
-					store.commit('wxLogin',wxResponse.userInfo);
-				})
+const wxLoginQuick = function() { // 根据微信的code获取用户登录状态:1已登录过 -1未登录过跳转
+	authorize.getCode('weixin').then(wechatcode => {
+		// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+		authorize.getUserInfo('weixin').then(wxResponse => {
+			userInfoLogin({
+				code: wechatcode,
+				encryptedData: wxResponse.encryptedData,
+				iv: wxResponse.iv
+			}).then(response => {
+				console.log(response)
+				store.commit('updateStatus', response.data)
+				store.commit('login', response.data)
+				store.commit('wxLogin', wxResponse.userInfo)
+				if (response.data.userIdentity == 1) {
+					uni.navigateTo({
+						url: '/seller/pages/index/index'
+					})
+				} else if (response.data.userIdentity === 3) {
+					uni.navigateTo({
+						url: '/supplier/pages/index/index'
+					})
+				} else {
+					uni.switchTab({
+						url: '/pages/tabBar/user/user'
+					})
+				}
+			}).catch(error => {
+				store.commit('logout', error.data)
+				store.commit('updateStatus', error.data)
+				store.commit('wxLogin', wxResponse.userInfo)
 			})
 		})
+	})
 }
-export default{
+export default {
 	wxLoginAuthorize,
 	wxLoginQuick
 }

+ 145 - 132
pages/authorization/authorization.vue

@@ -1,169 +1,182 @@
 <template>
-	<view class="container login" :style="{paddingTop:CustomBar+'px'}">
+	<view class="container login" :style="{ paddingTop: CustomBar + 'px' }">
 		<!-- <cu-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></cu-custom> -->
 		<view class="login-main">
 			<image class="logo" src="../../static/ws/logo.png" mode="widthFix"></image>
 		</view>
 		<view class="login-content">
-			<text>您暂未授权采美采购小程序获取您的信息,将无法正常使用小程序的功能。如需正常使用,请点击“授权”按钮,并允许头像、昵称等信息的授权。</text>
+			<text
+				>您暂未授权采美采购小程序获取您的信息,将无法正常使用小程序的功能。如需正常使用,请点击“授权”按钮,并允许头像、昵称等信息的授权。</text
+			>
 		</view>
 		<view class="login-form">
-			<button class="login-btn use" type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo">微信授权</button>
+			<button
+				class="login-btn use"
+				type="primary"
+				size="small"
+				open-type="getUserInfo"
+				lang="zh_CN"
+				@getuserinfo="getuserinfo"
+			>
+				微信授权
+			</button>
 			<view class="login-btn back" @tap="undGetuserinfo">取消</view>
 		</view>
 	</view>
 </template>
 
 <script>
-	import {mapState,mapMutations } from 'vuex';
-	import authorize from '@/common/config/authorize.js' 
-	import wxLogin from "@/common/config/wxLogin.js"
-	
-	export default{
-		data() {
-			return{
-				nvabarData: {		//顶部自定义导航
-					showCapsule: 1, // 是否显示左上角图标  1表示显示  0表示不显示,
-					showSearch: 0,
-					title: '微信授权', // 导航栏 中间的标题
-					haveBack:true,
-					haveHome:false,
-					textLeft:this.$store.state.isIphone,
-				},
-				CustomBar:this.CustomBar,// 顶部导航栏高度
-				authorizeType:''
+import { mapState, mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js'
+import wxLogin from '@/common/config/wxLogin.js'
+
+export default {
+	data() {
+		return {
+			nvabarData: {
+				//顶部自定义导航
+				showCapsule: 1, // 是否显示左上角图标  1表示显示  0表示不显示,
+				showSearch: 0,
+				title: '微信授权', // 导航栏 中间的标题
+				haveBack: true,
+				haveHome: false,
+				textLeft: this.$store.state.isIphone
+			},
+			CustomBar: this.CustomBar, // 顶部导航栏高度
+			authorizeType: ''
+		}
+	},
+	onLoad(e) {
+		this.authorizeType = e.type
+		if (this.authorizeType == '4') {
+			this.nvabarData.haveBack = false
+		}
+	},
+	computed: {
+		...mapState(['hasLogin', 'userInfo'])
+	},
+	methods: {
+		getuserinfo: function(e) {
+			//微信授权
+			if (e.detail.userInfo) {
+				this.wxGetUserInfo()
+			} else {
+				this.$util.msg('授权失败', 2000)
 			}
 		},
-		onLoad(e) {
-			this.authorizeType = e.type
-			if(this.authorizeType == '4'){
-				this.nvabarData.haveBack = false
-			}
+		undGetuserinfo() {
+			this.hanldBackFn()
 		},
-		computed: {
-			...mapState(['hasLogin','userInfo'])
+		hanldNavigateBack() {
+			this.hanldBackFn()
 		},
-		methods:{
-			getuserinfo: function (e) {//微信授权
-			    if (e.detail.userInfo) {
-					this.wxGetUserInfo()
-			    }else{
-					this.$util.msg('授权失败',2000)
-			    }
-			 },
-			undGetuserinfo(){
-				this.hanldBackFn()
-			},
-			hanldNavigateBack(){
-				this.hanldBackFn()
-			},
-			hanldBackFn(){
-				switch(this.authorizeType){
-					case '0':
-						this.$api.switchTabTo('/pages/tabBar/home/index')
-						break;
-					default:
-						uni.navigateBack({delta: 1})
-				}
-			},
-			wxGetUserInfo(){
-				let self = this
-				authorize.getCode('weixin').then(wechatcode =>{
-					wx.getUserInfo({
-						success: res => {
-							console.log(self.authorizeType)
-							wxLogin.wxLoginAuthorize()
-							switch(self.authorizeType){
-								case '0':
-									self.$api.switchTabTo('/pages/tabBar/home/index')
-									break;
-								case '1':
-									self.$api.navigateTo('/pages/login/login')
-									break;
-								case '2':
-									self.$api.navigateTo('/pages/login/register')
-									break;
-								case '3':
-									self.$api.navigateTo('/pages/login/logincode')
-									break;
-								default:
-									setTimeout(()=>{
-										uni.navigateBack({delta: 1});
-									},2000)
-							}
+		hanldBackFn() {
+			switch (this.authorizeType) {
+				case '0':
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+				default:
+					uni.navigateBack({ delta: 1 })
+			}
+		},
+		wxGetUserInfo() {
+			let self = this
+			authorize.getCode('weixin').then(wechatcode => {
+				wx.getUserInfo({
+					success: res => {
+						console.log(self.authorizeType)
+						wxLogin.wxLoginAuthorize()
+						switch (self.authorizeType) {
+							case '0':
+								self.$api.switchTabTo('/pages/tabBar/home/index')
+								break
+							case '1':
+								self.$api.navigateTo('/pages/login/login')
+								break
+							case '2':
+								self.$api.navigateTo('/pages/login/register')
+								break
+							case '3':
+								self.$api.navigateTo('/pages/login/logincode')
+								break
+							default:
+								setTimeout(() => {
+									uni.navigateBack({ delta: 1 })
+								}, 2000)
 						}
-					})
+					}
 				})
-			}
+			})
 		}
 	}
+}
 </script>
 
 <style lang="scss">
-	.login{
+.login {
+	width: 100%;
+	height: auto;
+	.model-warp.none {
+		display: none;
+	}
+	.model-warp.show {
+		display: block;
+	}
+	.login-main {
 		width: 100%;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
 		height: auto;
-		.model-warp.none{
-			display: none;			
-		}
-		.model-warp.show{
+		padding: 80rpx 0 0 0;
+		.logo {
+			width: 152rpx;
+			height: 152rpx;
 			display: block;
+			border-radius: 50%;
 		}
-		.login-main{
-			width: 100%;
-			display: flex;
-			flex-direction: column;
-			align-items: center;
-			height: auto;
-			padding:80rpx 0 0 0;
-			.logo{
-				width:152rpx;
-				height: 152rpx;
-				display: block;
-				border-radius: 50%;
-			}
-			.logo-text{
-				font-size: $font-size-40;
-				line-height: 40rpx;
-				color:$color-system;
-				margin-top: 40rpx;
-			}
-		}
-		.login-content{
-			width: 580rpx;
-			margin: 70rpx auto;
-			line-height: 48rpx;
-			font-size: 26rpx;
-			color: #666666;
-			text-align: justify;
+		.logo-text {
+			font-size: $font-size-40;
+			line-height: 40rpx;
+			color: $color-system;
+			margin-top: 40rpx;
 		}
-		.login-form{
-			width: 702rpx;
-			height: auto;
+	}
+	.login-content {
+		width: 580rpx;
+		margin: 70rpx auto;
+		line-height: 48rpx;
+		font-size: 26rpx;
+		color: #666666;
+		text-align: justify;
+	}
+	.login-form {
+		width: 702rpx;
+		height: auto;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		margin: 0 auto;
+		.login-btn {
+			width: 600rpx;
+			height: 90rpx;
+			border-radius: 45rpx;
+			font-size: $font-size-32;
+			line-height: 80rpx;
+			color: #ffffff;
+			text-align: center;
+			background: linear-gradient(135deg, rgba(4, 190, 2, 1) 0%, rgba(4, 183, 2, 1) 100%);
 			display: flex;
 			flex-direction: column;
 			align-items: center;
-			margin: 0 auto;
-			.login-btn{
-				width: 600rpx;
-				height: 90rpx;
-				border-radius: 45rpx;
-				font-size: $font-size-32;
-				line-height: 80rpx;
-				color: #FFFFFF;
-				text-align: center;
-				background: linear-gradient(135deg,rgba(4,190,2,1) 0%,rgba(4,183,2,1) 100%);
-				display: flex;
-				flex-direction: column;
-				align-items: center;
-				&.back{
-					height: 76rpx;
-					background: #FFFFFF;
-					border: 1px solid #666;
-					color: #666;
-					margin-top: 30rpx;
-				}
+			&.back {
+				height: 76rpx;
+				background: #ffffff;
+				border: 1px solid #666;
+				color: #666;
+				margin-top: 30rpx;
 			}
 		}
 	}
+}
 </style>

+ 95 - 34
pages/index/index.vue

@@ -5,8 +5,14 @@
 			<!-- 用户信息 -->
 			<view class="user-info">
 				<image src="@/static/ws/default_avatar.png" mode="widthFix"></image>
-				<view class="ws-login" @click="toAuthorize" v-if="hasLogin">请登录</view>
-				<view class="user-text" else> 瑞恺迪光电科技有限公司有限公司 </view>
+				<view
+					class="ws-login"
+					@click="navigator('/pages/login/login?type=0')"
+					v-if="!hasLogin"
+				>
+					请登录
+				</view>
+				<view class="user-text" v-else> 瑞恺迪光电科技有限公司有限公司 </view>
 			</view>
 			<!-- 背景图 -->
 			<image class="user-bg" src="@/static/ws/user_bg.png" mode="widthFix"></image>
@@ -17,44 +23,67 @@
 			<view class="more">
 				<text class="title">我的订单</text>
 				<view @click="navigator('/pages/user/order/order-list?state=0')">
-					<text class="more-right">全部订单</text> <text class="iconfont icon-chakangengduo"></text> 
+					<text class="more-right">全部订单</text>
+					<text class="iconfont icon-chakangengduo"></text>
 				</view>
 			</view>
 			<view class="line"></view>
 			<!-- 菜单选项 -->
 			<view class="order-nav">
-				<view class="order-nav-item" @click="navigator('/pages/user/order/order-list?state=1')">
-					<image src="@/static/ws/dh_dfk_02.png" mode="widthFix"></image> <text>待付款</text>
+				<view
+					class="order-nav-item"
+					@click="navigator('/pages/user/order/order-list?state=1')"
+				>
+					<image src="@/static/ws/dh_dfk_02.png" mode="widthFix"></image>
+					<text>待付款</text>
 				</view>
-				<view class="order-nav-item" @click="navigator('/pages/user/order/order-list?state=2')">
-					<image src="@/static/ws/dh_dfh_03.png" mode="widthFix"></image> <text>待发货</text>
+				<view
+					class="order-nav-item"
+					@click="navigator('/pages/user/order/order-list?state=2')"
+				>
+					<image src="@/static/ws/dh_dfh_03.png" mode="widthFix"></image>
+					<text>待发货</text>
 				</view>
-				<view class="order-nav-item" @click="navigator('/pages/user/order/order-list?state=3')">
-					<image src="@/static/ws/dh_yfh_04.png" mode="widthFix"></image> <text>已发货</text>
+				<view
+					class="order-nav-item"
+					@click="navigator('/pages/user/order/order-list?state=3')"
+				>
+					<image src="@/static/ws/dh_yfh_04.png" mode="widthFix"></image>
+					<text>已发货</text>
 				</view>
-				<view class="order-nav-item" @click="navigator('/pages/user/order/order-list?state=4')"> 
-					<image src="@/static/ws/dh_tk_05.png" mode="widthFix"></image> <text>退货/款</text> 
+				<view
+					class="order-nav-item"
+					@click="navigator('/pages/user/order/order-list?state=4')"
+				>
+					<image src="@/static/ws/dh_tk_05.png" mode="widthFix"></image>
+					<text>退货/款</text>
 				</view>
 			</view>
 		</view>
 		<!-- 订单状态区域END -->
 		<!-- 帮机构下单 -->
 		<view class="place-order" @click="navigator('/pages/user/club/club-list')">
-			<view class="place-left"> <text class="iconfont icon-bangjigouxiadan"></text> <text class="title">帮机构下单</text> </view>
+			<view class="place-left">
+				<text class="iconfont icon-bangjigouxiadan"></text>
+				<text class="title">帮机构下单</text>
+			</view>
 			<text class="iconfont icon-chakangengduo"></text>
 		</view>
 		<!-- 帮机构下单END -->
 		<!-- 客服 -->
-		<button class="ws-service" open-type="contact" @bindcontact="handleContact"> <text class="iconfont icon-zaixiankefu"></text> 在线客服 </button>
+		<button class="ws-service" open-type="contact" @bindcontact="handleContact">
+			<text class="iconfont icon-zaixiankefu"></text> 在线客服
+		</button>
 	</view>
 </template>
 
 <script>
+import { mapState, mapMutations } from 'vuex'
 import uniBadge from '@/components/uni-badge/uni-badge.vue'
 import upgradeAlert from '@/components/cm-module/modelAlert/upgradeAlert.vue'
 import authorize from '@/common/config/authorize.js'
-import { mapState, mapMutations } from 'vuex'
-import { cancelPrompt } from '@/services/use.js'
+import wxLogin from '@/common/config/wxLogin.js'
+
 
 export default {
 	components: {
@@ -77,7 +106,8 @@ export default {
 			StatusBar: this.StatusBar,
 			isCmcustom: false,
 			isUpgradeAlert: false,
-			bgImgUrl: 'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
+			bgImgUrl:
+				'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
 			name: '',
 			userType: '',
 			headpic: '',
@@ -94,18 +124,58 @@ export default {
 			waitShipmentsCount: 0, //待收货角标
 			shipmentsCount: 0, //已发货角标
 			salesReturnCount: '', //退货/款角标
-			firstList: [{ name: '帮机构下单', path: '/pages/user/club/club-list', icon: 'icon-yunyingrenyuanguanli' }]
+			firstList: [
+				{
+					name: '帮机构下单',
+					path: '/pages/user/club/club-list',
+					icon: 'icon-yunyingrenyuanguanli'
+				}
+			]
 		}
 	},
 	onLoad() {
-		
+		authorize.getSetting().then(res => {
+			// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
+			if (res == 1) {
+				this.getWxAuthorize()
+			} else {
+				this.$api
+					.getComStorage('userInfo')
+					.then(resolve => {
+						this.userID = resolve.userID ? resolve.userID : 0
+						// this.getHomeInformation()
+					})
+					.catch(error => {
+						// this.getHomeInformation()
+					})
+			}
+		})
 	},
 	computed: {
 		...mapState(['hasLogin', 'userInfo'])
 	},
 	methods: {
+		...mapMutations(['login', 'logout']),
+		// 获取授权
+		getWxAuthorize() {
+			authorize.getCode('weixin').then(wechatcode => {
+				// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+				authorize.getUserInfo('weixin').then(wxResponse => {
+					this.UserService.userInfoLogin({ code: wechatcode })
+						.then(response => {
+							console.log(wechatcode)
+							console.log(response)
+						})
+						.catch(error => {
+							this.isLogin = false
+							this.logout()
+							this.$store.commit('updateStatus', error.data)
+						})
+				})
+			})
+		},
 		// 客服
-		handleContact(e){
+		handleContact(e) {
 			console.log(e.detail.path)
 			console.log(e.detail.query)
 		},
@@ -147,7 +217,11 @@ export default {
 					this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount) //待收货
 					this.shipmentsCount = this.showBadge(data.shipmentsCount) //已发货
 					this.salesReturnCount = this.showBadge(data.salesReturnCount) //退货/款
-					let clubInfo = { name: this.name, image: this.headpic, clubID: $clubData.clubID }
+					let clubInfo = {
+						name: this.name,
+						image: this.headpic,
+						clubID: $clubData.clubID
+					}
 					if ($userData.tipStatus == '0') {
 						this.isUpgradeAlert = true
 					}
@@ -256,20 +330,7 @@ export default {
 		}
 	},
 	onShow() {
-		if (this.hasLogin) {
-			this.$api
-				.getComStorage('userInfo')
-				.then(resolve => {
-					this.userID = resolve.userID
-					this.getUserInfo()
-				})
-				.catch(reject => {
-					console.log('异常处理=========>', reject)
-				})
-		} else {
-			this.getPhone()
-			this.$store.commit('updateAllNum', 0)
-		}
+		
 	}
 }
 </script>

+ 24 - 9
pages/login/login.vue

@@ -10,11 +10,18 @@
 		</view>
 		<!-- 邀请码 -->
 		<view class="login-input">
-			<vcode-input borderValueColor="#e8e8e8" borderActiveColor="#e8e8e8" ref="vcodeInputRef" @vcodeInput="vcodeInput" @vcodeChange="vcodeChangeHandle" sum="6"></vcode-input>
+			<vcode-input
+				borderValueColor="#e8e8e8"
+				borderActiveColor="#e8e8e8"
+				ref="vcodeInputRef"
+				@vcodeInput="vcodeInput"
+				@vcodeChange="vcodeChangeHandle"
+				sum="6"
+			></vcode-input>
 		</view>
 		<!-- 提示信息 -->
-		<view class="logo-message"><text>邀请码错误,请联系采美客服获取最新邀请码</text> </view>
-		<button class="login-btn" :disabled="!isCodeEmpty">登录</button>
+		<view class="logo-message"  v-if="loginMessage !== ''"><text>{{loginMessage}}</text> </view>
+		<button class="login-btn" @click="goLogin" :disabled="isCodeEmpty">登录</button>
 	</view>
 </template>
 
@@ -28,23 +35,27 @@ export default {
 	components: { VcodeInput },
 	data() {
 		return {
-			invitationCode: '' //获取用户登录的邀请码
+			invitationCode: '', //获取用户登录的邀请码
+			loginMessage:''		//登录信息反馈
 		}
 	},
 	onLoad(option) {},
 	computed: {
 		...mapState(['isWxAuthorize', 'isLoginType', 'isLoginProductId', 'isLoginOrderId']),
+		// 邀请码长度是否符合要求
 		isCodeEmpty() {
-			return this.invitationCode.length > 0
+			return this.invitationCode.trim().length < 6
 		}
 	},
 	methods: {
 		...mapMutations(['login']),
+		// 登录
 		goLogin() {
 			if (this.invitationCode == '') {
 				this.$util.msg('请输入邀请码', 2000)
 				return
 			}
+			// 获取用户信息
 			wx.getUserInfo({
 				success: res => {
 					this.isUserInfo = false
@@ -54,8 +65,10 @@ export default {
 						nickName: res.userInfo.nickName,
 						headimgurl: res.userInfo.avatarUrl
 					}
+					// 验证邀请码
 					invitationCodeLogin(params)
 						.then(response => {
+							// 保存用户信息
 							this.login(response.data)
 							wxLogin.wxLoginAuthorize()
 							if (response.data.userIdentity === 3) {
@@ -87,7 +100,8 @@ export default {
 							}
 						})
 						.catch(error => {
-							this.$util.msg(error.msg, 2000)
+							// this.$util.msg(error.msg, 2000)
+							this.loginMessage = error.msg
 							this.isUserInfo = false
 						})
 				}
@@ -95,12 +109,13 @@ export default {
 		},
 		// 输入框输入介绍
 		vcodeInput(val) {
+			// this.invitationCode = val
 			console.log(val)
-			this.invitationCode = val
 		},
 		// 输入框输入事件
-		vcodeChangeHandle(val){
-			console.log(val);
+		vcodeChangeHandle(val) {
+			this.invitationCode = val
+			console.log(val)
 		},
 		// 控制组件获取焦点
 		setFocus() {

+ 18 - 13
services/ajax.service.js

@@ -2,22 +2,23 @@
  * ajax请求相关的服务
  */
 import baseUrl from './config.env'
-import { msg } from '@/utils/util'
+import {
+	msg
+} from '@/utils/util'
 
 class AjaxService {
 	constructor() {
 		this.name = 'AjaxService'
 	}
-	getBaseUrl (url = '') {
+	getBaseUrl(url = '') {
 		return url.indexOf('://') > -1 ? url : baseUrl + url
 	}
-	getHeaders({ header = {} }) {
-		const REV_TOKEN_ENV = uni.getStorageSync('token') ? uni.getStorageSync('token') : 'X-token';
-		const REV_COOKIE_ENV = uni.getStorageSync('sessionid') ? uni.getStorageSync('sessionid') : 'sessionid';
+	getHeaders({
+		header = {}
+	}) {
 		header['Accept'] = 'application/json'
-		header['Content-Type'] = 'application/x-www-form-urlencoded'
-		header['X-Token'] = REV_TOKEN_ENV
-		header['cookie'] = REV_COOKIE_ENV
+		// header['Content-Type'] = 'application/x-www-form-urlencoded'
+		header['Content-Type'] = 'application/json'
 		return header
 	}
 	request(options = {}) {
@@ -26,9 +27,13 @@ class AjaxService {
 			header = Object.assign(header, options.header)
 		}
 		let url = this.getBaseUrl(options.url)
-		let { isLoading = true } = options
+		let {
+			isLoading = true
+		} = options
 		if (isLoading) {
-			wx.showLoading({ title: '加载中' })
+			wx.showLoading({
+				title: '加载中'
+			})
 		}
 		const requestPromise = new Promise((resolve, reject) => {
 			uni.request({
@@ -37,10 +42,10 @@ class AjaxService {
 				data: options.data || {},
 				header,
 				success: res => {
-					if (isLoading) wx.hideLoading();
-					if(options.isStatus){
+					if (isLoading) wx.hideLoading()
+					if (options.isStatus) {
 						resolve(res.data)
-					}else{
+					} else {
 						if (res.data.code === 0) {
 							resolve(res.data)
 						} else {

+ 3 - 3
services/config.env.js

@@ -1,10 +1,10 @@
-let URL_CONFIG = ""
+let URL_CONFIG = ''
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
 	// URL_CONFIG = 'http://192.168.2.68:8008'	 //涛涛联调地址
-	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
+	URL_CONFIG = 'http://192.168.2.67:8010'	 //裴裴联调地址
 	// URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
-    URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
+    // URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
 	// URL_CONFIG = 'https://spi.caimei365.com'
 }else{
     // 生产环境

+ 4 - 4
services/use.js

@@ -53,12 +53,12 @@ export function organizationVerifyRegisterFirst(params) {
 		}
 		request.post('/club/common',params,true,res => {
 			if(res.code == 0){
-				resolve(res);
+				resolve(res)
 			}else{
 				reject(res)
 			}
 		})
-	});
+	})
 }
 /**
  *绑定邮箱
@@ -83,7 +83,7 @@ export function bindingEmail(params) {
 		}
 		request.post('/user/binding',params,true, res => {
 			if(res.code == 0){
-				resolve(res);
+				resolve(res)
 			}else{
 				reject(res)
 			}
@@ -164,7 +164,7 @@ export function accountInfo(params) {
  */
 export function userInfoLogin(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params,false, res => {
+		request.post('/buyer/authorization',params,false, res => {
 			if(res.code == 0 || res.code == 4){
 				resolve(res)
 			}else if(res.code == -6){

+ 131 - 42
services/user.service.js

@@ -3,16 +3,44 @@
  */
 export default class UserService {
 	constructor(AjaxService) {
-		Object.assign(this, { AjaxService })
+		Object.assign(this, {
+			AjaxService
+		})
 		this.name = 'UserService'
 	}
-	/* 供应商注册 */ 
-	appSupplierRegister (data = {}) {
-		return this.AjaxService.post({ url:'/supplier/register', data, isLoading: true })
-	}
-	/* 初始化查询用户是否为正常用户 */ 
-	appSelectLoginUser (data = {}) {
-		return this.AjaxService.post({ url:'', data, isLoading: true })
+	/* 初始化授权登录 */
+	userInfoLogin(data = {}) {
+		return this.AjaxService.post({
+			url: '/buyer/authorization',
+			data,
+			isLoading: false,
+			isStatus: true
+		})
+	}
+	/*维沙邀请码绑定*/
+	userInvitation(data = {}) {
+		return this.AjaxService.post({
+			url: '/buyer/invitation/code',
+			data,
+			isLoading: false,
+			isStatus: true
+		})
+	}
+	/* 供应商注册 */
+	appSupplierRegister(data = {}) {
+		return this.AjaxService.post({
+			url: '/supplier/register',
+			data,
+			isLoading: true
+		})
+	}
+	/* 初始化查询用户是否为正常用户 */
+	appSelectLoginUser(data = {}) {
+		return this.AjaxService.post({
+			url: '',
+			data,
+			isLoading: true
+		})
 	}
 	/**
 	 * 账号登录
@@ -20,8 +48,13 @@ export default class UserService {
 	 * @param password	密码
 	 * @param source 来源 PC与小程序传:'www'crm就传'crm'
 	 */
-	AorganizationLogin (data = {}) {
-		return this.AjaxService.post({ url:'/user/login', data, isLoading: true ,isStatus: true})
+	AorganizationLogin(data = {}) {
+		return this.AjaxService.post({
+			url: '/user/login',
+			data,
+			isLoading: true,
+			isStatus: true
+		})
 	}
 	/**
 	 * @机构-地址列表
@@ -29,72 +62,128 @@ export default class UserService {
 	 * @param:pageNum 页码
 	 * @param:pageSize 每页条数
 	 */
-	QueryAddressList (data = {}) {
-		return this.AjaxService.get({ url:'/personalCenter/findAddress', data, isLoading: true })
+	QueryAddressList(data = {}) {
+		return this.AjaxService.get({
+			url: '/personalCenter/findAddress',
+			data,
+			isLoading: true
+		})
 	}
 	/**
 	 * @机构-添加&&修改地址
 	 * @param:userId 用户ID(必传),
 	 * @param:地址信息,
 	 */
-	AddNewAddress (data = {}) {
-		return this.AjaxService.post({ url:'/personalCenter/saveAddress', data, isLoading: true })
+	AddNewAddress(data = {}) {
+		return this.AjaxService.post({
+			url: '/personalCenter/saveAddress',
+			data,
+			isLoading: true
+		})
 	}
 	/**
 	 * @机构-删除地址
 	 * @param:userId 用户ID(必传),
 	 * @param:地址信息,
 	 */
-	DeleteNewAddress (data = {}) {
-		return this.AjaxService.get({ url:'/personalCenter/deleteAddress', data, isLoading: true })
+	DeleteNewAddress(data = {}) {
+		return this.AjaxService.get({
+			url: '/personalCenter/deleteAddress',
+			data,
+			isLoading: true
+		})
 	}
 	/**
 	 * @机构-个人中心
 	 * @param:userId 用户ID(必传),
 	 */
-	PersonalInfo (data = {}) {
-		return this.AjaxService.get({ url:'/personalCenter/myCentre', data, isLoading: false })
+	PersonalInfo(data = {}) {
+		return this.AjaxService.get({
+			url: '/personalCenter/myCentre',
+			data,
+			isLoading: false
+		})
 	}
 	/* 运营人员管理-列表 */
-	QueryOperatorList (data = {}) {
-		return this.AjaxService.get({ url:'/operation/list', data, isLoading: true })
+	QueryOperatorList(data = {}) {
+		return this.AjaxService.get({
+			url: '/operation/list',
+			data,
+			isLoading: true
+		})
 	}
 	/* 运营人员管理-添加 */
-	PostAddOperator (data = {}) {
-		return this.AjaxService.post({ url:'/operation/add', data, isLoading: true })
+	PostAddOperator(data = {}) {
+		return this.AjaxService.post({
+			url: '/operation/add',
+			data,
+			isLoading: true
+		})
 	}
 	/* 运营人员管理-删除 */
-	PostDeleteOperator (data = {}) {
-		return this.AjaxService.post({ url:'/operation/delete', data, isLoading: true })
+	PostDeleteOperator(data = {}) {
+		return this.AjaxService.post({
+			url: '/operation/delete',
+			data,
+			isLoading: true
+		})
 	}
 	/* 运营人员管理-更新邀请码 */
-	PostUpdateOperatorCode (data = {}) {
-		return this.AjaxService.post({ url:'/operation/updateInvitationCode', data, isLoading: true })
+	PostUpdateOperatorCode(data = {}) {
+		return this.AjaxService.post({
+			url: '/operation/updateInvitationCode',
+			data,
+			isLoading: true
+		})
 	}
 	/* 机构资料*/
-	OrganizationUpdateModifyInfo (data = {}) {
-		return this.AjaxService.get({ url:'/user/club/applicationData', data, isLoading: true })
+	OrganizationUpdateModifyInfo(data = {}) {
+		return this.AjaxService.get({
+			url: '/user/club/applicationData',
+			data,
+			isLoading: true
+		})
 	}
 	/* 机构升级会员机构 */
-	OrganizationRegister (data = {}) {
-		return this.AjaxService.post({ url:'/club/upgrade', data, isLoading: true })
+	OrganizationRegister(data = {}) {
+		return this.AjaxService.post({
+			url: '/club/upgrade',
+			data,
+			isLoading: true
+		})
 	}
 	/* 机构提交资料修改 */
-	OrganizationUpdate (data = {}) {
-		return this.AjaxService.post({ url:'/operation/modifiedData', data, isLoading: true })
+	OrganizationUpdate(data = {}) {
+		return this.AjaxService.post({
+			url: '/operation/modifiedData',
+			data,
+			isLoading: true
+		})
 	}
 	/* 供应商资料信息-数据回显 */
-	SupplierShopInfo (data = {}) {
-		return this.AjaxService.get({ url:'/supplier/shopInfo', data, isLoading: true })
+	SupplierShopInfo(data = {}) {
+		return this.AjaxService.get({
+			url: '/supplier/shopInfo',
+			data,
+			isLoading: true
+		})
 	}
 	/* 供应商资料信息-提交修改 */
-	SupplierModifiedData (data = {}) {
-		return this.AjaxService.post({ url:'/supplier/modifiedData', data, isLoading: true })
+	SupplierModifiedData(data = {}) {
+		return this.AjaxService.post({
+			url: '/supplier/modifiedData',
+			data,
+			isLoading: true
+		})
 	}
 	/* 供应商修改申请信息保存 */
-	SupplierUpdateCompanyInfo (data = {}) {
-		return this.AjaxService.post({ url:'/supplier/updateCompanyInfo', data, isLoading: true })
-	}
-	
-	
-}
+	SupplierUpdateCompanyInfo(data = {}) {
+		return this.AjaxService.post({
+			url: '/supplier/updateCompanyInfo',
+			data,
+			isLoading: true
+		})
+	}
+
+
+}

+ 67 - 67
store/index.js

@@ -6,117 +6,117 @@ import authorize from '../common/config/authorize.js'
 Vue.use(Vuex)
 const store = new Vuex.Store({
 	state: {
-		isWxAuthorize:false,
+		isWxAuthorize: false,
 		hasLogin: false,
 		userInfo: {},
-		identity:0,
-		wechatUserInfo:{},
-		cartNumber:0,
-		isIphoneX:false,
-		isActivity:false,
-		isLoginType:0,
-		isLoginProductId:0
+		identity: 0,
+		wechatUserInfo: {},
+		cartNumber: 0,
+		isIphoneX: false,
+		isActivity: false,
+		isLoginType: 0,
+		isLoginProductId: 0
 	},
 	mutations: {
-		login(state, provider) {//用户身份 1、协销 2、会员机构 3、供应商 4.普通机构
-			state.hasLogin = true;
-			state.userInfo = provider;
-			uni.setStorage({//缓存用户登陆状态
-			    key: 'userInfo',
-			    data: provider
+		login(state, provider) { //用户身份 1、协销 2、会员机构 3、供应商 4.普通机构
+			state.hasLogin = true
+			state.userInfo = provider
+			uni.setStorage({ //缓存用户登陆状态
+				key: 'userInfo',
+				data: provider
 			})
 		},
 		logout(state) {
-			state.hasLogin = false;
-			state.userInfo = {};
+			state.hasLogin = false
+			state.userInfo = {}
 			uni.removeStorage({
-		        key: 'userInfo'
-		    })
+				key: 'userInfo'
+			})
 			uni.removeStorage({
-			    key: 'token'
+				key: 'token'
 			})
 		},
-		wxLogin(state,provider) {
+		wxLogin(state, provider) {
 			state.isWxAuthorize = true
 			// console.log(state.isWxAuthorize)
-			state.wechatUserInfo = provider;
-			uni.setStorage({//缓存用户登陆状态 
-			    key: 'wechatUserInfo',
-			    data: provider
+			state.wechatUserInfo = provider
+			uni.setStorage({ //缓存用户登陆状态 
+				key: 'wechatUserInfo',
+				data: provider
 			})
 		},
-		updateStatus(state,provider){
+		updateStatus(state, provider) {
 			let TIME = api.formatDate()
-			console.log(`${TIME}`,provider)
-			state.userInfo = provider;
-			if(state.userInfo){
-				if(provider.userIdentity){
+			console.log(`${TIME}`, provider)
+			state.userInfo = provider
+			if (state.userInfo) {
+				if (provider.userIdentity) {
 					state.identity = provider.userIdentity
-				}else if(provider.userID == 5261 || provider.userID == 10947 || provider.userID == 11579){
-					state.identity = 1;
-				}else{
-					state.identity = 0;
+				} else if (provider.userID == 5261 || provider.userID == 10947 || provider.userID == 11579) {
+					state.identity = 1
+				} else {
+					state.identity = 0
 				}
 			}
-			console.log('用户类型',state.identity)
-			uni.setStorage({//缓存用户登陆状态
-			    key: 'userInfo',
-			    data: provider
+			console.log('用户类型', state.identity)
+			uni.setStorage({ //缓存用户登陆状态
+				key: 'userInfo',
+				data: provider
 			})
 		},
-		updateAllNum(state,num){
-			if(num>=100){
+		updateAllNum(state, num) {
+			if (num >= 100) {
 				uni.setTabBarBadge({
-				  index: 2,
-				  text:'99+'
+					index: 2,
+					text: '99+'
 				})
-			}else if(num>0){
+			} else if (num > 0) {
 				uni.setTabBarBadge({
-				  index: 2,
-				  text:String(num)
+					index: 2,
+					text: String(num)
 				})
-			}else{
+			} else {
 				uni.removeTabBarBadge({
 					index: 2,
 				})
 			}
 		},
-		setActivity(state,variable){
-			state.isActivity = variable;
+		setActivity(state, variable) {
+			state.isActivity = variable
 		},
-		setChangeVar(state,variable){
+		setChangeVar(state, variable) {
 			//获取设备信息是否为IphoneX
-			state.isIphoneX = variable;
+			state.isIphoneX = variable
 		},
-		setIsIphone(state,variable){
+		setIsIphone(state, variable) {
 			//获取设备信息是否为IphoneX
-			state.isIphone = variable;
+			state.isIphone = variable
 		},
-		setLoginType(state,variable){
+		setLoginType(state, variable) {
 			//获取设备信息是否为IphoneX
-			state.isLoginType = variable;
-			console.log(state.isLoginType);
+			state.isLoginType = variable
+			console.log(state.isLoginType)
 		},
-		setLoginProductId(state,variable){
+		setLoginProductId(state, variable) {
 			//获取设备信息是否为IphoneX
-			state.isLoginProductId = variable;
-			console.log(state.isLoginProductId);
+			state.isLoginProductId = variable
+			console.log(state.isLoginProductId)
 		},
-		setLoginOrderId(state,variable){
+		setLoginOrderId(state, variable) {
 			//获取设备信息是否为IphoneX
-			state.isLoginOrderId = variable;
-			console.log(state.isLoginOrderId);
+			state.isLoginOrderId = variable
+			console.log(state.isLoginOrderId)
 		}
 	},
-	actions:{
-		setVariableFun:function(context,vData){
-			context.commit('setChangeVar',vData)
+	actions: {
+		setVariableFun: function(context, vData) {
+			context.commit('setChangeVar', vData)
 		},
-		setIsIphoneFun:function(context,vData){
-			context.commit('setIsIphone',vData)
+		setIsIphoneFun: function(context, vData) {
+			context.commit('setIsIphone', vData)
 		},
-		setActivityFn:function(context,vData){
-			context.commit('setActivity',vData)
+		setActivityFn: function(context, vData) {
+			context.commit('setActivity', vData)
 		},
 		// setLoginTypeFn:function(context,vData){
 		// 	context.commit('setLoginType',vData)