zhaobao 2 年 前
コミット
44d0b4f3cf

+ 6 - 5
libs/request.js

@@ -10,6 +10,12 @@ export async function request(parmas) {
 				title: '加载中',
 				mask: true
 			});
+			if(!getToken()){
+				uni.clearStorageSync()				
+				uni.reLaunch({
+					url: '/pages/login/index'
+				})
+			}
 			uni.request({
 				...formatRequestBody(parmas),
 				success(response) {
@@ -79,10 +85,5 @@ function formatRequestBody(parmas) {
 		method,
 		dataType
 	};
-	if(!getToken()){
-		uni.reLaunch({
-			url: '/pages/login/index'
-		})
-	}
 	return requestBody;
 };

+ 2 - 1
pages/history/detail/detail.vue

@@ -112,10 +112,11 @@
 		}
 		.tag{
 			padding: 8rpx 20rpx;
-			margin:10rpx ;
+			margin:8rpx ;
 			background-color: #2A83EF;
 			color: #fff;
 			border-radius: 5rpx;
+			display: inline-block;
 		}
 	}	
 }

+ 21 - 8
pages/index/detail/detail.vue

@@ -30,6 +30,7 @@
 		data(){
 			return{
 				readSrc:"",
+				innerAudioContext:null,
 				viewData:{
 					taskTitle:"",
 					taskContent:[]	
@@ -75,6 +76,11 @@
 		},
 		onUnload() {
 			uni.removeStorageSync('index-detail-info')
+			if(this.innerAudioContext){
+				this.innerAudioContext.stop();				
+				this.innerAudioContext.destroy()
+				this.innerAudioContext=null;
+			}
 		},
 		methods:{
 			submitForm(){
@@ -108,22 +114,30 @@
 			},
 			async read(){
 			  let taskContent=this.viewData.taskContent
-			  let time=2;
+			  
+			  let time=3;
+			  if(this.innerAudioContext){
+				  this.innerAudioContext.stop();			   				  
+			  }else{
+				this.innerAudioContext = uni.createInnerAudioContext();				  
+			  }
 			  for(let i=0;i<taskContent.length;i++){
-				await this.playAudio(this.getreadSrc(taskContent[i].text))
-				await this.playAudio(this.getreadSrc(taskContent[i].text))
-				await this.playAudio(this.getreadSrc(taskContent[i].text))
+				  for(let j=0;j<time;j++){
+					 await this.playAudio(this.getreadSrc(taskContent[i].text))
+				  }
 			  }
 			},
 			getreadSrc(ttsText){
 				let cuid="hyy-"+(new Date().getTime());
 				let access_token=this.tts_token
-				let readUrl=`https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=${cuid}&tok=${access_token}&vol=9&per=0&spd=5&pit=5&aue=3&tex=${ttsText}`;		
+				let spd=3
+				let per=0;
+				let readUrl=`https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=${cuid}&tok=${access_token}&vol=9&per=${per}&spd=${spd}&pit=5&aue=3&tex=${ttsText}`;		
 				return readUrl;
 			},
 			playAudio(src,sleep=3000){
 				return new Promise((resolve, reject)=>{
-					var innerAudioContext = uni.createInnerAudioContext();
+					var innerAudioContext = this.innerAudioContext;
 					innerAudioContext.autoplay = true;
 					innerAudioContext.src = src;
 					innerAudioContext.onPlay(() => {
@@ -136,10 +150,9 @@
 					});
 					innerAudioContext.onEnded(()=>{
 						setTimeout(()=>{
-							innerAudioContext=null
 							resolve()
 						},sleep)
-					})					
+					})
 				})
 			},
 			async getTTStoken() {

+ 5 - 1
pages/index/form/form.vue

@@ -5,7 +5,11 @@
 				<uni-easyinput type="text" v-model="formData.taskTitle" placeholder="请输入标题" />
 			</uni-forms-item>
 			<uni-forms-item label="内容" name="taskContent" required>
-				<uni-easyinput type="textarea" v-model="formData.taskContent" placeholder="请输入内容" />
+				<uni-easyinput 
+				v-model="formData.taskContent" 
+				:maxlength="-1" type="textarea" 
+				autoHeight
+				placeholder="请输入内容" />
 			</uni-forms-item>
 		</uni-forms>
 		<button @click="submitForm" class="submit-bt">提交</button>

+ 14 - 6
pages/myCenter/myCenter.vue

@@ -44,6 +44,7 @@
 
 <script>
 	import {logout} from '@/api/user.js'
+	import { getToken } from '@/libs/auth';	
 	import getPhone from '@/components/getPhone.vue'		
 	export default{
 		data(){
@@ -77,12 +78,13 @@
 			// 	}			
 			// },			
 			init(){
-				let user=uni.getStorageSync('accountInfo');
-				if(user){
-					user=JSON.parse(user)
-					this.userAvatar=user.avatar||this.defaultAvatar;
-					this.userName=user.name;	
-				}			
+				this.userName=uni.getStorageSync('accountId')
+				// let user=uni.getStorageSync('accountInfo');
+				// if(user){
+				// 	user=JSON.parse(user)
+				// 	this.userAvatar=user.avatar||this.defaultAvatar;
+				// 	this.userName=user.name;	
+				// }			
 			},
 			faceRecording(){
 				this.cameraModel=true;		
@@ -115,6 +117,12 @@
 								uni.reLaunch({
 									url:'/pages/login/index'
 								})							
+							}).catch(()=>{
+								/*token 异常未返回正确状态码*/
+								uni.clearStorageSync()
+								uni.reLaunch({
+									url:'/pages/login/index'
+								})									
 							})
 						}					
 					}

ファイルの差分が大きいため隠しています
+ 0 - 0
unpackage/cache/wgt/__UNI__C6FF24C/app-service.js


ファイルの差分が大きいため隠しています
+ 0 - 0
unpackage/cache/wgt/__UNI__C6FF24C/app-view.js


ファイルの差分が大きいため隠しています
+ 0 - 0
unpackage/dist/build/app-plus/app-service.js


ファイルの差分が大きいため隠しています
+ 0 - 0
unpackage/dist/build/app-plus/app-view.js


BIN
unpackage/release/apk/__UNI__C6FF24C__20230711183654.apk → unpackage/release/apk/__UNI__C6FF24C__20230714174034.apk


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません