Explorar o código

修改显示问题

lex hai 1 ano
pai
achega
419cfac96b

+ 6 - 1
src/views/creation/index-share.tsx

@@ -104,6 +104,7 @@ export default defineComponent({
 
     // 点赞
     const onStarChange = async () => {
+      await checkLogin();
       // 是否登录
       if (!state.loginTag) {
         state.loginStatus = true;
@@ -223,7 +224,7 @@ export default defineComponent({
       }
     };
 
-    const __init = async () => {
+    const checkLogin = async () => {
       try {
         // 判断是否登录
         const Authorization = storage.get(ACCESS_TOKEN) || '';
@@ -243,7 +244,11 @@ export default defineComponent({
         storage.remove(ACCESS_TOKEN);
         removeAuth();
         setLogout();
+        state.loginTag = false;
       }
+    };
+    const __init = async () => {
+      await checkLogin();
       try {
         const res = await api_openUserMusicDetail(state.id);
 

+ 17 - 3
src/views/creation/login-change-model/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, onMounted, ref } from 'vue';
+import { defineComponent, onMounted, ref, watch } from 'vue';
 import styles from './index.module.less';
 import { Radio, RadioGroup, Image, Button } from 'vant';
 import checkBoxActive from './images/icon-n-1.png';
@@ -22,16 +22,25 @@ export default defineComponent({
     const btnLoading = ref(false);
     const list = ref([] as any);
 
-    onMounted(async () => {
+    watch(
+      () => props.credential,
+      () => {
+        getUserList();
+      }
+    );
+
+    const getUserList = async () => {
       try {
+        if (!props.credential?.token) return;
         const { data } = await request.post('/edu-app/open/user/getMultiUser', {
           data: {
             ...props.credential
           }
         });
         const result = data || [];
+        const tempList = [] as any;
         result.forEach((item: any) => {
-          list.value.push({
+          tempList.push({
             userId: item.studentId,
             avatar: item.avatar,
             nickname: item.nickname,
@@ -40,9 +49,14 @@ export default defineComponent({
             tokenExpireTime: item.tokenExpireTime
           });
         });
+        list.value = tempList;
       } catch {
         //
       }
+    };
+
+    onMounted(async () => {
+      getUserList();
     });
     return () => (
       <div class={styles.loginChangeModel}>

+ 7 - 0
src/views/creation/login-model/index.tsx

@@ -61,6 +61,10 @@ export default defineComponent({
             loginTag: false,
             data: { ...result.errorData, phone: state.username }
           });
+
+          state.username = '';
+          state.password = '';
+          state.smsCode = '';
         } else {
           storage.set(
             ACCESS_TOKEN,
@@ -73,6 +77,9 @@ export default defineComponent({
           setLogin(userCash.data);
 
           emit('confirm', { loginTag: true });
+          state.username = '';
+          state.password = '';
+          state.smsCode = '';
         }
       } catch (e: any) {
         //