HZH 4 лет назад
Родитель
Сommit
4bee487359

+ 5 - 0
package-lock.json

@@ -12357,6 +12357,11 @@
       "integrity": "sha1-XS/yKXcAPsaHpLhwc9+7rBRszyk=",
       "dev": true
     },
+    "weixin-js-sdk": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+      "integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
+    },
     "whatwg-url": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-2.0.1.tgz",

+ 2 - 1
package.json

@@ -17,7 +17,8 @@
     "mypackage_hzh": "^1.0.0",
     "vue": "^2.6.11",
     "vue-router": "^3.1.3",
-    "vuex": "^3.1.2"
+    "vuex": "^3.1.2",
+    "weixin-js-sdk": "^1.6.0"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "^3.12.1",

+ 0 - 3
src/components/DoTest.vue

@@ -1,3 +0,0 @@
-<template src="./doTest/doTest.html"></template>
-<script src="./doTest/doTest.js"></script>
-<style src="./doTest/doTest.scss" lang="scss" scoped></style>

+ 1 - 1
src/components/MainPage.vue

@@ -88,7 +88,7 @@
       <div>
         {{currentUser.name}},欢迎你
         <ul>
-          <!-- <li @click="goSinglePage">个人主页</li> -->
+          <li @click="goSinglePage">个人主页</li>
           <li>
             <a @click="logout">退出</a>
           </li>

+ 0 - 282
src/components/MainPage/UserPage.vue

@@ -1,282 +0,0 @@
-<style lang="scss" scoped>
-.user-page{
-  .tool-card{
-    text-align: center;
-    &>div{
-      border-radius: 5px;
-      width: 230px;
-      height: 120px;
-      color: white;
-      display: inline-block;
-      margin: 10px;
-      padding-top: 35px; 
-      &:nth-child(1){
-        background: #FF6666;
-      }
-      &:nth-child(2){
-        background: #33CBCC;
-      }
-      &:nth-child(3){
-        background: #0299FC;
-      }
-      &:nth-child(4){
-        background: #99CC67;
-      }
-      &:nth-child(5){
-        background: #669ACC;
-      }
-      p{
-        &:nth-child(1){
-          font-size: 17px;
-        }
-        &:nth-child(2){
-        }
-      }
-    }
-  }
-  .chart-part{
-    width: 1220px;
-    height: 300px;
-    margin: 20px auto;
-    &>div{
-      display: inline-block;
-      width: 50%;
-      height: 100%;
-      vertical-align: top;
-      p{
-        width: calc(100% - 10px);
-        padding: 10px;
-        border-bottom: solid 2px #DCDCDC; 
-      }
-    }
-    .chart1{
-        width: 100%;
-        height: 250px;
-    }
-  }
-  .last-part{
-    width: 1220px;
-    margin: 20px auto;
-    &>div{
-      display: inline-block;
-      vertical-align: top;
-      &:nth-child(1){
-        width: 20%;
-      }
-      &:nth-child(2){
-        width: 50%;
-      }
-      &:nth-child(3){
-        width: 30%;
-      }
-      p{
-        width: calc(100% - 10px);
-        padding: 10px;
-        border-bottom: solid 2px #DCDCDC; 
-      }
-      ul{
-        color: #999999;
-        font-size: 16px;
-        margin: 10px;
-        li{
-          margin: 8px;
-        }
-      }
-      table{
-        width: 100%;
-        color: #999999;
-        font-size: 16px;
-        th{
-          text-align: center;
-          border-bottom:  solid 1px #DCDCDC;
-          padding: 10px;
-        }
-        td{
-          border-bottom:  solid 1px #DCDCDC;
-          padding: 10px;
-        }
-      }
-    }
-  }
-}
-</style>
-<template>
-<div class="user-page">
-  <div class="tool-card">
-    <div>
-      <p>我的账户</p>
-      <p>My account</p>
-    </div>
-    <div>
-      <p>个人资料</p>
-      <p>Personal information</p>
-    </div>
-    <div>
-      <p>测试报告</p>
-      <p>Test report</p>
-    </div>
-    <div>
-      <p>学习提高</p>
-      <p>Learning improvement</p>
-    </div>
-    <div>
-      <p>系统设置</p>
-      <p>System settings</p>
-    </div>
-  </div>
-  <div class="chart-part">
-    <div>
-      <p>登录频率</p>
-      <div class="chart1" v-echarts-render="{options: echartOp1}">
-
-      </div>  
-    </div>
-    <div>
-      <p>练习题数量</p>
-      <div class="chart1" v-echarts-render="{options: echartOp2}">
-
-      </div>  
-    </div>
-  </div>
-  <div class="last-part">
-    <div>
-      <p>站内热门测试</p>
-      <ul>
-        <li>能力测试
-          <ul>
-            <li>五年级数学测试 HOT</li>
-            <li>六年级数学测试 HOT</li>
-            <li>初一数学测试 HOT</li>
-          </ul>
-        </li>
-        <li>学习习惯诊断
-        </li>
-        <li>自主探究能力
-        </li>
-      </ul>
-    </div>
-    <div>
-      <p>系统消息</p>
-      <table class="table table-common">
-          <thead>
-            <tr>
-                <th>内容</th>
-                <th>日期</th>
-                <th>已/未读</th>
-                <th>操作</th>
-            </tr>
-          </thead>
-            <tbody>
-                <tr>
-                    <td>报告已签收,请确认</td>
-                    <td>2019-01-01</td>
-                    <td>未读</td>
-                    <td>删除</td>
-                </tr>
-                <tr>
-                    <td>恭喜你,完成《六年级数学测试》</td>
-                    <td>2019-01-02</td>
-                    <td>已读</td>
-                    <td>删除</td>
-                </tr>
-                <tr>
-                    <td>报告已签收,请确认</td>
-                    <td>2019-01-02</td>
-                    <td>已读</td>
-                    <td>删除</td>
-                </tr>
-                <tr>
-                    <td>恭喜你,完成《六年级数学测试》</td>
-                    <td>2019-01-02</td>
-                    <td>已读</td>
-                    <td>删除</td>
-                </tr>
-            </tbody>
-        </table>
-    </div>
-    <div>
-      <p>站内通告</p>
-      <ul>
-        <li>网站建设推进</li>
-        <li>官网设计稿出台</li>
-        <li>测试出题标准遭泄露</li>
-        <li>白爷新作《议爻象》发售</li>
-        <li>爻象测评首次会议记录</li>
-      </ul>
-    </div>
-  </div>
-</div>
-</template>
-
-<script>
-export default {
-  name: 'UserPage',
-  components: {
-  },
-  data () {
-      return {
-        echartOp1:{
-          grid: {
-              left: '3%',
-              right: '4%',
-              bottom: '3%',
-              containLabel: true
-          },
-          xAxis: {
-              type: 'category',
-              boundaryGap: false,
-              data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
-          },
-          yAxis: {
-              type: 'value'
-          },
-          
-          series: [{
-              data: [3, 3, 4, 5, 2, 1, 1],
-              type: 'line',
-              areaStyle: {}
-          }]
-        },
-        echartOp2:{
-          color: ['#3398DB'],
-          tooltip : {
-              trigger: 'axis',
-              axisPointer : {            // 坐标轴指示器,坐标轴触发有效
-                  type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
-              }
-          },
-          grid: {
-              left: '3%',
-              right: '4%',
-              bottom: '3%',
-              containLabel: true
-          },
-          xAxis : [
-              {
-                  type : 'category',
-                  data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
-                  axisTick: {
-                      alignWithLabel: true
-                  }
-              }
-          ],
-          yAxis : [
-              {
-                  type : 'value'
-              }
-          ],
-          series : [
-              {
-                  name:'直接访问',
-                  type:'bar',
-                  barWidth: '60%',
-                  data:[10, 52, 200, 334, 390, 330, 220]
-              }
-          ]
-        }
-	  }
-  },
-  methods: {
-  }
-}
-</script>

+ 76 - 0
src/components/UserPage.vue

@@ -0,0 +1,76 @@
+<style lang="scss" scoped>
+.user-page{
+  position: relative;
+  .head{
+    height: 50px;
+    line-height: 50px;
+    background: #2ea3cf;
+    text-align: right;
+    button{
+      border: none;
+      background: white;
+      color: #2ea3cf;
+      padding: 2px 10px;
+      font-size: 12px;
+      margin-right: 150px; 
+    }
+    .pic{
+      position: absolute;
+      top: 0;
+      right: 70px;
+      i{
+        display: block;
+        width: 1px;
+        height: 25px;
+        background: white;
+        margin: 0 auto -4px;
+      }
+      &>div{
+        width: 54px;
+        height: 54px;
+        border-radius: 27px;
+        border: solid 1px white;
+        background: transparent;
+        padding: 3px;
+        div{
+          width: 46px;
+          height: 46px;
+          border-radius: 23px;
+          border: solid 1px black;
+          background: white;
+        }
+      }
+    }
+  }
+}
+</style>
+<template>
+<div class="user-page">
+  <div class="head">
+    <button>爻象个人中心</button>
+    <div class="pic">
+      <i></i>
+      <div>
+        <div></div>
+      </div>
+    </div>
+  </div>
+  <div class="">
+
+  </div>
+</div>
+</template>
+
+<script>
+export default {
+  name: 'UserPage',
+  components: {
+  },
+  data () {
+    return {
+	  }
+  },
+  methods: {
+  }
+}
+</script>

+ 33 - 2
src/components/UserTest.vue

@@ -52,7 +52,7 @@
 </style>
 <template>
 <div class="user-test">
-  <div class="left-menu">
+  <!-- <div class="left-menu">
     <div class="user-info">
       <img src="@/images/icon/user.png">
       <p>你那么狗</p>
@@ -87,11 +87,14 @@
   </div>
   <div class="right-content">
 
-  </div>
+  </div> -->
+  <button @click="scan">扫一扫</button>
 </div>
 </template>
 
 <script>
+import wx from 'weixin-js-sdk';
+import axios from 'axios';
 export default {
   name: 'UserTest',
   components: {
@@ -101,8 +104,36 @@ export default {
       }
   },
   created() {
+    axios.post(
+      'http://my.service.com/index.php/opcode/6002',{ 
+      url:location.href.split('#')[0]   
+    }).then((res)=>{
+      wx.config({
+        debug: true, // 开启调试模式,
+        appId: res.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
+        timestamp: res.timestamp, // 必填,生成签名的时间戳
+        nonceStr: res.nonceStr, // 必填,生成签名的随机串
+        signature: res.signature,// 必填,签名,见附录1
+        jsApiList: ['scanQRCode'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+      });
+    })
   },
   methods: {
+    scan(){
+      wx.scanQRCode({
+          desc: 'scanQRCode desc',
+          needResult : 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+          scanType : [ "qrCode", "barCode" ], // 可以指定扫二维码还是一维码,默认二者都有
+          success : function(res) {
+              console.log("调用扫描成功",res);
+              var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
+              alert("扫码结果为:" + result);
+          },
+          error:function(res){
+              console.log(res)
+          }
+      });
+    }
   }
 }
 </script>

+ 3 - 0
src/components/doTest/DoTest.vue

@@ -0,0 +1,3 @@
+<template src="./doTest.html"></template>
+<script src="./doTest.js"></script>
+<style src="./doTest.scss" lang="scss" scoped></style>

+ 3 - 3
src/components/GuidePage.vue → src/components/doTest/GuidePage.vue

@@ -3,13 +3,13 @@
   width: 100%;
   height: 100%;
   position: relative;
-  background: url("../images/doTest/restBack.jpg") no-repeat center;
+  background: url("../../images/doTest/restBack.jpg") no-repeat center;
   background-size:cover;
   text-align: center;
   .top-part {
     width: 100%;
     height: 80px;
-    background: url("../images/doTest/top-back.png") no-repeat center;
+    background: url("../../images/doTest/top-back.png") no-repeat center;
     background-size:cover;
     position: relative;
     &>div{
@@ -47,7 +47,7 @@
       }
     }
     &.guide-2{
-      background: url("../images/doTest/testBack.jpg") no-repeat center;
+      background: url("../../images/doTest/testBack.jpg") no-repeat center;
       background-size:cover;
       position: relative;
       color: white;

+ 1 - 1
src/components/RestPage.vue → src/components/doTest/RestPage.vue

@@ -21,7 +21,7 @@
   .rest-page{
     width: 100%;
     height: calc(100% - 80px);
-    background: url("../images/doTest/restBack.jpg")no-repeat center;
+    background: url("../../images/doTest/restBack.jpg")no-repeat center;
     background-size: cover;
     padding: 20px;
     text-align: center;

+ 1 - 1
src/components/TestResult.vue → src/components/doTest/TestResult.vue

@@ -21,7 +21,7 @@
   .result-page{
     width: 100%;
     height: calc(100% - 80px);
-    background: url("../images/doTest/restBack.jpg")no-repeat center;
+    background: url("../../images/doTest/restBack.jpg")no-repeat center;
     background-size: cover;
     padding: 20px;
     text-align: center;

+ 0 - 0
src/components/TestResult2.vue → src/components/doTest/TestResult2.vue


+ 10 - 9
src/router/index.js

@@ -13,12 +13,13 @@ const News = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/M
 const AboutUs = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/MainPage/AboutUs');
 const ContactUs = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/MainPage/ContactUs');
 const ExamTable = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/MainPage/ExamTable');
-const UserPage = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/MainPage/UserPage');
 
-const DoTest = () => import(/* webpackChunkName: "group-doTest"*/'@/components/DoTest');
-const RestPage = () => import(/* webpackChunkName: "group-doTest"*/'@/components/RestPage');
-const TestResult = () => import(/* webpackChunkName: "group-doTest"*/'@/components/TestResult2');
-const GuidePage = () => import(/* webpackChunkName: "group-doTest"*/'@/components/GuidePage');
+const UserPage = () => import(/* webpackChunkName: "group-mainPage"*/'@/components/UserPage');
+
+const DoTest = () => import(/* webpackChunkName: "group-doTest"*/'@/components/doTest/DoTest.vue');
+const RestPage = () => import(/* webpackChunkName: "group-doTest"*/'@/components/doTest/RestPage');
+const TestResult = () => import(/* webpackChunkName: "group-doTest"*/'@/components/doTest/TestResult2');
+const GuidePage = () => import(/* webpackChunkName: "group-doTest"*/'@/components/doTest/GuidePage');
 
 const ControlApp = () => import(/* webpackChunkName: "group-controlApp"*/'@/ControlApp');
 const ControlMainPage = () => import(/* webpackChunkName: "group-controlApp"*/'@/components/ControlMainPage');
@@ -85,11 +86,11 @@ export default new Router({
                 path: 'examTable',
                 name: 'ExamTable',
                 component: ExamTable,
-            }, {
-                path: 'userPage',
-                name: 'UserPage',
-                component: UserPage,
             }],
+        },{
+            path: 'userPage',
+            name: 'UserPage',
+            component: UserPage,
         },{
             path: 'guidePage/:examId',
             name: 'GuidePage',