Explorar el Código

放开个人中心代码

liuyiran hace 1 semana
padre
commit
a4fe5fe23c
Se han modificado 5 ficheros con 61 adiciones y 77 borrados
  1. 1 1
      api/login.js
  2. 7 7
      pages.json
  3. 47 63
      pages/index.vue
  4. 4 4
      pages/login.vue
  5. 2 2
      store/modules/user.js

+ 1 - 1
api/login.js

@@ -46,7 +46,7 @@ export function getInfo() {
 // 退出方法
 export function logout() {
   return request({
-    'url': '/logout',
+    'url': '/auth/logout',
     'method': 'post'
   })
 }

+ 7 - 7
pages.json

@@ -114,13 +114,13 @@
 					 "iconPath": "static/images/tabbar/work.png",
 					 "selectedIconPath": "static/images/tabbar/work_.png",
 			     "text": "列表"
-			   } 
-			// {
-			// 	"pagePath": "pages/mine/index",
-			// 	"iconPath": "static/images/tabbar/mine.png",
-			// 	"selectedIconPath": "static/images/tabbar/mine_.png",
-			// 	"text": "我的"
-			// }
+			   } ,
+			{
+				"pagePath": "pages/mine/index",
+				"iconPath": "static/images/tabbar/mine.png",
+				"selectedIconPath": "static/images/tabbar/mine_.png",
+				"text": "我的"
+			}
 		]
 	},
 	"globalStyle": {

+ 47 - 63
pages/index.vue

@@ -73,6 +73,7 @@
 	import {
 		uploadPerson
 	} from "@/api/system/user"
+	import store from '@/store'
 	const recorderManager = uni.getRecorderManager();
 	const innerAudioContext = uni.createInnerAudioContext();
 	innerAudioContext.autoplay = true;
@@ -84,19 +85,6 @@
 			return {
 				videoName: '',
 				fileInfo: {},
-				// array: [{
-				// 		value: 'ceshi1',
-				// 		text: 'demo1'
-				// 	},
-				// 	{
-				// 		value: 'ceshi2',
-				// 		text: 'demo3'
-				// 	},
-				// ],
-				// modelIndex: undefined,
-				// isModalVisible: false,
-				// modalMessage: '',
-				// modalImageSrc: '',
 				videoContent: [{
 						value: 'text',
 						text: '文字输入'
@@ -119,7 +107,7 @@
 				},
 				videoText: '',
 				missingContent: [],
-				timbre:'a',
+				timbre: 'a',
 				timbreContent: [{
 						value: 'a',
 						text: 'timbre1'
@@ -129,6 +117,7 @@
 						text: 'timbre2'
 					}
 				],
+				personPath: ''
 			}
 		},
 		onLoad() {
@@ -148,7 +137,6 @@
 					title: '录音出错',
 					icon: 'none'
 				});
-				console.error('录音错误:', err);
 			});
 		},
 		onShow() {
@@ -171,9 +159,9 @@
 					sourceType: ['album', 'camera'],
 					success: function(res) {
 						that.imagePath = res.tempFilePaths[0];
+						that.uploadImagePath()
 					},
 					fail: function(err) {
-						console.error('图片选择失败:', err);
 						uni.showToast({
 							title: '图片选择失败',
 							icon: 'none'
@@ -181,19 +169,19 @@
 					}
 				});
 			},
-/* 			bindPickerChange(e) {
-				const tempOption = this.array.find(item => item.value == e).text;
-				this.modalMessage = `您选择的是: ${tempOption}`;
-				this.modalImageSrc = '../static/images/xijiao/avator.png';
-				this.isModalVisible = true;
-				this.modelIndex = e
-			},
-			onConfirm() {
-				this.isModalVisible = false;
-			},
-			onCancel() {
-				this.isModalVisible = false;
-			}, */
+			/* 			bindPickerChange(e) {
+							const tempOption = this.array.find(item => item.value == e).text;
+							this.modalMessage = `您选择的是: ${tempOption}`;
+							this.modalImageSrc = '../static/images/xijiao/avator.png';
+							this.isModalVisible = true;
+							this.modelIndex = e
+						},
+						onConfirm() {
+							this.isModalVisible = false;
+						},
+						onCancel() {
+							this.isModalVisible = false;
+						}, */
 			radioChange(evt) {
 				for (let i = 0; i < this.videoContent.length; i++) {
 					if (this.videoContent[i].value === evt.detail.value) {
@@ -218,7 +206,6 @@
 						numberOfChannels: 1,
 						encodeBitRate: 192000,
 						format: 'wav',
-						// frameSize: 50
 					});
 					this.isRecording = true;
 				}
@@ -236,43 +223,39 @@
 			// },
 			uploadImagePath() {
 				let data = {
-					// name: 'personimage',
-					// filePath: this.imagePath,
 					file: this.imagePath
 				}
 				uploadPerson(data).then(response => {
-					store.commit('SET_PERSON', baseUrl + response.data.url)
-					uni.navigateBack()
+					this.personPath = response.data.url
 				})
 			},
 			jumpToList() {
-					let missingFields = [];
-					if (!this.videoName.trim()) {
-						missingFields.push('视频名称');
-					}
-					// if (!this.fileInfo.path) {
-					// 	missingFields.push('人物形象');
-					// }
-					if (!this.imagePath) {
-						missingFields.push('人物形象');
-					}
-					// if (!this.modelIndex) {
-					// 	missingFields.push('视频模板');
-					// }
-					const hasContent = this.videoText.trim() !== '' && this.timbre;
-					const hasVoice = this.audioPath;
-					if (!hasContent && !hasVoice) {
-						missingFields.push('文字内容或语音输入');
-					}
-					if (missingFields.length > 0) {
-						this.missingContent = `请确定:${missingFields.join('、')}是否填写完整!`
-						this.$refs.alertDialog.open()
-						return;
-					}
-					// this.uploadImagePath()
-					uni.navigateTo({
-						url: 'list/creatingVideo/creatingVideo',
-					});
+				let missingFields = [];
+				if (!this.videoName.trim()) {
+					missingFields.push('视频名称');
+				}
+				// if (!this.fileInfo.path) {
+				// 	missingFields.push('人物形象');
+				// }
+				if (!this.imagePath) {
+					missingFields.push('人物形象');
+				}
+				// if (!this.modelIndex) {
+				// 	missingFields.push('视频模板');
+				// }
+				const hasContent = this.videoText.trim() !== '' && this.timbre;
+				const hasVoice = this.audioPath;
+				if (!hasContent && !hasVoice) {
+					missingFields.push('文字内容或语音输入');
+				}
+				if (missingFields.length > 0) {
+					this.missingContent = `请确定:${missingFields.join('、')}是否填写完整!`
+					this.$refs.alertDialog.open()
+					return;
+				}
+				uni.navigateTo({
+					url: 'list/creatingVideo/creatingVideo',
+				});
 			},
 			dialogClose() {
 				console.log('点击关闭')
@@ -379,7 +362,8 @@
 		display: block;
 		margin-top: 10px;
 	}
-	/deep/ .uni-border-left{
-		display:none;
+
+	/deep/ .uni-border-left {
+		display: none;
 	}
 </style>

+ 4 - 4
pages/login.vue

@@ -116,10 +116,10 @@
       // 登录成功后,处理函数
       loginSuccess(result) {
 				this.$tab.reLaunch('/pages/index')
-      //   // 设置用户信息
-      //   this.$store.dispatch('GetInfo').then(res => {
-      //     this.$tab.reLaunch('/pages/index')
-      //   })
+        // 设置用户信息
+        this.$store.dispatch('GetInfo').then(res => {
+          this.$tab.reLaunch('/pages/index')
+        })
       }
     }
   }

+ 2 - 2
store/modules/user.js

@@ -15,7 +15,8 @@ const user = {
     name: storage.get(constant.name),
     avatar: storage.get(constant.avatar),
     roles: storage.get(constant.roles),
-    permissions: storage.get(constant.permissions)
+    permissions: storage.get(constant.permissions),
+		person:storage.get(constant.person),
   },
 
   mutations: {
@@ -57,7 +58,6 @@ const user = {
       const uuid = userInfo.uuid
       return new Promise((resolve, reject) => {
         login(username, password, code, uuid).then(res => {
-					console.log(res,'resresres')
           setToken(res.data.access_token)
           commit('SET_TOKEN', res.data.access_token)
           resolve()