소스 검색

H5跳小程序

youchengjun 2 달 전
부모
커밋
70ceecd4e6

+ 23 - 0
.gitignore

@@ -0,0 +1,23 @@
+.DS_Store
+node_modules
+/dist
+
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?

+ 5 - 0
babel.config.js

@@ -0,0 +1,5 @@
+module.exports = {
+  presets: [
+    '@vue/cli-plugin-babel/preset'
+  ]
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 11860 - 0
package-lock.json


+ 45 - 0
package.json

@@ -0,0 +1,45 @@
+{
+  "name": "pay-h5",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve",
+    "build": "vue-cli-service build",
+    "lint": "vue-cli-service lint"
+  },
+  "dependencies": {
+    "axios": "^0.21.1",
+    "core-js": "^3.6.5",
+    "element-ui": "^2.15.12",
+    "vue": "^2.6.11",
+    "vue-router": "^3.2.0"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "~4.5.9",
+    "@vue/cli-plugin-eslint": "~4.5.9",
+    "@vue/cli-service": "~4.5.9",
+    "babel-eslint": "^10.1.0",
+    "eslint": "^6.7.2",
+    "eslint-plugin-vue": "^6.2.2",
+    "vue-template-compiler": "^2.6.11"
+  },
+  "eslintConfig": {
+    "root": true,
+    "env": {
+      "node": true
+    },
+    "extends": [
+      "plugin:vue/essential",
+      "eslint:recommended"
+    ],
+    "parserOptions": {
+      "parser": "babel-eslint"
+    },
+    "rules": {}
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions",
+    "not dead"
+  ]
+}

BIN
public/favicon.ico


+ 33 - 0
public/index.html

@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="">
+
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0 ">
+  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+  <title>繁星回收</title>
+  <script src = "https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"> </script> 
+</head>
+<style>
+</style>
+
+<body>
+  <noscript>
+    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
+      Please enable it to continue.</strong>
+  </noscript>
+  <div id="app"></div>
+  <button id="test" style="position: absolute;top:0;z-index: -9999;opacity: 0;"></button>
+  <!-- built files will be auto injected -->
+  <script>
+    // let width = document.documentElement.clientWidth || document.body.clientWidth;
+    // let r = width / 750; //计算字体大小
+    // // 获取html元素
+    // let a = document.getElementsByTagName('html')[0];
+    // //设置html字体大小
+    // a.setAttribute('style', 'font-size:' + r + 'px');
+  </script>
+</body>
+
+</html>

+ 21 - 0
src/App.vue

@@ -0,0 +1,21 @@
+<template>
+  <div id="app">
+    <router-view></router-view>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "App",
+};
+</script>
+
+<style>
+* {
+  padding: 0;
+  margin: 0;
+}
+#app {
+  font-size: 32px;
+}
+</style>

+ 9 - 0
src/api/index.js

@@ -0,0 +1,9 @@
+import request from "@/utils/http";
+
+export function generateScheme(params = {}) {
+    return request({
+        url: '/wechat/small/scheme/generateScheme',
+        method: 'POST',
+        data: params
+    })
+}

BIN
src/assets/icon_del_d.png


BIN
src/assets/icon_jttp.png


BIN
src/assets/img_bzt_123.png


BIN
src/assets/img_l.png


BIN
src/assets/tj_icon_cg.png


BIN
src/assets/tj_icon_fm.png


BIN
src/assets/tj_icon_fm_wx.png


BIN
src/assets/tj_icon_sb.png


BIN
src/assets/touxiang.png


+ 11 - 0
src/main.js

@@ -0,0 +1,11 @@
+import Vue from 'vue'
+import App from './App.vue'
+Vue.config.productionTip = false
+import router from './router/index.js'
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+Vue.use(ElementUI);
+new Vue({
+  render: h => h(App),
+  router
+}).$mount('#app')

+ 26 - 0
src/router/index.js

@@ -0,0 +1,26 @@
+//1.导入vue 和 vuerouter 的包
+import Vue from 'vue'
+import VueRouter from 'vue-router'
+
+//2.调用vue.use() 函数,把 VueRouter 安装为 Vue 的插件
+//vue.use()函数的作用,就是来安装插件的
+Vue.use(VueRouter)
+
+//3.创建路由的实例对象
+const router = new VueRouter({
+    mode: 'hash',
+    routes: [
+        {
+            path: '/',
+            redirect: '/index'
+        },
+        {
+            path: '/index',
+            name: 'index',
+            component: () => import('../views/index.vue')
+        },
+    ]
+})
+
+//4.向外共享路由的实例对象
+export default router

+ 64 - 0
src/utils/http.js

@@ -0,0 +1,64 @@
+import axios from 'axios'
+const request = function (
+    {
+        url = '', // 接口路径
+        method = 'post', // 请求方式
+        params = {}, // get请求时参数实体
+        data = {}, // post/put等请求的参数实体
+    }) {
+    const service = axios.create({
+        baseURL: 'http://192.168.1.183:1211', // 开发
+        // baseURL: 'https://bakgateway.btstars.cn', // 预发布
+        // baseURL: 'https://gateway.hnfanxingtiaodong.com', // 线上
+        timeout: 20000 // request timeout
+    })
+    // request interceptor 请求拦截
+    service.interceptors.request.use(
+        config => {
+            // config.headers['ACCESS_TOKEN'] = store.state.user.token
+            // config.headers['openid'] = localStorage.getItem('openid');
+            return config
+        },
+        error => {
+
+            Promise.reject(error)
+        }
+    )
+
+    // response interceptor
+    service.interceptors.response.use(
+        response => {
+
+            const code = response.data.code
+            // 请求失败
+            if (code === 0) {
+
+                return Promise.reject(response.data)
+            }
+
+            // 登录失效
+            if (code === 401) {
+                // router.replace('/login')
+                return Promise.reject(response.data)
+            }
+
+            // 请求成功
+            if (code) {
+                return response.data
+            }
+        },
+        error => {
+            console.log('err' + error) // for debug
+            return Promise.reject(error)
+        }
+    )
+
+    return service({
+        url,
+        method,
+        params,
+        data
+    })
+}
+
+export default request

+ 282 - 0
src/views/index.vue

@@ -0,0 +1,282 @@
+<template>
+  <div>
+    <div class="index_box flex flex-c">
+      <div class="pay_btn" @click="jumUrl()">跳转繁星回收小程序</div>
+    </div>
+  </div>
+</template>
+<script>
+import { generateScheme } from "@/api";
+export default {
+  data() {
+    return {
+      form: {
+        userName: "",
+        amount: "",
+      },
+      SchemeUrl: "",
+    };
+  },
+  created() {
+    console.log(this.$route.query);
+    if (this.$route.query) {
+      this.form.amount = this.$route.query.amount;
+      this.form.userName = this.$route.query.userName;
+    }
+    this.generateScheme();
+  },
+  methods: {
+    generateScheme() {
+      // 要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop",仅在微信外打开时生效
+      let form = {
+        jump_wxa: {
+          path: "/pages/index/index",
+          query: "",
+          env_version: "release",
+        },
+        is_expire: true,
+        expire_type: 1,
+        expire_interval: 1,
+      };
+      generateScheme(form)
+        .then((res) => {
+          console.log(res, "成功信息");
+          this.SchemeUrl=res.data.openlink;
+        })
+        .catch((err) => {
+          console.log(err, "错误信息");
+        });
+    },
+    // 跳转微信小程序
+    jumUrl() {
+     location.href = this.SchemeUrl;
+    },
+  },
+};
+</script>
+
+<style>
+.index_box {
+  width: 100vw;
+  height: 100vh;
+  box-sizing: border-box;
+  padding: 0 20px;
+}
+.flex {
+  display: flex;
+  align-items: center;
+}
+.flex-aa {
+  display: flex;
+  align-items: flex-start;
+}
+.flex1 {
+  flex: 1;
+}
+.flex-jb {
+  display: flex;
+  justify-content: space-between;
+}
+.flex-c {
+  display: flex;
+  flex-direction: column;
+}
+.flex-jc {
+  display: flex;
+  justify-content: center;
+}
+.flex-w {
+  flex-wrap: wrap;
+}
+.pay_img {
+  width: 65px;
+  height: 65px;
+  border-radius: 50%;
+  background: #eee;
+  margin-top: 30px;
+}
+
+.pay_price {
+  margin-top: 10px;
+  color: #ff4b0c;
+  font-weight: 500;
+  font-size: 30px;
+}
+
+.pay_name {
+  margin-top: 14px;
+  font-size: 14px;
+}
+
+.pay_input {
+  width: 325px;
+  height: 44px;
+  box-sizing: border-box;
+  margin-top: 33px;
+  outline: none;
+  border-radius: 5px;
+  font-size: 16px;
+}
+
+.pay_notice {
+  font-size: 14px;
+  margin-top: 40px;
+  padding: 0 10px;
+  color: #333333;
+  margin-bottom: 20px;
+  text-align: justify;
+}
+
+.pay_notice_title {
+  font-size: 16px;
+  font-weight: bold;
+  color: #108ee9;
+  margin-bottom: 4px;
+}
+
+.pay_text {
+  width: 100%;
+  font-size: 14px;
+  background: rgba(255, 240, 240, 0.9);
+  border-radius: 8px;
+  color: #ff4b0c;
+  padding: 5px 10px;
+  box-sizing: border-box;
+  text-align: justify;
+  line-height: 24px;
+}
+
+.pay_text_title {
+  font-weight: bold;
+}
+
+.dian {
+  min-width: 4px;
+  height: 4px;
+  background: #ff4b0c;
+  border-radius: 50%;
+  margin-right: 4px;
+  margin-top: 10px;
+}
+
+.pay_btn {
+  width: 320px;
+  height: 44px;
+  border: none;
+  color: #fff;
+  text-align: center;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #108ee9;
+  border-radius: 10px;
+  position: fixed;
+  top: 50%;
+  font-size: 16px;
+}
+.got_it {
+  width: 320px;
+  height: 44px;
+  color: #fff;
+  text-align: center;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #108ee9;
+  border-radius: 10px;
+  font-size: 16px;
+  margin: 20px auto 0;
+}
+/* 遮罩 */
+.mask {
+  position: fixed;
+  background: rgba(51, 51, 51, 0.212);
+  width: 100%;
+  height: 100vh;
+  z-index: 10;
+  top: 0;
+  left: 0;
+}
+.dialog {
+  width: 100%;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  background: #fff;
+  border-radius: 20px 20px 0 0;
+  z-index: 11;
+  text-align: center;
+  padding: 0 20px;
+  box-sizing: border-box;
+  padding-bottom: 30px;
+}
+.dialog_cancel {
+  width: 38px;
+  height: 33px;
+  position: absolute;
+  right: 0;
+  top: 0;
+}
+.dialog_title {
+  text-align: center;
+  font-size: 14px;
+  font-weight: bold;
+  color: #333333;
+  margin-top: 16px;
+}
+.dialog_title2 {
+  font-weight: 500;
+  margin-top: 20px;
+  text-align: justify;
+  padding: 0 2px;
+  margin-bottom: 10px;
+}
+.dialog_title2 .title1 {
+  font-size: 18px;
+  font-weight: bold;
+  margin-bottom: 4px;
+}
+.dialog_title2 .title2 {
+  color: #108ee9;
+  font-size: 14px;
+  font-weight: bold;
+  margin-bottom: 4px;
+  margin-top: 10px;
+}
+.dialog_img_box {
+  height: calc(100% - 95px);
+  overflow-y: scroll;
+}
+.dialog_img {
+  width: 100%;
+  margin-top: 5px;
+}
+/* 
+.el-input__inner {
+  height: 44px !important;
+  border-radius: 5px;
+  font-size: 16px;
+}
+.message {
+  width: 205px;
+  height: 36px;
+  background: rgba(0, 0, 0, 0.5);
+  border-radius: 5px;
+  text-align: center;
+  line-height: 36px;
+  position: fixed;
+  bottom: 150px;
+  left: 0;
+  right: 0;
+  margin: auto;
+  z-index: 9999;
+  color: #fff;
+  font-size: 14px;
+  font-weight: 500;
+  color: #ffffff;
+}
+input::-webkit-input-placeholder {
+  color: #c4c4c4;
+  font-size: 14px;
+} */
+</style>

+ 36 - 0
vue.config.js

@@ -0,0 +1,36 @@
+
+const path = require("path");
+function resolve(dir) {
+    return path.join(__dirname, dir);
+}
+
+module.exports = {
+    publicPath: "./", // 基本路径
+    outputDir: "dist", // 输出文件目录
+    lintOnSave: false, // eslint-loader 是否在保存的时候检查
+    chainWebpack: (config) => {
+        //修改文件引入自定义路径
+        config.resolve.alias
+            .set("@", resolve("src"))
+            .set("assets", resolve("src/assets"))
+            .set("api", resolve("src/api"))
+            .set("views", resolve("src/views"))
+    },
+    devServer: {
+        // host: "localhost",
+        // port: 8000, // 端口号
+        https: false, // https:{type:Boolean}
+        open: true, //配置自动启动浏览器  http://172.11.11.22:8888/rest/XX/
+        hotOnly: true, // 热更新
+        // proxy: 'http://localhost:8000'   // 配置跨域处理,只有一个代理
+        proxy: {
+            //配置自动启动浏览器
+            "/api": {
+                target: "http://192.168.1.190:8080",
+                changeOrigin: true,
+                // ws: true,//websocket支持
+                // secure: false,
+            },
+        },
+    },
+};

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 8776 - 0
yarn.lock