guhongwei před 3 roky
rodič
revize
5bdd013112

+ 98 - 0
src/views/login.vue

@@ -0,0 +1,98 @@
+<template>
+  <div id="detail">
+    <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" :leftArrow="false">
+      <template v-slot:info>
+        <van-tabs v-model="active">
+          <van-tab title="平台登录">
+            <van-col span="24" class="one">
+              <van-form @submit="onSubmit">
+                <van-field v-model="form.phone" name="phone" label="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+                <van-field v-model="form.password" type="password" name="password" label="密码" :rules="[{ required: true, message: '请填写密码' }]" />
+                <van-field name="role" label="用户类别">
+                  <template #input>
+                    <van-radio-group v-model="form.role" direction="horizontal">
+                      <van-radio name="4">个人登录</van-radio>
+                      <van-radio name="5">企业登录</van-radio>
+                    </van-radio-group>
+                  </template>
+                </van-field>
+                <div style="margin: 16px;">
+                  <van-button round block type="info" native-type="submit">提交</van-button>
+                </div>
+              </van-form>
+            </van-col>
+          </van-tab>
+        </van-tabs>
+      </template>
+    </mobileMain>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: personal } = createNamespacedHelpers('personal');
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'detail',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      active: 0,
+      form: {},
+    };
+  },
+  created() {},
+  methods: {
+    ...personal(['perLogin']),
+    ...organization(['orgLogin']),
+    async onSubmit(values) {
+      if (values.role == '4') {
+        let res = await this.perLogin({ user: values });
+        if (this.$checkRes(res)) {
+          this.$notify({
+            message: '登录成功',
+            type: 'success',
+          });
+          this.$router.push({ path: '/user/account/index' });
+        } else {
+          this.$notify({
+            message: res.errmsg,
+            type: 'danger',
+          });
+        }
+      } else if (values.role == '5') {
+        values.institution_code = values.phone;
+        let res = await this.orgLogin({ user: values });
+        if (this.$checkRes(res)) {
+          this.$notify({
+            message: '登录成功',
+            type: 'success',
+          });
+          this.$router.push('/user/account/index');
+        } else {
+          this.$notify({
+            message: res.errmsg,
+            type: 'danger',
+          });
+        }
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 69 - 0
src/views/user/account/basic.vue

@@ -0,0 +1,69 @@
+<template>
+  <div id="basic">
+    <van-row>
+      <van-col span="24" class="main">
+        <van-form>
+          <van-field v-model="form.name" name="用户名称" label="用户名称" placeholder="用户名称" />
+          <van-field v-model="form.phone" name="联系电话" label="联系电话" placeholder="联系电话" readonly />
+          <van-field v-model="form.code" name="所属机构" label="所属机构" placeholder="所属机构" readonly />
+          <van-field v-model="form.email" name="电子邮箱" label="电子邮箱" placeholder="电子邮箱" />
+          <van-field v-model="form.addr" name="联系地址" label="联系地址" placeholder="联系地址" />
+          <van-field v-model="form.office_phone" name="办公电话" label="办公电话" placeholder="办公电话" />
+          <van-field v-model="form.profession" name="所属行业" label="所属行业" placeholder="所属行业" />
+          <van-col span="24" class="btn">
+            <van-button round block type="info" @click="onSubmit">保存信息</van-button>
+            <van-button round block type="info" @click="upgradeBtn" v-if="form.is_expert == false">升级用户</van-button>
+          </van-col>
+        </van-form>
+      </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'basic',
+  props: {
+    form: { type: Object },
+  },
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.form });
+    },
+    // 用户升级
+    upgradeBtn() {
+      this.$emit('upgradeBtn');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .btn {
+    padding: 0 10px;
+    button {
+      margin: 5px 0;
+    }
+  }
+}
+</style>

+ 20 - 8
src/views/user/account/index.vue

@@ -1,21 +1,33 @@
 <template>
-  <div id="index">
-    <van-row>
-      <van-col span="24" class="main"> test </van-col>
-    </van-row>
+  <div id="detail">
+    <mobileMain :useNav="false" :usePage="false" :useTop="false">
+      <template v-slot:info>
+        <personal-frame v-if="userInfo.is_expert"></personal-frame>
+        <organization-frame v-else></organization-frame>
+      </template>
+    </mobileMain>
   </div>
 </template>
 
 <script>
+import personalFrame from '../personal/index.vue';
+import organizationFrame from '../organization/index.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
-  name: 'index',
+  name: 'detail',
   props: {},
-  components: {},
+  components: {
+    personalFrame,
+    organizationFrame,
+  },
   data: function() {
-    return {};
+    return {
+      userInfo: {},
+    };
+  },
+  created() {
+    if (this.user) this.$set(this, `userInfo`, this.user);
   },
-  created() {},
   methods: {},
   computed: {
     ...mapState(['user']),

+ 88 - 0
src/views/user/organization/basic/index.vue

@@ -0,0 +1,88 @@
+<template>
+  <div id="index">
+    <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" @back="back">
+      <template v-slot:info>
+        <van-tabs v-model="active" color="#409eff">
+          <van-tab title="基本信息">
+            <basic-frame :form="userInfo" @onSubmit="onSubmit" @upgradeBtn="upgradeBtn"></basic-frame>
+          </van-tab>
+          <van-tab title="详细信息">
+            <info-frame :form="userInfo" @onSubmit="onSubmit"></info-frame>
+          </van-tab>
+        </van-tabs>
+      </template>
+    </mobileMain>
+  </div>
+</template>
+
+<script>
+import basicFrame from '../../account/basic.vue';
+import infoFrame from '../parts/info.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    basicFrame,
+    infoFrame,
+  },
+  data: function() {
+    return {
+      active: 0,
+      userInfo: {},
+    };
+  },
+  created() {
+    if (this.user) this.search();
+  },
+  methods: {
+    ...organization(['fetch', 'update']),
+    async search() {
+      let res = await this.fetch(this.user.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `userInfo`, res.data);
+      }
+    },
+    async onSubmit({ data }) {
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$notify({
+          message: '修改信息成功',
+          type: 'success',
+        });
+        this.search();
+      } else {
+        this.$notify({
+          message: res.errmsg,
+          type: 'danger',
+        });
+      }
+    },
+    upgradeBtn() {
+      console.log('升级专家');
+    },
+    back() {
+      this.$router.push({ path: '/user/account/index' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 65 - 0
src/views/user/organization/index.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="detail">
+    <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" :leftArrow="false">
+      <template v-slot:info>
+        <van-col span="24" class="one">
+          <top-frame></top-frame>
+        </van-col>
+        <van-col span="24" class="two">
+          <van-cell title="基本信息" @click="btn('basic')" is-link />
+          <van-cell title="信息发布" @click="btn('product')" is-link />
+          <van-cell title="修改密码" @click="btn('password')" is-link />
+          <van-cell title="退出登录" @click="btn('logout')" is-link />
+        </van-col>
+      </template>
+    </mobileMain>
+  </div>
+</template>
+
+<script>
+import topFrame from './parts/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'detail',
+  props: {},
+  components: {
+    topFrame,
+  },
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {
+    btn(type) {
+      // 退出登录
+      if (type == 'logout') {
+        let key = localStorage.removeItem('token');
+        if (key == undefined) {
+          this.$notify({
+            message: '退出成功',
+            type: 'success',
+          });
+          this.$router.push({ path: '/login' });
+        }
+      } else {
+        this.$router.push({ path: `/user/organization/${type}/index` });
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 107 - 0
src/views/user/organization/parts/info.vue

@@ -0,0 +1,107 @@
+<template>
+  <div id="info">
+    <van-row>
+      <van-col span="24" class="main">
+        <van-form>
+          <van-field v-model="form.institution_code" name="信用代码" label="信用代码" placeholder="信用代码" disabled />
+          <van-field v-model="form.companyperson" name="企业法人" label="企业法人" placeholder="企业法人" />
+          <van-field v-model="form.companycapital" name="注册资金" label="注册资金" placeholder="注册资金" />
+          <van-field readonly clickable name="calendar" :value="form.companydate" label="注册时间" placeholder="点击选择日期" @click="showCalendar = true" />
+          <van-calendar v-model="showCalendar" @confirm="onConfirm" />
+          <van-field v-model="form.companytype" name="注册类型" label="注册类型" placeholder="注册类型" />
+          <van-field v-model="form.companytotal" name="企业总人数" label="企业总人数" placeholder="企业总人数" />
+          <van-field v-model="form.sndyffy" name="研发费用" label="研发费用" placeholder="研发费用" />
+          <van-field v-model="form.sndqyzsr" name="企业总收入" label="企业总收入" placeholder="企业总收入" />
+          <van-field v-model="form.zjzyfrs" name="研发人数" label="研发人数" placeholder="研发人数" />
+          <van-field
+            v-model="form.companybrief"
+            name="企业简介"
+            label="企业简介"
+            placeholder="企业简介"
+            type="textarea"
+            rows="2"
+            autosize
+            maxlength="300"
+            show-word-limit
+          />
+          <van-field
+            v-model="form.mainproduct"
+            name="主要产品"
+            label="主要产品"
+            placeholder="主要产品"
+            type="textarea"
+            rows="2"
+            autosize
+            maxlength="300"
+            show-word-limit
+          />
+          <van-field
+            v-model="form.qualifications"
+            name="企业资质"
+            label="企业资质"
+            placeholder="企业资质"
+            type="textarea"
+            rows="2"
+            autosize
+            maxlength="300"
+            show-word-limit
+          />
+          <van-col span="24" class="btn">
+            <van-button round block type="info" @click="onSubmit">保存信息</van-button>
+          </van-col>
+        </van-form>
+      </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+var moment = require('moment');
+export default {
+  name: 'info',
+  props: {
+    form: { type: Object },
+  },
+  components: {},
+  data: function() {
+    return {
+      showCalendar: false,
+    };
+  },
+  created() {},
+  methods: {
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.form });
+    },
+    onConfirm(date) {
+      this.$set(this.form, `companydate`, moment(date).format('YYYY-MM-DD'));
+      this.showCalendar = false;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .btn {
+    padding: 0 10px;
+    button {
+      margin: 5px 0;
+    }
+  }
+}
+</style>

+ 95 - 0
src/views/user/organization/parts/productList.vue

@@ -0,0 +1,95 @@
+<template>
+  <div id="productList">
+    <van-row>
+      <van-col span="24" class="main">
+        <van-col span="24" class="list" v-for="(item, index) in list" :key="index">
+          <van-col span="24" class="name">
+            {{ item.name }}
+          </van-col>
+          <van-col span="24" class="other">
+            <van-col span="24" class="otherInfo">
+              信息类型:<span>{{ item.type == '0' ? '科技需求' : item.type == '1' ? '技术成果' : item.type == '1' ? '商务服务' : '暂无' }}</span>
+            </van-col>
+            <van-col span="24" class="otherInfo">
+              联系电话:<span>{{ item.phone || '暂无' }}</span>
+            </van-col>
+            <van-col span="24" class="otherInfo">
+              发布时间:<span>{{ item.create_time || '暂无' }}</span>
+            </van-col>
+          </van-col>
+          <van-col span="24" class="btn">
+            <el-button type="primary" size="mini" v-if="item.status == '0'" @click="toCheck(item)">发布</el-button>
+            <el-button type="danger" size="mini" @click="toDelete(item)">删除</el-button>
+          </van-col>
+        </van-col>
+      </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'productList',
+  props: {
+    list: { type: Array },
+  },
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {
+    toCheck(data) {
+      this.$emit('toCheck', data);
+    },
+    toDelete(data) {
+      this.$emit('toDelete', data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 8px 8px 0 8px;
+  background-color: #f9f9f9;
+  .list {
+    padding: 8px;
+    margin: 0 0 10px 0;
+    border-radius: 8px;
+    background-color: #fff;
+    .name {
+      font-size: 16px;
+      font-weight: bold;
+      margin: 0 0 5px 0;
+    }
+    .other {
+      .otherInfo {
+        font-size: 14px;
+        color: #666;
+        margin: 0 0 5px 0;
+        span {
+          color: #000;
+        }
+      }
+    }
+    .btn {
+      text-align: center;
+    }
+  }
+}
+</style>

+ 85 - 0
src/views/user/organization/parts/top.vue

@@ -0,0 +1,85 @@
+<template>
+  <div id="top">
+    <van-row>
+      <van-col span="24" class="main">
+        <van-col span="24" class="one">
+          <van-col span="6" class="image">
+            <van-image :src="icon"></van-image>
+          </van-col>
+          <van-col span="18" class="other">
+            <van-col span="24" class="otherInfo">
+              {{ user ? user.name : '游客' }}
+            </van-col>
+            <van-col span="24" class="otherInfo">
+              联系电话:<span>{{ user ? user.phone : '游客' }}</span>
+            </van-col>
+          </van-col>
+        </van-col>
+      </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'top',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      icon: require('@a/icon.jpg'),
+    };
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  background-color: #f9f9f9;
+  .one {
+    padding: 15px 0;
+    .image {
+      text-align: center;
+      .van-image {
+        width: 70px;
+        height: 70px;
+      }
+      /deep/.van-image__img {
+        border-radius: 90px;
+        border: 1px solid #ffffff;
+      }
+    }
+    .other {
+      .otherInfo {
+        font-size: 14px;
+        color: #666666;
+        margin: 8px 0 0 0;
+        span {
+          color: #000000;
+        }
+      }
+      .otherInfo:first-child {
+        font-size: 16px;
+        font-weight: bold;
+        color: #000000;
+      }
+    }
+  }
+}
+</style>

+ 36 - 0
src/views/user/organization/password/index.vue

@@ -0,0 +1,36 @@
+<template>
+  <div id="index">
+    <van-row>
+      <van-col span="24" class="main"> test </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 101 - 0
src/views/user/organization/product/index.vue

@@ -0,0 +1,101 @@
+<template>
+  <div id="index">
+    <mobileMain :useNav="false" @search="search" :total="total" :limit="limit">
+      <template v-slot:info>
+        <van-tabs v-model="status" color="#409eff" @change="changeType">
+          <van-tab title="待发布"><list-frame :list="list" @toCheck="toCheck" @toDelete="toDelete"></list-frame></van-tab>
+          <van-tab title="待审中"><list-frame :list="list" @toDelete="toDelete"></list-frame></van-tab>
+          <van-tab title="已发布"><list-frame :list="list" @toDelete="toDelete"></list-frame></van-tab>
+        </van-tabs>
+      </template>
+    </mobileMain>
+  </div>
+</template>
+
+<script>
+import listFrame from '../parts/productList.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: product } = createNamespacedHelpers('product');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    listFrame,
+  },
+  data: function() {
+    return {
+      list: [],
+      total: 0,
+      limit: 10,
+      status: 0,
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...product(['query', 'update', 'delete']),
+    async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
+      if (searchName) info.name = searchName;
+      info.status = this.status;
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    changeType(name) {
+      this.$set(this, `status`, name);
+      this.search();
+    },
+    // 发布
+    async toCheck(data) {
+      data.status = '1';
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$notify({
+          message: '信息发布成功,等待审核',
+          type: 'success',
+        });
+        this.search();
+      } else {
+        this.$notify({
+          message: res.errmsg,
+          type: 'danger',
+        });
+      }
+    },
+    // 删除
+    async toDelete(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$notify({
+          message: '信息删除成功',
+          type: 'success',
+        });
+        this.search();
+      } else {
+        this.$notify({
+          message: res.errmsg,
+          type: 'danger',
+        });
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 36 - 0
src/views/user/personal/index.vue

@@ -0,0 +1,36 @@
+<template>
+  <div id="index">
+    <van-row>
+      <van-col span="24" class="main"> {{ user }} </van-col>
+    </van-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>