Jelajahi Sumber

新增打开app逻辑

wangfumin 1 bulan lalu
induk
melakukan
10d94081bf
5 mengubah file dengan 29 tambahan dan 193 penghapusan
  1. 4 33
      pages/guicangDetails/index.js
  2. 5 1
      pages/login_page/index.js
  3. 7 155
      pages/user/index.js
  4. 12 0
      utils/newServices.js
  5. 1 4
      utils/services.js

+ 4 - 33
pages/guicangDetails/index.js

@@ -356,41 +356,12 @@ Page({
     });
   },
 
-  // 下载APP - 跳转到苹果商店
+  // 下载APP - 跳转到webview页面
   downloadApp: function() {
-    // 苹果商店链接,需要替换为实际的App Store链接
-    const appStoreUrl = 'https://apps.apple.com/cn/app/%E5%BE%AE%E4%BF%A1/id414478124';
+    const downloadUrl = 'https://test.4dmuseum.cn/admin/swkzMobile.html';
     
-    // 使用 wx.miniapp.openUrl 直接打开第三方App
-    wx.miniapp.openUrl({
-      url: appStoreUrl,
-      success: () => {
-        console.log('成功打开App Store');
-      },
-      fail: (err) => {
-        console.log('打开App Store失败:', err);
-        // 如果直接打开失败,则使用备用方案
-        wx.showModal({
-          title: '下载APP',
-          content: '即将跳转到App Store下载归藏APP',
-          confirmText: '前往下载',
-          cancelText: '取消',
-          success: (res) => {
-            if (res.confirm) {
-              wx.setClipboardData({
-                data: appStoreUrl,
-                success: () => {
-                  wx.showToast({
-                    title: '链接已复制,请在浏览器中打开',
-                    icon: 'none',
-                    duration: 3000
-                  });
-                }
-              });
-            }
-          }
-        });
-      }
+    wx.navigateTo({
+      url: `/pages/webview/index?url=${encodeURIComponent(downloadUrl)}`
     });
   }
 })

+ 5 - 1
pages/login_page/index.js

@@ -3,6 +3,10 @@ const {
   request,
   serverName
 } = require('../../utils/services');
+// const {
+//   request,
+//   serverName
+// } = require('../../utils/newServices.js');
 // const WxParse = require('../../../common/component/wxParse/wxParse.js');
 const {
   Toast,
@@ -39,7 +43,7 @@ Page({
           } = res;
           if (code) {
             wx.request({
-              url: serverName + '/wx/api/user/getLoginSessionKey',
+              url: serverName + '/wx/user/getLoginSessionKey',
               data: {
                 encryptedData,
                 iv,

+ 7 - 155
pages/user/index.js

@@ -1,9 +1,12 @@
 // pages/user/index.js
 const {
-  request,
   serverName
 } = require('../../utils/services');
 const {
+  request,
+  newServerName
+} = require('../../utils/newServices.js');
+const {
   Toast
 } = require('../../utils/util.js');
 var app = getApp();
@@ -63,7 +66,7 @@ Page({
     let loginSessionKey = wx.getStorageSync("token");
 
     let requestTask = wx.request({
-      url: serverName + '/wx/api/user/longPolling',
+      url: newServerName + '/wx/user/longPolling',
       data: {
         loginSessionKey
       },
@@ -190,7 +193,7 @@ Page({
         wx.checkSession({
           success: res => {
             wx.request({
-              url: serverName + '/wx/api/user/checkLoginSessionKey',
+              url: newServerName + '/wx/user/checkLoginSessionKey',
               data: {
                 loginSessionKey
               },
@@ -289,7 +292,7 @@ Page({
 
             if (code) {
               wx.request({
-                url: serverName + '/wx/api/user/getLoginSessionKey',
+                url: newServerName + '/wx/user/getLoginSessionKey',
                 data: {
                   encryptedData,
                   iv,
@@ -321,29 +324,6 @@ Page({
                   Toast.hideLoading();
                 },
               })
-  
-  
-              // request["getLoginSessionKey"]({
-              //   encryptedData,
-              //   iv,
-              //   code,
-              //   loginSessionKey:''
-              // }, "post", res => {
-              //   if (res.data.code > -1) {
-              //     let {
-              //       loginSessionKey
-              //     } = res.data.data;
-              //     wx.setStorageSync('token', loginSessionKey)
-              //     this.isLongPolling();
-              //     console.log(loginSessionKey)
-              //   }
-  
-              // }, err => {
-  
-              // }, complete => {
-              //   this._isLogin();
-              //   Toast.hideLoading();
-              // })
             }
           }
         })
@@ -364,134 +344,6 @@ Page({
     })
   },
 
-// 微信改版了 
-  // _getUserInfoToLogin: function(e) {
-  //   Toast.showToast2('loading');
-
-  //   if (e.detail.encryptedData) {
-  //     // 可以将 res 发送给后台解码出 unionId
-  //     // app.globalData.userInfo = res.userInfo;
-  //     // app.globalData.encryptedData = res.encryptedData;
-  //     // app.globalData.iv = res.iv;
-  //     let {
-  //       encryptedData,
-  //       iv,
-  //       userInfo
-  //     } = e.detail;
-
-  //     console.log('---------',e);
-
-  //     app.globalData.userInfo = userInfo;
-  //     wx.setStorageSync("userInfo", userInfo)
-  //     this.setData({
-  //       avatarUrl: wx.getStorageSync('userInfo').avatarUrl
-  //     })
-  //     wx.login({
-  //       success: res => {
-  //         let {
-  //           code
-  //         } = res;
-  //         if (code) {
-
-  //           console.log(123456,code);
-
-  //           wx.request({
-  //             url: serverName + '/wx/api/user/getLoginSessionKey',
-  //             data: {
-  //               encryptedData,
-  //               iv,
-  //               code,
-  //             },
-  //             header: {
-  //               'content-type': 'application/x-www-form-urlencoded'
-  //             },
-  //             method: 'post',
-  //             // dataType: 'json',
-  //             // responseType: 'text',
-  //             success: res => {
-  //               if (res.data.code > -1) {
-  //                 let {
-  //                   loginSessionKey
-  //                 } = res.data.data;
-  //                 wx.setStorageSync('token', loginSessionKey)
-  //               }
-  //               else{
-  //                 Toast.showToast('warn', '登录失败,请重试');
-  //               }
-  //             },
-  //             fail: res => {
-  //               Toast.showToast('warn', '登录失败,请重试');
-                
-  //             },
-  //             complete: res=> {
-  //               this._isLogin();
-  //               Toast.hideLoading();
-  //             },
-  //           })
-
-
-  //           request["getLoginSessionKey"]({
-  //             encryptedData,
-  //             iv,
-  //             code,
-  //             loginSessionKey:''
-  //           }, "post", res => {
-  //             if (res.data.code > -1) {
-  //               let {
-  //                 loginSessionKey
-  //               } = res.data.data;
-  //               wx.setStorageSync('token', loginSessionKey)
-  //               this.isLongPolling();
-  //               console.log(loginSessionKey)
-  //             }
-
-  //           }, err => {
-
-  //           }, complete => {
-  //             this._isLogin();
-  //             Toast.hideLoading();
-  //           })
-  //         }
-  //       }
-  //     })
-
-
-
-  //     // console.log(res.userInfo)
-
-  //     // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-  //     // 所以此处加入 callback 以防止这种情况
-  //     if (this.userInfoReadyCallback) {
-  //       this.userInfoReadyCallback(res)
-  //     }
-  //   }
-
-  // },
-
-  // _login:function(e){
-  //   console.log(e)
-  //   // if(!this.data.isLogin){
-  //   //   Toast.showToast2('loading');
-  //   //   wx.getSetting({
-  //   //     success: res => {
-  //   //       console.log(res.authSetting['scope.userInfo'])
-  //   //       if (!res.authSetting['scope.userInfo'] == undefined || res.authSetting['scope.userInfo'] == false) {
-  //   //         Toast.showToast('tip', '四维看展申请获取个人信息权限', () => {
-  //   //           wx.openSetting({
-  //   //             success: res => {
-  //   //               this._getUserInfoToLogin();
-  //   //             }
-  //   //           });
-  //   //         });
-  //   //       } else {
-  //   //         // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
-  //   //         this._getUserInfoToLogin();
-  //   //       }
-  //   //     }
-  //   //   })
-  //   // }
-  // },
-
   _logout: function() {
 
     if (this.data.isLogin) {

+ 12 - 0
utils/newServices.js

@@ -4,10 +4,21 @@ const {
 
 // 新的API服务域名
 const serverName = 'https://test.4dmuseum.cn/api';
+const newServerName = 'https://test.4dmuseum.cn/api';
 const fileBaseURL = 'https://test.4dmuseum.cn/swkzModel/index.html';
 const cosBaseUrl = 'https://swkz-1332577016.cos.ap-guangzhou.myqcloud.com/'
 
 const urls = {
+  //用户API
+  getLoginSessionKey: '/wx/user/getLoginSessionKey',
+  // checkPaySessionKey:'/wx/api/user/checkLoginSessionKey',
+  checkLoginSessionKey: '/wx/user/getBrowsedExhibitions',
+
+  logout: '/wx/user/logout',
+  isCollect: '/wx/exhibition/like',
+  collectExhibitions: "/wx/user/getExhibitions",
+  getOrders: '/wx/user/getOrders',
+
   // 归藏轮播图接口
   getAntiqueList: '/wx/antique/page',
   // 归藏详情接口
@@ -214,5 +225,6 @@ const request = {
 
 module.exports.request = request;
 module.exports.serverName = serverName;
+module.exports.newServerName = newServerName;
 module.exports.cosBaseUrl = cosBaseUrl;
 module.exports.fileBaseURL = fileBaseURL;

+ 1 - 4
utils/services.js

@@ -70,10 +70,7 @@ const urls = {
   recommend: '/wx/api/exhibition/recommend',
 
   //线下展讯热门推荐
-  offlineRecommend: '/wx/api/exhibition/offlineRecommend',
-
-  // 归藏的接口
-  getGuicangBanner: 'api/wechat/antique/page',
+  offlineRecommend: '/wx/api/exhibition/offlineRecommend'
 };
 // 上传路径
 const uploadUrls = {};