Jelajahi Sumber

Merge remote-tracking branch 'origin/2024鹅状元' into 2024鹅状元

wangxy 5 bulan lalu
induk
melakukan
aaa68fa810

+ 1 - 1
api/login.js

@@ -23,7 +23,7 @@ export function login(data = {}) {
 }
 export function logout(data = {}) {
   return request({
-    'url': '/app/user/logout',
+    'url': '/app/user/my/logout',
     headers: {
       isToken: false
     },

+ 3 - 3
common/styles/global/pages.scss

@@ -145,7 +145,7 @@
 	background-image: url("@/static/images/login/slider-confirm.png");display: block;}
 	.nc-container{
 		position: unset;border-bottom: 1px dashed #70cbf4;padding: 36rpx 0 54rpx;box-sizing: border-box;
-		#nc_1_wrapper{width: 100%;}
+		.nc_wrapper{width: 100%!important;}
 		.nc_iconfont.btn_ok{font-family: unset;font-size: 0;}
 		.nc_iconfont.btn_ok::before{content: '';width: 20px;height:20px;display: block;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);
 		@include ezy-no-repeat-cover;background-image: url("@/static/images/login/slider-right-icon.png");z-index: 4;}
@@ -585,7 +585,7 @@
 			background-image: url("@/static/images/my/list-jt.png");
 			position: absolute;right: 20rpx;
 		}
-		.list-row:last-child::after{display: none;}
+		.no-jt::after,.no-jt::after{display: none;}
 		.list-icon{width: 42rpx;height: 42rpx;@include ezy-no-repeat-cover;margin-right: 10rpx;}
 		.tel-icon{background-image: url("@/static/images/my/list-icon1.png");}
 		.error-icon{background-image: url("@/static/images/my/list-icon2.png");}
@@ -683,7 +683,7 @@
 	// 滑块
 	.nc-container{
 		position: unset;padding: 24rpx 0 36rpx;box-sizing: border-box;
-		#nc_1_wrapper{width: 100%;}
+		.nc_wrapper{width: 100%!important;}
 		.nc_iconfont.btn_ok{font-family: unset;font-size: 0;}
 		.nc_iconfont.btn_ok::before{content: '';width: 20px;height:20px;display: block;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);
 		@include ezy-no-repeat-cover;background-image: url("@/static/images/login/slider-right-icon.png");z-index: 4;}

+ 4 - 0
components/custom-tabbar/custom-tabbar.vue

@@ -58,6 +58,10 @@
 						url: path + '?nianji=' + this.nianji + '&cardId=' + this.cardId + '&zhangId=' + this
 							.zhangId
 					});
+				}else{
+					uni.redirectTo({
+						url: path 
+					});
 				}
 
 			},

+ 4 - 1
pages/login/login.vue

@@ -18,7 +18,7 @@
 				<text class="login-text">客服电话:400-052-2130</text>
 			</view>
 		</view>
-		<sliderDialog ref="sliderDialogRef" @emitFun="emitFun" v-if="sliderFlag"></sliderDialog>
+		<sliderDialog ref="sliderDialogRef" @emitFun="emitFun" @sliderClose="sliderClose" v-if="sliderFlag"></sliderDialog>
 	</view>
 </template>
 
@@ -67,6 +67,9 @@
 				this.sliderData =data;
 				this.getYzmBtn();
 			},
+			sliderClose(){
+				this.sliderFlag =false;
+			},
 			loginInit(options) {
 				this.loginData.phoneNumber = options.telNum;
 				this.sliderFlag = true;

+ 12 - 7
pages/login/sliderDialog.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="slider-check-dialog">
 		<view class="slider-check-content">
-			<view class="slider-close"></view>
+			<view class="slider-close" @click="sliderClose"></view>
 			<view class="slider-check-tip" :class="{ 'slider-tip-red': isSlider}">请滑动下方滑块,完成验证</view>
 			<view id="yzm-slider"></view>
 			<text @click="AWSC.emitData" class="slider-check-btn"></text>
@@ -26,11 +26,9 @@
 			receiveRenderData(data) {
 				this.$emit('emitFun', data)
 			},
-			sliderShow() {
-				this.$refs.sliderPopup.open()
-			},
 			sliderClose() {
-				this.$refs.sliderPopup.close()
+				this.getReset();
+				this.$emit('sliderClose')
 			}
 		}
 	}
@@ -51,13 +49,14 @@
 				sessionId: '',
 				sig: '',
 				token: '',
+				nc:null,
 			}
 		},
 		methods: {
 			init() {
-					let that  =this
+				let that  =this
 				AWSC.use("nc", function(state, module) {
-					nc = module.init({
+				that.nc = module.init({
 						// 应用类型标识。它和使用场景标识(scene字段)一起决定了滑动验证的业务场景与后端对应使用的策略模型。您可以在阿里云验证码控制台的配置管理页签找到对应的appkey字段值,请务必正确填写。
 						appkey: "FFFF0N00000000007EC0",
 						//使用场景标识。它和应用类型标识(appkey字段)一起决定了滑动验证的业务场景与后端对应使用的策略模型。您可以在阿里云验证码控制台的配置管理页签找到对应的scene值,请务必正确填写。
@@ -78,6 +77,12 @@
 						}
 					});
 				})
+			},
+			getReset(){
+				this.sessionId = '';
+				this.sig = '';
+				this.token = '';
+				this.nc.reset();
 			},
 			getData(data){
 					this.isSlider = false;

+ 50 - 28
pages/my/index.vue

@@ -14,34 +14,35 @@
 			<view class="hyqy-btn" @click="hyqyBtn" v-if="!myInfoData.vipFlag"></view>
 		</view>
 		<view class="my-list-box">
-			<view class="list-row" @click="telClick">
+			<view class="list-row" @click="telClick" v-if="loginFlag">
 				<icon class="list-icon tel-icon"></icon>
 				<text>手机号码</text>
 			</view>
-			<view class="list-row" @click="checkWrong">
+			<view class="list-row" @click="checkWrong" v-if="loginFlag">
 				<icon class="list-icon error-icon"></icon>
 				<text>我的错题</text>
 			</view>
-			<view class="list-row" @click="orderClick">
+			<view class="list-row" @click="orderClick" v-if="loginFlag">
 				<icon class="list-icon order-icon"></icon>
 				<text>我的订单</text>
 			</view>
-			<view class="list-row" @click="aboutClick">
+			<view class="list-row no-jt" @click="aboutClick">
 				<icon class="list-icon about-icon"></icon>
 				<text>关于我们</text>
 			</view>
-			<view class="list-row" @click="exitLogin">
+			<view class="list-row no-jt" @click="exitLogin">
 				<icon class="list-icon login-out-icon"></icon>
 				<text>退出登录</text>
 			</view>
 		</view>
 		<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
 		<tip-small-dialog ref="exitDialogRef" @confirm-btn="exitBtn" :content="tipContent"></tip-small-dialog>
-		<tel-dialog @telClose="telClose" v-if="telDialogFlag"></tel-dialog>
+		<tel-dialog @telClose="telClose" @bindBtn="bindBtn" v-if="telDialogFlag"></tel-dialog>
 	</view>
 </template>
 
 <script setup>
+	import {toast,getUserIdentity} from "@/utils/common";
 	import cacheManager from '@/utils/cacheManager.js';
 	import {logout} from '@/api/login.js'
 	import {myInfo} from '@/api/my.js'
@@ -49,7 +50,6 @@
 	import {getCurrentInstance} from 'vue';
 	import {onLoad} from '@dcloudio/uni-app';
 	import {reactive,ref} from "vue";
-	import { toast } from "../../utils/common";
 	import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue';
 	import telDialog from './telDialog.vue'
 	import {MESSAGE_VISITER_TO_LOGIN} from "@/utils/constant.js"
@@ -66,6 +66,7 @@
 		credit: '',
 		vipFlag: '',
 	});
+	let routerOpt  = ref(false);
 	const exitDialogRef = ref(null);
 	
 	const exitLogin = () => {
@@ -73,22 +74,29 @@
 	}
 
 	const exitBtn = () => {
-		cacheManager.clearAll();
-		uni.redirectTo({
-			url: '/pages/login/index'
-		});
+		logout().then(res => {
+			cacheManager.clearAll();
+			uni.redirectTo({
+				url: '/pages/login/index'
+			});
+		}).catch(err => {
+			toast('退出登录失败,请稍后重试')
+		})
+		
 	}
 	
 	// 手机号码
 	function telClick(){
-		console.log('telClick');
 		telDialogFlag.value = true;
-		console.log(telDialogFlag.value,'telDialogFlag.value');
+	}
+	
+	// 手机号码绑定
+	function bindBtn(){
+		myGetAuth()
 	}
 	
 	// 关闭手机号码弹窗
 	function telClose(){
-		console.log('telClose');
 		telDialogFlag.value = false;
 	}
 	
@@ -156,24 +164,38 @@
 		let LocalStorage = cacheManager.get('auth');
 		if (LocalStorage) {
 			// 非游客
-			loginFlag.value = true;
-			getMyInfo();
+			noYoukeFun()
+		}else{
+			youkeFun();
 		}
 	}
 	
+	// 游客
+	function youkeFun(){
+		zhangId.value = routerOpt.zhangId
+		nianji.value = routerOpt.nianji
+		cardId.value = routerOpt.cardId
+		// my游客
+		loginFlag.value = false;
+		myInfoData.userName = '游客';
+		myInfoData.userImg = 'static/images/my/head-unlogin-img.png'
+	}
+	
+	// 非游客
+	function noYoukeFun(){
+		loginFlag.value = true;
+		getMyInfo();
+	}
+	
 	onLoad((options) => {
-		if(options){
-					zhangId.value = options.zhangId
-					nianji.value = options.nianji
-					cardId.value = options.cardId
-					// my游客
-					loginFlag.value = false;
-					myInfoData.userName = '游客';
-					myInfoData.userImg = 'static/images/my/head-unlogin-img.png'
-				}else{
-					myGetAuth();
-				}
-		// console.log(instance.appContext.config.globalProperties,'instance.appContext.config.globalProperties')
+		if(!cacheManager.get('auth')){
+			// 游客
+			routerOpt = options;
+			youkeFun();
+		}else{
+			// 非游客
+			noYoukeFun();
+		}
 	})
 
   function checkWrong() {

+ 13 - 13
pages/my/telDialog.vue

@@ -68,6 +68,7 @@
 				this.bindObj.telNumber = '';
 				this.bindObj.isDisabled = true;
 				this.bindObj.clearTelIcon = false;
+				this.bindObj.getYzmFlag = false;
 			},
 			
 			// 判断是否输入手机号
@@ -115,7 +116,7 @@
 					token: this.sliderObj.token,
 				}
 				sendCode(req).then(res => {
-				
+					this.bindObj.getYzmFlag = true;
 				}).catch(err => {
 					toast('验证码获取失败:'+ err)
 				})
@@ -167,13 +168,6 @@
 			
 			// 绑定按钮
 			bindBtn(){
-				cacheManager.updateArrayInObject('userName', 'hobbies', (hobbies) => {
-					hobbies.push('123');
-					hobbies = 'coding';
-					hobbies.pop();
-				});
-				// cacheManager.updateObject('userName','123');
-				/* console.log(this.bindObj.telNumber,'this.bindObj.telNumber');
 				if(this.bindObj.telNumber===''){
 					toast('手机号不能为空')
 					return;
@@ -190,12 +184,19 @@
 				telBind(req).then(res => {
 					if (res.code == 0) {
 						toast('手机号绑定成功')
-						telClose(); 
+						this.updataTel(this.bindObj.telNumber);
+						this.telClose();
+						this.$emit('bindBtn')
 					}
-				}).catch(err => {
-					toast('手机号绑定失败:'+ err)
-				}) */
+				})
 			},
+			
+			// 在缓存中修改手机号
+			updataTel(data){
+				cacheManager.updateObject('auth', {
+					userName: data
+				})
+			}
 		}
 	}
 </script>
@@ -256,7 +257,6 @@
 				this.sig = '';
 				this.token = '';
 				this.nc.reset();
-				console.log(this.nc.reset(),'nc');
 			},
 			getSliderData(e, ownerInstance) {
 				if(this.sessionId){

+ 9 - 11
pages/study/index.vue

@@ -66,15 +66,7 @@
 		numberStr: '',
 	});
 	onLoad((options) => {
-		// 获取路由参数
-		if(options){
-			zhangId.value = options.zhangId
-			nianji.value = options.nianji
-			cardId.value = options.cardId
-		}
-		
 		init(options)
-
 	})
 
 	function init(options){
@@ -89,10 +81,11 @@
 			// 蛋
 			// eggDialogRef.value.eggShow();
 		} else {
-			console.log(options);
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
 			// 未登录 游客 
 			getCommonZhang(options)
-	
 		}
 	}
 	
@@ -192,7 +185,12 @@
 	function getNewData() {
 		selectZhang.value.zhangId = cacheManager.get('zhangInfo').zhangId;
 		selectZhang.value.cardId = cacheManager.get('zhangInfo').cardId;
-		selectZhang.value.nianji = cacheManager.get('zhangInfo').nianji;
+		selectZhang.value.nianji = cacheManager.get('zhangInfo').nianji;
+		cacheManager.updateObject('auth', {
+		  zhangId: selectZhang.value.zhangId,
+		  cardId: selectZhang.value.cardId,
+		  nianji: selectZhang.value.nianji,
+		})
 
 	}
 

+ 2 - 2
pages/study/product/shuxue.vue

@@ -6,8 +6,8 @@
 			<view class="chapter-title-box">{{options.zhangName}}</view>
 			<view>
 				<view class="brand-item" v-for="(item, index) in options.jieList" :key="item.jieId"
-					@click="listClick(item, index)" :class="{ 'brand-active': index === 0 }">
-					<view class="brand-icon">
+					@click="listClick(item, index)" :class="{ 'brand-active': isVip === 'VIP' || item.number == 1 }">
+					<view v-if="isVip === 'VIP' || item.number == 1" class="brand-icon">
 						{{ item.number }}
 					</view>
 					<view v-if="item.daeFlag">

+ 2 - 1
utils/request.js

@@ -45,6 +45,7 @@ const request = config => {
 				//   return
 				// }
 				const code = res.code
+				const msg = res.msg
 				// const msg = errorCode[code] || res.data.msg || errorCode['default']
 				if (code === 401) {
 					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
@@ -72,7 +73,7 @@ const request = config => {
 					toast("数据异常-400")
 					reject('400')
 				} else if (code !== 0) {
-					//   toast(msg)
+					toast(msg)
 					reject(code)
 				}
 				resolve(res)