guhongwei 5 lat temu
rodzic
commit
1de06e6e0c
3 zmienionych plików z 93 dodań i 0 usunięć
  1. 7 0
      src/router/index.js
  2. 5 0
      src/store/user/auth-user.js
  3. 81 0
      src/views/bind.vue

+ 7 - 0
src/router/index.js

@@ -5,6 +5,13 @@ import store from '@/store/index';
 Vue.use(VueRouter);
 
 const routes = [
+  // 绑定
+  {
+    path: '/bind',
+    name: 'bind',
+    meta: { title: '绑定', isleftarrow: false },
+    component: () => import('../views/bind.vue'),
+  },
   // 首页
   {
     path: '/home/index',

+ 5 - 0
src/store/user/auth-user.js

@@ -6,6 +6,7 @@ Vue.use(Vuex);
 const api = {
   interface: `/api/auth/user`,
   getMenu: `/api/auth/user/menus`,
+  bindInfo: `/api/auth/user/bind`,
 };
 const state = () => ({});
 const mutations = {};
@@ -34,6 +35,10 @@ const actions = {
     const res = await this.$axios.$delete(`${api.interface}/${payload}`);
     return res;
   },
+  async bind({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.bindInfo}`, payload);
+    return res;
+  },
 };
 
 export default {

+ 81 - 0
src/views/bind.vue

@@ -0,0 +1,81 @@
+<template>
+  <div id="bind">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <el-button @click="bindBtn()" type="primary">确认绑定</el-button>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
+export default {
+  name: 'bind',
+  props: {},
+  components: {
+    NavBar,
+  },
+  data: () => ({
+    // 头部标题
+    title: '',
+    // meta为true
+    isleftarrow: '',
+    // 返回
+    navShow: true,
+  }),
+  created() {},
+  computed: {
+    uid() {
+      return this.$route.query.uid;
+    },
+  },
+  methods: {
+    ...authUser(['bind']),
+    async bindBtn() {
+      let data = {};
+      data.uid = this.uid;
+      data.openid = '05';
+      let res = await this.bind(data);
+      if (res.errcode == '0') {
+        this.$message({
+          message: '绑定成功',
+          type: 'success',
+        });
+      }
+    },
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+  padding: 150px;
+}
+.foot {
+  position: absolute;
+  bottom: 0;
+}
+</style>