wenliming 2 gadi atpakaļ
vecāks
revīzija
9879824896
5 mainītis faili ar 984 papildinājumiem un 1025 dzēšanām
  1. 1 0
      .eslintrc.js
  2. 121 116
      components/qrcode.vue
  3. 834 879
      pages/payment/index.vue
  4. 14 15
      pages/treasure/index.vue
  5. 14 15
      pages/treasure/invite.vue

+ 1 - 0
.eslintrc.js

@@ -11,5 +11,6 @@ module.exports = {
 	plugins: ['vue'],
 	rules: {
 		'vue/multi-word-component-names': 'off',
+		'vue/no-deprecated-filter': 'off',
 	},
 };

+ 121 - 116
components/qrcode.vue

@@ -1,131 +1,136 @@
 <template>
-    <div class="border">
-        <div class="ercode">
-            <canvas id="canvas"></canvas>
-        </div>
-        <div class="info">
-            <div class="font">{{tokenRechargeAddress}}</div>
-            <div class="copy copy-btn" @click="copy" :data-clipboard-text="tokenRechargeAddress">Copy</div>
-        </div>
-    </div>
+	<div class="border">
+		<div class="ercode">
+			<canvas id="canvas"></canvas>
+		</div>
+		<div class="info">
+			<div class="font">{{ tokenRechargeAddress }}</div>
+			<div class="copy copy-btn" @click="copy" :data-clipboard-text="tokenRechargeAddress">Copy</div>
+		</div>
+	</div>
 </template>
 
 <script>
-let QRCode = require('qrcode')
-let ClipboardJS = require('clipboard')
+let QRCode = require('qrcode');
+let ClipboardJS = require('clipboard');
 import Api from '../http/api';
 import { postRequest } from '../http/index';
 import { Toast } from 'vant';
 
 export default {
-    name: 'qrCode',
-    props: ['tokenChain', 'rechargeAddress'],
-    data() {
-        return {
-            tokenRechargeAddress: ''
-        }
-    },
-    mounted() {
-        this.getTokenAddress()
-    },
-    methods: {
-        getTokenAddress() {
-            if (this.rechargeAddress !== '') {
-                // 有过查询
-                this.tokenRechargeAddress = this.rechargeAddress;
-                this.createQRCode(this.rechargeAddress)
-                this.copyToken()
-            } else {
-                // 没查询过
-                postRequest(Api.getTokenRechargeAddress, {
-                    params: {
-                        tokenChain: this.tokenChain
-                    }
-                }).then(res => {
-                    let { code, data } = res;
-                    if (code === 0) {
-                        this.tokenRechargeAddress = data.rechargeAddress;
-                        this.createQRCode(data.rechargeAddress)
-                        this.copyToken()
-                    }
-                })
-            }
-        },
-        createQRCode(str) {
-            var canvas = document.getElementById('canvas')
-            QRCode.toCanvas(canvas, str, {
-                width: 110,
-                height: 110,
-                scale: 1,
-                color: {
-                    dark: '#000', // 二维码前景颜色
-                    light: '#fff' // 二维码背景颜色
-                }
-            }, function (error) {
-                if (error) console.error(error)
-                console.log('success!');
-            })
-        },
-        copyToken() {
-            var clipboard = new ClipboardJS('.copy-btn');
-            clipboard.on('success', function (e) {
-                Toast(`copy success`)
-                e.clearSelection();
-            });
+	name: 'qrCode',
+	props: ['tokenChain', 'rechargeAddress'],
+	data() {
+		return {
+			tokenRechargeAddress: '',
+		};
+	},
+	mounted() {
+		this.getTokenAddress();
+	},
+	methods: {
+		getTokenAddress() {
+			if (this.rechargeAddress !== '') {
+				// 有过查询
+				this.tokenRechargeAddress = this.rechargeAddress;
+				this.createQRCode(this.rechargeAddress);
+				this.copyToken();
+			} else {
+				// 没查询过
+				postRequest(Api.getTokenRechargeAddress, {
+					params: {
+						tokenChain: this.tokenChain,
+					},
+				}).then((res) => {
+					let { code, data } = res;
+					if (code === 0) {
+						this.tokenRechargeAddress = data.rechargeAddress;
+						this.createQRCode(data.rechargeAddress);
+						this.copyToken();
+					}
+				});
+			}
+		},
+		createQRCode(str) {
+			var canvas = document.getElementById('canvas');
+			QRCode.toCanvas(
+				canvas,
+				str,
+				{
+					width: 110,
+					height: 110,
+					scale: 1,
+					color: {
+						dark: '#000', // 二维码前景颜色
+						light: '#fff', // 二维码背景颜色
+					},
+				},
+				function (error) {
+					if (error) console.error(error);
+					console.log('success!');
+				}
+			);
+		},
+		copyToken() {
+			var clipboard = new ClipboardJS('.copy-btn');
+			clipboard.on('success', function (e) {
+				Toast(`copy success`);
+				e.clearSelection();
+			});
 
-            clipboard.on('error', function (e) {
-                Toast(`copy error`)
-            });
-        },
-        copy() {
-            this.$emit('copy');
-        },
-    }
-}
+			clipboard.on('error', function () {
+				Toast(`copy error`);
+			});
+		},
+		copy() {
+			this.$emit('copy');
+		},
+	},
+};
 </script>
 
 <style lang="scss" scoped>
 .border {
-    display: flex;
-    justify-content: space-between;
-    padding: 12px;
-    border-radius: 8px;
-    border: 1px solid #ECECEC;
-    .ercode {
-        overflow: hidden;
-        width: 110px;
-        height: 110px;
-        canvas {
-            width: 100%;
-            height: 100%;
-            transform: scale(1.24);
-        }
-    }
-    .info {
-        display: flex;
-        flex-direction: column;
-        justify-content: center;
-        flex: 1;
-        margin-left: 15px;
-        word-break: break-all;
-        .font {
-            font-size: 14px;
-            line-height: 22px;
-            font-weight: 400;
-        }
-        .copy {
-            display: flex;
-            align-items: center;
-            justify-content: center;
-            color: #1D9BF0;
-            font-size: 16px;
-            font-weight: 600;
-            width: 100%;
-            height: 35px;
-            margin-top: 13px;
-            border-radius: 35px;
-            border: 1px solid #1D9BF0;
-        }
-    }
+	display: flex;
+	justify-content: space-between;
+	padding: 12px;
+	border-radius: 8px;
+	border: 1px solid #ececec;
+	.ercode {
+		overflow: hidden;
+		width: 110px;
+		height: 110px;
+		canvas {
+			width: 100%;
+			height: 100%;
+			transform: scale(1.24);
+		}
+	}
+	.info {
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		flex: 1;
+		margin-left: 15px;
+		word-break: break-all;
+		.font {
+			font-size: 14px;
+			line-height: 22px;
+			font-weight: 400;
+		}
+		.copy {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			color: #1d9bf0;
+			font-size: 16px;
+			font-weight: 600;
+			width: 100%;
+			height: 35px;
+			margin-top: 13px;
+			border-radius: 35px;
+			border: 1px solid #1d9bf0;
+		}
+	}
 }
-</style>
+</style>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 834 - 879
pages/payment/index.vue


+ 14 - 15
pages/treasure/index.vue

@@ -42,7 +42,7 @@
 import axios from 'axios';
 import Cookies from 'js-cookie';
 import { Toast } from 'vant';
-import { isBrowser, appVersionCode, appType } from '../../utils/help.js';
+import { isBrowser, appVersionCode, appType, denetExtensionId, detectExtension } from '../../utils/help.js';
 import Report from '@/log-center/log';
 import MobileGuidePage from '@/components/MobileGuidePage.vue';
 import { PlayType } from '@/types';
@@ -151,20 +151,19 @@ export default {
 	mounted() {
 		this.setCookieMid();
 		this.setTreasureInfo();
-		setTimeout(() => {
-			this.checkInstall()
-				.then(() => {
-					console.log(this.detail);
-					if (this.detail.srcContentId && this.detail.postUserInfo && this.detail.postUserInfo.nickName) {
-						let url = `https://twitter.com/${this.detail.postUserInfo.nickName}/status/${this.detail.srcContentId}`;
-						window.location.replace(url);
-					}
-					this.isLoading = false;
-				})
-				.catch(() => {
-					this.isLoading = false;
-				});
-		}, 1000);
+
+		detectExtension(denetExtensionId, (isInstall) => {
+			if (isInstall) {
+				if (this.detail.srcContentId && this.detail.postUserInfo && this.detail.postUserInfo.nickName) {
+					let url = `https://twitter.com/${this.detail.postUserInfo.nickName}/status/${this.detail.srcContentId}`;
+					window.location.replace(url);
+				}
+				this.isLoading = false;
+			} else {
+				this.isLoading = false;
+			}
+		});
+
 		this.checkBrowser();
 
 		var clipboard = new ClipboardJS('.btn');

+ 14 - 15
pages/treasure/invite.vue

@@ -49,7 +49,7 @@
 import axios from 'axios';
 import Cookies from 'js-cookie';
 import { Toast } from 'vant';
-import { isBrowser, appVersionCode, appType } from '../../utils/help.js';
+import { isBrowser, appVersionCode, appType, denetExtensionId, detectExtension } from '../../utils/help.js';
 import Report from '@/log-center/log';
 import MobileGuidePage from '@/components/MobileGuidePage.vue';
 import { PlayType } from '@/types';
@@ -164,20 +164,18 @@ export default {
 		Cookies.set(this.detail.postId, JSON.stringify({ inviteCode: this.$route.params.id, channel: this.$route.params.channel }), { expires: 100 });
 		this.setTreasureInfo();
 
-		setTimeout(() => {
-			this.checkInstall()
-				.then(() => {
-					console.log(this.detail);
-					if (this.detail.repostSrcContentId && this.detail.inviteUserInfo && this.detail.inviteUserInfo.nickName) {
-						let url = `https://twitter.com/${this.detail.inviteUserInfo.nickName}/status/${this.detail.repostSrcContentId}`;
-						window.location.replace(url);
-					}
-					this.isLoading = false;
-				})
-				.catch(() => {
-					this.isLoading = false;
-				});
-		}, 1000);
+		detectExtension(denetExtensionId, (isInstall) => {
+			if (isInstall) {
+				if (this.detail.repostSrcContentId && this.detail.inviteUserInfo && this.detail.inviteUserInfo.nickName) {
+					let url = `https://twitter.com/${this.detail.inviteUserInfo.nickName}/status/${this.detail.repostSrcContentId}`;
+					window.location.replace(url);
+				}
+				this.isLoading = false;
+			} else {
+				this.isLoading = false;
+			}
+		});
+
 		this.checkBrowser();
 
 		var clipboard = new ClipboardJS('.btn');
@@ -318,6 +316,7 @@ export default {
 				postNickName: this.detail.inviteUserInfo.nickName,
 				postId: this.detail.postId,
 				shareLinkId: this.detail.inviteCode,
+				channelName: this.$route.params.channel,
 			};
 			Cookies.set('jump_info', JSON.stringify(treasureInfo), { expires: 100 });
 		},

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels