Эх сурвалжийг харах

feat: 跳转至登录页,右滑不在显示上页的内容

sunxiao 9 цаг өмнө
parent
commit
23c24c9450

+ 1 - 1
src/pages/login/index.vue

@@ -55,7 +55,7 @@ const handleSubmit = async () => {
         prevPage.$vm.init(); 
       }
       
-      uni.navigateTo({
+      uni.redirectTo({
         url: `/pages/answer/index`
       });
 

+ 7 - 7
src/utils/https.js

@@ -20,17 +20,17 @@ const httpInterceptor = {
 uni.addInterceptor('request', httpInterceptor);
 
 export const http = (options) => {
-  // uni.showLoading({
-  //   title: "加载中...",
-  //   mask: true
-  // })
+  uni.showLoading({
+    title: "加载中...",
+    mask: true
+  })
   return new Promise((resolve, reject) => {
     uni.request({
       ...options,
       customUrl: options.url,
       success(result) {
         const { data: res } = result;
-        // uni.hideLoading();
+        uni.hideLoading();
         
         switch(res.code){
           case 200:
@@ -42,7 +42,7 @@ export const http = (options) => {
             break;
           case 401:
             uni.showToast({ icon: 'none', title: '登录失效, 请重新登录', duration: 2 * 1000, mask: true});
-            setTimeout(_ => uni.navigateTo({ url: "/pages/login/index" }), 2000);
+            setTimeout(_ => uni.redirectTo({ url: "/pages/login/index" }), 2000);
             userStore.clearUserInfo();
             reject(res)
             break;
@@ -53,7 +53,7 @@ export const http = (options) => {
         }
       },
       fail(err) {
-        // uni.hideLoading();
+        uni.hideLoading();
         uni.showToast({
           icon: 'none',
           title: '网络错误,换个网络试试',