1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <script>
- import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
- import {login} from "@/api/member";
- import tools from "@/common/js/tools";
- export default {
- onLaunch: function () {
- console.log("App Launch");
- let bnbObj= tokenpocketBnb.getProvider()
- bnbObj.on('accountsChanged',(accounts)=>{
- if(accounts.length<=0){
- uni.reLaunch({
- 'url':'pages/index/error?errorType=2'
- })
- }else {
- uni.clearStorageSync()
- this.login(accounts[0])
- }
- })
- bnbObj.on('chainChanged',(chainId)=>{
- if(chainId!=='0x38'){
- uni.reLaunch({
- 'url':'pages/index/error?errorType=5'
- })
- }else {
- uni.reLaunch({
- 'url':'pages/index/index'
- })
- }
- })
- uni.$on('noBan',()=>{
- console.log(this.$Route)
- if(this.$Route.path!=='/pages/index/error'){
- uni.reLaunch({
- 'url':'pages/index/error?errorType=5'
- })
- }
- })
- },
- onShow: function () {
- console.log("App Show");
- },
- onHide: function () {
- console.log("App Hide");
- },
- methods:{
- login(Address){
- login({'address':Address}).then((res)=>{
- if(res.code===1){
- tools.setLoginInfo(res.data)
- setTimeout(()=>{
- uni.reLaunch({
- url: '/pages/index/index'
- })
- },50)
- }else {
- uni.reLaunch({
- url: 'pages/login/register?address='+Address
- })
- }
- })
- }
- }
- };
- </script>
- <style>
- /*每个页面公共css */
- @import "./common/css/common";
- /* icon */
- @import "./common/font/iconfont";
- checkbox .wx-checkbox-input {
- border-radius: 50% !important;
- }
- checkbox .wx-checkbox-input.wx-checkbox-input-checked {
- background: linear-gradient(129deg, #f0695b 0%, #ed301d 100%);
- border: 1px solid rgb(239, 74, 57);
- box-shadow: 0px 2px 3px rgba(239, 74, 57, 0.16);
- }
- uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
- border-color: #d1d1d1;
- }
- </style>
|