Przeglądaj źródła

1. platform wcfml -> wcfml 2. 鸿币支付, 鸿币不足, 选择鸿币支付, 鸿币足够, 显示支付宝支付 3. 支付取消 / 完成 关闭当前页

gongyan 4 lat temu
rodzic
commit
2239f3fe91

+ 14 - 8
README.md

@@ -129,34 +129,34 @@ appid
 
 -   [ ] 登录成功之后跳转 home 页面, home 页面应该请求一次鸿币, 因为可能还没出结果, 就跳转过去 home 了, 返回值还没拿到
 
-> xjqy 登录逻辑
+> wcfml 登录逻辑
 > jhremember 获取逻辑: 优先从 localStorage 取, 否则从 url 中取, 取到的值都是 json string
 
 -   [x] 从链接中获取 jhremember 不存在, 展示选择登录方式
 -   [x] 存在, 直接展示 login, 并填充账号密码
--   [x] 登录成功, 将 login 返回的用户信息, 前端的记住密码, 和 x-token 都传递给 xjqy
+-   [x] 登录成功, 将 login 返回的用户信息, 前端的记住密码, 和 x-token 都传递给 wcfml
         因为可能没法获取 存储的 x-token, 所以尝试一下登录完成之后先跳链接
 
-> xjqy 快速登录逻辑
+> wcfml 快速登录逻辑
 
 -   [x] 登录成功, 携带用户信息, 在 url 里面, 携带 x-token 在 url 里面 携带密码信息在 url 里面
 
 > 读取路由中的信息修改
 > 路由中必有参数:
-> platform: xjqy
+> platform: wcfml
 > appid:777
 > data: 我存的数据
 
 ## 2021.7.20
 
--   [ ] xjqy 游戏内充值
+-   [ ] wcfml 游戏内充值
 
-> xjqy
+> wcfml
 
 1. 游戏内支付路由参数 /gamepay
 
     > 支付参数: server_id=50001&server_name=圣者 1 服&cp_order_id=0123466789&role_name=刀剑无眼&role_id=5001_12&goods_id=4002&goods_name=100 元宝&amount=10000
-    > 固定参数 platform=xjqy&appid=777&data=xxx(我存的数据)
+    > 固定参数 platform=wcfml&appid=777&data=xxx(我存的数据)
 
 2. 回调地址需要的参数(我这边处理)
 
@@ -166,7 +166,7 @@ appid
     pay: hb/game => 重新拉起支付需要的参数 决定拉起的是鸿币充值还是游戏内充值
     pay_type
     pay_platform
-    固定参数 platform=xjqy&appid=777&data=xxx(我存的数据)
+    固定参数 platform=wcfml&appid=777&data=xxx(我存的数据)
 
 ## 2021.7.21
 
@@ -177,3 +177,9 @@ appid
 
 -   [x] 更新公众号引导图图片
 -   [x] 发送验证码返回错误码, 不倒计时
+
+## 2021.7.28
+
+-   [x] platform wcfml -> wcfml
+-   [x] 鸿币支付, 鸿币不足, 选择鸿币支付, 鸿币足够, 显示支付宝支付
+-   [x] 支付取消 / 完成 关闭当前页

+ 1 - 1
config/dev.env.js

@@ -5,5 +5,5 @@ const prodEnv = require('./prod.env')
 module.exports = merge(prodEnv, {
     NODE_ENV: '"development"',
     API_ROOT: '"//10.10.100.138:8080"', // 测试环境地址
-    xjqyLogin: '"jhfly://localhost/login"', // 仙界情缘登录地址
+    wcfmlLogin: '"jhfly://localhost/login"', // 忘川伏魔录登录地址
 })

+ 1 - 1
config/prod.env.js

@@ -2,6 +2,6 @@
 module.exports = {
     NODE_ENV: '"production"',
     API_ROOT: '"https://api.jhfly.cn"', // 正式环境地址
-    xjqyLogin: '"jhfly://localhost/login"', // 仙界情缘登录地址
+    wcfmlLogin: '"jhfly://localhost/login"', // 忘川伏魔录登录地址
 
 }

+ 1 - 1
config/test.env.js

@@ -5,5 +5,5 @@ const prodEnv = require('./prod.env')
 module.exports = merge(prodEnv, {
     NODE_ENV: '"development"',
     API_ROOT: '"//42.193.163.133:30000"', // 线上测试环境地址
-    xjqyLogin: '"jhfly://localhost/login"', // 仙界情缘登录地址
+    wcfmlLogin: '"jhfly://localhost/login"', // 忘川伏魔录登录地址
 })

+ 11 - 3
src/App.vue

@@ -76,7 +76,7 @@ export default {
       const appid = _appid || this.CONFIG.appid;
       this.appidAction(appid);
 
-      // 获取当前android是哪个(针对特殊处理的包, 比如仙界情缘)
+      // 获取当前android是哪个(针对特殊处理的包, 比如忘川伏魔录)
       const platform = this.$utils.getQueryString("platform");
       this.platformAction(platform);
 
@@ -198,8 +198,8 @@ export default {
 
           //   localStorage.setItem("orderList", JSON.stringify(orderList));
           this.$utils.writeStorage("", "orderList", JSON.stringify(orderList));
-
-          window.location.href = data.url;
+          //   window.location.href = data.url;
+          this.onPayUtil(data.url);
         });
     },
 
@@ -268,6 +268,14 @@ export default {
         });
     },
 
+    // android 和 其他的支付工具函数
+    onPayUtil(payUrl) {
+      // this.androidPayUtil()
+      window.location.href = `${this.$CONFIG.wcfmlPayUrl}?jump=${encodeURI(
+        encodeURIComponent(payUrl)
+      )}`;
+    },
+
     // 订单查询
     queryOrder(order_id) {
       this.$api.query({

+ 4 - 6
src/components/Menu/MenuPay/MenuHbPay.vue

@@ -67,6 +67,7 @@ export default {
     // 返回游戏内支付页面
     back() {
       this.showInnerControl("");
+      this.$utils.closePayPage();
     },
 
     // 充值鸿币
@@ -112,14 +113,11 @@ export default {
         this.canPay = true;
         this.$toast.text("鸿币支付成功");
         this.getFinance();
-        this.back();
+        setTimeout(() => {
+          this.back();
+        }, 3000);
       });
     },
-
-    // 返回  关闭当前浏览器
-    back() {
-      this.showInnerControl("");
-    },
   },
 };
 </script>

+ 2 - 2
src/config.js

@@ -30,8 +30,8 @@ const CONFIG = {
     kfQQ: 3563681140, // 客服qq
     serviceUrl: "//kf.jhfly.cn/chatIndex?kefu_id=kefu2&refer=", // 惊鸿客服url
     storeUrl: "//h5.jhfly.cn/rxzr/activities/dazhuanpan", // 积分商城链接
-    xjqyLoginUrl: "jhfly://localhost/login", // 仙界情缘登录路由
-    xjqyPayUrl: "jhfly://localhost/pay", // 仙界情缘支付路由
+    wcfmlLoginUrl: "jhfly://localhost/login", // 忘川伏魔录登录路由
+    wcfmlPayUrl: "jhfly://localhost/pay", // 忘川伏魔录支付路由
 }
 
 

+ 1 - 1
src/store/index.js

@@ -20,7 +20,7 @@ export default new Vuex.Store({
         showGameInner: "",
         /**
          * android平台
-         * 仙界情缘: xjqy
+         * 忘川伏魔录: wcfml
          */
         platform: "",
     },

+ 34 - 12
src/utils/utils.js

@@ -1,7 +1,10 @@
 import querystring from "querystring"
 import _this from "../main"
+import $CONFIG from "../config"
 var CryptoJS = require('crypto-js');
 var Md5 = require("js-md5");
+
+
 const utils = {
     // 设置cookie
     setCookie(name, value, days) {
@@ -212,10 +215,10 @@ const utils = {
         if (window.android) {
             return this.onRememberFun(account, password)
         }
-        const platform = this.getQueryString("platform");
 
-        // 仙界情缘
-        if (platform === "xjqy") {
+        const platform = this.getQueryString("platform");
+        // 忘川伏魔录
+        if (platform === "wcfml") {
             return this.onRememberFun(account, password)
         }
     },
@@ -293,8 +296,8 @@ const utils = {
         }
 
         const platform = this.getQueryString("platform");
-        // 仙界情缘特制版
-        if (platform == "xjqy") {
+        // 忘川伏魔录特制版
+        if (platform == "wcfml") {
             let data = JSON.parse(decodeURI(decodeURIComponent(this.getQueryString('data')))) || {}
             return localStorage.getItem(keyName) || data[keyName];
         }
@@ -308,10 +311,10 @@ const utils = {
             return
         }
 
-        // 仙界情缘特制版
+        // 忘川伏魔录特制版
         const platform = this.getQueryString("platform");
-        // 仙界情缘特制版
-        if (platform == "xjqy") {
+        // 忘川伏魔录特制版
+        if (platform == "wcfml") {
             localStorage.setItem(keyName, value);
             const query = this.getAllQueryString();
             let data = decodeURI(decodeURIComponent(query.data));
@@ -319,6 +322,7 @@ const utils = {
             query.data[keyName] = value;
             query.data = JSON.stringify(query.data)
             this.routeLink("", query, "", _this)
+            return
         }
     },
 
@@ -327,11 +331,14 @@ const utils = {
         // 安卓内部
         if (window.android) {
             window.android.deleteStorage(bookName, keyName)
+            return
         }
 
-        // 仙界情缘特制版
+        // 忘川伏魔录特制版
         const platform = this.getQueryString("platform");
-        if (platform == "xjqy") {}
+        if (platform == "wcfml") {
+            return
+        }
     },
 
     // 安卓内 销毁数据(bookName)
@@ -339,8 +346,9 @@ const utils = {
         // 安卓内部
         if (window.android) {
             window.android.destoryStorage(bookName)
+            return
         }
-        // 仙界情缘特制版
+        // 忘川伏魔录特制版
     },
 
     // 获取所有bookName里面的key列表
@@ -348,8 +356,9 @@ const utils = {
         // 安卓内部
         if (window.android) {
             window.android.getKeysInStorage(bookName)
+            return
         }
-        // 仙界情缘特制版
+        // 忘川伏魔录特制版
     },
 
     // 对象序列化工具函数
@@ -370,5 +379,18 @@ const utils = {
                 //   console.log(err);
             });
     },
+
+    // 关闭支付页面工具函数
+    closePayPage() {
+        if (window.android) {
+            return
+        }
+
+        const platform = this.getQueryString("platform");
+        if (platform == "wcfml") {
+            window.location.href = $CONFIG.wcfmlPayUrl
+            return
+        }
+    }
 };
 export default utils;

+ 1 - 0
src/views/Counter/Counter.vue

@@ -115,6 +115,7 @@ export default {
     // 返回游戏
     back() {
       console.log("返回");
+      this.$utils.closePayPage();
     },
   },
 };

+ 4 - 1
src/views/GamePay/GamePay.vue

@@ -41,6 +41,7 @@ export default {
     MenuHbPay,
     MenuHbDetail,
   },
+  inject: ["getFinance"],
   data() {
     return {
       showGameInner: "", // 控制显示哪个组件
@@ -49,7 +50,9 @@ export default {
   computed: {},
   watch: {},
   created() {},
-  mounted() {},
+  mounted() {
+    this.getFinance();
+  },
   methods: {
     // 控制显示哪个组件
     showInnerControl(showGameInner) {

+ 1 - 0
src/views/GamePay/GamePayBox.vue

@@ -25,6 +25,7 @@ export default {
     // 返回
     back() {
       this.$emit("close");
+      this.$utils.closePayPage();
     },
   },
 };

+ 2 - 2
src/views/GamePay/GamePayH5.vue

@@ -85,14 +85,14 @@ export default {
   },
   watch: {
     finance(newValue) {
-      newValue
+      newValue > this.query.amount / 100
         ? this.onSelectPayPlatform("ALIPAY")
         : this.onSelectPayPlatform("HB");
     },
   },
   created() {},
   mounted() {
-    this.finance
+    this.finance > this.query.amount / 100
       ? this.onSelectPayPlatform("ALIPAY")
       : this.onSelectPayPlatform("HB");
   },

+ 6 - 6
src/views/Login/LoginBox.vue

@@ -113,8 +113,8 @@ export default {
       if (window.android) {
         this.androidLogin(routeName, params);
       }
-      if (this.platform === "xjqy") {
-        this.xjqyLogin(data);
+      if (this.platform === "wcfml") {
+        this.wcfmlLogin(data);
       }
     },
 
@@ -125,8 +125,8 @@ export default {
       this.routeLink(routeName, params);
     },
 
-    // xjqy 仙界情缘登录工具函数
-    xjqyLogin(data) {
+    // wcfml 忘川伏魔录登录工具函数
+    wcfmlLogin(data) {
       // 记住密码 todo
       const savedata = this.$utils.getQueryString("data");
 
@@ -135,8 +135,8 @@ export default {
         uid: data.uid,
         data: encodeURIComponent(savedata),
       });
-      // window.open(`${this.$CONFIG.xjqyLoginUrl}?${query}`);  这个没法
-      window.location.href = `${this.$CONFIG.xjqyLoginUrl}?${query}`;
+      // window.open(`${this.$CONFIG.wcfmlLoginUrl}?${query}`);  这个没法
+      window.location.href = `${this.$CONFIG.wcfmlLoginUrl}?${query}`;
     },
   },
 };

+ 5 - 5
src/views/Visitor/Visitor.vue

@@ -78,8 +78,8 @@ export default {
         this.$toast.text("账号密码已复制,请注意保存");
 
         const { platform } = this;
-        // xjqy 仙界情缘
-        if (platform === "xjqy") {
+        // wcfml 忘川伏魔录
+        if (platform === "wcfml") {
           // 跳转对应登录链接
           const { userInfo } = this.$route.params;
           const data = this.$utils.getQueryString("data");
@@ -91,9 +91,9 @@ export default {
           // 1. 返回登录页, 因为游戏内点击返回是返回到原来的url
           this.routeLink("Login");
 
-          // 2. 调用xjqy的登录
-          // window.open(`${this.$CONFIG.xjqyLoginUrl}?${query}`);
-          window.location.href = `${this.$CONFIG.xjqyLoginUrl}?${query}`;
+          // 2. 调用wcfml的登录
+          // window.open(`${this.$CONFIG.wcfmlLoginUrl}?${query}`);
+          window.location.href = `${this.$CONFIG.wcfmlLoginUrl}?${query}`;
         }
       });
     },