Xiao_123 1 سال پیش
والد
کامیت
c7f34268cd

+ 1 - 0
components.d.ts

@@ -9,6 +9,7 @@ declare module 'vue' {
   export interface GlobalComponents {
     AreaSelect: typeof import('./src/components/AreaSelect/index.vue')['default']
     Autocomplete: typeof import('./src/components/FormUI/autocomplete/index.vue')['default']
+    Checkbox: typeof import('./src/components/FormUI/checkbox/index.vue')['default']
     Combobox: typeof import('./src/components/FormUI/combobox/index.vue')['default']
     ComboboxZhAndEn: typeof import('./src/components/FormUI/comboboxZhAndEn/index.vue')['default']
     copy: typeof import('./src/components/CtForm/index copy.vue')['default']

+ 17 - 0
src/api/common/index.js

@@ -8,6 +8,23 @@ export const sendSmsCode = async (data) => {
   })
 }
 
+// 企业-验证码登录
+export const smsLoginOfEnterprise = async (data) => {
+  return await request.post({
+    url: '/app-api/menduner/system/auth/sms-login',
+    data
+  })
+}
+
+
+// 企业-密码登录
+export const passwordLoginOfEnterprise = async (data) => {
+  return await request.post({
+    url: '/app-api/menduner/system/auth/login',
+    data
+  })
+}
+
 // 验证码登录
 export const smsLogin = async (data) => {
   return await request.post({

+ 7 - 0
src/components/CtForm/index.vue

@@ -44,6 +44,12 @@
                 :item="item"
                 @change="handleChange(item)"
               ></radioGroupUI>
+              <checkboxUI
+                v-if="item.type === 'checkbox'"
+                v-model="item.value"
+                :item="item"
+                @change="handleChange(item)"
+              ></checkboxUI>
               <textareaUI
                 v-if="item.type === 'textarea'"
                 v-model="item.value"
@@ -70,6 +76,7 @@ import autocompleteUI from './../FormUI/autocomplete'
 import comboboxUI from './../FormUI/combobox'
 import comboboxZhAndEnUI from './../FormUI/comboboxZhAndEn'
 import radioGroupUI from './../FormUI/radioGroup'
+import checkboxUI from './../FormUI/checkbox'
 import textareaUI from './../FormUI/textArea'
 import DatePicker from '@/components/DatePicker'
 import { ref, defineEmits } from 'vue'

+ 41 - 0
src/components/FormUI/checkbox/index.vue

@@ -0,0 +1,41 @@
+<template>
+  <v-checkbox
+    v-model="value"
+    v-for="k in item.items"
+    :key="k.key"
+    :label="k.label"
+    :value="k.value"
+    :disabled="k.disabled"
+    :color="item.color || 'primary'"
+    :density="k.density || 'compact'"
+    :multiple="k.multiple === false ? false : true"
+    class="mr-3"
+    hide-details
+    @update:modelValue="modelValueUpDate"
+  ></v-checkbox>
+</template>
+<script setup>
+import { ref, defineEmits } from 'vue';
+defineOptions({ name:'FormUI-v-checkbox'})
+
+const props = defineProps({item: Object, modelValue: [String, Number, Boolean]})
+const emit = defineEmits(['update:modelValue', 'change'])
+const item = props.item
+const value = ref(props.modelValue)
+const modelValueUpDate = (val) => {
+  value.value = val
+  emit('update:modelValue', value.value)
+  emit('change', value.value)
+}
+</script>
+<style lang="scss" scoped>
+// :deep(.v-input__control) {
+//   flex-direction: row !important;
+// }
+// :deep(.v-selection-control-group) {
+//   margin-top: 0 !important;
+// }
+// :deep(.v-label) {
+//   margin-left: 0 !important;
+// }
+</style>

+ 0 - 1
src/components/FormUI/radioGroup/index.vue

@@ -1,5 +1,4 @@
 <template>
-  
   <!-- <div :style="`width: ${item.width || 120}px;`">{{ item.label }}</div> -->
   <v-radio-group
     v-model="value"

+ 2 - 3
src/layout/personal/navBar.vue

@@ -148,11 +148,10 @@ const handleToPersonalCenter = () => {
 }
 
 // 退出登录
-const handleLogout = async (index) => {
+const handleLogout = async (num = 0) => {
   // try {
     await userStore.userLogout()
-    // if (index) router.push({ name: '/login', query: { loginType: index } })
-    if (index) router.push({ path: `/login?loginType=${index}` })
+    if (num === 330) router.push({ name: 'login', query: { loginType: num } })
     else router.push({ path: '/login' })
   // } catch (error) {
   //   console.log(error, 'error')

+ 20 - 6
src/store/user.js

@@ -1,6 +1,6 @@
 import { defineStore } from 'pinia'
 import { setToken, removeToken } from '@/utils/auth'
-import { smsLogin, passwordLogin, getBaseInfo } from '@/api/common/index'
+import { smsLogin, passwordLogin, getBaseInfo, passwordLoginOfEnterprise, smsLoginOfEnterprise } from '@/api/common/index'
 import { logout } from '@/api/common/index'
 import { getUserInfo } from '@/api/personal/user'
 import Snackbar from '@/plugins/snackbar'
@@ -16,12 +16,26 @@ export const useUserStore = defineStore('user',
       baseInfo: {} // 人才信息
     }),
     actions: {
-      // 验证码&密码登录
-      async handleTypeLogin (type, data) {
-        // type: 1验证码登录 0密码登录
-        const api = type ? smsLogin : passwordLogin
+      // 短信登录
+      async handleSmsLogin (data) {
         return new Promise((resolve, reject) => {
-          api(data).then(res => {
+          const loginApi = data.type === 330 ? smsLoginOfEnterprise : smsLogin
+          loginApi(data).then(res => {
+            setToken(res.accessToken)
+            this.accountInfo = res
+            localStorage.setItem('accountInfo', JSON.stringify(res))
+            localStorage.setItem('expiresTime', res.expiresTime) // token过期时间
+            this.getUserInfos()
+            this.getUserBaseInfos()
+            resolve()
+          }).catch(err => { reject(err) })
+        })
+      },
+      // // 密码登录
+      async handlePasswordLogin(data) {
+        return new Promise((resolve, reject) => {
+          const loginApi = data.type === 330 ? passwordLoginOfEnterprise : passwordLogin
+          loginApi(data).then(res => {
             setToken(res.accessToken)
             this.accountInfo = res
             localStorage.setItem('accountInfo', JSON.stringify(res))

+ 7 - 2
src/views/enterprise/systemManagement/informationSettings.vue

@@ -50,8 +50,13 @@ const tab = ref(1)
 
 const infoData = {
   name: '苏州工业园区娄葑镇香草叶咖啡店', // 企业名称
-  suozaidi: '企业所在地',
-  dizhi: '企业地址',
+  suoZaiDi: '江苏 苏州 吴中区',
+  diZhi: '苏州工业园区斜塘林泉街598号邻里中心翰林大厦2幢N111室',
+  key1: '120.67439051247,31.349085947054',
+  time: new Date().getTime(),
+  select: '1',
+  net: 'https://www.baidu.com',
+  content: '香草叶总部位于苏州,始创于2010年;主营业务是中西结合简餐,以西式为主,适宜商务宴请、休闲小憩、情侣约会、家庭和朋友聚餐。创始人基于对西餐的热爱和菜品高品质的要求,不断研发和丰富菜品,中西结合式简餐,深受顾客朋友们的喜爱。诚邀志同道合者,热爱餐饮业的有志之士加盟香草叶!',
 }
 provide('infoData', JSON.stringify(infoData))
 </script>

+ 162 - 4
src/views/enterprise/systemManagement/informationSettingsComponents/basicInfo.vue

@@ -1,15 +1,173 @@
 <template>
-  <div>
-    <div>{{ infoData?.name }}</div>
+  <div style="width: 100%;">
+    <div class="tiShi">丰富详尽的企业介绍能提高求职者对贵企业的关注和了解,有助于达到更好的招聘效果</div>
+    <CtForm ref="CtFormRef" :items="formItems" style="width: 900px;margin: 0 auto">
+      <template #name="{ item }">
+        <div v-show="!item.show" class="text-right" style="width: 80px; line-height: 40px;">
+          <v-icon color="primary" size="20">mdi-shield-check</v-icon> <!-- mdi-shield-remove -->
+          <span style="color: var(--v-primary-base);font-size: 14px;">已认证</span>
+        </div>
+      </template>
+    </CtForm>
+    <div class="text-center">
+      <v-btn color="primary" class="buttons mt-3 mb-10" @click="handleSave">{{ $t('common.save') }}</v-btn>
+    </div>
   </div>
 </template>
 
 <script setup>
-import { inject } from 'vue';
+import { inject, ref } from 'vue';
 
 defineOptions({name: 'informationSettingsComponents-basicInfo'})
 const infoData = JSON.parse(inject('infoData'))
-
+const formItems = ref({
+  options: [
+    {
+      type: 'text',
+      key: 'name',
+      value: '',
+      label: '企业名称 *',
+      disabled: true,
+      slotName: 'name',
+      rules: [v => !!v || '请输入企业名称']
+    },
+    {
+      type: 'text',
+      key: 'suoZaiDi',
+      value: '',
+      label: '企业所在地 *',
+      disabled: true,
+      rules: [v => !!v || '请输入企业所在地']
+    },
+    {
+      type: 'text',
+      key: 'diZhi',
+      value: '',
+      label: '企业地址 *',
+      rules: [v => !!v || '请输入企业地址']
+    },
+    {
+      type: 'text',
+      key: 'key1',
+      value: '',
+      label: '区域定位',
+    },
+    {
+      type: 'autocomplete',
+      key: 'select',
+      value: null,
+      label: '行业类别 *',
+      outlined: true,
+      clearable: false,
+      disabled: true,
+      itemText: 'label',
+      itemValue: 'value',
+      col: 6,
+      flexStyle: 'mr-3',
+      rules: [v => !!v || '请选择行业类别'],
+      items: [{ label: '餐饮业', value: '1' }]
+    },
+    {
+      type: 'autocomplete',
+      key: 'select',
+      value: null,
+      label: '企业类型 *',
+      outlined: true,
+      clearable: false,
+      itemText: 'label',
+      itemValue: 'value',
+      col: 6,
+      rules: [v => !!v || '请选择企业类型'],
+      items: [{ label: '西餐餐饮', value: '1' }]
+    },
+    {
+      type: 'autocomplete',
+      key: 'select',
+      value: null,
+      label: '所属类别 *',
+      outlined: true,
+      clearable: false,
+      itemText: 'label',
+      itemValue: 'value',
+      col: 6,
+      flexStyle: 'mr-3',
+      rules: [v => !!v || '请选择所属类别'],
+      items: [{ label: '总部', value: '1' }]
+    },
+    {
+      type: 'autocomplete',
+      key: 'select',
+      value: null,
+      label: '企业规模 *',
+      outlined: true,
+      clearable: false,
+      itemText: 'label',
+      itemValue: 'value',
+      col: 6,
+      rules: [v => !!v || '请选择企业规模'],
+      items: [{ label: '50-99人', value: '1' }]
+    },
+    {
+      type: 'autocomplete',
+      key: 'select',
+      value: null,
+      label: '企业性质 *',
+      outlined: true,
+      clearable: false,
+      itemText: 'label',
+      itemValue: 'value',
+      rules: [v => !!v || '请选择企业性质'],
+      items: [{ label: '民营、私营企业', value: '1' }]
+    },
+    {
+      type: 'datePicker',
+      key: 'time',
+      value: null,
+      col: 6,
+      flexStyle: 'mr-3',
+      class: 'mb-3',
+      options: {
+        // type: 'time',
+        format: 'timestamp',
+        placeholder: '开业时间 *',
+      },
+      rules: [v => !!v || '请选择开业时间']
+    },
+    {
+      type: 'checkbox',
+      key: 'select',
+      value: '1',
+      // label: '筹建中',
+      col: 6,
+      items: [
+        { key: '1', label: '筹建中', value: '1' }
+      ]
+    },
+    {
+      type: 'text',
+      key: 'net',
+      value: '',
+      label: '企业网址',
+    },
+    {
+      type: 'textarea',
+      key: 'content',
+      value: null,
+      counter: 2000,
+      label: '企业介绍 *',
+      outlined: true,
+      rules: [v => !!v || '请输入企业介绍']
+    },
+  ]
+})
+formItems.value.options.forEach(e => { if (infoData[e.key]) e.value = infoData[e.key] })
 </script>
 <style lang="scss" scoped>
+.tiShi {
+  background-color: #f7f8fa;
+  color: #2f3640;
+  padding: 12px 20px;
+  margin: 10px 0 40px;
+  font-size: 14px;
+}
 </style>

+ 21 - 5
src/views/login/index.vue

@@ -8,6 +8,7 @@
               {{ isPhone ? '短信、密码登录/注册' : '微信扫码快速登录' }}
             </div>
           </div>
+          <div v-if="loginType" class="loginType">企业登录</div>
         </div>
         <div class="right mr-2 mt-3" v-if="showClose">
           <v-icon color="grey" size="30">mdi-close</v-icon>
@@ -54,11 +55,13 @@ import phoneFrom from '@/components/VerificationCode'
 import qrCode from './components/qrCode.vue'
 
 import { useUserStore } from '@/store/user'
-import { useRouter } from 'vue-router'
+import { useRoute, useRouter } from 'vue-router'
 import Snackbar from '@/plugins/snackbar'
 defineOptions({ name: 'login-index' })
 
 const router = useRouter()
+const route = useRoute()
+const loginType = ref(route.query?.loginType - 0 || null)
 
 const phone = ref()
 let isPhone = ref(false)
@@ -78,11 +81,13 @@ const handleLogin = async () => {
   const { valid } = tab.value ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
   if (!valid) return
   loginLoading.value = true
-  // type: 1验证码登录 0密码登录
-  const type = tab.value ? 1 : 0
-  const query = tab.value ? phoneRef.value.loginData : passRef.value.loginData
   try {
-    await userStore.handleTypeLogin(type, query)
+    const type = loginType.value
+    if (tab.value === 1) {
+      await userStore.handleSmsLogin({ ...phoneRef.value.loginData, type })
+    } else {
+      await userStore.handlePasswordLogin({ ...passRef.value.loginData, type })
+    }
     Snackbar.success('登录成功')
     router.push({ path: '/home' })
   }
@@ -101,6 +106,17 @@ const handlePrivacyPolicy = () => {
 </script>
 
 <style lang="scss" scoped>
+.loginType {
+  position: absolute;
+  top: 10px;
+  right: 0;
+  // width: 100%;
+  color: #fff;
+  padding: 10px 30px;
+  border-radius: 8px 0 0 8px;
+  background-color: #ffba5d;
+  font-size: 16px;
+}
 .login-box {
   position: relative;
   width: 100%;