Browse Source

1、看课调整字体
2、去掉问诊
3、请求异常处理

XSLu08042 1 day ago
parent
commit
31faf6e1d5

File diff suppressed because it is too large
+ 24 - 24
App.vue


+ 3 - 0
api/course.js

@@ -101,3 +101,6 @@ export function getWxConfig(data) {
  export function uploadOSS(data, type) {
  	return request('/app/common/uploadOSS', data, 'POST','application/json;charset=UTF-8','https://h5api.his.cdwjyyh.com');
  }
+ export function getConfigByKey(data, type) {
+ 	return request('/app/common/getConfigByKey',data,'GET','','https://h5api.his.cdwjyyh.com');
+ }

+ 78 - 71
common/request.js

@@ -1,85 +1,92 @@
 // uni-app请求封装
+import store from "@/store";
 export default class Request {
-	http(router, data = {}, method,contentType,url) {
+	http(router, data = {}, method, contentType, url) {
 		let that = this;
 		// let path = 'http://127.0.0.1:8113';
-		var path=uni.getStorageSync('requestPath')
+		var path = uni.getStorageSync('requestPath')
 		// var path = 'https://userapp.his.cdwjyyh.com';
 		// var path = 'https://app.rtys.cdwjyyh.com';
-		let token="";
-		if(url!=null){
-			path= url;
-			token= uni.getStorageSync('AppTokenmini_RTCourse')
-		}
-		else{
-			// path= 'https://app.rtys.cdwjyyh.com';
-			uni.setStorageSync('requestPath',path)
-			token= uni.getStorageSync('AppToken');
+		let token = "";
+		let pathType = 0
+		if (url != null) {
+			path = url;
+			pathType = 1
+			token = uni.getStorageSync('AppTokenmini_RTCourse')
+		} else {
+			pathType = 0
+			uni.setStorageSync('requestPath', path)
+			token = uni.getStorageSync('AppToken');
 		}
 		// uni.showLoading({
 		// 	title: '加载中'
 		// });
-		// var path = 'https://test.userapp.his.cdwjyyh.com';
-		return new Promise((resolve, reject) => {
-			// let token = uni.getStorageSync('AppToken');
-			let CompanyUserToken = uni.getStorageSync('CompanyUserToken');
-			var httpContentType='application/x-www-form-urlencoded';
-			if(contentType!=undefined){
-				//application/json;charset=UTF-8
-				httpContentType=contentType;
-			}
-			var routers=router;
-			// 请求
-			uni.request({
-				header: {
-					// 'Content-Type': 'application/x-www-form-urlencoded',
-					'Content-Type': httpContentType,
-					'AppToken': token,
-					'CompanyUserToken':CompanyUserToken
-				},
-				url: `${path}${router}`,
-				data: data,
-				method: method,
-				success: (res) => {
-					//收到开发者服务器成功返回的回调函数
-					if(res.data.code==401){//没有权限直接退出到登录界面
-						let pages = getCurrentPages();
-						let url = pages[ pages.length - 1]; //当前页页面实例
-						console.log(url)
-						//如果登录界面已打开,自动关闭
-						if(url!=undefined&&url.route=="pages/auth/login"){
-							resolve(res.data)
-							return;
+		// 内部真正发请求的方法
+		const _request = (retry = false) => {
+			return new Promise((resolve, reject) => {
+				let CompanyUserToken = uni.getStorageSync('CompanyUserToken');
+				var httpContentType='application/x-www-form-urlencoded';
+				if(contentType!=undefined){
+					//application/json;charset=UTF-8
+					httpContentType=contentType;
+				}
+
+				uni.request({
+					header: {
+						'Content-Type': httpContentType,
+						'AppToken': token,
+						'CompanyUserToken':CompanyUserToken
+					},
+					url: `${path}${router}`,
+					data,
+					method,
+					success: (res) => {
+						if(pathType == 1) {
+							store.commit("networkErrorInfo/setStatus", '0');
 						}
-						uni.navigateTo({
-							url:'/pages/auth/login',
-							success: () => {
-								
-							},
-							fail: () => {
+						//没有权限直接退出到登录界面
+						if (res.data.code == 401) {
+							const pages = getCurrentPages();
+							const cur = pages[pages.length - 1];
+							if (cur && cur.route == 'pages/auth/login') {
+								resolve(res.data);
+								return;
 							}
-						})
-						return;
-					}
-					if (res.data.token) {
-						uni.setStorageSync('AppToken',res.data.token)
-					}
-					resolve(res.data)
-				},
-				fail:(res) =>{
-					//接口调用失败的回调函数
-				},
-				complete:(res) =>{
-					//接口调用结束的回调函数(调用成功、失败都会执行)
-					if (res.data.code == 401) {
-						return false
+							uni.navigateTo({
+								url: '/pages/auth/login'
+							});
+							return;
+						}
+
+						// 更新 token
+						if (res.data.token && pathType == 0) {
+							uni.setStorageSync('AppToken', res.data.token);
+						}
+						resolve(res.data);
+					},
+					fail: (err) => {
+						// 看课页面网络异常,刷新重试
+						const excludeRouter = ['/app/course/updateWatchDuration','/app/course/getInternetTraffic','/app/course/getIntegralByH5Video','/app/course/getErrMsg']
+
+						if (excludeRouter.indexOf(router) == -1 &&pathType == 1&&err.errMsg.indexOf('request:fail') !== -1) {
+							// // 第一次失败 -> 重试
+							// if (!retry) {
+							// 	_request(true).then(resolve).catch(reject);
+							// 	return;
+							// }
+							// 第二次仍失败
+							store.commit("networkErrorInfo/setStatus", '1');
+						}
+						reject(err);
+					},
+					complete: (res) => {
+						if (res.data && res.data.code == 401) return;
 					}
-					//uni.hideLoading();
-				}
-				
-			})
-		})
-		 
+				});
+			});
+		};
+
+		return _request(); // 第一次调用 
 	}
-	
-}
+
+}

+ 47 - 44
pages.json

@@ -74,45 +74,45 @@
 				"navigationStyle": "custom"
 		    }
 		    
-		},
-		{
-			"path": "pages/TUIKit/TUIPages/TUIConversation/index",
-			"style": {
-				"navigationBarTitleText": "咨询消息",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-			}
-		},
-		{
-		  "path": "pages/TUIKit/TUIPages/TUIConversation/create",
-		  "style": {
-		    "navigationBarTitleText": "选择联系人",
-		    "app-plus": {
-		      "scrollIndicator": "none"
-		    }
-		  }
-		},
-		{
-		  "path": "pages/TUIKit/TUIPages/TUIChat/index",
-		  "style": {
-		    "navigationBarTitleText": "咨询中",
-		    "app-plus": {
-				"scrollIndicator": "none", //当前页面不显示滚动条
-				"softinputNavBar": "none", // App平台在iOS上,webview中的软键盘弹出时,默认在软键盘上方有一个横条,显示着:上一项、下一项和完成等按钮
-				"bounce": "none" // 页面回弹
-		    },
-			"usingComponents": {
-				"tuicallkit": "/wxcomponents/TUICallKit/TUICallKit/TUICallKit"
-			}
-		  }
-		},
-		{
-		  "path": "pages/TUIKit/TUIPages/TUIChat/components/message-elements/video-play",
-		  "style": {
-		    "navigationBarTitleText": "消息",
-		    "app-plus": {}
-		  }
 		}
+		// {
+		// 	"path": "pages/TUIKit/TUIPages/TUIConversation/index",
+		// 	"style": {
+		// 		"navigationBarTitleText": "咨询消息",
+		// 		"navigationBarBackgroundColor": "#fff",
+		// 		"navigationBarTextStyle": "black"
+		// 	}
+		// },
+		// {
+		//   "path": "pages/TUIKit/TUIPages/TUIConversation/create",
+		//   "style": {
+		//     "navigationBarTitleText": "选择联系人",
+		//     "app-plus": {
+		//       "scrollIndicator": "none"
+		//     }
+		//   }
+		// },
+		// {
+		//   "path": "pages/TUIKit/TUIPages/TUIChat/index",
+		//   "style": {
+		//     "navigationBarTitleText": "咨询中",
+		//     "app-plus": {
+		// 		"scrollIndicator": "none", //当前页面不显示滚动条
+		// 		"softinputNavBar": "none", // App平台在iOS上,webview中的软键盘弹出时,默认在软键盘上方有一个横条,显示着:上一项、下一项和完成等按钮
+		// 		"bounce": "none" // 页面回弹
+		//     },
+		// 	"usingComponents": {
+		// 		"tuicallkit": "/wxcomponents/TUICallKit/TUICallKit/TUICallKit"
+		// 	}
+		//   }
+		// },
+		// {
+		//   "path": "pages/TUIKit/TUIPages/TUIChat/components/message-elements/video-play",
+		//   "style": {
+		//     "navigationBarTitleText": "消息",
+		//     "app-plus": {}
+		//   }
+		// }
 	     
     ],
 	"subPackages": [
@@ -1353,6 +1353,7 @@
 				        "navigationBarTitleText": "课程",
 				        "navigationStyle": "custom",
 				        "scrollIndicator": "none",
+						"navigationBarTextStyle": "black",
 						"usingComponenets": {
 							"uni-popup": "/uni_modules/uni-popup/components/uni-popup/uni-popup"
 						},
@@ -1372,6 +1373,8 @@
 				        "navigationBarTitleText": "投诉反馈",
 				        "navigationStyle": "custom",
 				        "scrollIndicator": "none",
+						"navigationBarTextStyle": "black",
+						"navigationBarBackgroundColor": "#fff",
 						"app-plus": {
 							"bounce": "none",
 							"softinputMode": "adjustResize"
@@ -1423,12 +1426,12 @@
 			// 	"text": "查医生"
 			// },
 		
-			{
-				"pagePath": "pages/TUIKit/TUIPages/TUIConversation/index",
-				"iconPath": "/static/images/inquiry.png",
-				"selectedIconPath": "/static/images/inquiry_select.png",
-				"text": "问诊"
-			},
+			// {
+			// 	"pagePath": "pages/TUIKit/TUIPages/TUIConversation/index",
+			// 	"iconPath": "/static/images/inquiry.png",
+			// 	"selectedIconPath": "/static/images/inquiry_select.png",
+			// 	"text": "问诊"
+			// },
 			{
 				"pagePath": "pages/store/index",
 				"iconPath": "/static/images/store.png",

+ 7 - 7
pages/user/index.vue

@@ -70,10 +70,10 @@
 							<image src="https://cos.his.cdwjyyh.com/fs/20250417/b18b26fcee394213aa736ddbf7c746af.png"></image>
 							<view class="title">我的随访</view>
 						</view>
-						<view class="menu"  @click="toIM()">
+						<!-- <view class="menu"  @click="toIM()">
 							<image src="https://cos.his.cdwjyyh.com/fs/20240429/6e68b42d9d824532945a1dda73350576.png"></image>
 							<view class="title">用药咨询</view>
-						</view>
+						</view> -->
 						<view class="menu"  @click="navTo('/pages_user/drugReportList')" >
 							<image src="https://cos.his.cdwjyyh.com/fs/20240429/6b9f340b16e74fa2bc095265d525769e.png"></image>
 							<view class="title">用药报告</view>
@@ -222,7 +222,7 @@
 			this.$isLogin().then(
 				res => {
 					if(res){
-						uni.$emit('refreshIM')
+						// uni.$emit('refreshIM')
 						this.getUserInfo();
 					}
 				},
@@ -378,10 +378,10 @@
 			},
 			logout(){
 				this.$logout();
-				uni.$TUIKit.logout();
-				if(uni.$TUICallKit!=null){
-					uni.$TUICallKit.logout();
-				}
+				// uni.$TUIKit.logout();
+				// if(uni.$TUICallKit!=null){
+				// 	uni.$TUICallKit.logout();
+				// }
 				uni.reLaunch({
 					url: '/pages/index/index',
 					animationType: 'pop-in',

+ 54 - 0
pages_course/components/networkError.vue

@@ -0,0 +1,54 @@
+<template>
+	<view></view>
+</template>
+
+<script>
+	import store from "@/store";
+	export default {
+		data() {
+			return {
+				show: false
+			}
+		},
+		computed: {
+			statusValue() {
+				return store.state.networkErrorInfo.networkError
+			}
+		},
+		watch: {
+			statusValue(newVal, oldVal) {
+				console.log('value changed========:', newVal, oldVal)
+				if (newVal == '1'&&!this.show) {
+					const that = this
+					uni.showModal({
+						title: '提示',
+						content: '网络异常,请重试',
+						showCancel: false,
+						confirmText: '刷新',
+						success: function(res) {
+							store.commit("networkErrorInfo/setStatus", '0');
+							that.show = true
+							
+							if (res.confirm) {
+								that.show = false
+								that.$emit('refreshAll')
+							} else if (res.cancel) {
+								that.show = false
+								that.$emit('refreshAll')
+								console.log('用户点击取消');
+							}
+						}
+					});
+				} else {
+					that.show = false
+				}
+			}
+		},
+		mounted() {
+			store.commit("networkErrorInfo/setStatus", '0');
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+</style>

+ 16 - 7
pages_course/components/ques.vue

@@ -1,10 +1,10 @@
 <template>
-	<view class="ques-content">
-		<view class="ques-content-tit" v-show="openCommentStatus!=1">问答题</view>
+	<view class="ques-content" :style="{ fontSize: fontSize(28)}">
+		<view class="ques-content-tit" :style="{ fontSize: fontSize(36)}" v-show="openCommentStatus!=1">问答题</view>
 		<view v-for="(item,index) in quesList" :key="index">
-			<view class="ques-title">
+			<view class="ques-title" :style="{ fontSize: fontSize(32)}">
 				<text>{{index + 1}}.</text>
-				<view class="ques-type" v-show="item.type == 1 || item.type == 2">
+				<view class="ques-type" :style="{ fontSize: fontSize(24)}" v-show="item.type == 1 || item.type == 2">
 					{{item.type == 1 ? '单选' : item.type == 2 ? '多选' : ''}}
 				</view>
 				<text>{{item.title}}</text>
@@ -25,11 +25,20 @@
 	export default {
 		props: ['quesList','openCommentStatus'],
 		data() {
-			return {
-				
-			}
+			return {}
 		},
 		computed: {
+			fontSize() {
+				return size=>{
+					const value = uni.upx2px(size)
+					const scale = uni.getStorageSync('fontScale') || 1;
+					if(scale<1){
+						return value + 'px';
+					}else {
+						return value * scale + 'px';
+					}
+				}
+			},
 			isAnswer() {
 				return (item, name) => {
 					if (item.type == 1) {

+ 41 - 6
pages_course/feedback.vue

@@ -1,10 +1,11 @@
 <template>
-	<view>
-		<view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
+	<view :style="{fontSize: fontSize(30)}">
+		<view class="header-nav" :style="{height: `calc(44px + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
 			<view class="arrow-left" :style="{top: statusBarHeight + 'px'}" @click="goBack"><u-icon name="arrow-left" size="24"></u-icon></view>
 			<view class="header-title" :style="{height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">投诉反馈</view>
 		</view>
-		<view class="container" :style="{paddingTop: `calc(88rpx + ${statusBarHeight}px)`}">
+		<networkError @refreshAll="refreshAll"></networkError>
+		<view class="container" :style="{paddingTop: `calc(44px + ${statusBarHeight}px)`}">
 			<view class="formbox" v-if="isLastChild==1">
 				<view class="formbox-title">{{ text }}</view>
 				<view class="form">
@@ -48,8 +49,12 @@
 </template>
 
 <script>
+	import networkError from "./components/networkError.vue"
 	import{ getTypeTree, complaintRecord,loginByMp } from "@/api/course.js"
 	export default {
+		components: {
+			networkError
+		},
 		data() {
 			return {
 				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
@@ -78,6 +83,21 @@
 				fileList1: [],
 			};
 		},
+		computed: {
+			fontSize() {
+				return size=>{
+					const value = uni.upx2px(size)
+					const scale = uni.getStorageSync('fontScale') || 1;
+					if(scale>1.5) {
+						return value * 1.5 + 'px';
+					} else if(scale<1){
+						return value + 'px';
+					}else {
+						return value * scale + 'px';
+					}
+				}
+			},
+		},
 		onLoad(option) {
 			this.userId = option.userId || ''
 			this.courseId = option.courseId || ''
@@ -97,6 +117,21 @@
 			);
 		},
 		methods: {
+			refreshAll() {
+				this.$isLoginCourse().then(
+					res => {
+						if(res){
+							this.isLogin = true
+							this.getMenuButton()
+							this.getList()
+						} else{
+							this.isLogin = false
+							this.goLogin()
+						}
+					},
+					rej => {}
+				);
+			},
 			getMenuButton(){
 				const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
 				this.menuButtonH = menuButtonInfo.height
@@ -346,7 +381,7 @@
 		height: 88rpx;
 		line-height: 88rpx;
 		text-align: center;
-		font-size: 30rpx;
+		// font-size: 30rpx;
 		font-family: PingFang SC;
 		color: #FFFFFF;
 		background: rgb(0,178,106);
@@ -383,7 +418,7 @@
 			text-overflow: ellipsis;
 			font-family: PingFang SC,PingFang SC;
 			font-weight: 500;
-			font-size: 15px;
+			// font-size: 15px;
 			color: #000;
 			box-sizing: border-box;
 		}
@@ -401,7 +436,7 @@
 		background-color: #fff;
 		padding: 24rpx;
 		border-bottom: 1rpx solid #f4f4f4;
-		font-size: 15px;
+		// font-size: 15px;
 		color: #333;
 	}
 

+ 52 - 6
pages_course/video.vue

@@ -1,12 +1,13 @@
 <template>
 	<view class="content">
-		<view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
+		<view class="header-nav" :style="{height: `calc(44px + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
 			<view class="arrow-left-warning" @click="feedback">
 				<image src="/static/images/warning.png"></image>
 				<text>投诉</text>
 			</view>
 			<view class="header-title" :style="{width:menuButtonLeft + 'px',height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">{{courseInfo.title}}</view>
 		</view>
+		<networkError @refreshAll="refreshAll"></networkError>
 		<view class="video-box">
 			<image v-if="!isLogin || isAddKf!=1" class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
 			</image>
@@ -69,7 +70,10 @@
 			@getScrollTop="getScrollTop"
 			@getMore="getMore"
 			@getActiveDanmus="getActiveDanmus"></commentBox>
-		<view id="title-contentnav">
+		<view id="title-contentnav"> 
+			<template v-show="isLogin&&notice">
+				<u-notice-bar :text="notice" color="red" speed='60'></u-notice-bar>
+			</template>
 			<view class="title-content" v-if="openCommentStatus!=1">
 				<!-- 答题时展示小节课程名,其他展示课程名 -->
 				<!-- 小节课程名 -->
@@ -234,8 +238,8 @@
 				<text>立即学习</text>
 			</view>
 			<view v-if="isLogin&&isAddKf==1&&currentTab==1&&quesList&&quesList.length>0" class="footer-btn footer-btn-border" @click="submit">
-				<image class="footer-btn-img" :src="baseUrl+'/images/red_envelope_btnimg.png'" mode="aspectFill"></image>
-				<text>提交答案领取奖励</text>
+				<!-- <image class="footer-btn-img" :src="baseUrl+'/images/red_envelope_btnimg.png'" mode="aspectFill"></image> -->
+				<text>提交答案</text>
 			</view>
 			<!-- <view @click="checked=!checked" class="agreement" v-if="!isLogin">
 				<radio value="r1" :checked="checked" color="#ff5c03" activeBorderColor="#ff5c03"
@@ -255,6 +259,7 @@
 </template>
 
 <script>
+	import networkError from "./components/networkError.vue"
 	import ques from "./components/ques.vue"
 	import descInfo from "./components/descInfo.vue"
 	import descInfoNav from "./components/descInfoNav.vue"
@@ -274,6 +279,7 @@
 		loginByMp,
 		getRealLink,
 		errorLogUpload,
+		getConfigByKey
 	} from "@/api/course.js"
 	export default {
 		components: {
@@ -281,6 +287,7 @@
 			descInfo,
 			commentBox,
 			ques,
+			networkError
 		},
 		data() {
 			return {
@@ -411,7 +418,8 @@
 				showAnswerTip: false,
 				showDanmu: 1,
 				activeDanmus:[],
-				flagTime: 0
+				flagTime: 0,
+				notice: ''
 			}
 		},
 		onLoad(option) {
@@ -428,6 +436,7 @@
 			var that=this;
 			if (this.videoId) {
 				this.getH5CourseByVideo()
+				this.getConfigByKey()
 			}
 			this.sortLink = this.urlOption.link || ''
 			this.getMenuButton()
@@ -448,7 +457,7 @@
 				this.getLink()
 			} else {
 				uni.showToast({
-					title: 'sortLink is not found',
+					title: '链接地址有误',
 					icon: 'none'
 				});
 			}
@@ -493,6 +502,37 @@
 			// #endif
 		},
 		methods: {
+			refreshAll() {
+				if (this.videoId) {
+					this.getH5CourseByVideo()
+					this.getConfigByKey()
+				}
+				if(uni.getStorageSync('userInfo') && JSON.stringify(uni.getStorageSync('userInfo'))!='{}') {
+					this.user = JSON.parse(uni.getStorageSync('userInfo'))
+				} else {
+					this.user = {}
+				}
+				if(this.sortLink){
+					this.getLink()
+				} else {
+					uni.showToast({
+						title: '链接地址有误',
+						icon: 'none'
+					});
+				}
+			},
+			getConfigByKey(){
+				let param = {key:"course.config"};
+				getConfigByKey(param).then(
+					res => {
+						if(res.code==200){
+							let data=res.data ? JSON.parse(res.data) : {};
+							this.notice = data.notify || ''
+						}
+					},
+					rej => {}
+				);
+			},
 			numberToChinese(number) {
 				if (number) {
 					const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
@@ -639,9 +679,13 @@
 			},
 			getH5CourseByVideo() {
 				this.loading = true
+				uni.showLoading({
+					title: '加载中'
+				})
 				getH5CourseByVideoId({
 					videoId: this.videoId
 				}).then(res => {
+					uni.hideLoading()
 						this.loading = false
 						if (res.code == 200) {
 							this.courseInfo = res.data
@@ -656,9 +700,11 @@
 						})
 					},
 					rej => {
+						uni.hideLoading()
 						this.loading = false
 					}
 				).catch(() => {
+					uni.hideLoading()
 					this.loading = false
 				})
 			},

+ 3 - 1
store/index.ts

@@ -3,9 +3,11 @@ import { createStore, Store } from 'vuex';
 import createPersistedstate from 'vuex-persistedstate'
 import modules from './modules';
 import { timState } from './modules/timStore';
+import { networkErrorInfo } from './modules/networkErrorInfo';
 
 export interface State {
-  timStore: timState;
+  timStore: timState,
+  networkErrorInfo,
 }
 
 export default createStore <State>({

+ 2 - 0
store/modules.ts

@@ -1,4 +1,6 @@
 import timStore from './modules/timStore';
+import networkErrorInfo from './modules/networkErrorInfo';
 export default {
   timStore,
+  networkErrorInfo
 };

+ 27 - 0
store/modules/networkErrorInfo.ts

@@ -0,0 +1,27 @@
+export type networkErrorInfo = {
+	networkError: string,
+};
+
+const state: networkErrorInfo = {
+	networkError: uni.getStorageSync('networkError') || '0'
+};
+
+export default {
+	namespaced: true,
+	state,
+	getters: {
+		networkError: (state): string => {
+			return state.networkError;
+		}
+	},
+	mutations: {
+		setStatus(state: networkErrorInfo, payload: string): void {
+			uni.setStorageSync('networkError', payload)
+			state.networkError = payload;
+		},
+	},
+	actions: {
+		// 
+
+	},
+};

Some files were not shown because too many files changed in this diff