ArvinQi 6 år sedan
förälder
incheckning
646d235abe

+ 49 - 28
components/input/ver.vue

@@ -1,60 +1,81 @@
 <template>
   <div class="input-ver">
     <el-input v-model="code" @change="$emit('change', code)" placeholder="请输入验证码"></el-input>
-    <el-button :class="{grey: running}" type="text" @click="run">{{text}}</el-button>
+    <el-button :class="{grey: running}" type="text" @click="run">
+      <span>{{text}}</span>
+    </el-button>
+    <div id="getCode"></div>
   </div>
 </template>
 
 <script>
-let time = 60
-let text = '获取验证码'
-let interval
+let time = 60;
+let text = "获取验证码";
+let interval;
 
 export default {
   data() {
     return {
       // 验证码
-      code: '',
+      code: "",
       time: time + 1,
-      running: false,
-    }
+      running: false
+    };
+  },
+  head() {
+    return {
+      script: [
+        { src: "https://cdn.dingxiang-inc.com/ctu-group/captcha-ui/index.js" }
+      ]
+    };
   },
   computed: {
     text() {
-      if(this.time < 1 || this.time > time) {
-        this.running = false
-        if(this.time < 1) {
-          clearInterval(interval)
-          this.time = time + 1
-          this.running = false
+      if (this.time < 1 || this.time > time) {
+        this.running = false;
+        if (this.time < 1) {
+          clearInterval(interval);
+          this.time = time + 1;
+          this.running = false;
         }
-        return text
+        return text;
       }
-      return `重新获取(${this.time}s)`
+      return `重新获取(${this.time}s)`;
     }
   },
-  mounted() {
-
-  },
+  mounted() {},
   methods: {
     run() {
-      if(this.running) return
-      this.$emit('click', () => {
-        this.running = true
-        this.time--
-        interval = setInterval(() => {
-          this.time--
-        }, 1000)
-      })
-    },
+      if (this.running) return;
+      const that = this;
+      const myCaptcha = _dx.Captcha(document.getElementById("getCode"), {
+        appId: "2db960e4ca0eaeee12ef63db7e5b3918", //appId,在控制台中“应用管理”或“应用配置”模块获取
+        success: function(token) {
+          console.log("token:", token);
+
+          that.$emit("click", token, () => {
+            that.running = true;
+            that.time--;
+            interval = setInterval(() => {
+              that.time--;
+            }, 1000);
+          });
+        }
+      });
+      myCaptcha.show();
+    }
   }
-}
+};
 </script>
 
 <style scoped>
 .input-ver {
   position: relative;
 }
+#getCode {
+  position: relative;
+  z-index: 20;
+}
 .el-button {
   position: absolute;
   top: 0;

+ 15 - 7
components/sign/education.vue

@@ -63,11 +63,7 @@
                 ></el-option>
               </el-select>
               <span class="opts">
-                <el-button
-                  v-if="education.length > 1"
-                  type="danger"
-                  @click="handleDelete(idx, item)"
-                >删除</el-button>
+                <el-button type="danger" @click="handleDelete(idx, item)">删除</el-button>
                 <el-button type="info" @click="handleCancel(idx, item)">取消</el-button>
                 <el-button type="primary" @click="handleConfirm(idx, item)">确认</el-button>
               </span>
@@ -258,15 +254,27 @@ export default {
       if (!item.date) {
         this.$message.error("请设置开始时间/结束时间!");
         return;
+      } else if (
+        item.date &&
+        item.date[0] &&
+        item.date[1] &&
+        item.date[0] > item.date[1]
+      ) {
+        this.$message.error("请设置开始时间小于结束时间!");
+        return;
       }
       if (!item.university || !item.major || !item.education_background) {
         this.$message.error("请设置学校名称/专业/学历!");
         return;
       }
-      if (!item.diploma_url && !item.diploma_photo) {
-        this.$message.error("请提供学历证明!");
+      if (!item.description || item.description.length < 15) {
+        this.$message.error("教育经历不得低于15个字符");
         return;
       }
+      // if (!item.diploma_url && !item.diploma_photo) {
+      //   this.$message.error("请提供学历证明!");
+      //   return;
+      // }
       this.editingItem = [];
       // const submitItem = {
       //   ...item,

+ 17 - 8
components/sign/experience.vue

@@ -141,10 +141,9 @@ export default {
       };
     },
     handleRank() {
-      console.log(this.rankForm.first);
       let idx = 0;
       this.experience.map((it, index) => {
-        if (it.id == this.rankForm) {
+        if (it.id == this.rankForm.first) {
           idx = index;
         }
         return it;
@@ -190,9 +189,18 @@ export default {
         this.$message.error("请修改后保存!");
         return;
       }
+      console.log(item.date);
       if (!item.date) {
         this.$message.error("请设置开始时间/结束时间!");
         return;
+      } else if (
+        item.date &&
+        item.date[0] &&
+        item.date[1] &&
+        item.date[0] > item.date[1]
+      ) {
+        this.$message.error("请设置开始时间小于结束时间!");
+        return;
       }
       if (!item.company || !item.title) {
         this.$message.error("请设置公司名称/职位!");
@@ -203,12 +211,9 @@ export default {
         return;
       }
       this.editingItem = [];
-      const submitItem = {
-        ...item,
-        start_time: item.date[0],
-        end_time: item.date[1]
-      };
-      this.originExperience.splice(idx, 1, submitItem);
+      item.start_time = item.date[0];
+      item.end_time = item.date[1];
+      this.originExperience.splice(idx, 1, item);
       this.onSubmit();
     },
     editItem(item, idx) {
@@ -297,6 +302,10 @@ export default {
   }
   .first-form {
     margin-left: 40px;
+    .el-radio-group {
+      display: flex;
+      flex-direction: column;
+    }
   }
   .first-radio {
     position: relative;

+ 1 - 1
components/sign/info.vue

@@ -423,7 +423,7 @@ export default {
           this.$message.success("保存成功!");
           this.editing = false;
         } else {
-          this.$message.error(res.info);
+          // this.$message.error(res.info);
         }
       });
     },

+ 1 - 1
components/sign/profile.vue

@@ -38,7 +38,7 @@ export default {
   },
   async mounted() {
     let res = await this.$axios.$post("/api/user/get_resume");
-    this.content = res.data && res.data.personaldetails;
+    this.content = res.data ? res.data.personaldetails : "";
   },
   methods: {
     handleEdit() {

+ 1 - 1
components/sign/verify.vue

@@ -5,7 +5,7 @@
       <span v-if="this.userInfo.realname_verify_status === '2'" class="status success">已认证</span>
       <span v-else-if="this.userInfo.realname_verify_status === '1'" class="status info">审核中</span>
       <span v-else class="status warning">
-        <a href="/setting/user">去认证</a>
+        <a href="/setting/user" target="_blank">去认证</a>
       </span>
     </h5>
   </div>

+ 8 - 3
components/sign/work-form.vue

@@ -50,7 +50,12 @@
         </el-form-item>
       </div>
       <el-form-item label="作品描述" prop="description">
-        <el-input type="textarea" :rows="5" placeholder="请输入" v-model="work.description"></el-input>
+        <el-input
+          type="textarea"
+          :rows="5"
+          placeholder="请输入60~200字的作品描述"
+          v-model="work.description"
+        ></el-input>
       </el-form-item>
       <el-form-item label="作品职责" prop="duty">
         <el-input
@@ -118,14 +123,14 @@ export default {
           {
             required: true,
             message: "行业类型不得为空",
-            trigger: "change"
+            trigger: "blur"
           }
         ],
         function_ops: [
           {
             required: true,
             message: "关键功能不得为空",
-            trigger: "change"
+            trigger: "blur"
           }
         ],
         duty: [

+ 4 - 3
package.json

@@ -15,15 +15,16 @@
     "@nuxtjs/axios": "^5.3.6",
     "@nuxtjs/proxy": "^1.3.1",
     "cross-env": "^5.2.0",
+    "css-loader": "^2.1.1",
+    "dayjs": "^1.8.15",
     "element-ui": "^2.4.11",
     "hljs": "^6.2.3",
     "node-sass": "^4.12.0",
     "nuxt": "^2.6.3",
     "qs": "^6.7.0",
     "sass-loader": "^7.1.0",
-    "vue-quill-editor": "^3.0.6",
-    "css-loader": "^2.1.1",
-    "style-loader": "^0.23.1"
+    "style-loader": "^0.23.1",
+    "vue-quill-editor": "^3.0.6"
   },
   "devDependencies": {
     "less": "^3.9.0",

+ 4 - 0
pages/sign/new.vue

@@ -68,6 +68,10 @@ export default {
       if (res.status === 1) {
         this.$message.success(res.info);
         window.location.href = "/sign/success";
+      } else if (res.status === -11) {
+        // this.$message.error("请设置主要展示工作经历");
+      } else if (res.status === -10) {
+        // this.$message.error("其他错误");
       }
     }
   }

+ 92 - 88
pages/user/register.vue

@@ -73,17 +73,17 @@
       <a
         href="https://github.com/login/oauth/authorize?client_id=65396ecb78f8cb000768&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Flogingithub&scope=user%3Aemail"
       >
-        <img src="~@/assets/img/user/github_logo.png" alt="github">
+        <img src="~@/assets/img/user/github_logo.png" alt="github" />
       </a>
       <a
         href="https://api.weibo.com/oauth2/authorize?client_id=2749593033&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Floginweibo&response_type=code&forcelogin=true"
       >
-        <img src="~@/assets/img/user/sina_logo.png" alt="sina">
+        <img src="~@/assets/img/user/sina_logo.png" alt="sina" />
       </a>
       <a
         href="https://open.weixin.qq.com/connect/qrconnect?appid=wx0f62bbdc948d0f23&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Floginweixin&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect"
       >
-        <img src="~@/assets/img/user/wechat_logo.png" alt="wechat">
+        <img src="~@/assets/img/user/wechat_logo.png" alt="wechat" />
       </a>
     </div>
     <agreement :visible.sync="agreeShow"></agreement>
@@ -91,182 +91,186 @@
 </template>
 
 <script>
-import InputVer from '@/components/input/ver'
-import InputVerImg from '@/components/input/ver_img'
-import InputArea from '@/components/input/area'
-import Agreement from '@/components/agreement'
+import InputVer from "@/components/input/ver";
+import InputVerImg from "@/components/input/ver_img";
+import InputArea from "@/components/input/area";
+import Agreement from "@/components/agreement";
 
 export default {
   components: {
     InputVer,
     InputVerImg,
     InputArea,
-    Agreement,
+    Agreement
   },
   data() {
     let validateEmail = (rule, value, callback) => {
       if (!value.trim()) {
-        callback(new Error('请输入邮箱'))
+        callback(new Error("请输入邮箱"));
       } else {
         if (value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)) {
-          callback()
+          callback();
         } else {
-          callback(new Error('邮箱格式不正确!'))
+          callback(new Error("邮箱格式不正确!"));
         }
       }
-    }
+    };
     return {
       pwdShow: false,
       agreeShow: false,
       usePhone: true,
       ruleFormPhone: {
-        mobile: '',
-        ver: '',
-        nickname: '',
-        pwd: '',
+        mobile: "",
+        ver: "",
+        nickname: "",
+        pwd: ""
       },
       rulesPhone: {
         mobile: [
-          { required: true, message: '请输入手机号', trigger: 'blur' },
-          { min: 7, max: 16, message: '请输入正确的手机号', trigger: 'blur' }
-        ],
-        ver: [
-          { required: true, message: '请输入验证码', trigger: 'blur' },
-        ],
-        nickname: [
-          { required: true, message: '请输入昵称', trigger: 'blur' },
+          { required: true, message: "请输入手机号", trigger: "blur" },
+          { min: 7, max: 16, message: "请输入正确的手机号", trigger: "blur" }
         ],
+        ver: [{ required: true, message: "请输入验证码", trigger: "blur" }],
+        nickname: [{ required: true, message: "请输入昵称", trigger: "blur" }],
         pwd: [
-          { required: true, message: '请输入密码', trigger: 'blur' },
-          { min: 6, message: '密码至少为6位字符', trigger: 'blur' },
-        ],
+          { required: true, message: "请输入密码", trigger: "blur" },
+          { min: 6, message: "密码至少为6位字符", trigger: "blur" }
+        ]
       },
       ruleFormEmail: {
-        email: '',
-        ver: '',
-        nickname: '',
-        pwd: '',
+        email: "",
+        ver: "",
+        nickname: "",
+        pwd: ""
       },
       rulesEmail: {
         email: [
-          { validator: validateEmail, message: '请输入正确的邮箱', trigger: 'blur' },
-        ],
-        ver: [
-          { required: true, message: '请输入验证码', trigger: 'blur' },
-        ],
-        nickname: [
-          { required: true, message: '请输入昵称', trigger: 'blur' },
+          {
+            validator: validateEmail,
+            message: "请输入正确的邮箱",
+            trigger: "blur"
+          }
         ],
+        ver: [{ required: true, message: "请输入验证码", trigger: "blur" }],
+        nickname: [{ required: true, message: "请输入昵称", trigger: "blur" }],
         pwd: [
-          { required: true, message: '请输入密码', trigger: 'blur' },
-          { min: 6, message: '密码至少为6位字符', trigger: 'blur' },
-        ],
+          { required: true, message: "请输入密码", trigger: "blur" },
+          { min: 6, message: "密码至少为6位字符", trigger: "blur" }
+        ]
       }
-    }
+    };
   },
   mounted() {
     if (this.$store.getters.isLogin) {
-      this.$message('你已有注册的账号')
+      this.$message("你已有注册的账号");
       setTimeout(() => {
-        location.href = '/'
-      }, 1000)
+        location.href = "/";
+      }, 1000);
     }
   },
   methods: {
     chengeVerMobile(val) {
-      this.ruleFormPhone.ver = val
+      this.ruleFormPhone.ver = val;
     },
     chengeVerEmail(val) {
-      this.ruleFormEmail.ver = val
+      this.ruleFormEmail.ver = val;
     },
     chengeMobile(val) {
-      this.ruleFormPhone.mobile = val
+      this.ruleFormPhone.mobile = val;
     },
     /**
      * 点击注册
      */
     doRegist() {
-      let mobile = this.ruleFormPhone.mobile
+      let mobile = this.ruleFormPhone.mobile;
       let register = async body => {
-        let res = await this.$axios.$post('/api/passport/register', body)
+        let res = await this.$axios.$post("/api/passport/register", body);
         if (res && res.data) {
-          this.$message(res.data.info)
+          this.$message(res.data.info);
           setTimeout(() => {
-            location.href = "/user/success"
-          }, 1000)
+            location.href = "/user/success";
+          }, 1000);
         }
-      }
+      };
       if (this.usePhone) {
-        this.$refs.ruleFormPhone.validate((valid) => {
+        this.$refs.ruleFormPhone.validate(valid => {
           if (valid) {
             let body = {
               auth_code: this.ruleFormPhone.ver,
               login_name: mobile,
               mobile,
               nickname: this.ruleFormPhone.nickname,
-              password: this.ruleFormPhone.pwd,
-            }
-            register(body)
+              password: this.ruleFormPhone.pwd
+            };
+            register(body);
           } else {
-            console.log('error submit!!')
-            return false
+            console.log("error submit!!");
+            return false;
           }
-        })
+        });
       } else {
-        this.$refs.ruleFormEmail.validate((valid) => {
+        this.$refs.ruleFormEmail.validate(valid => {
           if (valid) {
             let body = {
               captcha: this.ruleFormEmail.ver,
               email: this.ruleFormEmail.email,
               nickname: this.ruleFormEmail.nickname,
-              password: this.ruleFormEmail.pwd,
-            }
-            register(body)
+              password: this.ruleFormEmail.pwd
+            };
+            register(body);
           } else {
-            console.log('error submit!!')
-            return false
+            console.log("error submit!!");
+            return false;
           }
-        })
+        });
       }
     },
     /**
      * 获取手机验证码
      * @params {function} run 闭包函数,用来启动验证码内部脚本
      */
-    async getVerMobile(run) {
+    async getVerMobile(token, run) {
       // let checkRes = await this.$axios.$post('')
-      let mobileSplit = this.ruleFormPhone.mobile.split('-')
-      let area = mobileSplit[0] || ''
-      let mobile = mobileSplit[1] || ''
-      if (area.match(/\+86/) && !mobile.match(/^(0|86|17951)?(13[0-9]|15[012356789]|166|17[35678]|18[0-9]|14[57])[0-9]{8}$/)) {
+      let mobileSplit = this.ruleFormPhone.mobile.split("-");
+      let area = mobileSplit[0] || "";
+      let mobile = mobileSplit[1] || "";
+      if (
+        area.match(/\+86/) &&
+        !mobile.match(
+          /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[35678]|18[0-9]|14[57])[0-9]{8}$/
+        )
+      ) {
         this.$message({
-          message: '请输入正确手机号',
-          type: 'error'
-        })
-        return
+          message: "请输入正确手机号",
+          type: "error"
+        });
+        return;
       }
       //console.log(area + mobile)
-      let res = await this.$axios.$post('/api/user/sendMobileAuthCode', {
-        mobile: area + '-' + mobile,
-      })
+      let res = await this.$axios.$post("/api/user/sendMobileAuthCode", {
+        mobile: area + "-" + mobile,
+        token,
+        type: 1 // 注册1,忘记密码2,提现3
+      });
       if (res) {
-        run()
-        this.$message(res.info)
+        run();
+        // this.$message(res.info);
       }
     },
     /**
      * 点击切换注册模式
      */
     doSwitch() {
-      this.usePhone = !this.usePhone
-      let clearValidate
-      if (!this.usePhone) clearValidate = this.$refs.ruleFormPhone.clearValidate
-      else clearValidate = this.$refs.ruleFormEmail.clearValidate
+      this.usePhone = !this.usePhone;
+      let clearValidate;
+      if (!this.usePhone)
+        clearValidate = this.$refs.ruleFormPhone.clearValidate;
+      else clearValidate = this.$refs.ruleFormEmail.clearValidate;
       // setTimeout(clearValidate, 200)
-      this.$nextTick(clearValidate)
+      this.$nextTick(clearValidate);
     }
   }
-}
+};
 </script>
 
 <style scoped>

+ 13 - 0
yarn.lock

@@ -2638,6 +2638,11 @@ date-now@^0.1.4:
   resolved "https://registry.npm.taobao.org/date-now/download/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
   integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=
 
+dayjs@^1.8.15:
+  version "1.8.15"
+  resolved "https://registry.npm.taobao.org/dayjs/download/dayjs-1.8.15.tgz?cache=0&sync_timestamp=1562597134097&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdayjs%2Fdownload%2Fdayjs-1.8.15.tgz#7121bc04e6a7f2621ed6db566be4a8aaf8c3913e"
+  integrity sha1-cSG8BOan8mIe1ttWa+SoqvjDkT4=
+
 de-indent@^1.0.2:
   version "1.0.2"
   resolved "https://registry.npm.taobao.org/de-indent/download/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
@@ -7253,6 +7258,14 @@ strip-json-comments@~2.0.1:
   resolved "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
   integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
 
+style-loader@^0.23.1:
+  version "0.23.1"
+  resolved "https://registry.npm.taobao.org/style-loader/download/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925"
+  integrity sha1-y5FUYG8+dxq2xKtjcCahBJF02SU=
+  dependencies:
+    loader-utils "^1.1.0"
+    schema-utils "^1.0.0"
+
 style-resources-loader@^1.2.1:
   version "1.2.1"
   resolved "https://registry.npm.taobao.org/style-resources-loader/download/style-resources-loader-1.2.1.tgz#7679d5dc2f27046b2fc2b83c1d5b6c1b8a9b820c"