瀏覽代碼

[bug] eslint fix

jihuaqiang 2 年之前
父節點
當前提交
466d41ea42
共有 12 個文件被更改,包括 2363 次插入1800 次删除
  1. 2 2
      .editorconfig
  2. 15 0
      .eslintrc.js
  3. 4 0
      .husky/pre-commit
  4. 8 0
      .prettierrc.json
  5. 353 318
      components/CustomCardCover.vue
  6. 18 1
      package.json
  7. 313 326
      pages/index.vue
  8. 766 758
      pages/luckdraw.vue
  9. 252 264
      pages/toolbox/index.vue
  10. 8 7
      test/NuxtLogo.spec.js
  11. 109 109
      utils/help.js
  12. 515 15
      yarn.lock

+ 2 - 2
.editorconfig

@@ -2,8 +2,8 @@
 root = true
 
 [*]
-indent_style = space
-indent_size = 2
+indent_style = tab
+indent_size = 4
 end_of_line = lf
 charset = utf-8
 trim_trailing_whitespace = true

+ 15 - 0
.eslintrc.js

@@ -0,0 +1,15 @@
+module.exports = {
+	env: {
+		es2021: true,
+		node: true,
+	},
+	extends: ['eslint:recommended', 'plugin:vue/vue3-essential'],
+	parserOptions: {
+		ecmaVersion: 'latest',
+		sourceType: 'module',
+	},
+	plugins: ['vue'],
+	rules: {
+		'vue/multi-word-component-names': 'off',
+	},
+};

+ 4 - 0
.husky/pre-commit

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+yarn lint-staged

+ 8 - 0
.prettierrc.json

@@ -0,0 +1,8 @@
+{
+	"printWidth": 300,
+  	"tabWidth": 4,
+  	"useTabs": true,
+  	"semi": true,
+  	"singleQuote": true,
+  	"bracketSpacing": true
+}

+ 353 - 318
components/CustomCardCover.vue

@@ -1,354 +1,389 @@
 <!-- 自定义卡片红包封面 -->
 <!-- todo:目前只有自定义奖品类型,货币类型待添加 -->
 <template>
-    <!-- 改版之后的卡片 -->
-    <div class="not-open-custom-card custom-card">
-        <img class="customImg" v-if="posterType === 2 && !!customPosterInstalled" :src="customPosterInstalled" />
-        <div class="common-top" v-else>
-          <img class="cover" v-if="isLottaryCpd" :src="require('../static/svg/img-custom-lottary-bg.svg')"  />
-          <img class="cover" v-else :src="require('../static/svg/img-custom-common-bg.svg')"  />
-          <img class="gift" :src="require('../static/svg/icon-gift.gif')" />
-          <div class="prize">
-              <font-zoom width="340">
-                <img class="icon" :src="require('../static/svg/icon-gift-inline.svg')"/>
-                <span class="name" id="custom-name" >
-                  {{customizedReward}}
-                  <span class="total">X{{totalCount}}</span>
-                </span>
-              </font-zoom>
-          </div>
-        </div>
+	<!-- 改版之后的卡片 -->
+	<div class="not-open-custom-card custom-card">
+		<img class="customImg" v-if="posterType === 2 && !!customPosterInstalled" :src="customPosterInstalled" />
+		<div class="common-top" v-else>
+			<img class="cover" v-if="isLottaryCpd" :src="require('../static/svg/img-custom-lottary-bg.svg')" />
+			<img class="cover" v-else :src="require('../static/svg/img-custom-common-bg.svg')" />
+			<img class="gift" :src="require('../static/svg/icon-gift.gif')" />
+			<div class="prize">
+				<font-zoom width="340">
+					<img class="icon" :src="require('../static/svg/icon-gift-inline.svg')" />
+					<span class="name" id="custom-name">
+						{{ customizedReward }}
+						<span class="total">X{{ totalCount }}</span>
+					</span>
+				</font-zoom>
+			</div>
+		</div>
 
-        <!-- 底部公共模块 -->
-        <div class="common-bottom" v-if="showBottomInfo">
-            <div class="theme">
-                <img v-if="isLottaryCpd" class="theme-icon" :src="require('../static/svg/icon-last-time.svg')"/>
-                <span v-if="isLottaryCpd" class="theme-time" >{{validity || '00:00:00'}}</span>
-                <span class="theme-info">{{isLottaryCpd ? 'Left' : 'Instant Giveaway'}}</span>
-            </div>
-            <div class="winner-info">
-                <font-zoom width="340">
-                  <span class="count">{{totalCount}}Winners</span>
-                  <span>to Share </span>
-                  <span class="prize-name">{{isMoneyRewardCpd ? amountValue + ' ' + tokenSymbol : customizedReward}}</span>
-                </font-zoom>
-            </div>
-        </div>
-    </div>
+		<!-- 底部公共模块 -->
+		<div class="common-bottom" v-if="showBottomInfo">
+			<div class="theme">
+				<img v-if="isLottaryCpd" class="theme-icon" :src="require('../static/svg/icon-last-time.svg')" />
+				<span v-if="isLottaryCpd" class="theme-time">{{ validity || '00:00:00' }}</span>
+				<span class="theme-info">{{ isLottaryCpd ? 'Left' : 'Instant Giveaway' }}</span>
+			</div>
+			<div class="winner-info">
+				<font-zoom width="340">
+					<span class="count">{{ totalCount }}Winners</span>
+					<span>to Share </span>
+					<span class="prize-name">{{ isMoneyRewardCpd ? amountValue + ' ' + tokenSymbol : customizedReward }}</span>
+				</font-zoom>
+			</div>
+		</div>
+	</div>
 </template>
 
 <script>
-import { formatSecondsAsDaysOrTime } from "../utils/help";
-import FontZoom  from './FontZoom.vue';
-import { RewardType, PlayType } from "../types";
+import FontZoom from './FontZoom.vue';
+import { RewardType, PlayType } from '../types';
 export default {
-  name:'CustomCardCover',
-  props: {
-    totalCount: 0,
-    amountValue: 0,
-    tokenSymbol: "",
-    playType: 1,
-    validityDuration: "",
-    userInfo: {},
-    rewardType: 1,
-    customizedReward: "",
-    validity: "",
-    showBottomInfo: true,
-    customPosterInstalled: "",
-    posterType: 1
-  },
-  data() {
-      return {
-          amount_font_size: 22,
-      }
-  },
-  computed: {
-    isMoneyRewardCpd() {
-      return this.rewardType === RewardType.money
-    },
-    isLottaryCpd() {
-      return this.playType === PlayType.lottery
-    }
-  },
-  mounted() {
-      this.setFontSize()
-  },
-  methods: {
-      setFontSize() {
-          let lendom = document.querySelector('#custom-name');
-          if (lendom) {
-              let lenstr = lendom.innerText.length;
-              let num = parseInt(450 / lenstr);
-              this.amount_font_size = num < 22 ? num : 22;
-          }
-      }
-  },
-  components: { FontZoom }
-}
+	name: 'CustomCardCover',
+	props: {
+		totalCount: {
+			type: Number,
+			default: 0,
+		},
+		amountValue: {
+			type: Number,
+			default: 0,
+		},
+		tokenSymbol: {
+			type: String,
+			default: '',
+		},
+		playType: {
+			type: Number,
+			default: 1,
+		},
+		validityDuration: {
+			type: String,
+			default: '',
+		},
+		userInfo: {
+			type: Object,
+			default: () => {},
+		},
+		rewardType: {
+			type: Number,
+			default: 1,
+		},
+		customizedReward: {
+			type: String,
+			default: '',
+		},
+		validity: {
+			type: String,
+			default: '',
+		},
+		showBottomInfo: {
+			type: Boolean,
+			default: true,
+		},
+		customPosterInstalled: {
+			type: String,
+			default: '',
+		},
+		posterType: {
+			type: Number,
+			default: 1,
+		},
+	},
+	data() {
+		return {
+			amount_font_size: 22,
+		};
+	},
+	computed: {
+		isMoneyRewardCpd() {
+			return this.rewardType === RewardType.money;
+		},
+		isLottaryCpd() {
+			return this.playType === PlayType.lottery;
+		},
+	},
+	mounted() {
+		this.setFontSize();
+	},
+	methods: {
+		setFontSize() {
+			let lendom = document.querySelector('#custom-name');
+			if (lendom) {
+				let lenstr = lendom.innerText.length;
+				let num = parseInt(450 / lenstr);
+				this.amount_font_size = num < 22 ? num : 22;
+			}
+		},
+	},
+	components: { FontZoom },
+};
 </script>
 
 <style scoped lang="scss">
 .not-open-custom-card {
-    width: 100%;
-    height: 100%;
-    position: relative;
-    border-radius: 16px;
-    filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
+	width: 100%;
+	height: 100%;
+	position: relative;
+	border-radius: 16px;
+	filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
 
-    .customImg {
-        width: 100%;
-        min-height: 373px;
-    }
-    .common-top {
-      position: relative;
-    }
+	.customImg {
+		width: 100%;
+		min-height: 373px;
+	}
+	.common-top {
+		position: relative;
+	}
 
-    .money-area {
-        width: 100%;
-        position: absolute;
-        top: 65px;
+	.money-area {
+		width: 100%;
+		position: absolute;
+		top: 65px;
 
-        .txt {
-            font-weight: 800;
-            font-size: 16px;
-            text-align: center;
-            letter-spacing: 0.3px;
-            color: #ffffff;
-        }
+		.txt {
+			font-weight: 800;
+			font-size: 16px;
+			text-align: center;
+			letter-spacing: 0.3px;
+			color: #ffffff;
+		}
 
-        .coin {
-            text-align: center;
-            width: 100%;
-            padding: 6px 0;
-            margin: 0 auto;
-            display: flex;
-            align-items: center;
-            justify-content: center;
+		.coin {
+			text-align: center;
+			width: 100%;
+			padding: 6px 0;
+			margin: 0 auto;
+			display: flex;
+			align-items: center;
+			justify-content: center;
 
-            img {
-                width: 46px;
-                height: 46px;
-                border-radius: 50%;
-                border: 3px solid #ffffff;
-            }
+			img {
+				width: 46px;
+				height: 46px;
+				border-radius: 50%;
+				border: 3px solid #ffffff;
+			}
 
-            span {
-                margin-left: 15px;
-                font-weight: 800;
-                font-size: 60px;
-                line-height: 76px;
-                color: #ffffff;
-            }
-        }
+			span {
+				margin-left: 15px;
+				font-weight: 800;
+				font-size: 60px;
+				line-height: 76px;
+				color: #ffffff;
+			}
+		}
 
-        .people {
-            font-weight: 800;
-            font-size: 13px;
-            line-height: 16px;
-            letter-spacing: 0.05em;
-            color: #ffffff;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-        }
+		.people {
+			font-weight: 800;
+			font-size: 13px;
+			line-height: 16px;
+			letter-spacing: 0.05em;
+			color: #ffffff;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+		}
 
-        .time-area {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            width: 100%;
-            height: 46px;
-            background: rgba(0,0,0,.15);
-            color: #FFCC4D;
-            font-weight: 900;
-            font-size: 26px;
-            margin-top: -10px;
-            .icon-clock {
-                width: 26px;
-                height: 26px;
-                margin-right: 10px;
-            }
-        }
-    }
+		.time-area {
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			width: 100%;
+			height: 46px;
+			background: rgba(0, 0, 0, 0.15);
+			color: #ffcc4d;
+			font-weight: 900;
+			font-size: 26px;
+			margin-top: -10px;
+			.icon-clock {
+				width: 26px;
+				height: 26px;
+				margin-right: 10px;
+			}
+		}
+	}
 
-    .title {
-        position: absolute;
-        top: 15px;
-        left: 15px;
-        z-index: 3;
-        width: 100%;
-        display: flex;
-        align-items: center;
+	.title {
+		position: absolute;
+		top: 15px;
+		left: 15px;
+		z-index: 3;
+		width: 100%;
+		display: flex;
+		align-items: center;
 
-        img {
-            width: 24px;
-            height: 24px;
-            border: 2px solid #fff;
-            border-radius: 50%;
-        }
+		img {
+			width: 24px;
+			height: 24px;
+			border: 2px solid #fff;
+			border-radius: 50%;
+		}
 
-        span {
-            margin-left: 10px;
-            font-weight: 600;
-            font-size: 16px;
-            letter-spacing: 0.3px;
-            color: #fff;
-        }
-    }
+		span {
+			margin-left: 10px;
+			font-weight: 600;
+			font-size: 16px;
+			letter-spacing: 0.3px;
+			color: #fff;
+		}
+	}
 
-    // .txt {
-    //   width: 100%;
-    //   position: absolute;
-    //   font-style: normal;
-    //   font-weight: 700;
-    //   font-size: 42px;
-    //   line-height: 50px;
-    //   text-align: center;
+	// .txt {
+	//   width: 100%;
+	//   position: absolute;
+	//   font-style: normal;
+	//   font-weight: 700;
+	//   font-size: 42px;
+	//   line-height: 50px;
+	//   text-align: center;
 
-    //   color: #FFF2D3;
-    //   top: 90px;
-    //   z-index: 3;
-    // }
+	//   color: #FFF2D3;
+	//   top: 90px;
+	//   z-index: 3;
+	// }
 
-    img {
-        width: 100%;
-    }
+	img {
+		width: 100%;
+	}
 
-    .cover {
-        border-radius: 16px;
-    }
+	.cover {
+		border-radius: 16px;
+	}
 
-    .up {
-        position: absolute;
-        top: 0;
-        // box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
-        z-index: 1;
-    }
+	.up {
+		position: absolute;
+		top: 0;
+		// box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
+		z-index: 1;
+	}
 
-    .down {
-        position: absolute;
-        top: 253px;
-    }
+	.down {
+		position: absolute;
+		top: 253px;
+	}
 
-    .open {
-        width: 335px;
-        height: 50px;
-        cursor: pointer;
-        position: absolute;
-        bottom: 28px;
-        left: 50%;
-        margin-left: -167.5px;
-        z-index: 2;
-    }
+	.open {
+		width: 335px;
+		height: 50px;
+		cursor: pointer;
+		position: absolute;
+		bottom: 28px;
+		left: 50%;
+		margin-left: -167.5px;
+		z-index: 2;
+	}
 
-    .open-gif {
-        width: 200px;
-        height: 200px;
-        text-align: center;
-        position: absolute;
-        bottom: 90px;
-        left: 50%;
-        margin-left: -100px;
-        z-index: 3;
-    }
+	.open-gif {
+		width: 200px;
+		height: 200px;
+		text-align: center;
+		position: absolute;
+		bottom: 90px;
+		left: 50%;
+		margin-left: -100px;
+		z-index: 3;
+	}
 }
 .custom-card {
-    position: relative;
-    background:#111214;
-    width: 100%;
-    position: relative;
-    border-radius: 10px;
-    filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
-    .cover {
-        width: 100%;
-        border-radius: 10px 10px 0 0;
-    }
-    .gift {
-        width: 210px;
-        position: absolute;
-        left: 50%;
-        top: 83px;
-        transform: translateX(-50%);
-    }
-    .prize {
-        width: 100%;
-        position: absolute;
-        top: 76%;
-        left: 0;
-        height: 47px;
-        display: flex;
-        flex-direction: row;
-        justify-content: center;
-        font-style: normal;
-        font-weight: 800;
-        font-size: 22px;
-        line-height: 47px;
-        letter-spacing: 0.3px;
+	position: relative;
+	background: #111214;
+	width: 100%;
+	position: relative;
+	border-radius: 10px;
+	filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
+	.cover {
+		width: 100%;
+		border-radius: 10px 10px 0 0;
+	}
+	.gift {
+		width: 210px;
+		position: absolute;
+		left: 50%;
+		top: 83px;
+		transform: translateX(-50%);
+	}
+	.prize {
+		width: 100%;
+		position: absolute;
+		top: 76%;
+		left: 0;
+		height: 47px;
+		display: flex;
+		flex-direction: row;
+		justify-content: center;
+		font-style: normal;
+		font-weight: 800;
+		font-size: 22px;
+		line-height: 47px;
+		letter-spacing: 0.3px;
 
-        .icon {
-            width: 24px;
-        }
-        .name {
-            padding: 0 7px;
-            color: #fff;
-        }
-        .total {
-            color: #F5C03F;
-        }
-    }
-    .common-bottom {
-        width: 100%;
-        height: 62px;
-        background:#111214;
-        border-radius: 0 0 10px 10px;
-        padding: 10px 16px;
-        font-weight: 500;
-        font-size: 12px;
-        line-height: 14px;
-        letter-spacing: 0.3px;
-        color: #838383;
-        line-height: 20px;
-        .theme {
-            display: flex;
-            height: 20px;
-            align-items: center;
-            justify-content: flex-start;
-            &-icon {
-                width: 12px;
-            }
-            &-time {
-                margin: 0 4px;
-                color: #1D9BF0;
-            }
-        }
-        .winner-info {
-            display: flex;
-            height: 20px;
-            align-items: center;
-            justify-content: flex-start;
-            margin-bottom: 13px;
-            .count{
-                color: #1D9BF0;
-                margin-right: 4px;
-            }
-            .prize-name {
-                color: #1D9BF0;
-                margin-left: 4px;
-            }
-        }
-        .open-btn {
-            width: 100%;
-            height: 45px;
-            background: linear-gradient(180deg, #4AB6FF 0%, #1D9BF0 100%, #1D9BF0 100%);
-            border: 1.5px solid rgba(255, 255, 255, 0.15);
-            border-radius: 52px;
-            line-height: 45px;
-            text-align: center;
-            cursor: pointer;
-            font-weight: 800;
-            font-size: 16px;
-            color: #FFFFFF;
-        }
-    }
+		.icon {
+			width: 24px;
+		}
+		.name {
+			padding: 0 7px;
+			color: #fff;
+		}
+		.total {
+			color: #f5c03f;
+		}
+	}
+	.common-bottom {
+		width: 100%;
+		height: 62px;
+		background: #111214;
+		border-radius: 0 0 10px 10px;
+		padding: 10px 16px;
+		font-weight: 500;
+		font-size: 12px;
+		line-height: 14px;
+		letter-spacing: 0.3px;
+		color: #838383;
+		line-height: 20px;
+		.theme {
+			display: flex;
+			height: 20px;
+			align-items: center;
+			justify-content: flex-start;
+			&-icon {
+				width: 12px;
+			}
+			&-time {
+				margin: 0 4px;
+				color: #1d9bf0;
+			}
+		}
+		.winner-info {
+			display: flex;
+			height: 20px;
+			align-items: center;
+			justify-content: flex-start;
+			margin-bottom: 13px;
+			.count {
+				color: #1d9bf0;
+				margin-right: 4px;
+			}
+			.prize-name {
+				color: #1d9bf0;
+				margin-left: 4px;
+			}
+		}
+		.open-btn {
+			width: 100%;
+			height: 45px;
+			background: linear-gradient(180deg, #4ab6ff 0%, #1d9bf0 100%, #1d9bf0 100%);
+			border: 1.5px solid rgba(255, 255, 255, 0.15);
+			border-radius: 52px;
+			line-height: 45px;
+			text-align: center;
+			cursor: pointer;
+			font-weight: 800;
+			font-size: 16px;
+			color: #ffffff;
+		}
+	}
 }
 </style>

+ 18 - 1
package.json

@@ -19,7 +19,19 @@
     "start": "nuxt start",
     "pm2": "pm2 start yarn --interpreter bash --name oitboy-front -- start",
     "generate": "nuxt generate",
-    "test": "jest"
+    "prepare": "husky install"
+  },
+  "husky": {
+    "hooks": {
+      "pre-commit": "lint-staged"
+    }
+  },
+  "lint-staged": {
+    "*.{js,vue}": [
+      "prettier --write",
+      "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
+      "git add"
+    ]
   },
   "dependencies": {
     "axios": "^0.26.1",
@@ -44,7 +56,12 @@
     "@vue/test-utils": "^1.3.0",
     "babel-core": "7.0.0-bridge.0",
     "babel-jest": "^27.4.4",
+    "eslint": "^8.19.0",
+    "eslint-plugin-vue": "^9.2.0",
+    "husky": "^8.0.1",
     "jest": "^27.4.4",
+    "lint-staged": "^13.0.3",
+    "prettier": "^2.7.1",
     "sass": "^1.49.11",
     "sass-loader": "^10.2.1",
     "vue-jest": "^3.0.4"

File diff suppressed because it is too large
+ 313 - 326
pages/index.vue


File diff suppressed because it is too large
+ 766 - 758
pages/luckdraw.vue


+ 252 - 264
pages/toolbox/index.vue

@@ -1,297 +1,285 @@
 <template>
-    <div class="main">
-        <!-- pc -->
-        <div v-if="device == 'chrome' || device == 'no-chrome'" class="content">
-            <v-logo></v-logo>
-            <div class="tool-cover">
-                <img :src="detail.postBizData.linkImagePath" alt="">
-            </div>
-            <!-- 非chrome -->
-            <div v-if="device == 'no-chrome'">
-                <div class="txt">Use chrome browser to access Subway Surfers</div>
-                <install-chrome></install-chrome>
-            </div>
-            <!-- chrome -->
-            <div v-if="device == 'chrome'">
-                <div class="txt">Use chrome browser to access Subway Surfers</div>
-                <install-extension :extensionsInstallUrl="config.extensionsInstallUrl"></install-extension>
-            </div>
-        </div>
+	<div class="main">
+		<!-- pc -->
+		<div v-if="device == 'chrome' || device == 'no-chrome'" class="content">
+			<v-logo></v-logo>
+			<div class="tool-cover">
+				<img :src="detail.postBizData.linkImagePath" alt="" />
+			</div>
+			<!-- 非chrome -->
+			<div v-if="device == 'no-chrome'">
+				<div class="txt">Use chrome browser to access Subway Surfers</div>
+				<install-chrome></install-chrome>
+			</div>
+			<!-- chrome -->
+			<div v-if="device == 'chrome'">
+				<div class="txt">Use chrome browser to access Subway Surfers</div>
+				<install-extension :extensionsInstallUrl="config.extensionsInstallUrl"></install-extension>
+			</div>
+		</div>
 
-        <!-- 移动端 -->
-        <div v-if="device == 'ios' || device == '安卓'" class="mobile">
-            <div class="mobile-content">
-                <img :src="detail.postBizData.linkImagePath" alt="">
-                <div class="title">Open link on PC to use Subway Surfers</div>
-            </div>
-            <div class="area-button">
-                <div class="btn1" @click="clickExtension">
-                    Install Chrome Extension
-                </div>
-                <div class="btn2" @click="clickCopy" :data-clipboard-text="copy_link">
-                    Copy Link
-                </div>
-            </div>
-        </div>
-    </div>
+		<!-- 移动端 -->
+		<div v-if="device == 'ios' || device == '安卓'" class="mobile">
+			<div class="mobile-content">
+				<img :src="detail.postBizData.linkImagePath" alt="" />
+				<div class="title">Open link on PC to use Subway Surfers</div>
+			</div>
+			<div class="area-button">
+				<div class="btn1" @click="clickExtension">Install Chrome Extension</div>
+				<div class="btn2" @click="clickCopy" :data-clipboard-text="copy_link">Copy Link</div>
+			</div>
+		</div>
+	</div>
 </template>
 <script>
-import VLogo from '@/components/logo.vue'
-import InstallChrome from '@/components/InstallChrome.vue'
-import InstallExtension from '@/components/InstallExtension.vue'
-import { getBrowserType, baseURL, appVersionCode, jumpUrl } from '@/utils/help.js'
-import axios from 'axios'
-import Cookies from 'js-cookie'
+import VLogo from '@/components/logo.vue';
+import InstallChrome from '@/components/InstallChrome.vue';
+import InstallExtension from '@/components/InstallExtension.vue';
+import { getBrowserType, baseURL, appVersionCode, jumpUrl } from '@/utils/help.js';
+import axios from 'axios';
+import Cookies from 'js-cookie';
 import { Toast } from 'vant';
 
-
-var ClipboardJS = require('clipboard')
+var ClipboardJS = require('clipboard');
 
 export default {
-    name: 'tool_box',
-    data() {
-        return {
-            config: {},
-            copy_link: '',
-            title: 'Install DeNet Plugin to Participate',
-            metaTitle: 'Install DeNet Plugin to Participate',
-            device: '',
-            detail: {}
-        }
-    },
-    head() {
-        return {
-            type: '',
-            title: this.title,
-            appVersionCode: appVersionCode,
-            meta: [
-                // facebook 
-                {
-                    name: 'og:url',
-                    content: jumpUrl + 'toolbox/' + this.$route.params.id
-                },
-                {
-                    name: 'og:title',
-                    content: this.metaTitle
-                },
-                {
-                    name: 'og:image',
-                    content: this.detail.postBizData.linkImagePath || ''
-                },
-                // twitter
-                {
-                    name: 'twitter:card',
-                    content: 'summary_large_image'
-                },
-                {
-                    name: 'twitter:url',
-                    content: jumpUrl + 'toolbox/' + this.$route.params.id
-                },
-                {
-                    name: 'twitter:title',
-                    content: this.detail.postBizData.linkTitle || this.metaTitle
-                },
-                {
-                    name: 'twitter:image',
-                    content: this.detail.postBizData.linkImagePath || ''
-                }
-            ]
-        }
-    },
-    components: {
-        VLogo,
-        InstallChrome,
-        InstallExtension
-    },
-    async asyncData(params) {
-        let { route } = params;
-        let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
-            baseInfo: {
-                appVersionCode: appVersionCode,
-                mid: '00000000-0000-0000-0000-000000000000',
-            },
-            params: {
-                postId: route.params.id || ''
-            }
-        })
-        if (data.code == 0) {
-            if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
-                data.data.postBizData = JSON.parse(data.data.postBizData)
-            }
-            if (data.data.postBizData === null) {
-                data.data.postBizData = {
-                    postUserInfo: {}
-                }
-            }
-            console.log('detail', data.data)
-
-            return {
-                detail: data.data,
-            }
-        }
-    },
-    mounted() {
-        this.copy_link = window.location.href
-        this.device = getBrowserType()
-        this.getConfig()
-        console.log('device', this.device)
-        if (this.device == 'chrome') {
-            this.setCookie()
-        }
-    },
+	name: 'tool_box',
+	data() {
+		return {
+			config: {},
+			copy_link: '',
+			title: 'Install DeNet Plugin to Participate',
+			metaTitle: 'Install DeNet Plugin to Participate',
+			device: '',
+			detail: {},
+		};
+	},
+	head() {
+		return {
+			type: '',
+			title: this.title,
+			appVersionCode: appVersionCode,
+			meta: [
+				// facebook
+				{
+					name: 'og:url',
+					content: jumpUrl + 'toolbox/' + this.$route.params.id,
+				},
+				{
+					name: 'og:title',
+					content: this.metaTitle,
+				},
+				{
+					name: 'og:image',
+					content: this.detail.postBizData.linkImagePath || '',
+				},
+				// twitter
+				{
+					name: 'twitter:card',
+					content: 'summary_large_image',
+				},
+				{
+					name: 'twitter:url',
+					content: jumpUrl + 'toolbox/' + this.$route.params.id,
+				},
+				{
+					name: 'twitter:title',
+					content: this.detail.postBizData.linkTitle || this.metaTitle,
+				},
+				{
+					name: 'twitter:image',
+					content: this.detail.postBizData.linkImagePath || '',
+				},
+			],
+		};
+	},
+	components: {
+		VLogo,
+		InstallChrome,
+		InstallExtension,
+	},
+	async asyncData(params) {
+		let { route } = params;
+		let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
+			baseInfo: {
+				appVersionCode: appVersionCode,
+				mid: '00000000-0000-0000-0000-000000000000',
+			},
+			params: {
+				postId: route.params.id || '',
+			},
+		});
+		if (data.code == 0) {
+			if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
+				data.data.postBizData = JSON.parse(data.data.postBizData);
+			}
+			if (data.data.postBizData === null) {
+				data.data.postBizData = {
+					postUserInfo: {},
+				};
+			}
+			console.log('detail', data.data);
 
-    methods: {
-        setCookie() {
-            let pickupInfo = {
-                srcContentId: this.detail.srcContentId || '',
-                postNickName: this.detail.srcUserId || '',
-                createTime: Date.now(),
-                jump_type: 'jump_info',
-            };
-            Cookies.set('jump_info', JSON.stringify(pickupInfo), { expires: 1000 });
-        },
-        async getConfig() {
-            let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
-                baseInfo: {
-                    appVersionCode: this.appVersionCode,
-                    mid: this.mid
-                },
-                params: {
-                }
-            })
-            if (data.code == 0) {
-                this.config = data.data;
-            }
-        },
-        clickCopy() {
-            // 复制链接
-            var clipboard = new ClipboardJS('.btn2');
-            clipboard.on('success', function (e) {
-                Toast('copy success');
-                e.clearSelection();
-            });
+			return {
+				detail: data.data,
+			};
+		}
+	},
+	mounted() {
+		this.copy_link = window.location.href;
+		this.device = getBrowserType();
+		this.getConfig();
+		console.log('device', this.device);
+		if (this.device == 'chrome') {
+			this.setCookie();
+		}
+	},
 
-            clipboard.on('error', function (e) {
-                Toast('copy error');
-            });
-        },
-        clickExtension() {
-            window.open(this.config.extensionsInstallUrl)
-        }
-    }
-}
+	methods: {
+		setCookie() {
+			let pickupInfo = {
+				srcContentId: this.detail.srcContentId || '',
+				postNickName: this.detail.srcUserId || '',
+				createTime: Date.now(),
+				jump_type: 'jump_info',
+			};
+			Cookies.set('jump_info', JSON.stringify(pickupInfo), { expires: 1000 });
+		},
+		async getConfig() {
+			let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
+				baseInfo: {
+					appVersionCode: this.appVersionCode,
+					mid: this.mid,
+				},
+				params: {},
+			});
+			if (data.code == 0) {
+				this.config = data.data;
+			}
+		},
+		clickCopy() {
+			// 复制链接
+			var clipboard = new ClipboardJS('.btn2');
+			clipboard.on('success', function (e) {
+				Toast('copy success');
+				e.clearSelection();
+			});
 
+			clipboard.on('error', function () {
+				Toast('copy error');
+			});
+		},
+		clickExtension() {
+			window.open(this.config.extensionsInstallUrl);
+		},
+	},
+};
 </script>
-<style lang="scss" >
+<style lang="scss">
 html,
 body,
 #__nuxt,
 #__layout {
-    margin: 0;
-    padding: 0;
-    width: 100%;
-    height: 100%;
-    background: #F5FAFF;
-
-
+	margin: 0;
+	padding: 0;
+	width: 100%;
+	height: 100%;
+	background: #f5faff;
 }
 
 .main {
-    width: 100%;
-    height: 100%;
-
-    .tool-cover {
-        min-width: 400px;
-        margin-right: 90px;
-
-        img {
-            max-height: 270px;
-        }
-    }
-
-    .content {
-        width: 100%;
-        height: 100%;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        padding-bottom: 70px;
+	width: 100%;
+	height: 100%;
 
-        .txt {
-            width: 400px;
-            font-weight: 700;
-            font-size: 36px;
-            line-height: 44px;
-            /* or 122% */
+	.tool-cover {
+		min-width: 400px;
+		margin-right: 90px;
 
-            letter-spacing: 0.3px;
+		img {
+			max-height: 270px;
+		}
+	}
 
-            color: #323232;
-            margin-bottom: 40px;
-        }
-    }
+	.content {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding-bottom: 70px;
 
-    .mobile {
-        .mobile-content {
-            padding: 36px 16px 0 16px;
+		.txt {
+			width: 400px;
+			font-weight: 700;
+			font-size: 36px;
+			line-height: 44px;
+			/* or 122% */
 
-            img {
-                width: 100%;
-                margin-bottom: 25px;
-                border-radius: 5px;
-            }
+			letter-spacing: 0.3px;
 
-            .title {
-                font-weight: 700;
-                font-size: 22px;
-                line-height: 26px;
-                text-align: center;
-                letter-spacing: 0.3px;
-                color: #000000;
-                width: 240px;
-                margin: 0 auto;
-            }
-        }
+			color: #323232;
+			margin-bottom: 40px;
+		}
+	}
 
+	.mobile {
+		.mobile-content {
+			padding: 36px 16px 0 16px;
 
+			img {
+				width: 100%;
+				margin-bottom: 25px;
+				border-radius: 5px;
+			}
 
-        .area-button {
-            position: fixed;
-            width: 100%;
-            padding: 27px 16px 25px 16px;
-            bottom: 0;
-            height: 170px;
+			.title {
+				font-weight: 700;
+				font-size: 22px;
+				line-height: 26px;
+				text-align: center;
+				letter-spacing: 0.3px;
+				color: #000000;
+				width: 240px;
+				margin: 0 auto;
+			}
+		}
 
-            .btn1 {
-                height: 50px;
-                line-height: 50px;
-                background: #1D9BF0;
-                border-radius: 100px;
-                width: 100%;
-                font-weight: 600;
-                font-size: 18px;
-                text-align: center;
-                letter-spacing: 0.3px;
+		.area-button {
+			position: fixed;
+			width: 100%;
+			padding: 27px 16px 25px 16px;
+			bottom: 0;
+			height: 170px;
 
-                color: #FFFFFF;
-                margin-bottom: 16px;
-            }
+			.btn1 {
+				height: 50px;
+				line-height: 50px;
+				background: #1d9bf0;
+				border-radius: 100px;
+				width: 100%;
+				font-weight: 600;
+				font-size: 18px;
+				text-align: center;
+				letter-spacing: 0.3px;
 
-            .btn2 {
-                height: 50px;
-                line-height: 50px;
-                background: rgba(29, 155, 240, 0.01);
-                border: 1px solid #1D9BF0;
-                border-radius: 100px;
-                width: 100%;
-                font-weight: 600;
-                font-size: 18px;
-                text-align: center;
-                letter-spacing: 0.3px;
-                color: #1D9BF0;
+				color: #ffffff;
+				margin-bottom: 16px;
+			}
 
-            }
-        }
-    }
+			.btn2 {
+				height: 50px;
+				line-height: 50px;
+				background: rgba(29, 155, 240, 0.01);
+				border: 1px solid #1d9bf0;
+				border-radius: 100px;
+				width: 100%;
+				font-weight: 600;
+				font-size: 18px;
+				text-align: center;
+				letter-spacing: 0.3px;
+				color: #1d9bf0;
+			}
+		}
+	}
 }
-</style>
+</style>

+ 8 - 7
test/NuxtLogo.spec.js

@@ -1,9 +1,10 @@
-import { mount } from '@vue/test-utils'
-import NuxtLogo from '@/components/NuxtLogo.vue'
+/* eslint-disable */
+import { mount } from '@vue/test-utils';
+import NuxtLogo from '@/components/NuxtLogo.vue';
 
 describe('NuxtLogo', () => {
-  test('is a Vue instance', () => {
-    const wrapper = mount(NuxtLogo)
-    expect(wrapper.vm).toBeTruthy()
-  })
-})
+	test('is a Vue instance', () => {
+		const wrapper = mount(NuxtLogo);
+		expect(wrapper.vm).toBeTruthy();
+	});
+});

+ 109 - 109
utils/help.js

@@ -1,138 +1,138 @@
 //application/vnd.chromium.remoting-viewer 可能为360特有 通过_mine判断是否是360
 export function isBrowser() {
-    var agent = navigator.userAgent.toLowerCase()
-    console.log(agent)
-    System = function () {
-        if (agent.indexOf('qqbrowser') > 0) {//判断是qq浏览器还是其它浏览器
-            return "qq浏览器"
-        }
-        if (agent.indexOf("se 2.x") > 0) {
-            return "搜狗浏览器"
-        }
+	var agent = navigator.userAgent.toLowerCase();
+	console.log(agent);
+	const System = function () {
+		if (agent.indexOf('qqbrowser') > 0) {
+			//判断是qq浏览器还是其它浏览器
+			return 'qq浏览器';
+		}
+		if (agent.indexOf('se 2.x') > 0) {
+			return '搜狗浏览器';
+		}
 
-        var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
+		var is360 = _mime('type', 'application/vnd.chromium.remoting-viewer');
 
-        if (is360) {
-            return "360浏览器"
-        }
+		if (is360) {
+			return '360浏览器';
+		}
 
-        //检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
-        //测试mime
-        function _mime(option, value) {
-            var mimeTypes = navigator.mimeTypes;
-            console.log(mimeTypes)
-            for (var mt in mimeTypes) {
-                if (mimeTypes[mt][option] == value) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-    let s = System()
-    if (s) {
-        return s
-    }
-    if (agent.indexOf('firefox') > 0) {
-        return "firefox浏览器"
-    }
-    if (agent.indexOf('trident') > 0) {
-        return "IE浏览器"
-    }
-    if (agent.indexOf('edg') > 0) {
-        return "IE浏览器"
-    }
-    if (agent.indexOf("safari") > 0 && agent.indexOf("chrome") < 0) {
-        return 'Safari'
-    }
-    if (agent.indexOf("chrome") > 0) {
-        return 'chrome'
-    }
+		//检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
+		//测试mime
+		function _mime(option, value) {
+			var mimeTypes = navigator.mimeTypes;
+			console.log(mimeTypes);
+			for (var mt in mimeTypes) {
+				if (mimeTypes[mt][option] == value) {
+					return true;
+				}
+			}
+			return false;
+		}
+	};
+	let s = System();
+	if (s) {
+		return s;
+	}
+	if (agent.indexOf('firefox') > 0) {
+		return 'firefox浏览器';
+	}
+	if (agent.indexOf('trident') > 0) {
+		return 'IE浏览器';
+	}
+	if (agent.indexOf('edg') > 0) {
+		return 'IE浏览器';
+	}
+	if (agent.indexOf('safari') > 0 && agent.indexOf('chrome') < 0) {
+		return 'Safari';
+	}
+	if (agent.indexOf('chrome') > 0) {
+		return 'chrome';
+	}
 }
 
 export function getBrowser() {
-    let browser;
-    let UserAgent = navigator.userAgent.toLowerCase();
-    if (UserAgent.indexOf('chrome') > -1 || UserAgent.indexOf('crios') > -1) {
-        browser = `Chrome`
-    } else if (UserAgent.indexOf('firefox') > -1) {
-        browser = `Firefox`
-    } else if (UserAgent.indexOf('opera') > -1) {
-        browser = `Opera`
-    } else if (UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1) {
-        browser = `Safari`
-    } else if (UserAgent.indexOf('edge') > -1) {
-        browser = `Edge`
-    } else {
-        browser = `Other`
-    }
-    return browser;
+	let browser;
+	let UserAgent = navigator.userAgent.toLowerCase();
+	if (UserAgent.indexOf('chrome') > -1 || UserAgent.indexOf('crios') > -1) {
+		browser = `Chrome`;
+	} else if (UserAgent.indexOf('firefox') > -1) {
+		browser = `Firefox`;
+	} else if (UserAgent.indexOf('opera') > -1) {
+		browser = `Opera`;
+	} else if (UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1) {
+		browser = `Safari`;
+	} else if (UserAgent.indexOf('edge') > -1) {
+		browser = `Edge`;
+	} else {
+		browser = `Other`;
+	}
+	return browser;
 }
 
 export function formatSecondsAsTime(secs) {
-    var hr = Math.floor(secs / 3600)
-    var min = Math.floor((secs - (hr * 3600)) / 60)
-    var sec = Math.floor(secs - (hr * 3600) - (min * 60))
-    var text
-    if (hr < 10) {
-        hr = "0" + hr
-    }
-    if (min < 10) {
-        min = "0" + min
-    }
-    if (sec < 10) {
-        sec = "0" + sec
-    }
-    text = hr + ':' + min + ':' + sec
+	var hr = Math.floor(secs / 3600);
+	var min = Math.floor((secs - hr * 3600) / 60);
+	var sec = Math.floor(secs - hr * 3600 - min * 60);
+	var text;
+	if (hr < 10) {
+		hr = '0' + hr;
+	}
+	if (min < 10) {
+		min = '0' + min;
+	}
+	if (sec < 10) {
+		sec = '0' + sec;
+	}
+	text = hr + ':' + min + ':' + sec;
 
-    return text
+	return text;
 }
 
 // 抽奖红包 left
 export function formatSecondsAsDaysOrTime(secs) {
-    if (secs <= 0) {
-      return '00:00:00'
-    }
-    let text = ''
-    var hr = Math.floor(secs / 3600)
-    if (hr >= 24) {
-      let day = parseInt(hr / 24)
-      text = `${day} days left`
-    } else {
-      text = formatSecondsAsTime(secs)
-    }
-    return text
+	if (secs <= 0) {
+		return '00:00:00';
+	}
+	let text = '';
+	var hr = Math.floor(secs / 3600);
+	if (hr >= 24) {
+		let day = parseInt(hr / 24);
+		text = `${day} days left`;
+	} else {
+		text = formatSecondsAsTime(secs);
+	}
+	return text;
 }
 
 export const appVersionCode = 12;
 
 export const appType = 1;
 
-export function getBrowserType(){
-    let device =  '' // ios 安卓 chrome no-chrome
-    if(/android/i.test(navigator.userAgent)){
-        device = '安卓'
-	}else if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
-		 device = 'ios'
-	}else if(isBrowser() == 'chrome'){
-        device = 'chrome'
-    }else{
-        device = 'no-chrome'
-    }
-    return device
+export function getBrowserType() {
+	let device = ''; // ios 安卓 chrome no-chrome
+	if (/android/i.test(navigator.userAgent)) {
+		device = '安卓';
+	} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+		device = 'ios';
+	} else if (isBrowser() == 'chrome') {
+		device = 'chrome';
+	} else {
+		device = 'no-chrome';
+	}
+	return device;
 }
 
-
 const api = {
 	prod: 'https://api.denetme.net',
 	pre: 'https://preapi.denetme.net',
-	test: 'https://testapi.denetme.net'
-}
+	test: 'https://testapi.denetme.net',
+};
 const page = {
-	prod: "https://h5.denetme.net",
-	pre: "https://preh5.denetme.net",
-	test: 'https://testh5.denetme.net'
-}
+	prod: 'https://h5.denetme.net',
+	pre: 'https://preh5.denetme.net',
+	test: 'https://testh5.denetme.net',
+};
 
-export const jumpUrl = page[process.env.NUXT_ENV.MODE] + '/'
-export const baseURL = api[process.env.NUXT_ENV.MODE]
+export const jumpUrl = page[process.env.NUXT_ENV.MODE] + '/';
+export const baseURL = api[process.env.NUXT_ENV.MODE];

File diff suppressed because it is too large
+ 515 - 15
yarn.lock


Some files were not shown because too many files changed in this diff