Explorar o código

Merge branch 'nuxt' of http://192.168.32.253:3000/Software/android-cloud-H5 into nuxt

huangxiaojing %!s(int64=3) %!d(string=hai) anos
pai
achega
034ef2d003
Modificáronse 7 ficheiros con 3304 adicións e 160 borrados
  1. 1 0
      .npmrc
  2. 5 0
      nuxt.config.js
  3. 3272 145
      package-lock.json
  4. 10 0
      package.json
  5. 1 12
      pages/activity/invite-user.vue
  6. 7 3
      pages/register-for-invite.vue
  7. 8 0
      plugins/baidu-tongji.js

+ 1 - 0
.npmrc

@@ -0,0 +1 @@
+registry = "https://registry.npmmirror.com/"

+ 5 - 0
nuxt.config.js

@@ -103,6 +103,7 @@ export default {
     // https://go.nuxtjs.dev/stylelint
     '@nuxtjs/stylelint-module',
     // '~/modules/unplugin-vue-components'
+    '@aceforth/nuxt-optimized-images',
     '~/modules/postcss-px-to-viewport',
     '~/modules/vant',
     // https://go.nuxtjs.dev/vuetify
@@ -121,6 +122,10 @@ export default {
     uno: true,
   },
 
+  optimizedImages: {
+    // optimizeImagesInDev: true,
+  },
+
   // Axios module configuration: https://go.nuxtjs.dev/config-axios
   axios: {
     proxy: process.env.NODE_ENV === 'development',

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3272 - 145
package-lock.json


+ 10 - 0
package.json

@@ -26,6 +26,7 @@
     "axios": "^0.27.2",
     "core-js": "^3.19.3",
     "dayjs": "^1.11.3",
+    "format-number": "^3.0.0",
     "jsencrypt": "^3.2.1",
     "jweixin-module": "^1.6.0",
     "normalize.css": "^8.0.1",
@@ -40,6 +41,7 @@
     "webpack": "^4.46.0"
   },
   "devDependencies": {
+    "@aceforth/nuxt-optimized-images": "^1.4.0",
     "@babel/eslint-parser": "^7.16.3",
     "@commitlint/cli": "^15.0.0",
     "@commitlint/config-conventional": "^15.0.0",
@@ -56,11 +58,19 @@
     "eslint-config-prettier": "^8.3.0",
     "eslint-plugin-nuxt": "^3.1.0",
     "eslint-plugin-vue": "^8.2.0",
+    "imagemin-gifsicle": "^7.0.0",
+    "imagemin-mozjpeg": "^9.0.0",
+    "imagemin-pngquant": "^9.0.2",
+    "imagemin-svgo": "^8.0.0",
     "less": "^4.1.3",
     "less-loader": "^7.3.0",
+    "lqip-loader": "^2.2.1",
     "postcss-html": "^1.3.0",
     "postcss-px-to-viewport": "^1.1.1",
     "prettier": "^2.5.1",
+    "responsive-loader": "^2.3.0",
+    "sharp": "^0.30.6",
+    "sqip-loader": "^1.0.0",
     "stylelint": "^14.1.0",
     "stylelint-config-prettier": "^9.0.3",
     "stylelint-config-recommended-vue": "^1.1.0",

+ 1 - 12
pages/activity/invite-user.vue

@@ -133,18 +133,7 @@ export default {
   mounted() {},
   methods: {
     share() {
-      // window.aplus.getNextTrackCode(
-      //   {
-      //     appkey: '',
-      //     openid: '',
-      //     unionId: 'aTestUnionid',
-      //     trackCode: '',
-      //     rootTrackCode: '',
-      //     url: location.href || 'testurl',
-      //   },
-      //   () => {},
-      // );
-      window._hmt.push(['_trackEvent', '活动', '分享', '邀请好友', 0]);
+      this.$tongji.trackEvent('活动', '分享', '', 0);
       this.$native.share({
         title: '标题',
         content: '内容',

+ 7 - 3
pages/register-for-invite.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="register-for-invite">
     <div class="">注册</div>
-    <form>
+    <form @submit.prevent>
       <input v-model="form.phone" label="phone" name="phone" />
       <input v-model="form.code" label="code" name="code" maxlength="6" />
       <div class="">
@@ -13,6 +13,8 @@
 </template>
 
 <script>
+import { registerForInvite } from '~/api/user/client.js';
+import { sendSmsCode } from '~/api/message/phone.js';
 export default {
   name: 'RegisterForInvite',
   data() {
@@ -34,10 +36,12 @@ export default {
   },
   methods: {
     async register() {
-      await this.$api.user.registerForInvite(this.form);
+      this.$tongji.trackEvent('活动', '注册', '', 0);
+      await registerForInvite(this, this.form);
     },
     async sendSmsCode() {
-      const res = await this.$api.message.sendSmsCode({
+      this.$tongji.trackEvent('活动', '发送短信', '', 0);
+      const res = await sendSmsCode(this, {
         type: 'common',
         authorizationType: 4,
         phone: this.form.phone,

+ 8 - 0
plugins/baidu-tongji.js

@@ -1,6 +1,7 @@
 export default function (c, i) {
   const { app, $auth, store } = c;
   window._hmt = window._hmt || [];
+
   window._hmt.push(['_setAutoPageview', false]);
   window._hmt.push(['_setCustomVar', 1, 'MODE', process.env.MODE, 1]);
   app.router.afterEach((to, from) => {
@@ -27,4 +28,11 @@ export default function (c, i) {
     {},
   );
   setUserId();
+  i('tongji', {
+    // 上报pv
+    trackPageview: (path) => window._hmt.push(['_trackPageview', path]),
+    // 上报事件
+    trackEvent: (category, action, optLabel, optValue) =>
+      window._hmt.push(['_trackEvent', category, action, optLabel, optValue]),
+  });
 }