Xiao_123 hai 2 meses
pai
achega
f34365cb6e

+ 25 - 1
api/common.js

@@ -90,7 +90,7 @@ export const shareUserRegister = (data) => {
   })
 }
 
-// 退出登录
+// 招聘端-退出登录
 export const logout = (token) => {
   return request({
     url: `/app-api/menduner/system/recruit/enterprise/auth/logout-token?token=${token}`,
@@ -102,6 +102,18 @@ export const logout = (token) => {
   })
 }
 
+// 个人端-退出登录
+export const userLogout = () => {
+  return request({
+    url: `/app-api/menduner/system/auth/logout`,
+    method: 'POST',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
 // 字典
 export const getDictData = (params) => {
   return request({
@@ -439,3 +451,15 @@ export const socialUserBind = async (data) => {
     }
   })
 }
+
+// 企业营业执照图片识别文字
+export const getBusinessLicenseOCR = async (url) => {
+  return request({
+    url: '/app-api/menduner/system/recruit/enterprise/business/ocr?url=' + url,
+    method: 'POST',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}

+ 39 - 0
api/enterprise.js

@@ -74,4 +74,43 @@ export const getPersonCvDetail = (userId) => {
       auth: false
     }
   })
+}
+
+// 企业注册
+export const enterpriseRegisterApply = (data) => {
+  return request({
+    url: `/app-api/menduner/system/enterprise-register/apply`,
+    method: 'POST',
+    data,
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
+// 获取当前用户提交的企业申请
+export const getUserRegisterEnterpriseApply = () => {
+  return request({
+    url: '/app-api/menduner/system/enterprise-register/by/user',
+    method: 'GET',
+    custom: {
+      openEncryption: true,
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 根据邮箱获取企业注册申请
+export const getEnterpriseRegisterApply = (email) => {
+  return request({
+    url: '/app-api/menduner/system/enterprise-register/by/email?email=' + email,
+    method: 'GET',
+    custom: {
+      openEncryption: true,
+      showLoading: false,
+      auth: false
+    }
+  })
 }

+ 56 - 2
layout/components/authModal/login/index.vue

@@ -104,6 +104,8 @@ import { ref, unref } from 'vue'
 import { mobile, password, code, emailRequired } from '@/utils/validate'
 import { getSmsCode, getSmsTimer } from '@/utils/code'
 import { userStore } from '@/store/user'
+import { closeAuthModal } from '@/hooks/useModal'
+import { getUserRegisterEnterpriseApply, getEnterpriseRegisterApply } from '@/api/enterprise'
 
 const useUserStore = userStore()
 const current = ref(0)
@@ -195,14 +197,45 @@ function handleChangeLogin () {
 async function handleRegister () {
   const validate = await unref(registerForm).validate()
   if (!validate) return
+  const query = state.value.register
+  Object.assign(query, {
+    account: query.phone,
+    autoRegister: true
+  })
   try {
-    await useUserStore.handleRegister(state.value.register)
+    await useUserStore.handleRegister(query)
+    uni.showToast({
+      title: '手机号验证成功',
+      icon: 'none',
+      duration: 2000
+    })
+
+    const { data } = await getUserRegisterEnterpriseApply()
+
     changeType.value = 'login'
+    const hasData = data && Object.keys(data).length > 0 && data.status !== '1'
+    console.log(data, '查看用户是否有在申请中的数据')
+
+    uni.navigateTo({
+      url: hasData ? '/pages/register/review' : '/pages/register/index'
+    })
   } finally {
 
   }
 }
 
+const handleCheckEnterprise = async () => {
+  const { data } = await getEnterpriseRegisterApply(state.value.account.phone)
+  if (data && Object.keys(data).length) {
+    // 查看申请状态
+    uni.setStorageSync('entRegisterData', JSON.stringify(data))
+    uni.navigateTo({
+      url: '/pages/register/review?hasData=true'
+    })
+  }
+  closeAuthModal()
+}
+
 // 登录
 const handleLogin = async () => {
   if (!protocol.value) return uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
@@ -213,7 +246,28 @@ const handleLogin = async () => {
     account: query.phone
   })
   console.log(query, '登录参数')
-  await useUserStore.handleSmsLogin(query, 1)
+  try {
+    await useUserStore.handleSmsLogin(query, 1)
+    closeAuthModal()
+  } catch (err) {
+    console.log(err, '登录失败')
+    if (!err.code || (err?.message && err.message.includes('timeout'))) return closeAuthModal()
+    if (err.code === 1100017022) {
+      // 密码不安全
+      uni.showToast({ title: '您的密码不安全,请重置密码', icon: 'none', duration: 2000 })
+      closeAuthModal()
+      return
+    }
+    if (err.code === 1100021016) {
+      // 企业注册申请中
+      handleCheckEnterprise()
+      return
+    }
+    if (err.code === 1100017019) {
+      uni.showToast({ title: '您的邮箱还未注册过,请先注册', icon: 'none', duration: 2000 })
+      changeType.value = 'register'
+    }
+  }
 }
 </script>
 

+ 18 - 0
pages.json

@@ -18,6 +18,24 @@
 				"navigationBarTitleText": "企业注册"
 			}
 		},
+		{
+			"path": "pages/register/contact",
+			"style": {
+				"navigationBarTitleText": "企业注册-联系人填写"
+			}
+		},
+		{
+			"path": "pages/register/review",
+			"style": {
+				"navigationBarTitleText": "账号注册进度"
+			}
+		},
+		{
+			"path": "pages/register/phoneValidate",
+			"style": {
+				"navigationBarTitleText": "手机号效验"
+			}
+		},
 		{
 			"path": "pages/index/communicate",
 			"style": {

+ 0 - 278
pages/login/index.vue

@@ -1,278 +0,0 @@
-<template>
-  <view class="ss-p-30 head-box">
-    <view class="head-title">欢迎来到门墩儿,新用户注册领积分</view>
-    <view class="head-subtitle ss-m-t-30 justify-center">未注册的手机号,验证后自动注册账号</view>
-
-    <view class="ss-m-t-60">
-      <!-- 短信验证码登录 -->
-      <uni-forms
-        ref="smsLoginRef"
-        v-model="state.sms"
-        :rules="state.smsRules"
-        validateTrigger="bind"
-        labelWidth="140"
-        labelAlign="center"
-      >
-        <uni-forms-item name="phone" label="手机号">
-          <uni-easyinput placeholder="请输入手机号" v-model="state.sms.phone" :inputBorder="false" type="number">
-            <template v-slot:right>
-              <button class="login-code" :disabled="state.isMobileEnd" :class="{ 'code-btn-end': state.isMobileEnd }" @tap="handleCode">
-                {{ getSmsTimer('smsLogin') }}
-              </button>
-            </template>
-          </uni-easyinput>
-        </uni-forms-item>
-
-        <uni-forms-item name="code" label="验证码">
-          <uni-easyinput placeholder="请输入验证码" v-model="state.sms.code" :inputBorder="false" type="number" maxlength="6"></uni-easyinput>
-        </uni-forms-item>
-      </uni-forms>
-      <!-- <view>
-        <button v-if="!protocol" class="wxLogon" type="text" :plain="true" @click="showProtocolToast">微信一键登录</button>
-        <button v-else class="wxLogon" type="text" :plain="true" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信一键登录</button>
-      </view> -->
-
-      <button class="send-button" @tap="handleLogin"> 注册 </button>
-      <view class="agreement-box ss-flex ss-row-center">
-        <uni-icons size="20" :type="protocol ? 'checkbox-filled' : 'circle'" :color="protocol ? '#00B760' : '#ccc'" @tap="protocol = !protocol"></uni-icons>
-        <view class="color-999 ss-flex ss-col-center ss-m-l-8 font-size-13">
-          我已阅读并遵守
-          <view class="color-primary" @tap.stop="handleToDetail('user')">
-            《用户协议》
-          </view>
-          <view class="agreement-text">和</view>
-          <view class="color-primary" @tap.stop="handleToDetail('privacy')">
-            《隐私协议》
-          </view>
-        </view>
-      </view>
-    </view>
-
-    <!-- <AdvertisePop></AdvertisePop> -->
-
-    <!-- <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false">
-      <view style="padding: 20px;">
-        <view class="text-center ss-m-b-50 font-size-20 color-primary">请完善您的基本信息</view>
-        <uni-forms
-          ref="baseInfoRef"
-          v-model="formData"
-          :rules="formRules"
-          validateTrigger="bind"
-          label-width="75px"
-          labelAlign="center"
-        >
-          <uni-forms-item name="name" label="姓名" required>
-            <uni-easyinput placeholder="请输入姓名" v-model="formData.name" :inputBorder="false" type="text"></uni-easyinput>
-          </uni-forms-item>
-          <uni-forms-item name="phone" label="联系电话" required>
-            <uni-easyinput placeholder="请输入联系电话" v-model="formData.phone" :inputBorder="false" type="number"></uni-easyinput>
-          </uni-forms-item>
-          <uni-forms-item name="sex" label="性别" required>
-            <uni-data-picker v-model="formData.sex" :localdata="dictObj.sex" :clear-icon="false" popup-title="请选择性别" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
-          </uni-forms-item>
-          <uni-forms-item name="jobStatus" label="求职状态" required>
-            <uni-data-picker v-model="formData.jobStatus" :localdata="dictObj.jobStatus" :clear-icon="false" popup-title="请选择求职状态" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
-          </uni-forms-item>
-          <uni-forms-item name="expType" label="工作经验" required>
-            <uni-data-picker v-model="formData.expType" :localdata="dictObj.exp" :clear-icon="false" popup-title="请选择工作经验" :clear="false" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
-          </uni-forms-item>
-          <uni-forms-item name="eduType" label="最高学历" required>
-            <uni-data-picker v-model="formData.eduType" :localdata="dictObj.edu" :clear-icon="false" popup-title="请选择最高学历" :clear="false" :map="{ text: 'label', value: 'value' }"></uni-data-picker>
-          </uni-forms-item>
-        </uni-forms>
-      </view>
-      <view class="f-horizon-center">
-				<button type="primary" size="default" class="send-button"  @click="submit">提 交</button>
-			</view>
-		</uni-popup> -->
-  </view>
-</template>
-
-<script setup>
-// 扫码登录注册
-import { ref, unref } from 'vue'
-import { mobile, code } from '@/utils/validate'
-import { getSmsCode, getSmsTimer } from '@/utils/code'
-import { userStore } from '@/store/user'
-import { onLoad } from '@dcloudio/uni-app'
-import { useIM } from '@/hooks/useIM'
-import { watch } from 'vue'
-// import AdvertisePop from '@/components/Advertisement'
-// import { dictObj } from '@/utils/position.js'
-// import { savePersonSimpleInfo } from '@/api/user'
-// import { showAuthModal } from '@/hooks/useModal'
-
-const useUserStore = userStore()
-const smsLoginRef = ref()
-const protocol = ref(false)
-// const popup = ref()
-// const baseInfoRef = ref()
-// const formData = ref({})
-const state = ref({
-  isMobileEnd: false, // 手机号输入完毕
-  codeText: '获取验证码',
-  sms: {
-    phone: '',
-    code: '',
-    inviteCode: ''
-  },
-  smsRules: {
-    code,
-    phone: mobile
-  }
-})
-// const formRules = {
-// 	name:{
-// 		rules: [{required: true, errorMessage: '请输入姓名' }]
-// 	},
-//   phone:{
-// 		rules: [{required: true, errorMessage: '请输入联系电话' }]
-// 	},
-// 	sex : {
-// 		rules: [{required: true, errorMessage: '请选择您的性别' }]
-// 	},
-//   expType: {
-// 		rules: [{required: true, errorMessage: '请选择您的工作年限' }]
-// 	},
-//   eduType: {
-// 		rules: [{required: true, errorMessage: '请选择您的最高学历' }]
-// 	},
-//   jobStatus: {
-// 		rules: [{required: true, errorMessage: '请选择您的求职状态' }]
-// 	}
-// }
-
-const { resetConfig } = useIM()
-watch(() => useUserStore?.accountInfo?.userId, (newVal, oldVal) => {
-  if (useUserStore.refreshToken) {
-		// 监听登录状态
-    resetConfig()
-	}
-})
-
-onLoad((options) => {
-  console.log(options, 'options-my-share=========')
-  // const testOptions = { scene: "shareId%3D1" }
-	if (options.scene) {
-    const scene = decodeURIComponent(options.scene)
-    const shareUserId = scene.split('=')[1]
-    state.value.sms.inviteCode = shareUserId
-    console.log(shareUserId, 'shareUserId')
-  }
-})
-
-// 获取验证码
-const handleCode = () => {
-  if (!state.value.sms.phone) {
-    uni.showToast({
-      title: '请输入手机号',
-      icon: 'none',
-      duration: 2000
-    })
-    return
-  }
-  getSmsCode('smsLogin', state.value.sms.phone)
-}
-
-// 查看协议详情
-const handleToDetail = (type) => {
-  const url = type === 'user' ? '/pagesB/agreement/user' : '/pagesB/agreement/privacy'
-  uni.navigateTo({
-    url
-  })
-}
-
-// 登录
-const handleLogin = async () => {
-  if (!protocol.value) return uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
-  const validate = await unref(smsLoginRef).validate()
-  if (!validate) return
-  if (!state.value.sms.inviteCode) {
-    uni.showToast({
-      title: '邀请码缺失,请重新扫码',
-      icon: 'none'
-    })
-    return
-  }
-  const result = await useUserStore.handleShareUserRegister(state.value.sms)
-  if (!result || !Object.keys(result).length) return
-  uni.switchTab({
-    url: '/pages/index/my'
-  })
-  
-  // uni.showToast({ icon: 'none', title: '请先完善信息' })
-  // formData.value.phone = state.value.sms.phone
-  // popup.value.open()
-}
-
-// const submit = async () => {
-//   const validate = await unref(baseInfoRef).validate()
-//   if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
-//   try {
-//     uni.showToast({ title: '保存成功', icon: 'none' })
-//     await useUserStore.getInfo()
-//     await useUserStore.getUserInfo()
-//     uni.switchTab({
-//       url: '/pages/index/position'
-//     })
-//   } catch (err) {
-//     uni.showToast({ title: err.msg || '保存失败', icon: 'none' })
-//   }
-// }
-
-
-// const showProtocolToast = () => {
-//   uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
-// }
-
-// // 微信登录
-// const getPhoneNumber = async (e) => {
-//   if (e?.detail?.errMsg !== 'getPhoneNumber:ok') {
-//     uni.showToast({ title: '微信登录失败', icon: 'none' })
-//     return
-//   }
-//   changeType.value = 'login'
-//   wx.login({
-//     success: async (result) => {
-//       const wxLoginCode = result?.code || ''
-//       const query = {
-//         loginCode: wxLoginCode,
-//         phoneCode: e.detail.code,
-//         state: e.detail.encryptedData,
-//       }
-//       await useUserStore.handleSmsLogin(query, 2)
-//     },
-//     fail:(res)=> { console.log("获取登录凭证code失败!", res) }
-//   })
-// }
-</script>
-
-<style scoped lang="scss">
-.login-code {
-  width: 73px;
-  min-width: 73px;
-  color: #00B760;
-  text-align: center; 
-  font-size: 12px; 
-  cursor: pointer;
-  border: 1px dashed #00B760;
-  border-radius: 26px;
-  padding: 0;
-}
-.head-title {
-  font-size: 40rpx;
-  text-align: center;
-  color: #00B760;
-}
-.wxLogon {
-  text-align: center;
-  font-size: .85em;
-  color: #00B760;
-  border: none;
-  margin: 0;
-  padding: 0;
-  // margin: 40rpx;
-  margin-top: -20px;
-  margin-bottom: -15px;
-}
-</style>

+ 197 - 0
pages/register/contact.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="f-straight wrapper">
+		<!-- <uni-notice-bar class="ss-m-b-30" scrollable text="填写联系人1后可获得500积分,可前往【门墩儿商城】兑换礼品【减压捏捏乐】,企业注册审核通过后积分将自动发放到您的账户中。" /> -->
+		<view v-for="(val, index) in contacts" :key="index" class="f-straight contact-item">
+			<view class="d-flex justify-space-between align-center ss-m-b-20">
+				<view class="color-primary">{{ index === 0 ? '管理员' : '联系人' + index }}</view>
+				<view v-if="index > 1">
+					<uni-icons type="closeempty" size="20" color="#fe574a" @click="deleteContact(index)"></uni-icons>
+				</view>
+			</view>
+			<uni-forms ref="formRef" :modelValue="val" :rules="formRules" validateTrigger="bind" label-width="105px" label-align="right" label-position="left">
+				<uni-forms-item name="contactName" label="联系人姓名" required>
+					<uni-easyinput v-model="val.contactName" placeholder="请输入"></uni-easyinput>
+				</uni-forms-item>
+				<uni-forms-item name="phone" label="联系电话" required>
+					<uni-easyinput v-model="val.phone" placeholder="请输入" :disabled="index === 0"></uni-easyinput>
+				</uni-forms-item>
+				<uni-forms-item name="email" label="企业邮箱" required>
+					<uni-easyinput v-model="val.email" placeholder="请输入企业邮箱(用于日后“登录邮箱”)"></uni-easyinput>
+				</uni-forms-item>
+				<uni-forms-item name="password" label="账户登录密码" required>
+					<uni-easyinput v-model="val.password" placeholder="请输入"></uni-easyinput>
+				</uni-forms-item>
+				<uni-forms-item name="passwordConfirm" label="密码二次确认" required>
+					<uni-easyinput v-model="val.passwordConfirm" placeholder="请输入"></uni-easyinput>
+				</uni-forms-item>
+			</uni-forms>
+		</view>
+		<view class="color-warning" style="text-align: center; margin-bottom: 50px;" @tap.stop="handleAddContact">
+			<uni-icons type="plusempty" size="20" color="#fb8c00"></uni-icons>
+			继续添加联系人
+		</view>
+
+		<button class="send-button" @tap="handleSubmit">提 交</button>
+	</view>
+</template>
+
+<script setup>
+import { ref, computed } from 'vue'
+import { userStore } from '@/store/user'
+import { onLoad } from '@dcloudio/uni-app'
+import { realName, mobile, emailRequired, password } from '@/utils/validate'
+import { enterpriseRegisterApply } from '@/api/enterprise'
+
+const useUserStore = userStore()
+const adminUserPhone = computed(() => useUserStore?.phone)
+const register = ref(JSON.parse(uni.getStorageSync('registerInfo')))
+console.log(adminUserPhone.value, '注册手机号', register.value)
+
+const formRef = ref()
+const formRules = {
+	contactName: realName,
+  phone: mobile,
+	email: emailRequired,
+	password,
+	passwordConfirm: {
+		rules: [
+			{ required: true, errorMessage: '请再次输入密码' },
+			{ 
+				validateFunction: function(rule, value, data, callback) {
+					if (value !== data.password) callback('两次输入的密码不一致')
+					return true
+				}
+			}
+		]
+	}
+}
+
+const contacts = ref([
+  {
+    contactName: '',
+    phone: adminUserPhone.value || '',
+    email: '',
+    password: '',
+    passwordConfirm: ''
+  },
+  {
+    contactName: '',
+    phone: '',
+    email: '',
+    password: '',
+    passwordConfirm: ''
+  }
+])
+
+onLoad((options) => {
+	if (options?.isEdit) {
+		const applyInfo = ref(uni.getStorageSync('entRegisterData') ? JSON.parse(uni.getStorageSync('entRegisterData')) : {})
+		contacts.value = applyInfo.value.contacts.map(e =>  {
+			e.passwordConfirm = e.password
+			return e
+		})
+	}
+})
+
+const handleAddContact = () => {
+	contacts.value.push({
+		contactName: '',
+		phone: '',
+		email: '',
+		password: '',
+		passwordConfirm: ''
+	})
+}
+
+const deleteContact = (index) => {
+	contacts.value.splice(index, 1)
+}
+
+// 检查联系人信息是否重复
+const checkDuplicates = (dataList) => {
+  const emailRecord = {}
+  const phoneRecord = {}
+  for (const item of dataList) {
+    const email = item.email
+    const phone = item.phone
+    if (emailRecord[email]) {
+      return false
+    }
+    if (phoneRecord[phone]) {
+      return false
+    }
+    emailRecord[email] = true
+    phoneRecord[phone] = true
+  }
+  return true
+}
+
+const handleSubmit = async () => {
+  // 存储所有的验证Promise
+  const validationPromises = []
+  formRef.value.forEach((e) => {
+    validationPromises.push(e.validate().catch(err => {
+      return false
+    }))
+  })
+
+  // 等待所有验证Promise完成
+  const validationResults = await Promise.all(validationPromises)
+  const errorCount = validationResults.filter(result => result === false).length
+  if (errorCount > 0) return
+
+  if (!contacts.value.length || contacts.value.length < 2) {
+    uni.showToast({
+      title: '请至少添加两个联系人',
+      icon: 'none',
+      duration: 2000
+    })
+    return
+  }
+
+  const checkValue = checkDuplicates(contacts.value)
+  if (!checkValue) {
+    uni.showToast({
+      title: '手机号或邮箱不能重复',
+      icon: 'none',
+      duration: 2000
+    })
+    return
+  }
+
+	const params = {
+		...register.value,
+		contacts: contacts.value,
+		contactName: contacts.value[0].contactName,
+		phone: contacts.value[0].phone,
+		email: contacts.value[0].email
+	}
+	console.log(params, '企业注册参数')
+
+	uni.showLoading({ title: '提交中' })
+	try {
+		await enterpriseRegisterApply(params)
+		uni.hideLoading()
+		uni.showToast({
+			title: '提交成功',
+			icon: 'success',
+			duration: 2000
+		})
+		uni.reLaunch({
+			url: '/pages/register/review'
+		})
+	} catch {
+		uni.hideLoading()
+	}
+}
+</script>
+
+<style lang="scss" scoped>
+.wrapper{
+	padding: 15px;
+}
+.contact-item {
+	border-bottom: 1px solid #eee;
+	margin-bottom: 30px;
+}
+</style>

+ 232 - 0
pages/register/index.vue

@@ -0,0 +1,232 @@
+<template>
+  <view class="f-straight wrapper">
+    <uni-forms ref="formRef" :modelValue="formData" :rules="formRules" validateTrigger="bind" label-width="105px" label-align="right" label-position="left">
+      <uni-forms-item name="prepare" label="筹备中" required>
+        <uni-data-checkbox 
+          v-model="formData.prepare" 
+          selectedColor="#00B760" 
+          selectedTextColor="#00B760" 
+          :localdata="[{ text: '是', value: true }, { text: '否', value: false }]"
+          @change="handleChangePrepare"
+        />
+      </uni-forms-item>
+      <uni-forms-item name="businessLicenseUrl" label="营业执照" :required="required['businessLicenseUrl']">
+        <view style="display: flex;flex-wrap: wrap;">
+          <view class="upload-img" v-if="formData?.businessLicenseUrl">
+            <uni-icons size="35" type="clear" color="#fe574a" style="position: absolute; right: -15px; top: -15px; z-index: 9" @click="handleDeleteImg"></uni-icons>
+            <image :src="formData?.businessLicenseUrl" mode="contain" style="width: 200rpx;height: 200rpx;" @click="handlePreviewImage"></image>
+          </view>
+          <view v-else class="upload-file" @click="uploadPhotos">
+            <uni-icons type="plusempty" size="50" color="#f1f1f1"></uni-icons>
+          </view>
+          <view class="ss-m-t-10 color-999">上传营业执照支持jpg、jpeg、png格式,图片大小不得超过20M</view>
+        </view>
+      </uni-forms-item>
+      <uni-forms-item name="name" label="企业名称" required>
+        <uni-easyinput v-model="formData.name" placeholder="请输入"></uni-easyinput>
+        <view class="ss-m-t-10 color-999">注:需与营业执照一致,上传营业执照可自动识别</view>
+      </uni-forms-item>
+      <uni-forms-item name="anotherName" label="对外展示名称" required>
+        <uni-easyinput v-model="formData.anotherName" placeholder="请输入"></uni-easyinput>
+      </uni-forms-item>
+      <uni-forms-item name="code" label="社会信用代码" :required="required['code']">
+        <uni-easyinput v-model="formData.code" placeholder="请输入"></uni-easyinput>
+        <view class="ss-m-t-10 color-999">注:需与营业执照一致,上传营业执照可自动识别</view>
+      </uni-forms-item>
+      <uni-forms-item name="description" label="备注/说明">
+        <uni-easyinput v-model="formData.description" placeholder="请输入" type="textarea"></uni-easyinput>
+      </uni-forms-item>
+    </uni-forms>
+
+    <button class="send-button" @tap="handleNext">下一步</button>
+  </view>
+</template>
+
+<script setup>
+// 扫码登录注册
+import { ref, unref } from 'vue'
+import { uploadFile } from '@/api/file'
+import { getBusinessLicenseOCR } from '@/api/common'
+
+const formRef = ref()
+const formData = ref({
+  prepare: true,
+  businessLicenseUrl: '',
+  name: '',
+  anotherName: '',
+  code: '',
+  description: ''
+})
+
+const required = ref({
+  code: false,
+  businessLicenseUrl: false
+})
+const otherRules = ref({
+  businessLicenseUrl: {
+    rules: [{required: true, errorMessage: '请上传营业执照' }]
+  },
+  code: {
+    rules: [{required: true, errorMessage: '请填写统一社会信用代码' }]
+  }
+})
+
+const formRules = ref({
+	name:{
+		rules: [{required: true, errorMessage: '请输入企业名称' }]
+	},
+  anotherName:{
+		rules: [{required: true, errorMessage: '请输入企业对外展示名称' }]
+	},
+	prepare: {
+		rules: [{required: true, errorMessage: '请选择贵企业是否在筹备中' }]
+	}
+})
+
+// 图片预览
+const handlePreviewImage = () => {
+  uni.previewImage({
+    current: 0,
+    urls: [formData.value.businessLicenseUrl]
+  })
+}
+
+// 图片删除
+const handleDeleteImg = () => {
+  formData.value.businessLicenseUrl = ''
+  business.value = {}
+  formData.value.ocr = null
+  formData.value.code = ''
+  formData.value.name = ''
+}
+
+// 识别营业执照图片
+const business = ref({})
+const getOcr = async () => {
+  uni.showLoading({ title: '识别中...' })
+  try {
+    const { data } = await getBusinessLicenseOCR(formData.value.businessLicenseUrl)
+    if (data && Object.keys(data).length) {
+      formData.value.code = data.code
+      formData.value.name = data.name
+      business.value = data
+    } else {
+      formData.value.businessLicenseUrl = ''
+      uni.showToast({
+        title: '识别失败,请重新上传清晰合法图片',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  } catch (error) {
+    formData.value.businessLicenseUrl = ''
+    console.error(error, 'error')
+    uni.hideLoading()
+    uni.showToast({
+      title: '识别失败,请重新上传清晰合法图片',
+      icon: 'none',
+      duration: 2000
+    })
+  } finally {
+    uni.hideLoading()
+  }
+}
+
+// 选择营业执照
+const uploadPhotos = () => {
+  wx.chooseImage({
+    count: 1,
+    sizeType: ['original', 'compressed'],
+    sourceType: ['album', 'camera'],
+    success: function(res){
+      const size = res.tempFiles[0]?.size || 0
+      if (size >= 31457280) {
+        uni.showToast({
+          icon: 'none',
+          title: '上传图片大小不得超过 20MB !',
+          duration: 2000
+        })
+        return
+      }
+      const path = res.tempFilePaths[0]
+      uploadFile(path, 'img').then(res => {
+        formData.value.businessLicenseUrl = res.data
+        getOcr()
+      }).catch(error => {
+        uni.showToast({
+          icon: 'error',
+          title: '图片上传失败!',
+          duration: 2000
+        })
+      })
+    }
+  })
+}
+
+// 是否筹备中
+const handleChangePrepare = (e, clear = true) => {
+  const prepare = e.detail.value
+  for(let i in required.value) {
+    required.value[i] = !prepare
+  }
+  if (!prepare) {
+    formRules.value = Object.assign(formRules.value, otherRules.value)
+  } else {
+    delete formRules.value.code
+    delete formRules.value.businessLicenseUrl
+  }
+  if (clear) formRef.value.clearValidate()
+}
+
+// 申请拒绝-重新提交数据回显
+const applyInfo = ref(uni.getStorageSync('entRegisterData') ? JSON.parse(uni.getStorageSync('entRegisterData')) : {})
+console.log(applyInfo.value, '申请拒绝-重新提交数据回显')
+if (applyInfo.value && Object.keys(applyInfo.value).length > 0 && applyInfo.value.status === '2') {
+  for (let i in formData.value) {
+    formData.value[i] = applyInfo.value[i]
+  }
+  business.value = applyInfo.value?.orc || {}
+  handleChangePrepare({ detail: { value: applyInfo.value.prepare }}, false)
+}
+
+// 登录
+const handleNext = async () => {
+  const validate = await unref(formRef).validate()
+  if (!validate) return
+
+  if (business.value && Object.keys(business.value).length) formData.value.ocr = business.value
+  
+  const isEdit = applyInfo.value && Object.keys(applyInfo.value).length > 0 && applyInfo.value.status === '2'
+  if (isEdit) formData.value.id = applyInfo.value.id
+  console.log(formData.value, 'index-next-formData')
+
+  uni.setStorageSync('registerInfo', JSON.stringify(formData.value))
+  uni.navigateTo({
+    url: isEdit ? '/pages/register/contact?isEdit=true' : '/pages/register/contact'
+  })
+}
+</script>
+
+<style scoped lang="scss">
+.wrapper{
+	padding: 15px;
+  padding-top: 30px;
+}
+.upload-img{
+  position: relative;
+  width: 200rpx;
+  height: 200rpx;
+  border: 1px solid #f1f1f1;
+  margin: 10rpx;
+}
+.upload-file{
+  width: 200rpx;
+  height: 200rpx;
+  border: 1px solid #f1f1f1;
+  margin: 10rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 10rpx;
+}
+</style>

+ 155 - 0
pages/register/phoneValidate.vue

@@ -0,0 +1,155 @@
+<template>
+  <view class="ss-p-30">
+      <view class="head-title ss-m-b-30">请输入您申请企业账号时填入的手机号进行效验</view>
+
+      <view class="ss-m-t-50">
+        <uni-forms
+					ref="smsLoginRef"
+					v-model="state.sms"
+					:rules="state.smsRules"
+					validateTrigger="bind"
+					labelWidth="140"
+					labelAlign="center"
+				>
+					<uni-forms-item name="phone" label="手机号">
+						<uni-easyinput placeholder="请输入手机号" v-model="state.sms.phone" :inputBorder="false" type="number">
+						</uni-easyinput>
+					</uni-forms-item>
+
+					<uni-forms-item name="code" label="验证码">
+						<uni-easyinput
+							placeholder="请输入验证码"
+							v-model="state.sms.code"
+							:inputBorder="false"
+							type="number"
+							maxlength="6"
+						>
+							<template v-slot:right>
+								<button
+									class="login-code"
+									:disabled="state.isMobileEnd"
+									:class="{ 'code-btn-end': state.isMobileEnd }"
+									@tap="handleCode"
+								>
+									{{ getSmsTimer('smsRegister') }}
+								</button>
+							</template>
+						</uni-easyinput>
+					</uni-forms-item>
+				</uni-forms>
+
+        <button class="send-button" @tap="handleLogin"> 验 证  </button>
+      </view>
+  </view>
+</template>
+
+<script setup>
+import { ref, unref } from 'vue'
+import { mobile, code } from '@/utils/validate'
+import { getSmsCode, getSmsTimer } from '@/utils/code'
+import { userStore } from '@/store/user'
+import { onLoad } from '@dcloudio/uni-app'
+import { closeAuthModal } from '@/hooks/useModal'
+
+const useUserStore = userStore()
+const smsLoginRef = ref()
+const state = ref({
+  isMobileEnd: false, // 手机号输入完毕
+  codeText: '获取验证码',
+  sms: {
+    phone: '',
+    code: ''
+  },
+  smsRules: {
+    code,
+    phone: mobile
+  }
+})
+
+onLoad((options) => {
+	if (options.phone) state.value.sms.phone = options.phone
+})
+
+// 获取验证码
+const handleCode = () => {
+  if (!state.value.sms.phone) {
+    uni.showToast({
+      title: '请输入手机号',
+      icon: 'none',
+      duration: 2000
+    })
+    return
+  }
+  getSmsCode('smsLogin', state.value.sms.phone)
+}
+
+// 验证
+const handleLogin = async () => {
+  const validate = await unref(smsLoginRef).validate()
+  if (!validate) return
+  const query = state.value.sms
+  Object.assign(query, {
+    sms: query.phone
+  })
+  console.log(query, '手机号效验参数')
+	try {
+		await useUserStore.handleSmsLogin(query, 0, false)
+		uni.showToast({
+			title: '手机号效验成功',
+			icon: 'none',
+			duration: 2000
+		})
+		closeAuthModal()
+		uni.navigateTo({
+			url: '/pages/register/index'
+		})
+	} catch (err) {
+		closeAuthModal()
+		console.log(err, '手机号效验')
+	}
+}
+</script>
+
+<style scoped lang="scss">
+.login-code {
+  width: 73px;
+  min-width: 73px;
+  color: #00B760;
+  text-align: center; 
+  font-size: 12px; 
+  cursor: pointer;
+  padding: 0;
+}
+.head-title {
+  font-size: 40rpx;
+  text-align: center;
+  color: #00B760;
+  margin-top: 30rpx;
+}
+.quickLogon {
+  display: flex;
+  justify-content: space-between;
+  padding: 0 20rpx;
+  align-items: center;
+}
+.wxLogon {
+  font-size: .85em;
+  color: #00B760;
+  border: none;
+  margin: 0;
+  padding: 0;
+}
+.register {
+  widows: 100%;
+  font-size: .85em;
+  color: red;
+  // text-align: right;
+  &.login {
+    color: #00B760;
+  }
+}
+.pb-20 {
+  padding-bottom: 40rpx;
+}
+
+</style>

+ 122 - 0
pages/register/review.vue

@@ -0,0 +1,122 @@
+<template>
+	<view style="padding: 15px;">
+		<!-- 提交企业注册以后跳转显示页面 -->
+		<view v-if="!applyInfo || !(Object.keys(applyInfo).length)">
+			<view class="d-flex flex-column align-center">
+				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
+			</view>
+      <view><span class="color-primary font-size-20 font-weight-bold">提交成功,</span>已收到您的企业账号申请,审核时间预计在1~3个工作日内,申请结果会以短信方式通知到您的手机上,请注意查收。</view>
+      <view style="width: 100%;">
+        <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
+        <view style="width: 150px; height: 150px; margin: auto;">
+					<image show-menu-by-longpress="true" src="https://minio.menduner.com/dev/menduner/contact.png" style="width: 150px; height: 150px;"></image>
+        </view>
+        <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
+      </view>
+		</view>
+
+		<!-- 等待审核 -->
+		<view v-else-if="applyInfo?.status === '0'">
+			<view class="d-flex flex-column align-center">
+				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
+			</view>
+			<view>
+        您的企业账号申请<span class="color-primary font-size-20 font-weight-bold"> 正在审核中,</span>审核时间在1~3个工作日内,申请结果会以短信方式通知到您的手机上,请注意查收。
+      </view>
+      <view class="ss-m-t-30">
+        <span>提交时间:{{ applyInfo.createTime }}</span>
+      </view>
+      <view style="width: 100%;">
+        <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
+        <view style="width: 150px; height: 150px; margin: auto;">
+					<image show-menu-by-longpress="true" src="https://minio.menduner.com/dev/menduner/contact.png" style="width: 150px; height: 150px;"></image>
+        </view>
+        <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
+      </view>
+		</view>
+
+		<!-- 审核不通过 -->
+		<view v-else-if="applyInfo?.status === '2'" class="ss-m-b-100">
+			<view class="ss-m-b-20 color-error">
+        您的企业账号注册申请<span class="color-error font-size-20 font-weight-bold"> 审核不通过</span>
+      </view>
+			<view class="ss-m-b-20 color-error">具体原因如下:{{ applyInfo.reason }}</view>
+      <view v-if="applyInfo.remark">备注:{{ applyInfo.remark }}</view>
+      <view class="mt-5">
+        <span>审核时间:{{ applyInfo.updateTime }}</span>
+      </view>
+      <view>
+        <span>提交时间:{{ applyInfo.createTime }}</span>
+      </view>
+      <view style="width: 100%;">
+        <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
+        <view style="width: 150px; height: 150px; margin: auto;">
+          <image show-menu-by-longpress="true" src="https://minio.menduner.com/dev/menduner/contact.png" style="width: 150px; height: 150px;"></image>
+        </view>
+        <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
+      </view>
+		</view>
+
+		<view class="d-flex">
+			<button :class="{'second-button': applyInfo.status === '2', 'send-button': applyInfo.status !== '2'}" @tap="handleToHome">回到首页</button>
+			<button v-if="applyInfo.status === '2'" class="second-button" @tap="handleConfirm">重新提交</button>
+		</view>
+	</view>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+import { getUserRegisterEnterpriseApply } from '@/api/enterprise.js'
+import { timesTampChange } from '@/utils/date'
+import { onLoad } from '@dcloudio/uni-app'
+import { userStore } from '@/store/user'
+
+const user = userStore()
+const applyInfo = ref({})
+
+// 查看用户是否有在申请中的数据
+const getApplyInfo = async (hasData) => {
+	// 已经有数据说明已经申请过了
+	let result = {}
+	if (hasData) {
+		result = JSON.parse(uni.getStorageSync('entRegisterData'))
+	} else {
+		const { data } = await getUserRegisterEnterpriseApply()
+		result = data
+		uni.setStorageSync('applyInfo', JSON.stringify(result))
+	}
+	
+  applyInfo.value = {
+		phone: result.phone,
+    createTime: timesTampChange(result.createTime), // 创建时间
+    updateTime: timesTampChange(result.updateTime), // 更新时间
+    status: result.status, // 审核状态(0审核中 1审核通过 2审核不通过)) // 审核状态
+    reason: result.reason, // 审核原因
+    remark: result.remark // 备注
+  }
+  console.log(result, 'review----查看是否有申请中的数据', applyInfo.value)
+  
+}
+
+onLoad((options) => {
+	getApplyInfo(options?.hasData)
+})
+
+// 回到首页时需将当前个人登录状态及缓存中的数据清除
+const handleToHome = async () => {
+	await user.handleUserLogout()
+	uni.reLaunch({
+		url: '/pages/index/my'
+	})
+}
+
+const handleConfirm = () => {
+	uni.reLaunch({
+		url: `/pages/register/phoneValidate?phone=${applyInfo.value?.phone}`
+	})
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 1 - 0
static/style/index.css

@@ -9031,6 +9031,7 @@
   width: 50vw;
   height: 44px;
   margin: 15px;
+  color: #fff;
   background-color: #00B760 !important;
 }
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
static/style/index.min.css


+ 1 - 0
static/style/index.scss

@@ -406,6 +406,7 @@
   width: 50vw;
   height: 44px;
   margin: 15px;
+  color: #fff;
   background-color: #00B760 !important;
   // border-radius: 25px;
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
static/svg/submit.svg


+ 14 - 6
store/user.js

@@ -4,6 +4,7 @@ import { smsLogin, passwordLogin, weChatLogin, logout, userRegister, shareUserRe
 import { closeAuthModal, showAuthModal } from '@/hooks/useModal'
 import { timesTampChange } from '@/utils/date'
 import { getBaseInfoDictOfName } from '@/utils/getText'
+import { userLogout } from '@/api/common';
 
 // 默认账户信息
 const defaultAccountInfo = {
@@ -36,7 +37,7 @@ export const userStore = defineStore('user', {
       this.isLogin = val
     },
     // 登录
-    async handleSmsLogin (query, index = 0) {
+    async handleSmsLogin (query, index = 0, isGetData = true) {
       this.phone = query.phone
       const apiList = [smsLogin, passwordLogin] 
       const { data, code } = await apiList[index](query)
@@ -46,23 +47,24 @@ export const userStore = defineStore('user', {
         })
       }
       this.accountInfo = data
+
+      // 企业注册-审核被拒绝-重新提交-效验手机号不需要获取用户信息
+      if (!isGetData) return
+
       this.getUserInfos()
       this.getAccountInfo()
-      closeAuthModal()
     },
 
     async handleRegister (query) {
       this.phone = query.phone
-      const { data, code } = await userRegister(query)
+      const { data, code } = await smsLogin(query)
       if (code === 0) {
         uni.showToast({
           title: '手机号验证成功'
         })
       }
       this.accountInfo = data
-      const res = await this.getInfo()
-      this.getUserInfos()
-      return Promise.resolve(res);
+      closeAuthModal()
     },
     // 获取用户信息
     async getUserInfos() {
@@ -135,6 +137,12 @@ export const userStore = defineStore('user', {
       this.resetUserData();
       return !this.isLogin;
     },
+    // 账号注册-回到首页
+    async handleUserLogout () {
+      await userLogout()
+      this.resetUserData()
+      return !this.isLogin
+    },
     // 字典对应中文
     async getFieldText (data) {
       if (!data || !Object.keys(data).length) return {}

+ 2 - 2
utils/validate.js

@@ -81,8 +81,8 @@ export const password = {
     },
     {
       validateFunction: function (rule, value, data, callback) {
-        if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/.test(value)) {
-          callback('需包含字母和数字,长度在6-12之间');
+        if (!/^.{8,}$/.test(value)) {
+          callback('密码长度不能少于8位');
         }
         return true;
       },

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio