XSLu08042 1 nedēļu atpakaļ
vecāks
revīzija
629f442044

+ 4 - 0
api/user.js

@@ -77,6 +77,10 @@ let request = new Request().http
  	 return request('/app/index/getMenuUser',data,'GET','application/json;charset=UTF-8');
  }
  
+ // 更新jpushId
+  export function updatePushId(data) {
+  	 return request('/app/updatePushId',data,'GET');
+  }
  
  
  

+ 3 - 4
common/request.js

@@ -2,11 +2,10 @@
 export default class Request {
 	http(router, data = {}, method,contentType) {
 		let that = this;
-		let path = 'http://admin.ylrztop.com:7005'
+		// let path = 'http://admin.ylrztop.com:7005'
 		// let path = 'http://1.95.39.2:7005';
 		//云联融智
-		// let path = 'https://userapp.his.cdwjyyh.com';
-		// let path = 'https://userapp.zhengzefeng.com';
+		let path = 'http://app.user.ylrztop.com';
 		uni.setStorageSync('requestPath',path)
 		// uni.showLoading({
 		// 	title: '加载中'
@@ -67,7 +66,7 @@ export default class Request {
 					//接口调用失败的回调函数
 				},
 				complete:(res) =>{
-					console.log("complete=======",router,res,data)
+					// console.log("complete=======",router,data,res,data)
 					//接口调用结束的回调函数(调用成功、失败都会执行)
 					if (res.code == 401) {
 						return false

+ 4 - 2
main.js

@@ -2,7 +2,8 @@ import Vue from 'vue'
 import App from './App'
 
 import {
-	showLoginPage
+	showLoginPage,
+	getRegistrationID
 } from './utils/login.js'
 Vue.config.productionTip = false
 
@@ -20,7 +21,8 @@ Vue.prototype.setData = setData;
 Vue.prototype.$showLoginPage = showLoginPage;
 Vue.prototype.$navTo = utils.navTo;
 Vue.prototype.$checkToken = utils.checkToken;
-Vue.prototype.$isEmpty = utils.isEmpty
+Vue.prototype.$isEmpty = utils.isEmpty;
+Vue.prototype.$getRegistrationID = getRegistrationID
 
 App.mpType = 'app'
 const app = new Vue({

+ 13 - 3
manifest.json

@@ -5,7 +5,7 @@
     "versionName" : "1.0.1",
     "versionCode" : 101,
     "transformPx" : false,
-	"sassImplementationName": "node-sass",
+    "sassImplementationName" : "node-sass",
     /* 5+App特有相关 */
     "app-plus" : {
         "usingComponents" : true,
@@ -19,7 +19,10 @@
         },
         /* 模块配置 */
         "modules" : {
-            "OAuth" : {}
+            "OAuth" : {},
+            "Push" : {},
+            "Camera" : {},
+            "VideoPlayer" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -63,7 +66,14 @@
                         "appid" : "wx9e6519e1fbf2ee6b",
                         "UniversalLinks" : ""
                     }
-                }
+                },
+                "push" : {
+                    "unipush" : {
+                        "version" : "2",
+                        "offline" : false
+                    }
+                },
+                "share" : {}
             }
         }
     },

+ 27 - 3
pages/auth/passwordLogin.vue

@@ -54,10 +54,32 @@
 				phone:'',
 				password:'',
 				isAgreement:false,
-				loginType:1
+				loginType:1,
+				registrationID: '',
+			}
+		},
+		watch: {
+			isAgreement: {
+				immediate: true,
+				handler(value) {
+					// #ifdef APP-PLUS
+					if(value && !this.registrationID) {
+						this.getRegistrationID()
+					}
+					// #endif
+				}
 			}
 		},
 		methods: {
+			async getRegistrationID() {
+				try {
+					this.registrationID = await this.$getRegistrationID();
+					console.log('推送ID:', this.registrationID);
+				} catch (err) {
+					this.registrationID = ''
+					console.error('获取registrationID失败:', err);
+				}
+			},
 			// 校验手机号
 			validatePhone() {
 			  return /^1[3-9]\d{9}$/.test(this.phone);
@@ -110,7 +132,8 @@
 				const data={
 					phone:this.phone,
 					password:this.password,
-					loginType:this.loginType
+					loginType:this.loginType,
+					jpushId: this.registrationID,
 				}
 				login(data).then(res=>{
 					if(res.code==200){
@@ -121,7 +144,8 @@
 							icon:'none',
 							title: '登录成功',
 						});
-						uni.setStorageSync('userInfo',res.user)
+						uni.setStorageSync('AppToken', res.token);
+						uni.setStorageSync('userInfo', JSON.stringify(res.user));
 					}else{
 						uni.showToast({
 							icon:'none',

+ 6 - 6
pages/course/components/studyCenter.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="content">
-		<view class="navbox" id="guide4">
+		<!-- <view class="navbox" id="guide4">
 			<view class="navbox-item">
 				<view class="navbox-iteminfo" @click="loginNavTo('/pages_course/learning')">
 					<image src="@/static/images/course/course_icon.png" mode="aspectFill"></image>
@@ -19,12 +19,12 @@
 					<text>我的收藏</text>
 				</view>
 			</view>
-			<!-- <view class="navbox-item" >
+			<view class="navbox-item" >
 				<view class="navbox-iteminfo">
 					<image src="@/static/images/course/evaluate_icon.png" mode="aspectFill"></image>
 					<text>我的评价</text>
 				</view>
-			</view> -->
+			</view>
 		</view>
 		<view class="navbox navbox-other">
 			<view class="navbox-item" @click="handleOrder(0)">
@@ -43,7 +43,7 @@
 				<image src="@/static/images/course/evaluate_icon24.png" mode="aspectFill"></image>
 				<text>已退款</text>
 			</view>
-		</view>
+		</view> -->
 		
 		<!-- 开通会员入口 -->
 		<!-- <view class="vipbox" v-if="!user.isVip" @tap="loginNavTo('/pages_course/vipBuy')">
@@ -56,7 +56,7 @@
 		
 		
 		<!-- 签到 -->
-		<view class="sign">
+		<!-- <view class="sign">
 			<view class="sign-info">
 				<view class="sign-day">已连续签到<text>{{signNum}}</text>天</view>
 				<view class="sign-num">我的积分:{{integral}}</view>
@@ -76,7 +76,7 @@
 				<button class="sign-btn"  @click="loginNavTo('/pages_user/user/integral')">立即签到</button>
 			</view>
 		</view>
-		
+		 -->
 		<!-- 讲堂 -->
 		<view class="hallbox">
 			<hallItem class="gapitem"  v-for="(item, index) in recommendList " :key="index" :item="item"  @click.native="navTo('/pages_course/info?courseId='+item.courseId)"  />

+ 11 - 7
pages/user/index.vue

@@ -18,11 +18,11 @@
 							<image :src="user.avatar==null?'/static/images/detault_head.jpg':user.avatar" mode="aspectFill"></image>
 						</view>
 						<view class="name-phone">
-							<view class="name">{{user.nickname}}</view>
-							<view class="phone">{{utils.parsePhone(user.phone)}}</view>
+							<!-- <view class="name">{{user.nickname}}</view> -->
+							<!-- <view class="phone">{{utils.parsePhone(user.phone)}}</view> -->
 						</view>
 					</view>
-					<view class="right">
+					<!-- <view class="right">
 						<uni-badge size="small" :text="msgNum" absolute="rightTop" type="error">
 							<view class="set" @click="navgetTo('/pages_user/user/personInfo')">
 								<image src="../../static/images/icon-set.png" mode=""></image>
@@ -33,7 +33,7 @@
 								<image src="../../static/images/icon-msg.png" mode=""></image>
 							</view>
 						</uni-badge>
-					</view>
+					</view> -->
 				</view>
 				<!-- 我的订单 -->
 				<view class="my-order" >
@@ -171,7 +171,11 @@
 				</view>
 				
 				<!-- 退出登录按钮 -->
-				<view @tap="loginOUt" class="log-out x-c" >退出登录</view>
+				<view @tap="loginOUt" style="padding: 0 24rpx;">
+					<view class="log-out x-c" >
+						退出登录
+					</view>
+				</view>
 				
 				<!-- <view class="like-product">
 					<likeProduct  ref="product" />
@@ -352,7 +356,7 @@
 			top: 0;
 			left: 0;
 			z-index: 2;
-			padding-bottom: 24rpx;
+			padding-bottom: calc(24rpx + 50px);
 			.user-info{
 				padding: 88upx 30upx 0 30upx;
 				display: flex;
@@ -578,7 +582,7 @@
 	
 	.log-out {
 		height: 80upx;
-		width: 80%;
+		width: 100%;
 		background:#fff;
 		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
 		line-height: 80upx;

+ 2 - 2
pages_course/components/comment.vue

@@ -342,7 +342,7 @@
 					this.$showLoginPage();
 					return;
 				}
-				let params={"courseId":this.courseId,"content":this.pingContent};
+				let params={"courseId":this.courseId,"content":this.pingContent,"type":this.pingType};
 				this.postComment(params);
 			},
 			//点击回复发送按钮
@@ -355,7 +355,7 @@
 					this.$showLoginPage();
 					return;
 				}
-				let params={"courseId":this.courseId,"content":this.replyContent,"parentId":this.replyParentId};
+				let params={"courseId":this.courseId,"content":this.replyContent,"parentId":this.replyParentId,"type":this.pingType};
 				this.postComment(params);
 			},		
 			//提交评论请求

+ 51 - 0
uniCloud-aliyun/cloudfunctions/push/index.js

@@ -0,0 +1,51 @@
+'use strict';
+const uniPush = uniCloud.getPushManager({
+	appId: "__UNI__33EAA2D"
+})
+exports.main = async (event) => {
+	let obj = JSON.parse(event.body)
+	console.log(obj)
+	// const res = await uniPush.sendMessage({
+	// 	category: {  
+	// 		//HarmonyOS NEXT系统(纯血鸿蒙、非安卓鸿蒙)的消息分类,要给鸿蒙设备推送时才必传  
+	// 		"harmony":"MARKETING"  
+	// 	},  
+	// 	options:{  
+	// 		"HW": {      
+	// 			 // 值为int 类型。1 表示华为测试消息,华为每个应用每日可发送该测试消息500条。此 target_user_type 参数请勿发布至线上。      
+	// 			  "/message/android/target_user_type":1      
+	// 		  } ,    
+	// 		"HO": {      
+	// 			 //值为int 类型。1 表示测试推送,不填默认为0。荣耀每个应用每日可发送该测试消息1000条。此测试参数请勿发布至线上。  
+	// 			  "/android/targetUserType": 1   
+	// 		  } ,  
+	// 		"VV": {      
+	// 			 //值为int 类型。0 表示正式推送;1 表示测试推送,不填默认为0。此 pushMode 参数请勿发布至线上。  
+	// 			  "/pushMode":1      
+	// 		  } ,    
+	// 		"XM": {      
+	// 			 //新小米消息分类下,私信公信id都必须要传,否则请求小米厂商接口会被拦截  
+	// 			  "/extra.channel_id": ""   
+	// 		  }    
+	// 	},
+	// 	...obj,
+	// })
+	switch (obj.action) {
+		case 'getClientDetail':
+			return getClientDetailByCid(obj.cid)
+		default: 
+			return sendMessage(obj)
+	}
+};
+
+// 推送通知
+async function sendMessage(event) {
+	const res = await uniPush.sendMessage(event)
+	return res  
+}
+
+// 查询设备的信息
+async function getClientDetailByCid(cid) {
+	const res = await uniPush.getClientDetailByCid(cid)
+	return res 
+}

+ 8 - 0
uniCloud-aliyun/cloudfunctions/push/package.json

@@ -0,0 +1,8 @@
+{
+  "name": "push",
+  "dependencies": {},
+  "extensions": {
+    "uni-cloud-jql": {},
+    "uni-cloud-push": {}
+  }
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 576 - 515
utils/login.js


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels