lrf402788946 5 yıl önce
ebeveyn
işleme
749d5d6dac

BIN
src/assets/question.png


+ 7 - 2
src/router/index.js

@@ -12,7 +12,12 @@ const routes = [
     meta: { title: '日程安排', isleftarrow: true },
     component: () => import('../views/index.vue'),
   },
-
+  {
+    path: '/confirm',
+    name: 'confirm',
+    meta: { title: '测试页', isleftarrow: true },
+    component: () => import('../views/bind/confirm.vue'),
+  },
   // 班级信息
   {
     path: '/classinfo',
@@ -22,7 +27,7 @@ const routes = [
   {
     path: '/bind',
     meta: { title: '填写信息', isleftarrow: true },
-    component: () => import('../views/bind.vue'),
+    component: () => import('../views/bind/bind.vue'),
   },
   // 班级名单
   {

src/views/bind.vue → src/views/bind/bind.vue


+ 66 - 0
src/views/bind/confirm.vue

@@ -0,0 +1,66 @@
+<template>
+  <div id="index">
+    <el-row style="padding:10px;height:100vh">
+      <el-col :span="24" class="icon">
+        <el-image :src="question"></el-image>
+      </el-col>
+      <el-col :span="24" style="height:10vh;text-align:center">
+        您确定将您的微信号与本平台账号绑定吗?
+      </el-col>
+      <el-col :span="24" style="height:4rem">
+        <van-button type="info" style="width:100%" round @click="toBind()">确定</van-button>
+      </el-col>
+      <el-col :span="24">
+        <van-button plain style="width:100%" round @click="cancel()">取消</van-button>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { createNamespacedHelpers } from 'vuex';
+const { mapActions: login } = createNamespacedHelpers('login');
+export default {
+  metaInfo: { title: '用户绑定' },
+  name: 'index',
+  props: {},
+  components: {},
+  data: () => ({
+    question: require('@/assets/question.png'),
+  }),
+  created() {},
+  computed: {
+    openid() {
+      return this.$route.query.openid;
+    },
+    uid() {
+      return this.$route.query.uid;
+    },
+  },
+  methods: {
+    ...login(['userBind']),
+    async toBind() {
+      const res = await this.userBind({ uid: this.uid, openid: this.openid });
+      if (res.errcode === 0) {
+        this.$toast({ type: 'success', message: '绑定成功' });
+      } else {
+        this.$toast({ type: 'fail', message: res.errmsg });
+      }
+    },
+    cancel() {
+      window.history.go(-1);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.icon {
+  height: 30vh;
+  text-align: center;
+}
+.icon .el-image {
+  width: 100px;
+  margin: 40px 0;
+}
+</style>