소스 검색

智慧考试

xuqiaoying 3 년 전
부모
커밋
2364264b14
4개의 변경된 파일133개의 추가작업 그리고 39개의 파일을 삭제
  1. 2 2
      common/request.js
  2. 11 3
      pages2/appointment/order.vue
  3. 103 3
      pages2/exam/signCommit.vue
  4. 17 31
      project.config.json

+ 2 - 2
common/request.js

@@ -6,11 +6,11 @@ var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://120.79.166.s78:19012' // 测试环境
+export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test(后端本地)
 // export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
 // export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
-export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
+// export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
 
  //图片上传api
 // export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release

+ 11 - 3
pages2/appointment/order.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="safeArea">
+  <view class="safeAreas">
     <nav-bar title="预约考试"></nav-bar>
     <view class="appointment">
       <view class="appointmentItem">
@@ -124,7 +124,7 @@
             class="item"
             v-for="(item, index) in listData"
             :key="index"
-            @click="choAddress(index)"
+            @click="choAddress(item, index)"
           >
             <u-checkbox
               class="checkbox"
@@ -166,6 +166,7 @@ export default {
       openVerify: false, // 控制是否手动验证
       commitment_electr_signature: '',
       isUploading: false,
+      siteId: '', // 考试id
     };
   },
   async onLoad(option) {
@@ -197,6 +198,7 @@ export default {
     },
     //获取考试地点
     getInfo() {
+      // apply/subscribeApplySite
       this.$api
         .getApplysubscribeApplySite({ applyId: this.applyId })
         .then((res) => {
@@ -212,7 +214,8 @@ export default {
     showAddress() {
       this.address_show = true;
     },
-    choAddress(index) {
+    choAddress(item, index) {
+      this.siteId = item.siteId
       this.listData.forEach((item, idx) => {
         this.$set(item, "checked", false);
         if (idx === index) {
@@ -230,6 +233,7 @@ export default {
         });
         return;
       }
+      this.siteId = this.listData[index].siteId
       if (this.addressId === this.listData[index].id) {
         this.address_show = false;
         return;
@@ -330,6 +334,7 @@ export default {
             applySiteStartTime: copyData[index].startTimeC,
             applySiteEndTime: copyData[index].endTimeC,
             orderGoodsId: self.orderGoodsId,
+            siteId: this.siteId, // 考场id
             reportFile: this.commitment_electr_signature,
           };
           console.log('-----data', data)
@@ -457,6 +462,9 @@ page {
 }
 </style>
 <style scoped lang="scss">
+  .safeAreas {
+    padding-bottom: 30rpx;
+  }
 .appointment {
   padding: 0 8rpx;
   .appointmentItem {

+ 103 - 3
pages2/exam/signCommit.vue

@@ -46,23 +46,112 @@
           </view> -->
         </view>
       </view>
+      <view class="finish_btn" @click="submits()">
+        完成签署
+      </view>
     </view>
 </template>
 
 <script>
+  import Handwriting from "@/common/signature.js";
 export default {
     name: 'sign_commit',
     data() {
         return {
+          handwriting: '',
+          lineColor: "black",
+          slideValue: 50,
+          commitment_electr_signature: '',
+          isUploading: false,
+        }
+    },
+    onReady(res) {
+      this.handwriting = new Handwriting({
+        lineColor: this.lineColor,
+        slideValue: this.slideValue, // 0, 25, 50, 75, 100
+        canvasName: "handWriting",
+      });
+      // this.$refs.uForm.setRules(this.rules);
+    },
+    methods: {
+      retDraw() {
+        this.handwriting.retDraw()
+        this.commitment_electr_signature = ''
+        // this.$set(this.form, "commitment_electr_signature", "");
+      },
+      uploadScaleStart(event) {
+        this.handwriting.uploadScaleStart(event);
+      },
+      uploadScaleMove(event) {
+        this.handwriting.uploadScaleMove(event);
+      },
+      uploadScaleEnd(event) {
+        this.handwriting.uploadScaleEnd(event);
+      },
+      subCanvas() {
+        console.log("签名-------");
+        return new Promise((resolve, reject) => {
+          if (this.commitment_electr_signature) {
+            resolve();
+            return;
+          }
+          this.handwriting.saveCanvas().then((res) => {
+              if (this.handwriting.linePrack.length) {
+                console.log('签名-----res', res)
+                // this.$set(this.form, "commitment_electr_signature", res);
+                this.commitment_electr_signature = res
+              }
+              resolve(res)
+            })
+            .catch((err) => {
+              uni.showToast({
+                title: "签名上传失败",
+                icon: "error",
+              });
 
+            });
+            this.isUploading = false
+        });
+      },
+      async submits() {
+        if (this.isUploading) {
+          return;
         }
-    }
+        this.isUploading = true
+        await this.subCanvas()
+          if (!this.commitment_electr_signature) {
+            uni.showToast({
+              title: "请签名",
+              icon: "none",
+            })
+            return
+          } else {
+            await this.submitApi()
+          }
+      },
+       //提交表单
+      async submitApi() {
+        if (this.commitment_electr_signature) {
+          this.commitment_electr_signature = await this.$method.uploadFile(
+            this.commitment_electr_signature,
+            0
+          );
+          console.log('----commitment_electr_signature', this.commitment_electr_signature)
+        }
+      },
+    },
 }
 </script>
 
+<style>
+  page {
+    background-color: #eaeef1;
+  }
+</style>
 <style lang="scss" scoped>
 .sign_commit {
-    .appointmentItem {
+  padding-bottom: 50rpx;
+  .appointmentItem {
     margin: 24rpx 0 40rpx;
     .title {
       font-size: 30rpx;
@@ -87,7 +176,7 @@ export default {
     }
     .commitment {
       padding: 12rpx;
-      height: 300rpx;
+      height: 900rpx;
       background: #ffffff;
       overflow-y: auto;
     }
@@ -108,5 +197,16 @@ export default {
       }
     }
   }
+  .finish_btn {
+    // width: 100%;
+    height: 100rpx;
+    line-height: 100rpx;
+    text-align: center;
+    background-color:#1890ff;
+    font-size: 32rpx;
+    color: #fff;
+    border-radius: 10rpx;
+    margin: 20rpx 24rpx;
+  }
 }
 </style>

+ 17 - 31
project.config.json

@@ -1,7 +1,8 @@
 {
-  "description": "项目配置文件",
+  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "packOptions": {
-    "ignore": []
+    "ignore": [],
+    "include": []
   },
   "setting": {
     "bundle": false,
@@ -31,39 +32,24 @@
     "packNpmRelationList": [],
     "minifyWXSS": true,
     "showES6CompileOption": false,
-    "minifyWXML": true
+    "minifyWXML": true,
+    "useStaticServer": true,
+    "checkInvalidKey": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "disableUseStrict": false,
+    "useCompilerPlugins": false
   },
   "compileType": "miniprogram",
   "libVersion": "2.17.0",
   "appid": "wxfde43fb55c186822",
   "projectname": "miniprogram-1",
-  "debugOptions": {
-    "hidedInDevtools": []
-  },
-  "scripts": {},
-  "staticServerOptions": {
-    "baseURL": "",
-    "servePath": ""
-  },
-  "isGameTourist": false,
-  "condition": {
-    "search": {
-      "list": []
-    },
-    "conversation": {
-      "list": []
-    },
-    "game": {
-      "list": []
-    },
-    "plugin": {
-      "list": []
-    },
-    "gamePlugin": {
-      "list": []
-    },
-    "miniprogram": {
-      "list": []
-    }
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
   }
 }