Ver Fonte

微信登录

lilei há 4 anos atrás
pai
commit
cfdf8b5faf

+ 8 - 116
api/user.js

@@ -1,26 +1,9 @@
 import axios from '@/libs/axios.js'
-
-//  axios.request()  第二个参数若为true则表示不传token
-
-// 登录
-export const login = (params) => {
-  return axios.request({
-    url: 'auth/login',
-    data: params,
-    method: 'post'
-  }, true)
-}
-//  校验手机号是否注册
-export const validateUser = params => {
-  return axios.request({
-    url: `org/apply/validateUser/${params.phone}`,
-    method: 'get'
-  }, true)
-}
+ 
 // 获取图片验证码
 export const getCaptcha = randomCode => {
   return axios.request({
-    url: `org/apply/getCaptcha/${randomCode}`,
+    url: `captcha/captcha/create/${randomCode}`,
     method: 'get',
     responseType: 'blob',
   }, true)
@@ -28,109 +11,18 @@ export const getCaptcha = randomCode => {
 // 发送短信验证码
 export const sendVerifyCode = params => {
   return axios.request({
-    url: 'org/apply/sendVerifyCode',
-    method: 'post',
-    data: params
-  }, true)
-}
-// 申请试用
-export const apply = params => {
-  return axios.request({
-    url: 'org/apply/apply',
-    method: 'post',
-    data: params
-  }, true)
-}
-// 获取门店名称
-export const getStore = (token) => {
-  return axios.request({
-    url: 'getStore',
-    method: 'get'
-  })
-}
-// 登出
-export const logout = () => {
-  return axios.request({
-    url: 'auth/logout',
-    method: 'get'
-  })
-}
-// 修改密码
-export const changePwd = params => {
-  return axios.request({
-    url: 'employee/changePWD',
-    method: 'post',
-    data: {
-      oldPassword: params.oldPassword,
-      password: params.password
-    }
-  }).then(res => res)
-} 
-//  忘记密码 校验手机号是否注册过
-export const memberGetByMobile = params => {
-  return axios.request({
-    url: 'member/getByMobile',
-    method: 'post',
-    data: params
-  }, true)
-}
-//  忘记密码 获取图片验证码
-export const memberCaptcha = randomCode => {
-  return axios.request({
-    url: `member/captcha/create/${randomCode}`,
-    method: 'get',
-    responseType: 'blob'
-  }, true)
-}
-//  忘记密码 发送短信验证码
-export const memberVerifyCode = params => {
-  return axios.request({
-    url: 'member/sendVerifyCode',
+    url: 'sendVerifiCode',
     method: 'post',
     data: params
   }, true)
 }
-//  忘记密码 修改密码
-export const memberChangePwd = params => {
+export const loginPhone = params => {
   return axios.request({
-    url: 'member/changePwd',
+    url: `loginPhone`,
     method: 'post',
-    data: params
-  }, true)
-}
-//  忘记密码 校验短信验证码是否正确
-export const memberValidateVerifyCode = params => {
-  return axios.request({
-    url: 'member/validateVerifyCode',
-    method: 'post',
-    data: params
-  }, true)
-}
-// 获取通知消息未读数
-export const getUnreadCount = params => {
-  return axios.request({
-    url: 'noticeUser/queryNotReadCount',
-    method: 'post'
-  })
-}
-// 设置已读消息
-export const hasRead = params => {
-  return axios.request({
-    url: `noticeUser/setRead/${params.msg_id}`,
-    method: 'get'
-  })
-}
-// 查询所有消息
-export const getMessage = params => {
-  let url = `noticeUser/queryLike/${params.pageNo}/${params.pageSize}`
-  delete params.pageNo
-  delete params.pageSize
-  return axios.request({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
+	data: params
+  },true)
+};
 // 乐豆使用明细
 export const ldUsedQuery = params => { 
   let url = `customerGoldLog/queryByMonth`

+ 4 - 9
components/uni-popup/image-txt-popup.vue

@@ -8,7 +8,7 @@
 </template>
 
 <script>
-	import { getCaptcha, memberCaptcha } from '@/api/user.js'
+	import { getCaptcha } from '@/api/user.js'
 	export default{
 		name: 'ImageTxtPopup',
 		props: {
@@ -38,7 +38,7 @@
 			}
 		},
 		created() {
-			this.getCode()
+			// this.getCode()
 		},
 		methods: {
 			//  获取验证码
@@ -46,13 +46,8 @@
 			  const _this = this
 			  //  6位随机数
 			  this.nowRandomCode = Math.random().toString().slice(-6)
-			  let portAddress = ''
-			  if(_this.type == 'applyImageTxt'){  //  申请试用  获取图片验证码
-				  portAddress = getCaptcha
-			  }else if(_this.type == 'forgetImageTxt'){  //  忘记密码  获取图片验证码
-				  portAddress = memberCaptcha
-			  }
-			  portAddress(this.nowRandomCode).then(res => {
+			  getCaptcha(this.nowRandomCode).then(res => {
+				console.log(res.data)
 			    //  获取图片路径
 			    _this.captchaBase = 'data:image/png;base64,' + res.data
 			    // 显示图文验证码弹框

+ 16 - 21
libs/axios.js

@@ -40,30 +40,25 @@ const request = (opts, hasToken) => {
 					resolve(ret)
 				}else{
 					if(ret.status == '401'){  //  未登录或登录过期
-					    // 除过查询未完成订单的请求
-						if(opts.url.indexOf("order/unFinishedOrderRunStatus")<0){
-							uni.showToast({
-								icon:'none',
-								title: '未登录或登录已过期,请重新登录',
-								duration: 5000 
-							})
-							setTimeout(function() {
-							  const currentRoute = getRoutePath();
-							  const url = `/pages/login/login?lanuch=${currentRoute.lanuch}&path=` + encodeURIComponent(currentRoute.url);
-							  uni.redirectTo({ url });
-							}, 1000);
-						}
+					    uni.showToast({
+					    	icon:'none',
+					    	title: '未登录或登录已过期,请重新登录',
+					    	duration: 5000 
+					    })
+					    setTimeout(function() {
+					      const currentRoute = getRoutePath();
+					      const url = `/pages/login/login?lanuch=${currentRoute.lanuch}&path=` + encodeURIComponent(currentRoute.url);
+					      uni.redirectTo({ url });
+					    }, 1000);
 					}
 					else{
 						if(ret.status == 500){
-							if(opts.url.indexOf("store/validateStoreAndDevice")<0&&opts.url.indexOf("couponReceives/findUsableCoupon")<0){
-								uni.showToast({
-									icon:'none',
-									title: ret.message,
-									mask: true,
-									duration: 3000 
-								})
-							}
+							uni.showToast({
+								icon:'none',
+								title: ret.message,
+								mask: true,
+								duration: 3000 
+							})
 						}
 					}
 					resolve(ret)

+ 5 - 1
pages/goods/index.vue

@@ -12,7 +12,9 @@
 					<uni-coods :list="item.list"></uni-coods>
 				</view>
 			</view>
-			<u-empty v-else text="暂无商品" mode="list"></u-empty>
+			<view v-else>
+				<u-empty text="暂无商品" mode="list"></u-empty>
+			</view>
 		</view>
 		<!-- 购物车 -->
 		<uni-cart-fix></uni-cart-fix>
@@ -45,6 +47,8 @@
 					this.goodsType.map((item,index) => {
 						this.getGoods(item,index)
 					})
+				}else{
+					this.goodsList = []
 				}
 			})
 		},

+ 4 - 4
pages/index/index.vue

@@ -5,19 +5,19 @@
 		<view class="nav">
 			<u-grid :col="4" :border="false" @click="toPage">
 				<u-grid-item :index="0">
-					<u-image width="72rpx" height="72rpx" src="/static/zhinan.png"></u-image>
+					<u-image width="90rpx" height="90rpx" src="/static/zhinan.png"></u-image>
 					<view class="grid-text">分类指南</view>
 				</u-grid-item>
 				<u-grid-item :index="1">
-					<u-image width="72rpx" height="72rpx" src="/static/liucheng.png"></u-image>
+					<u-image width="90rpx" height="90rpx" src="/static/liucheng.png"></u-image>
 					<view class="grid-text">投递流程</view>
 				</u-grid-item>
 				<u-grid-item :index="2">
-					<u-image width="72rpx" height="72rpx" src="/static/shouyi.png"></u-image>
+					<u-image width="90rpx" height="90rpx" src="/static/shouyi.png"></u-image>
 					<view class="grid-text">乐豆收益</view>
 				</u-grid-item>
 				<u-grid-item :index="3">
-					<u-image width="72rpx" height="72rpx" src="/static/hexiao.png"></u-image>
+					<u-image width="90rpx" height="90rpx" src="/static/hexiao.png"></u-image>
 					<view class="grid-text">扫码核销</view>
 				</u-grid-item>
 			</u-grid>

+ 1 - 0
pages/login/login.scss

@@ -43,6 +43,7 @@
 				border-top-left-radius: 0;
 				border-bottom-left-radius: 0;
 				line-height: 3;
+				z-index: 10;
 			}
 		}
 		.flex-box{

+ 10 - 16
pages/login/phoneLogin.vue

@@ -17,7 +17,7 @@
 		</form>
 		<!-- 图文验证码 -->
 		<uni-popup ref="imageTxtPopup" type="center">
-			<popup-con type="forgetImageTxt" title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
+			<popup-con title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
 		</uni-popup>
 	</view>
 </template>
@@ -26,7 +26,7 @@
 	import { isvalidPhone } from '@/libs/validate.js'
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import popupCon from '@/components/uni-popup/popup-con.vue'
-	import { memberVerifyCode, memberValidateVerifyCode, memberGetByMobile } from '@/api/user.js'
+	import { loginPhone, sendVerifyCode } from '@/api/user.js'
 	export default{
 		components: {
 			uniPopup,
@@ -72,12 +72,12 @@
 					uni.showToast({icon: 'none',title: '请输入验证码'})
 					return
 				}
-				//  校验短信验证码是否正确
+				// 校验短信验证码是否正确
 				const obj = {}
 				obj.phone = _this.form.phone,
 				obj.random = _this.randomCode,  // 当前随机码
-				obj.verifyCode = _this.form.verifyCode
-				memberValidateVerifyCode(obj).then(res => {
+				obj.code = _this.form.verifyCode
+				loginPhone(obj).then(res => {
 				  if(res.status == 200){
 				    _this.state = 1
 				  }else{
@@ -92,15 +92,9 @@
 						uni.showToast({icon: 'none',title: '请输入正确的手机号码'})
 						return
 					}else{
-						//  校验手机号是否注册过
-						memberGetByMobile({phone: this.form.phone}).then(res => {
-							if(res.status == 200){
-								//  图文验证码
-								this.$refs.imageTxtPopup.open()
-							}else{
-								uni.showToast({icon: 'none',title: res.message})
-							}
-						})
+						//  图文验证码
+						this.$refs.imageTxtPopup.open()
+						this.changeImg = true
 					}
 				}else{
 					uni.showToast({icon: 'none',title: '请先输入手机号'})
@@ -135,9 +129,9 @@
 				let obj = {}
 				obj.phone = this.form.phone
 				obj.random = nowRandomCode
-				obj.captcha = code
+				obj.verifiCode = code
 				//  短信验证码
-				memberVerifyCode(obj).then(res => {
+				sendVerifyCode(obj).then(res => {
 					console.log(JSON.stringify(res))
 					if(res.status == 200){  //  验证码输入正确
 						_this.randomCode = nowRandomCode  //  图片验证码随机码

+ 1 - 1
pages/userCenter/index.vue

@@ -51,7 +51,7 @@
 		onShow() {
 			checkLogin().then(res => {
 				console.log(res)
-				this.hasLogin = true
+				this.hasLogin = res.status == 200
 			})
 		},
 		onLoad() {