瀏覽代碼

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 4 月之前
父節點
當前提交
27a74affa1
共有 7 個文件被更改,包括 114 次插入43 次删除
  1. 6 0
      App.vue
  2. 11 0
      api/login.js
  3. 8 3
      components/catalogue/catalogue.vue
  4. 12 4
      pages.json
  5. 1 1
      pages/game/index.vue
  6. 53 23
      pages/login/index.vue
  7. 23 12
      pages/study/index.vue

+ 6 - 0
App.vue

@@ -11,13 +11,19 @@
 		// creat by wgy 0619  生命周期 钩子  
 		onLaunch: function() {
 			//console.log('App Launch')
+			
 		},
 		onShow: function() {
+
 			// #ifdef APP-PLUS
+					
 			if (cacheManager.get('auth')) {	
 				uni.redirectTo({
 					url: `/pages/study/index`
 				})
+			}else if(!(cacheManager.get('wxLogin').bind)){
+					console.log('asdfadsfadsfasd')
+				// 微信登录且未绑定 
 			} else {
 				cacheManager.clearAll()
 				uni.redirectTo({

+ 11 - 0
api/login.js

@@ -54,4 +54,15 @@ export function telBind(data = {}) {
     data,
     timeout: 20000
   })
+}
+export function firstTelBind(data = {}) {
+  return request({
+    'url': '/common/app/bind/code',
+    headers: {
+      isToken: false
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 8 - 3
components/catalogue/catalogue.vue

@@ -46,6 +46,12 @@
 	import {MESSAGE_VISITER_TO_LOGIN,MESSAGE_BEFORE_PAY} from "@/utils/constant.js"
     import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
 	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
+	import {
+	  onShow
+	} from '@dcloudio/uni-app';
+	const growthType = ref(null);
+	const AuthCode = ref(null);
+	onShow(() => AuthCode.value = getUserIdentity()); // 用户身份
 
 	const $emit = defineEmits(['change-zhang'])
 
@@ -56,7 +62,6 @@
 	const list = ref([]); // 章节
 	const activeCollapse = ref('');
 	const Message = MESSAGE_BEFORE_PAY;
-	const AuthCode = getUserIdentity(); // 用户身份
 	const youkeDialogRef = ref(null);
 
 	function ykConfirm() {
@@ -103,13 +108,13 @@
 	 * @param({zhangId:string}) data
 	 */
 	function handleSelectZhang(data,index) {
-		if(index !=0 && AuthCode == 'Visitor'){
+		if(index !=0 && AuthCode.value == 'Visitor'){
 			// 游客
 			youkeDialogRef.value.handleShow();
 			return;
 		}
 
-		if(index !=0 && AuthCode == 'Not-Vip'){
+		if(index !=0 && AuthCode.value == 'Not-Vip'){
 			// 非VIP
 			popupRef.value.close();
 			confirmDialogRef.value.handleShow();

+ 12 - 4
pages.json

@@ -16,7 +16,10 @@
 			"path": "pages/selectGradesTerms/index",
 			"style": {
 				"navigationBarTitleText": "选择学科和年纪",
-				"navigationStyle": "custom"
+				"navigationStyle": "custom",
+				"app-plus": {
+					"animationType": "none"
+				}
 			}
 		},
 		{
@@ -35,9 +38,14 @@
 		},
 		{
 			"path": "pages/game/index",
+				
 			"style": {
-				"navigationStyle": "custom"
+				"navigationStyle": "custom",
+				"app-plus": {
+					"animationType": "none"
+				}
 			}
+		
 		},
 		{
 			"path": "pages/my/index",
@@ -121,8 +129,8 @@
 		"navigationBarTitleText": "麦塔软件",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"backgroundColor": "#F8F8F8",
-		"animationType": "none",
-		"animationDuration": "0",
+		// "animationType": "none",
+		// "animationDuration": "0",
 		//禁止滑动返回
 		"app-plus": {
 					"popGesture": "none"

+ 1 - 1
pages/game/index.vue

@@ -59,7 +59,7 @@
 	}]);
 	const foodSelectRef = ref(null);
 	const dlRef = ref(null);
-	
+
 	function handleClose() {
 		dlRef.value.handleClose();
 	}

+ 53 - 23
pages/login/index.vue

@@ -31,12 +31,14 @@
 		<agree-content-dialog ref="agreeContentDialogRef"></agree-content-dialog>
 		<agree-dialog ref="agreeDialogRef" @confirm-btn="confirmBtn"></agree-dialog>
 		<agree-dialog ref="agreeYkDialog" @confirm-btn="ykConfirmBtn"></agree-dialog>
+		<tel-dialog ref="telDialogRef" @telClose="telClose" @bindBtn="bindBtn" v-if="telDialogFlag"></tel-dialog>
 	</view>
 </template>
 
 <script setup>
 	import {
 		ref,
+		nextTick,
 		reactive
 	} from "vue"
 	import {
@@ -52,6 +54,8 @@
 		toast,
 		getUserIdentity
 	} from "@/utils/common";
+	import telDialog from './telDialog.vue'
+	import cacheManager from "@/utils/cacheManager.js";
 	import {
 		error
 	} from "uview-plus";
@@ -65,6 +69,8 @@
 	const agreeContentDialogRef = ref(null);
 	const agreeDialogRef = ref(null);
 	const agreeYkDialog = ref(null);
+	const telDialogRef = ref(null);
+	let telDialogFlag = ref(false);
 
 	onLoad((options) => {})
 
@@ -84,7 +90,22 @@
 		indexData.isAgreed = true;
 		getYzmBtn();
 	}
-	
+	const telClose = () => {
+		telDialogFlag.value = false;
+	}
+	const bindBtn = (res) => {
+		telDialogFlag.value = false;
+		if (res.cardId == 0) {
+			uni.redirectTo({
+				url: `/pages/selectGradesTerms/index`
+			})
+		} else {
+			uni.redirectTo({
+				url: `/pages/study/index`
+			})
+		}
+	}
+
 	const ykConfirmBtn = () => {
 		uni.navigateTo({
 			url: `/pages/selectGradesTerms/index`
@@ -137,26 +158,23 @@
 		}
 	}
 
-	const wxLoginClick = () => {
-		
-		//获取服务商信息判断手机端是否安装了app
-		// uni.getProvider({
-		// 	service: 'oauth',// oauth  代表授权登录
-		// 	success: function (res) {
-		// 	  // 登录
-		// 	  uni.login({
-		// 		  // 表示授权方式  如果不设置则弹出登录列表选择界面
-		// 		  provider: 'weixin',
-		// 		 	"onlyAuthorize": true, // 微信登录仅请求授权认证
-		// 		  success: function (loginRes) {
-		// 			  		console.log('loginRes',loginRes); 
-				 
-		// 		  }
-		// 	  });
-		//    }
-		// });
-		
-		
+	const wxLoginClick = () => {
+		//获取服务商信息判断手机端是否安装了app
+		// uni.getProvider({
+		// 	service: 'oauth',// oauth  代表授权登录
+		// 	success: function (res) {
+		// 	  // 登录
+		// 	  uni.login({
+		// 		  // 表示授权方式  如果不设置则弹出登录列表选择界面
+		// 		  provider: 'weixin',
+		// 		 	"onlyAuthorize": true, // 微信登录仅请求授权认证
+		// 		  success: function (loginRes) {
+		// 			  		console.log('loginRes',loginRes); 
+
+		// 		  }
+		// 	  });
+		//    }
+		// });
 		uni.login({
 			"provider": "weixin",
 			"onlyAuthorize": true, // 微信登录仅请求授权认证
@@ -170,8 +188,20 @@
 					"apple": false,
 					"code": code
 				}
-				wxLogin(req).then(res => {
+				wxLogin(req).then(res => {
 					console.log(res);
+					if (!res.data.bind) {
+						console.log('未绑定');
+						cacheManager.set('wxLogin', { 
+							bind: res.data.bing
+						})
+						telDialogFlag.value = true;
+						nextTick(() => {
+							telDialogRef.value.getOpenId(res.data.openId);
+						})
+					} else {
+
+					}
 				}).catch((error) => {
 					console.log(error);
 				})
@@ -183,4 +213,4 @@
 			}
 		})
 	}
-</script> 
+</script>

+ 23 - 12
pages/study/index.vue

@@ -81,7 +81,7 @@
 			// 已登录
 			// 选择年级进入调用此接口
 			//options.flag == 'selectGrades'
-			if (!selectZhang.value.eggFlag) {
+			if (!selectZhang.value.firstLogin) {
 				nextTick(() => {
 					eggDialogRef.value.eggShow();
 				})
@@ -175,6 +175,7 @@
 	}
 
 	function onRight(event) {
+		console.log('');
 		const authCode = getUserIdentity();
 		if (authCode !== 'VIP') {
 			return false
@@ -187,16 +188,26 @@
 		}
 		userZhangNextInfo(req).then(res => {
 			cacheManager.set('zhangInfo', res.data)
-			infoData.jieList = res.data.jieList
-			infoData.haveFlag = res.data.haveFlag
-			infoData.nianji = res.data.nianji
-			infoData.number = res.data.number
-			infoData.numberStr = res.data.numberStr
-			infoData.cardId = res.data.cardId
-			infoData.zhangId = res.data.zhangId
-			infoData.zhangName = res.data.zhangName
-			recordZhangJie()
-			getNewData()
+			nextTick(() => {
+				// uni.redirectTo({
+				// 	url: `/pages/study/index`
+				// })
+				uni.navigateTo({
+				  url:  `/pages/study/index`
+				});
+			})
+
+			// cacheManager.set('zhangInfo', res.data)
+			// infoData.jieList = res.data.jieList
+			// infoData.haveFlag = res.data.haveFlag
+			// infoData.nianji = res.data.nianji
+			// infoData.number = res.data.number
+			// infoData.numberStr = res.data.numberStr
+			// infoData.cardId = res.data.cardId
+			// infoData.zhangId = res.data.zhangId
+			// infoData.zhangName = res.data.zhangName
+			// recordZhangJie()
+			// getNewData()
 		})
 	}
 
@@ -303,7 +314,7 @@
 	function eggBtn() {
 		console.log('点击:开启提分之旅');
 		cacheManager.updateObject('auth', {
-			eggFlag: true
+			firstLogin: true
 		})
 	}
 </script>