Kaynağa Gözat

合并冲突

nihao 4 yıl önce
ebeveyn
işleme
76a554f7e2

+ 0 - 1
.gitignore

@@ -1,6 +1,5 @@
 .DS_Store
 node_modules
-/dist
 
 # local env files
 .env.local

+ 7 - 7
package.json

@@ -12,20 +12,20 @@
     "axios": "^0.19.2",
     "bar": "^0.1.2",
     "core-js": "^3.6.4",
-    "echarts": "^4.7.0",
-    "element-ui": "^2.13.1",
+    "echarts": "^4.8.0",
+    "element-ui": "^2.13.2",
     "jsonwebtoken": "^8.5.1",
     "loadsh": "0.0.4",
-    "moment": "^2.25.3",
+    "moment": "^2.26.0",
     "naf-core": "^0.1.2",
+    "qrcode": "^1.4.4",
     "stomp": "^0.1.1",
     "videojs-contrib-hls": "^5.15.0",
     "videojs-flash": "^2.2.1",
     "vue": "^2.6.11",
-    "vue-meta": "^2.3.3",
-    "vue-router": "^3.1.6",
-    "vue-video-player": "^5.0.2",
-    "vuex": "^3.1.3",
+    "vue-meta": "^2.3.4",
+    "vue-router": "^3.3.2",
+    "vuex": "^3.4.0",
     "wangeditor": "^3.1.1"
   },
   "devDependencies": {

+ 7 - 2
public/home.html

@@ -21,8 +21,13 @@
     <a href="" style="display: none;">
       <div class="home-btn"></div>
     </a>
-    <img src="static/images/logo.png" alt="">
-    <p>吉林省计算中心科技服务平台</p>
+    <img class='image' src="static/images/logo.png" alt="">
+    <p class='title'>吉林省计算中心科技服务平台</p>
+    <p class='login'>
+      <a href=""><img src="./static/home/images/登录.png" alt=""></a>
+      <a href="http://free.liaoningdoupo.com/platlive/newlogin">个人登录</a>
+      <a href="http://free.liaoningdoupo.com/platlogin/">管理登录</a>
+    </p>
   </div>
   <img class="sci-wheel" src="static/home/images/sci.gif" alt="">
   <div class="center">

+ 41 - 3
public/static/home/css/index.css

@@ -163,19 +163,57 @@ body {
     background: rgba(0, 0, 0, 0.3);
 }
 
-.header img {
+.header .image {
     float: left;
     margin: 27px 10px;
     width: 60px;
 }
 
-.header p {
+.header .title {
     float: left;
     font-size: 30px;
     color: white;
     letter-spacing: 3px;
 }
-
+.header .login{
+  float: right;
+  width: 270px;
+  margin: 30px 60px 0 0px;
+}
+.header .login a:first-child{
+  float: left;
+  width: 40px;
+  height: 40px;
+  border: 1px solid #ccc;
+  background-color: #cccccc3f;
+  border-radius: 5px;
+}
+.header .login a:first-child img{
+    float: left;
+    padding: 10px;
+}
+.header .login a:nth-child(2){
+  float: left;
+  width: 100px;
+  height: 40px;
+  border: 1px solid #ccc;
+  line-height: 40px;
+  text-align: center;
+  color: #ccc;
+  background-color: #cccccc3f;
+  border-radius: 5px;
+}
+.header .login a:nth-child(3){
+  float: left;
+  width: 100px;
+  height: 40px;
+  border: 1px solid #ccc;
+  line-height: 40px;
+  text-align: center;
+  color: #ccc;
+  background-color: #cccccc3f;
+  border-radius: 5px;
+}
 .header .home-btn {
     float: left;
     margin-top: 20px;

BIN
public/static/home/images/登录.png


+ 54 - 0
src/components/qrcode.vue

@@ -0,0 +1,54 @@
+<template>
+  <div id="qrcode">
+    <img :src="dataUrl" />
+  </div>
+</template>
+
+<script>
+import Vue from 'vue';
+import QRCode from 'qrcode';
+export default {
+  name: 'qrcode',
+  props: {
+    qrcode: null,
+  },
+  components: {},
+  data: () => ({
+    dataUrl: null,
+    token: null,
+  }),
+  async mounted() {
+    await this.initQrcode();
+  },
+  created() {},
+  computed: {},
+  methods: {
+    async initQrcode() {
+      // 创建二维码
+      if (!this.qrcode) return;
+      let uri = `${Vue.config.weixin.baseUrl}/qrcode/${this.qrcode}/scan`;
+      if (uri.startsWith('/')) {
+        uri = `${location.protocol}//${location.host}${uri}`;
+      }
+      this.dataUrl = await QRCode.toDataURL(uri);
+      this.$stomp({
+        [`/exchange/qrcode.login/${this.qrcode}`]: this.onMessage,
+      });
+    },
+    onMessage(message) {
+      console.log('receive a message: ', message.body);
+      if (message.body == 'scaned') {
+        try {
+          this.$emit('toReturn', message);
+          console.log('扫码登录成功');
+        } catch (err) {
+          console.log('扫码登录失败');
+          console.error(err);
+        }
+      }
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 2 - 0
src/store/index.js

@@ -26,6 +26,7 @@ import comment from '@common/store/live/comment';
 import tranaudit from '@common/store/market/tranaudit';
 import expertsuser from '@common/store/market/exportuser';
 import productpact from '@common/store/market/productpact';
+import wxchattest from './user/wxchattest';
 import users from './user';
 Vue.use(Vuex);
 
@@ -59,5 +60,6 @@ export default new Vuex.Store({
     expertsuser,
     users,
     productpact,
+    wxchattest,
   },
 });

+ 34 - 0
src/store/user/wxchattest.js

@@ -0,0 +1,34 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  wxchattestInfo: `/api/auth/wxchattest`,
+};
+const state = () => ({});
+const mutations = {
+  setUser(state, payload) {
+    if (payload) {
+      state.user = payload;
+      sessionStorage.setItem('user', JSON.stringify(payload));
+    } else {
+      let user = sessionStorage.getItem('user');
+      if (user) state.user = JSON.parse(user);
+      else return false;
+    }
+  },
+};
+
+const actions = {
+  async login({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.wxchattestInfo}`, payload);
+    return res;
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 27 - 0
src/views/userCenter/basicInfo/index.vue

@@ -3,6 +3,10 @@
     <el-row>
       <el-col :span="24">
         <el-col :span="24" class="leftTop"> <span>|</span> <span>基本信息</span> </el-col>
+        <el-col :span="24" class="qrcode">
+          <span>绑定微信</span>
+          <img :src="qc" />
+        </el-col>
         <el-col :span="24" class="info">
           <el-form ref="form" :model="form" :rules="rules" label-width="120px">
             <el-form-item label="用户名称" prop="name">
@@ -140,6 +144,7 @@ import upload from '@/components/uploadone.vue';
 const { mapActions: login } = createNamespacedHelpers('login');
 const { mapActions: market } = createNamespacedHelpers('market');
 const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
+import QRCode from 'qrcode';
 export default {
   name: 'index',
   props: {},
@@ -219,6 +224,7 @@ export default {
         remark: [{ required: false, message: '请输入备注', trigger: 'blur' }],
       },
       form: {},
+      qc: '',
     };
   },
   created() {
@@ -288,6 +294,14 @@ export default {
     uploadSuccess({ type, data }) {
       this.$set(this.form, `${type}`, data.uri);
     },
+    async creatQrCode() {
+      let url = `http://free.liaoningdoupo.com/api/auth/wxchat?redirect_uri=http://free.liaoningdoupo.com/platmobile/bind/&type=1&uid=${this.user.uid}`; // 需要转换为二维码的内容
+      let el = document.getElementById('qrCodeUrl');
+      this.qc = await QRCode.toDataURL(url, { height: 100, width: 100 });
+    },
+  },
+  mounted() {
+    this.creatQrCode();
   },
   computed: {
     ...mapState(['user']),
@@ -317,4 +331,17 @@ export default {
 .info {
   padding: 0 40px 0 0;
 }
+.qrcode {
+  padding: 10px 45px;
+  span {
+    float: left;
+    width: 85px;
+    font-size: 16px;
+    color: #606266;
+    padding: 50px 0;
+  }
+  img {
+    border: 1px solid #ccc;
+  }
+}
 </style>