Преглед изворни кода

feat: API udpate to education

ArvinQi пре 6 година
родитељ
комит
e084c774d6
4 измењених фајлова са 472 додато и 139 уклоњено
  1. 204 34
      components/sign/education.vue
  2. 140 37
      components/sign/experience.vue
  3. 124 24
      components/sign/info.vue
  4. 4 44
      components/sign/profile.vue

+ 204 - 34
components/sign/education.vue

@@ -8,42 +8,88 @@
     </header>
     <div v-if="education.length > 0">
       <template v-for="(item, idx) in education">
-        <div v-if="editingItem.indexOf(idx) < 0" :key="item.company" class="show">
+        <div v-if="editingItem.indexOf(idx) < 0" :key="item.university" class="show">
           <h4>
-            <span>{{`${item.start} - ${item.end} ${item.company} ${item.position}`}}</span>
+            <span>{{`${item.start_time} - ${item.end_time || '至今'} ${item.university} ${item.major}`}}</span>
             <el-button @click="editItem(idx)" type="text">编辑</el-button>
           </h4>
-          <p>{{item.des}}</p>
+          <p>{{item.description}}</p>
         </div>
-        <div v-else :key="item.company" class="edit">
-          <el-form ref="form" :rules="rules" :model="education[idx]" label-width="147px">
+        <div v-else :key="'education' + idx" class="edit">
+          <el-form ref="form" :rules="rules" :model="item" label-width="147px">
             <div class="header">
-              <el-date-picker v-model="education[idx].start" type="date" placeholder="开始时间"></el-date-picker>
-              <span class="to">至</span>
-              <el-date-picker v-model="education[idx].end" type="date" placeholder="结束时间"></el-date-picker>
-              <el-input
-                :style="{width: '202px'}"
-                v-model="education[idx].company"
+              <el-date-picker
+                v-model="item.date"
+                type="daterange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd"
+              ></el-date-picker>
+              <el-select
+                v-model="item.university"
+                allow-create
+                filterable
+                remote
+                reserve-keyword
                 placeholder="学校名称"
-              ></el-input>
-              <el-select v-model="education[idx].position" placeholder="选择专业">
-                <el-option label="区域一" value="shanghai"></el-option>
-                <el-option label="区域二" value="beijing"></el-option>
+                :remote-method="fetchUniversity"
+                :loading="loadingUniversity"
+              >
+                <el-option
+                  v-for="item in universities"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+              <el-select
+                class="small"
+                v-model="item.major"
+                allow-create
+                filterable
+                remote
+                reserve-keyword
+                placeholder="选择专业"
+                :remote-method="fetchMajor"
+                :loading="loadingMajor"
+              >
+                <el-option
+                  v-for="item in majors"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+              <el-select class="small" v-model="item.education_background" placeholder="学历">
+                <el-option
+                  v-for="educationBackground in educationBackgrounds"
+                  :key="educationBackground.value"
+                  :label="educationBackground.label"
+                  :value="educationBackground.value"
+                ></el-option>
               </el-select>
               <span class="opts">
                 <el-button type="danger" @click="handleDelete(idx)">删除</el-button>
                 <el-button type="info" @click="handleCancel(idx)">取消</el-button>
-                <el-button type="primary" @click="onSubmit(idx)">确认</el-button>
+                <el-button type="primary" @click="handleConfirm(idx)">确认</el-button>
               </span>
             </div>
+            <div>
+              <el-input class="big" v-model="item.diploma_url" placeholder="请输入学信网在线验证报告地址"></el-input>
+            </div>
             <div class="content">
               <el-input
                 type="textarea"
                 :rows="7"
                 placeholder="教育经历文字说明,不得低于15个字符"
-                v-model="education[idx].des"
+                v-model="item.description"
               ></el-input>
-              <uploader :imageUrl="education[idx].imageUrl" title="工作证明" @change="handleImageUrl"></uploader>
+              <uploader
+                :imageUrl="item.diploma_photo"
+                title="毕业证图片"
+                @change="val => handleImageUrl(idx, val)"
+              ></uploader>
             </div>
             <footer>
               <p>学信网在线验证报告, 例如:https://www.proginn.com</p>
@@ -68,48 +114,153 @@ export default {
         name: ""
       },
       init: {
-        imageUrl: "",
+        diploma_photo: "",
+        diploma_url: "",
         start: "",
         end: "",
-        company: "",
-        position: "",
-        des: ""
+        data: "",
+        university: "",
+        major: "",
+        education_background: "",
+        description: ""
       },
       education: [
         // {
-        //   imageUrl: "",
+        //   diploma_photo: "",
         //   start: "2019-01-02",
         //   end: "2019-01-02",
-        //   company: "程序员客栈",
-        //   position: "高级产品经理",
-        //   des:
+        //   university: "程序员客栈",
+        //   major: "高级产品经理",
+        //   description:
         //     "主要负责程序员客栈“雇佣直通车、1980服务、云端项目、雇佣项目“项目前后端开发,参与整个项目的设计、需求讨论、代码开发、联调测试及系统维护迭代。 【主要工作成就】:解决“雇佣直通车”项目,系统智能自动匹配算法问题。"
         // }
       ],
-      current: null
+      current: null,
+      originEducation: [],
+      universities: [],
+      loadingUniversity: false,
+      majors: [],
+      loadingMajor: false,
+      educationBackgrounds: []
     };
   },
   components: {
     uploader
   },
+  computed: {},
+  watch: {},
+  async mounted() {
+    this.getData();
+    this.getEducationBackground();
+  },
   methods: {
-    onSubmit(idx) {
-      console.log("submit!", this.form);
-      this.education.push(this.form);
+    async onSubmit(idx) {
+      console.log("submit!", this.originEducation);
+      if (this.originEducation.length > 10) {
+        this.$message.error("最多可添加10项工作经历!");
+      }
+      const res = await this.$axios.$post("/api/user_education/save_all", {
+        data: JSON.stringify(this.originEducation)
+      });
+      if (res.status === 1) {
+        this.$message.success(res.info);
+      } else {
+        this.$message.error(res.info);
+      }
+    },
+    async getData() {
+      const res = await this.$axios.$post("/api/user_education/list");
+      const data = res.data || [];
+      const education = data.map(it => ({
+        ...it,
+        date: [it.start_time, it.end_time]
+      }));
+      console.log(education);
+      this.education = education;
+      this.originEducation = data;
+    },
+    async getEducationBackground() {
+      const res = await this.$axios.$post(
+        "/api/simple_data/select_education_background"
+      );
+      const data = res.data || [];
+      this.educationBackgrounds = data.map(it => ({
+        value: it.id,
+        label: it.name
+      }));
+    },
+    async fetchUniversity(keyword) {
+      console.log(keyword);
+      this.loadingUniversity = true;
+      const res = await this.$axios.$post(
+        "/api/simple_data/select_university",
+        { keyword }
+      );
+      this.loadingUniversity = false;
+      const data = res.data || [];
+      this.universities = data.map(it => ({ value: it.id, label: it.name }));
+    },
+    async fetchMajor(keyword) {
+      console.log(keyword);
+      this.loadingMajor = true;
+      const res = await this.$axios.$post("/api/simple_data/select_major", {
+        keyword
+      });
+      this.loadingMajor = false;
+      const data = res.data || [];
+      this.majors = data.map(it => ({ value: it.id, label: it.name }));
+    },
+    handleRankClose() {
+      this.rankForm = {
+        first: ""
+      };
+    },
+    handleRank() {
+      this.rankDialog = false;
     },
     handleAdd() {
       this.education.push(this.init);
       this.editingItem.push(this.education.length - 1);
     },
-    handleImageUrl(url) {
-      this.form.imageUrl = url;
+    handleImageUrl(idx, url) {
+      this.education[idx].diploma_photo = url;
     },
     handleDelete(idx) {
-      this.education.splice(this.education.indexOf(this.current), 1);
+      this.education.splice(idx, 1);
+      this.originEducation.splice(idx, 1);
+      this.onSubmit();
     },
     handleCancel(idx) {
       this.editingItem.splice(this.editingItem.indexOf(idx), 1);
     },
+    handleConfirm(idx) {
+      const item = this.education.slice(idx, idx + 1)[0];
+      const origin = this.originEducation.slice(idx, idx + 1)[0];
+      if (item == origin) {
+        this.$message.error("请修改后保存!");
+        return;
+      }
+      if (!item.date) {
+        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("请提供学历证明!");
+        return;
+      }
+      this.editingItem.splice(this.editingItem.indexOf(idx), 1);
+      const submitItem = {
+        ...item,
+        start_time: item.date[0],
+        end_time: item.date[1]
+      };
+      this.originEducation.splice(idx, 1, submitItem);
+      this.onSubmit();
+    },
     editItem(idx) {
       this.editingItem.push(idx);
     }
@@ -125,8 +276,18 @@ export default {
   .edit {
     padding: 20px;
     > form {
+      .header {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        margin-bottom: 10px;
+      }
       .opts {
-        float: right;
+        display: flex;
+        align-items: center;
+        .el-button {
+          margin-left: 5px;
+        }
       }
       .el-select,
       .el-input {
@@ -136,6 +297,15 @@ export default {
           padding-right: 0;
         }
       }
+      .small {
+        width: 100px;
+      }
+      .big {
+        width: 100%;
+      }
+      .el-date-editor {
+        margin-right: 10px;
+      }
       .to {
         margin-right: 10px;
       }

+ 140 - 37
components/sign/experience.vue

@@ -29,30 +29,28 @@
       <template v-for="(item, idx) in experience">
         <div v-if="editingItem.indexOf(idx) < 0" :key="item.company" class="show">
           <h4>
-            <span>{{`${item.start} - ${item.end} ${item.company} ${item.position}`}}</span>
+            <span>{{`${item.start_time} - ${item.end_time || '至今'} ${item.company} ${item.title}`}}</span>
             <el-button @click="editItem(idx)" type="text">编辑</el-button>
           </h4>
-          <p>{{item.des}}</p>
+          <p>{{item.description}}</p>
         </div>
-        <div v-else :key="item.company" class="edit">
-          <el-form ref="form" :rules="rules" :model="experience[idx]" label-width="147px">
+        <div v-else :key="'experience' + idx" class="edit">
+          <el-form ref="form" :rules="rules" :model="item" label-width="147px">
             <div class="header">
-              <el-date-picker v-model="experience[idx].start" type="date" placeholder="开始时间"></el-date-picker>
-              <span class="to">至</span>
-              <el-date-picker v-model="experience[idx].end" type="date" placeholder="结束时间"></el-date-picker>
-              <el-input
-                :style="{width: '202px'}"
-                v-model="experience[idx].company"
-                placeholder="请输入公司名称"
-              ></el-input>
-              <el-select v-model="experience[idx].position" placeholder="选择职位">
-                <el-option label="区域一" value="shanghai"></el-option>
-                <el-option label="区域二" value="beijing"></el-option>
-              </el-select>
+              <el-date-picker
+                v-model="item.date"
+                type="daterange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd"
+              ></el-date-picker>
+              <el-input v-model="item.company" placeholder="请输入公司名称"></el-input>
+              <el-input v-model="item.title" placeholder="请输入职位"></el-input>
               <span class="opts">
                 <el-button type="danger" @click="handleDelete(idx)">删除</el-button>
                 <el-button type="info" @click="handleCancel(idx)">取消</el-button>
-                <el-button type="primary" @click="onSubmit(idx)">确认</el-button>
+                <el-button type="primary" @click="handleConfirm(idx)">确认</el-button>
               </span>
             </div>
             <div class="content">
@@ -60,9 +58,13 @@
                 type="textarea"
                 :rows="7"
                 placeholder="请从主要工作内容、成就等方面,描述你的工作经历,字数不少于60字符"
-                v-model="experience[idx].des"
+                v-model="item.description"
               ></el-input>
-              <uploader :imageUrl="experience[idx].imageUrl" title="工作证明" @change="handleImageUrl"></uploader>
+              <uploader
+                :imageUrl="item.work_certify_img"
+                title="工作证明"
+                @change="val => handleImageUrl(idx, val)"
+              ></uploader>
             </div>
             <footer>
               <p>注:有效的工作证明包括:工牌/入职通知邮件/在职证明/公司邮箱截图/公司获奖证书/钉钉截图/离职证明/社保公积金证明等(其中之一即可,截图中需同时出现公司信息和个人信息,才能作为有效工作证明,并与目前公司相一致)</p>
@@ -83,27 +85,53 @@ export default {
       // editing: true,
       editingItem: [],
       rules: {
-        name: ""
+        // date: [
+        //   {
+        //     required: true,
+        //     message: "请设置开始时间/结束时间",
+        //     trigger: "change"
+        //   }
+        // ],
+        // company: [
+        //   {
+        //     required: true,
+        //     message: "请设置公司名称/职位",
+        //     trigger: "change"
+        //   }
+        // ],
+        // title: [
+        //   {
+        //     required: true,
+        //     message: "请设置公司名称/职位",
+        //     trigger: "change"
+        //   }
+        // ],
+        // description: [
+        //   { min: 60, message: "经历描述不少于60字符", trigger: "blur" }
+        // ]
       },
       init: {
-        imageUrl: "",
-        start: "",
-        end: "",
+        work_certify_img: "",
+        start_time: "",
+        date: "",
+        end_time: "",
         company: "",
-        position: "",
-        des: ""
+        title: "",
+        is_main: 0,
+        description: ""
       },
       experience: [
         // {
-        //   imageUrl: "",
-        //   start: "2019-01-02",
-        //   end: "2019-01-02",
+        //   work_certify_img: "",
+        //   start_time: "2019-01-02",
+        //   end_time: "2019-01-02",
         //   company: "程序员客栈",
-        //   position: "高级产品经理",
-        //   des:
+        //   title: "高级产品经理",
+        //   description:
         //     "主要负责程序员客栈“雇佣直通车、1980服务、云端项目、雇佣项目“项目前后端开发,参与整个项目的设计、需求讨论、代码开发、联调测试及系统维护迭代。 【主要工作成就】:解决“雇佣直通车”项目,系统智能自动匹配算法问题。"
         // }
       ],
+      originExperience: [],
       current: null,
       rankDialog: false,
       rankForm: {
@@ -114,10 +142,45 @@ export default {
   components: {
     uploader
   },
+  computed: {},
+  watch: {},
+  async mounted() {
+    this.getData();
+    this.getCompany();
+    this.getTitle();
+  },
   methods: {
-    onSubmit(idx) {
-      console.log("submit!", this.form);
-      this.experience.push(this.form);
+    async onSubmit(idx) {
+      console.log("submit!", this.originExperience);
+      if (this.originExperience.length > 10) {
+        this.$message.error("最多可添加10项工作经历!");
+      }
+      const res = await this.$axios.$post("/api/user_experience/save_all", {
+        data: JSON.stringify(this.originExperience)
+      });
+      if (res.status === 1) {
+        this.$message.success(res.info);
+      } else {
+        this.$message.error(res.info);
+      }
+    },
+    async getData() {
+      const res = await this.$axios.$post("/api/user_experience/get_my_list");
+      const data = res.data || [];
+      const experience = data.map(it => ({
+        ...it,
+        date: [it.start_time, it.end_time]
+      }));
+      this.experience = experience;
+      this.originExperience = data;
+    },
+    async getCompany() {
+      const res = await this.$axios.$post("/api/simple_data/select_company");
+      console.log(res.data);
+    },
+    async getTitle() {
+      const res = await this.$axios.$post("/api/simple_data/select_title");
+      console.log(res.data);
     },
     handleRankClose() {
       this.rankForm = {
@@ -131,15 +194,45 @@ export default {
       this.experience.push(this.init);
       this.editingItem.push(this.experience.length - 1);
     },
-    handleImageUrl(url) {
-      this.form.imageUrl = url;
+    handleImageUrl(idx, url) {
+      this.experience[idx].work_certify_img = url;
     },
     handleDelete(idx) {
-      this.experience.splice(this.experience.indexOf(this.current), 1);
+      this.experience.splice(idx, 1);
+      this.originExperience.splice(idx, 1);
+      this.onSubmit();
     },
     handleCancel(idx) {
       this.editingItem.splice(this.editingItem.indexOf(idx), 1);
     },
+    handleConfirm(idx) {
+      const item = this.experience.slice(idx, idx + 1)[0];
+      const origin = this.originExperience.slice(idx, idx + 1)[0];
+      if (item == origin) {
+        this.$message.error("请修改后保存!");
+        return;
+      }
+      if (!item.date) {
+        this.$message.error("请设置开始时间/结束时间!");
+        return;
+      }
+      if (!item.company || !item.title) {
+        this.$message.error("请设置公司名称/职位!");
+        return;
+      }
+      if (!item.description || item.description.length < 60) {
+        this.$message.error("经历描述不少于60字符!");
+        return;
+      }
+      this.editingItem.splice(this.editingItem.indexOf(idx), 1);
+      const submitItem = {
+        ...item,
+        start_time: item.date[0],
+        end_time: item.date[1]
+      };
+      this.originExperience.splice(idx, 1, submitItem);
+      this.onSubmit();
+    },
     editItem(idx) {
       this.editingItem.push(idx);
     }
@@ -155,8 +248,18 @@ export default {
   .edit {
     padding: 20px;
     > form {
+      .header {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        margin-bottom: 10px;
+      }
       .opts {
-        float: right;
+        display: flex;
+        align-items: center;
+        .el-button {
+          margin-left: 5px;
+        }
       }
       .el-select,
       .el-input {

+ 124 - 24
components/sign/info.vue

@@ -17,9 +17,12 @@
         </el-form-item>
         <el-form-item label="工作状态">
           <el-select v-model="form.type" placeholder="请选择">
-            <el-option label="求职" value="2"></el-option>
-            <el-option label="自由职业" value="4"></el-option>
-            <el-option label="正常工作" value="5"></el-option>
+            <el-option
+              v-for="type in types"
+              :key="type.value"
+              :label="type.label"
+              :value="type.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="职业方向">
@@ -62,15 +65,15 @@
             :min="300"
             :max="2000"
             controls-position="right"
-            v-model="form.salary"
+            v-model="form.work_price"
             :style="{width: '150px', marginRight: '10px'}"
           ></el-input-number>元/天(8小时)
         </el-form-item>
         <el-form-item label="可工作时间">
           <div class="times">
-            <el-checkbox v-model="form.workingday" label="工作日"></el-checkbox>
+            <el-checkbox v-model="form.workday" label="工作日"></el-checkbox>
             <el-time-select
-              v-model="form.workingStart"
+              v-model="form.workdayStart"
               :picker-options="{
                   start: '00:00',
                   step: '00:30',
@@ -80,7 +83,7 @@
             ></el-time-select>
             <span class="to">至</span>
             <el-time-select
-              v-model="form.workingEnd"
+              v-model="form.workdayEnd"
               :picker-options="{
                   start: '00:00',
                   step: '00:30',
@@ -116,18 +119,41 @@
     </div>
     <div v-else class="show">
       <el-form ref="form" :rules="rules" :model="form" label-width="147px">
-        <el-form-item label="昵称">{{form.name}}</el-form-item>
-        <el-form-item label="工作状态">{{form.status}}</el-form-item>
-        <el-form-item label="职业方向">{{form.position}}</el-form-item>
-        <el-form-item label="所在地区">{{form.address}}</el-form-item>
-        <el-form-item label="日薪">{{form.dailyRate}}</el-form-item>
-        <el-form-item label="可工作时间">{{form.workingTime}}</el-form-item>
+        <el-form-item label="昵称">{{form.nickname}}</el-form-item>
+        <el-form-item label="工作状态">{{typeShow}}</el-form-item>
+        <el-form-item label="职业方向">{{`${occupationShow}`}}</el-form-item>
+        <el-form-item label="所在地区">{{`${addressShow}`}}</el-form-item>
+        <el-form-item label="日薪">{{form.work_price}}元/天(8小时)</el-form-item>
+        <el-form-item label="可工作时间">
+          <el-form-item
+            v-if="form.workday"
+            label="工作日"
+          >{{form.workdayStart && form.workdayEnd ? `${form.workdayStart} 至 ${form.workdayEnd}` : '-'}}</el-form-item>
+          <el-form-item
+            v-if="form.weekend"
+            label="周末"
+          >{{form.weekendStart && form.weekendEnd ? `${form.weekendStart} 至 ${form.weekendEnd}` : '-'}}</el-form-item>
+        </el-form-item>
       </el-form>
     </div>
   </div>
 </template>
 
 <script>
+const types = [
+  {
+    value: "2",
+    label: "求职"
+  },
+  {
+    value: "4",
+    label: "自由职业"
+  },
+  {
+    value: "5",
+    label: "正常工作"
+  }
+];
 export default {
   data() {
     return {
@@ -137,21 +163,22 @@ export default {
       form: {
         nickname: "",
         type: "",
-        salary: 300,
+        work_price: 300,
         occupation_op: "",
         direction_op: "",
         address: ["", ""],
         region: "",
-        workingDay: "",
-        weekend: "",
-        workingStart: "",
-        workingEnd: "",
+        workday: true,
+        weekend: true,
+        workdayStart: "",
+        workdayEnd: "",
         weekendStart: "",
         weekendEnd: "",
         dailyRate: "",
-        workingTime: ""
+        workdayTime: ""
       },
-      editing: true,
+      editing: false,
+      types,
       directions: [],
       regions: []
     };
@@ -169,27 +196,100 @@ export default {
         return [];
       }
       return current.children;
+    },
+    typeShow: function() {
+      const types = this.types;
+      const type = this.form.type;
+      let show = "-";
+      for (let i = 0, len = types.length; i < len; i++) {
+        if (types[i].value == type) {
+          show = `${types[i].label}`;
+        }
+      }
+      return show;
+    },
+    occupationShow: function() {
+      const directions = this.directions;
+      let show = "-";
+      for (let i = 0, len = directions.length; i < len; i++) {
+        if (directions[i].occupation_id == this.form.occupation_op) {
+          const subs = directions[i].children;
+          for (let j = 0, len = subs.length; j < len; j++) {
+            if (subs[j].direction_id == this.form.direction_op) {
+              show = `${directions[i].occupation_name} - ${subs[j].direction_name}`;
+            }
+          }
+        }
+      }
+      return show;
+    },
+    addressShow: function() {
+      const directions = this.directions;
+      let show = "-";
+      for (let i = 0, len = directions.length; i < len; i++) {
+        if (directions[i].occupation_id == this.type) {
+          show = `${directions[i].occupation_name}`;
+        }
+      }
+      return show;
+    }
+  },
+  watch: {
+    "form.occupation_op": function() {
+      if (this.form.occupation_op !== this.userInfo.occupation_op) {
+        this.form.direction_op = "";
+      }
     }
   },
   async mounted() {
     this.userInfo = await this.getUserInfo();
-    console.log(this.userInfo);
     this.form.nickname = this.userInfo.nickname;
     this.form.type = this.userInfo.type;
     this.form.occupation_op = this.userInfo.occupation_op;
     this.form.direction_op = this.userInfo.direction_op;
+    this.form.work_price = this.userInfo.work_price;
+    const work_time_op = this.userInfo.work_time_op;
+    if (work_time_op) {
+      this.form.weekendStart = work_time_op.weekend[0];
+      this.form.weekendEnd = work_time_op.weekend[1];
+      this.form.workdayStart = work_time_op.workday[0];
+      this.form.workdayEnd = work_time_op.workday[1];
+    }
     this.getDirection();
   },
   methods: {
     async onSubmit() {
       console.log("submit!");
-      const data = this.form;
+      const form = this.form;
+      const work_time_op = {};
+      if (form.weekend) {
+        work_time_op.weekend = [form.weekendStart, form.weekendEnd];
+      }
+      if (form.workday) {
+        work_time_op.workday = [form.workdayStart, form.workdayEnd];
+      }
+      const data = {
+        work_time_op: JSON.stringify(work_time_op),
+        // province_op_id: '',
+        // city_op_id: '',
+        // district_op_name: '',
+        // work_time_per_work: '',
+        // work_remote: '',
+        // work_area: '',
+        // province_op: '', // 远程工作
+        city_op: "", // 远程工作
+        work_price: form.work_price,
+        nickname: form.nickname,
+        type: form.type,
+        occupation_op: form.occupation_op,
+        direction_op: form.direction_op
+      };
       const res = await this.$axios.$post("/api/user/update_info", data);
       if (res.status === 1) {
-        this.$message("保存成功!");
+        this.$message.success("保存成功!");
         this.editing = false;
       } else {
-        this.$message(res.message);
+        this.$message.error(res.info);
       }
     },
     async getDirection() {

+ 4 - 44
components/sign/profile.vue

@@ -23,32 +23,7 @@ export default {
   data() {
     return {
       editing: false,
-      content: "asdasd",
-      editorOption: {
-        theme: "snow",
-        placeholder: "请输入正文...",
-        modules: {
-          toolbar: [
-            ["bold", "italic", "underline", "strike"],
-            ["blockquote", "code-block"],
-            [{ header: 1 }, { header: 2 }],
-            [{ list: "ordered" }, { list: "bullet" }],
-            [{ script: "sub" }, { script: "super" }],
-            [{ indent: "-1" }, { indent: "+1" }],
-            [{ direction: "rtl" }],
-            [{ size: ["small", false, "large", "huge"] }],
-            [{ header: [1, 2, 3, 4, 5, 6, false] }],
-            [{ font: [] }],
-            [{ color: [] }, { background: [] }],
-            [{ align: [] }],
-            ["clean"],
-            ["link", "image"]
-          ],
-          syntax: {
-            highlight: text => hljs.highlightAuto(text).value
-          }
-        }
-      }
+      content: "test"
     };
   },
   components: { editor },
@@ -57,7 +32,9 @@ export default {
     //   console.log(val);
     // }
   },
-  mounted() {},
+  async mounted() {
+    this.userInfo = await this.getUserInfo();
+  },
   methods: {
     handleChange(val) {
       this.content = val;
@@ -65,23 +42,6 @@ export default {
     onSubmit() {
       console.log(this.content);
       console.log("submit!");
-    },
-    handleContentFileChange(e) {
-      const file = e.target.files[0];
-      if (file.size / 1024 > 500) {
-        this.$message.error("图片大小不得超过500k,请重新选择");
-        return false;
-      }
-      const formData = new FormData();
-      formData.append("file", file);
-      formData.append("original_filename", file.name);
-      this.$axios
-        .$post(`/upload_image`, formData, {
-          headers: { "Content-Type": "multipart/form-data" }
-        })
-        .then(res => {
-          this.content += `<img src="${res.filename}" alt="${file.name}"/>`;
-        });
     }
   }
 };