Browse Source

Merge remote-tracking branch 'origin/2025鹅状元数学' into 2025鹅状元数学

tanxue 1 month ago
parent
commit
d3bbb95ddb
2 changed files with 35 additions and 35 deletions
  1. 8 2
      pages/chanpinMy/components/telDialog.vue
  2. 27 33
      pages/chanpinneirong/chanpin1.vue

+ 8 - 2
pages/chanpinMy/components/telDialog.vue

@@ -212,15 +212,21 @@
 					toast('手机号不能为空')
 					return;
 				}
-				if (this.bindObj.yzmNumber === '') {
+        const phoneRegex = /^1[3-9]\d{9}$/;
+        if (!phoneRegex.test(this.bindObj.telNumber)) {
+          toast('请输入正确的手机号!')
+          return;
+        }
+
+        if (this.bindObj.yzmNumber === '') {
 					toast('验证码不能为空')
 					return;
 				}
-
 				let req = {
 					tel: this.bindObj.telNumber,
 					code: this.bindObj.yzmNumber,
 				}
+
 				telBind(req).then(res => {
 					if (res.code == 0) {
 						toast('手机号绑定成功')

+ 27 - 33
pages/chanpinneirong/chanpin1.vue

@@ -1,8 +1,8 @@
 <template>
 	<view class="ezy-page-body xuexi-page-body">
 		<!-- 滚动区域 -->
-		<scroll-view v-if="existData" :scroll-with-animation="true" scroll-y
-			:scroll-top="scrollTop" @scroll="handleScroll">
+		<scroll-view v-if="existData" :scroll-with-animation="true" scroll-y :scroll-top="scrollTop"
+			@scroll="handleScroll">
 			<view class="xxjl-card-box-padding">
 				<view class="xxjl-card-box">
 					<!-- 显示内容 -->
@@ -190,8 +190,8 @@
 					// this.$nextTick(() => {
 					// 	this.updateTitlePositions();
 					// });
-				}else{
-					 this.existData = false;
+				} else {
+					this.existData = false;
 				}
 			},
 
@@ -269,38 +269,32 @@
 					"jieId": jieId
 				}
 				console.log('req', req);
-				try {
-					const res = await shuxueSave(req);
-					if (res.code == 0 && res.data) {
-						let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
-						if (!curJieAndDanyuan) {
-							toast("未找到课程信息");
-							return false;
-						}
+				const res = await shuxueSave(req);
+				if (res.code == 0) {
+					let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
+					if (!curJieAndDanyuan) {
+						toast("未找到课程信息");
+						return false;
+					}
 
-						const cacheData = cacheManager.get('contentInfo') || {};
-						cacheData.curDanyuanName = curJieAndDanyuan.danyuan.danyuanName;
-						cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
-						cacheData.danyuanId = curJieAndDanyuan.jie.danyuanId;
-						cacheData.curJieId = jieId;
-						cacheData.type = curJieAndDanyuan.jie.type;
-						cacheManager.set('contentInfo', cacheData);
+					const cacheData = cacheManager.get('contentInfo') || {};
+					cacheData.curDanyuanName = curJieAndDanyuan.danyuan.danyuanName;
+					cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
+					cacheData.danyuanId = curJieAndDanyuan.jie.danyuanId;
+					cacheData.curJieId = jieId;
+					cacheData.type = curJieAndDanyuan.jie.type;
+					cacheManager.set('contentInfo', cacheData);
 
-						if (type == 1) {
-							uni.navigateTo({
-								url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
-							})
-						} else {
-							uni.navigateTo({
-								url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
-							})
-						}
+					if (type == 1) {
+						uni.navigateTo({
+							url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
+						})
 					} else {
-						toast("保存位置出错");
-						return false;
+						uni.navigateTo({
+							url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
+						})
 					}
-				} catch (error) {
-					toast("保存失败");
+				} else {
 					return false;
 				}
 			},
@@ -345,4 +339,4 @@
 
 		}
 	}
-</script>
+</script>