lrf402788946 пре 4 година
родитељ
комит
15bdbac3b8
3 измењених фајлова са 66 додато и 5 уклоњено
  1. 4 0
      src/store/index.js
  2. 17 1
      src/views/newTeck/index.vue
  3. 45 4
      src/views/userCenter/menuParst/password.vue

+ 4 - 0
src/store/index.js

@@ -54,6 +54,9 @@ import place from '@common/src/store/place';
 // 问卷调查
 import questionnaire from '@common/src/store/question/questionnaire';
 import answer from '@common/src/store/question/answer';
+// 科技创新能力评价申请
+import apply from '@common/src/store/newteck/apply';
+
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -91,5 +94,6 @@ export default new Vuex.Store({
     dockChat,
     questionnaire,
     answer,
+    apply,
   },
 });

+ 17 - 1
src/views/newTeck/index.vue

@@ -21,6 +21,11 @@
                 <checks :key="`checks-${fi}`" :label="f.label" v-model="form[f.model]" :list="f.list"></checks>
               </template>
             </template>
+            <el-row type="flex" justify="center">
+              <el-col :span="4">
+                <el-button type="primary" @click="toSubmit">提交</el-button>
+              </el-col>
+            </el-row>
           </el-form>
         </div>
       </el-col>
@@ -37,6 +42,7 @@ import selects from './input/selects.vue';
 import checks from './input/checks.vue';
 const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: apply } = createNamespacedHelpers('apply');
 export default {
   name: 'index',
   props: {},
@@ -64,7 +70,17 @@ export default {
     };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...apply(['create']),
+    async toSubmit() {
+      let dup = _.cloneDeep(this.form);
+      if (this.user.id) dup.user_id = this.user.id;
+      const res = await this.create(dup);
+      if (this.$checkRes(res, '申请提交成功', res.errmsg || '申请提交失败')) {
+        // TODO
+      }
+    },
+  },
   computed: {
     ...mapState(['user', 'menuParams']),
     pageTitle() {

+ 45 - 4
src/views/userCenter/menuParst/password.vue

@@ -1,15 +1,27 @@
 <template>
   <div id="password">
     <el-row>
-      <el-col :span="24">
-        <p>password</p>
+      <el-col :span="24" style="padding:50px">
+        <el-form ref="form" :model="form" label-position="left" label-width="120px">
+          <el-form-item label="新密码" prop="password" :rules="[{ required: true, message: '请输入新密码', trigger: 'blur' }]">
+            <el-input v-model="form.password" placeholder="请输入新密码" type="password" show-password></el-input>
+          </el-form-item>
+          <el-row type="flex" justify="center">
+            <el-col :span="4">
+              <el-button type="primary" @click="toSubmit">修改密码</el-button>
+            </el-col>
+          </el-row>
+        </el-form>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: personal } = createNamespacedHelpers('personal');
+const { mapActions: organization } = createNamespacedHelpers('organization');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -18,10 +30,39 @@ export default {
   props: {},
   components: {},
   data: function() {
-    return {};
+    return {
+      form: {},
+    };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...personal({ pPassword: 'updatePassword' }),
+    ...organization({ oPassword: 'updatePassword' }),
+    toSubmit() {
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          this.toUpdate();
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    async toUpdate() {
+      let dup = _.cloneDeep(this.form);
+      dup.id = _.get(this.user, 'id');
+      // 用is_expert字段区分是个人/专家 还是 企业
+      const r = Object.keys(this.user).find(f => f === 'is_expert');
+      let res;
+      if (r) res = await this.pPassword(dup);
+      else res = await this.oPassword(dup);
+      if (this.$checkRes(res, '修改成功', '修改失败')) {
+        localStorage.removeItem('token');
+        localStorage.removeItem('type');
+        this.$router.push('/');
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },