fix:注册

This commit is contained in:
atshike
2025-01-10 10:07:47 +08:00
parent 102c55d7be
commit 2c2ed776eb
13 changed files with 587 additions and 376 deletions
+9
View File
@@ -5,6 +5,15 @@ export const ApiGetSet = () => {
return http.get('/config')
}
export const ApiGetSetALL = () => {
return http.get('/config/base')
}
//保存配置
export const ApiSaveSet = (data: any) => {
return http.put('/config', data)
}
/*
* 获取图片验证码
* */
+2
View File
@@ -4,6 +4,7 @@ import { ApiGetSet } from '@/api/comment'
const useConfigStore = defineStore('init', {
state: () => ({
code_mode: 0,
verify_code_is_open:0,
package: [] as Array<any>,
asset_url: '',
web_site_bottom_logo: '',
@@ -14,6 +15,7 @@ const useConfigStore = defineStore('init', {
actions: {
refresh(res: any) {
this.code_mode = res.code_mode
this.verify_code_is_open = res.verify_code_is_open
this.package = res.package
this.asset_url = res.asset_url
this.web_site_bottom_logo = res.web_site_bottom_logo
+8 -9
View File
@@ -3,7 +3,6 @@ import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import usePropData from '@/hooks/propData'
import { configStore } from '@/stores'
import EquityInstruction from '@/views/auth/components/equityInstruction.vue'
import { useWindowSize } from '@vueuse/core'
import imageCaptcha from '@/utils/imageCaptcha'
import { ApiGetSmsCaptcha } from '@/api/comment'
@@ -11,7 +10,6 @@ import { ElMessage, type FormInstance } from 'element-plus'
import { validateForm } from '@/utils'
import { ApiRegister } from '@/api/user'
import PayButton from '@/views/home/components/PayButton.vue'
import { Warning } from '@element-plus/icons-vue'
const emits = defineEmits(['update:visible'])
const props = defineProps<{
visible: boolean
@@ -29,10 +27,12 @@ const formData = ref({
authCode: '',
agent: ''
})
const regexTxt = ref()
regexTxt.value = configStore.code_mode === 1 ? /^1\d{10}$/ : /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/
const msgTxt = ref()
msgTxt.value = configStore.code_mode === 1 ? '手机号' : '邮箱'
const regexTxt = ref(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/)
const msgTxt = ref('邮箱')
if (configStore.verify_code_is_open === 1) {
regexTxt.value = configStore.code_mode === 1 ? /^1\d{10}$/ : /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/
msgTxt.value = configStore.code_mode === 1 ? '手机号' : '邮箱'
}
const rules = {
phone: [
@@ -116,7 +116,7 @@ const clickRegister = () => {
agent_id: formData.value.agent,
referral_code: route.query.code as string
})
.then((res) => {
.then(() => {
ElMessage.success('注册成功,请登录')
localStorage.setItem('register', 'register')
visible.value = false
@@ -167,7 +167,7 @@ const clickRegister = () => {
></el-input>
</el-form-item>
<el-form-item prop="authCode" label="验证码">
<el-form-item v-if="configStore.verify_code_is_open === 1" prop="authCode" label="验证码">
<el-input v-model="formData.authCode" placeholder="请输入验证码">
<template v-slot:suffix>
<el-button
@@ -186,7 +186,6 @@ const clickRegister = () => {
class="sign-btn"
v-loading="formLoading"
type="primary"
@click="clickRegister"
>
立即注册
</el-button>
@@ -0,0 +1,157 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ApiSaveSet } from '@/api/comment'
import { ElMessage } from 'element-plus'
import { configStore } from '@/stores'
const webFormData = ref({
verify_code_is_open: 0,
send_code_mode: 1,
ali_sms_key: '',
ali_sms_secret: '',
ali_sms_sign_name: '',
mail_from_name: '',
mail_host: '',
mail_port: '',
mail_from_address: '',
mail_username: '',
mail_password: ''
})
const props = defineProps<{
data: any
}>()
watch(
() => props.data,
() => {
webFormData.value.verify_code_is_open = props.data.verify_code_is_open
webFormData.value.send_code_mode = props.data.send_code_mode
webFormData.value.ali_sms_key = props.data.ali_sms_key
webFormData.value.ali_sms_secret = props.data.ali_sms_secret
webFormData.value.ali_sms_sign_name = props.data.ali_sms_sign_name
webFormData.value.mail_from_name = props.data.mail_from_name
webFormData.value.mail_host = props.data.mail_host
webFormData.value.mail_port = props.data.mail_port
webFormData.value.mail_from_address = props.data.mail_from_address
webFormData.value.mail_username = props.data.mail_username
webFormData.value.mail_password = props.data.mail_password
},{
deep: true,
immediate: true
}
)
const clickSubmit = () => {
if (webFormData.value.verify_code_is_open) {
if (!webFormData.value.send_code_mode) {
ElMessage.error('请选择发送方式')
return
}
if (webFormData.value.send_code_mode === 1) {
if (!webFormData.value.ali_sms_key) {
ElMessage.error('请填写阿里短信key')
return
}
if (!webFormData.value.ali_sms_secret) {
ElMessage.error('请填写阿里短信secret')
return
}
if (!webFormData.value.ali_sms_secret) {
ElMessage.error('请填写阿里短信secret')
return
}
} else if (webFormData.value.send_code_mode === 2) {
if (!webFormData.value.mail_from_name) {
ElMessage.error('请填写发信名称')
return
}
if (!webFormData.value.mail_host) {
ElMessage.error('请填写服务器地址')
return
}
if (!webFormData.value.mail_port) {
ElMessage.error('请填写端口')
return
}
if (!webFormData.value.mail_from_address) {
ElMessage.error('请填写发信地址')
return
}
if (!webFormData.value.mail_username) {
ElMessage.error('请填写邮箱账号')
return
}
if (!webFormData.value.mail_password) {
ElMessage.error('请填写邮箱密码')
return
}
}
}
ApiSaveSet(webFormData.value).then(() => {
ElMessage.success('保存成功')
configStore.refreshConfig()
})
}
</script>
<template>
<el-card>
<div style="width: 500px">
<div>
<div class="margin-b-10" style="margin-top: 20px">是否开启验证码</div>
<el-switch
style="width: 100%"
:active-value="1"
:inactive-value="0"
v-model="webFormData.verify_code_is_open"
></el-switch>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">验证码发送方式</div>
<el-select style="width: 100%" v-model="webFormData.send_code_mode" placeholder="请选择验证码发送方式">
<el-option label="短信" :value="1" />
<el-option label="邮箱" :value="2" />
</el-select>
</div>
<div v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信key</div>
<el-input v-model="webFormData.ali_sms_key" placeholder="请输入阿里短信key"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信secret</div>
<el-input v-model="webFormData.ali_sms_secret" placeholder="请输入阿里短信secret"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信签名</div>
<el-input v-model="webFormData.ali_sms_sign_name" placeholder="请输入阿里短信签名"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信名称</div>
<el-input v-model="webFormData.mail_from_name" placeholder="请输入发信名称"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">服务器地址</div>
<el-input v-model="webFormData.mail_host" placeholder="请输入服务器地址"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">端口</div>
<el-input v-model="webFormData.mail_port" placeholder="端口"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信地址</div>
<el-input v-model="webFormData.mail_from_address" placeholder="请输入发信地址"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信账号</div>
<el-input v-model="webFormData.mail_username" placeholder="请输入发信账号"></el-input>
</div>
<div v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信密码</div>
<el-input v-model="webFormData.mail_password" placeholder="请输入发信密码"></el-input>
</div>
<div class="m-b-20 text-center" style="margin-top: 60px">
<el-button type="primary" size="large" @click="clickSubmit">保存</el-button>
</div>
</div>
</el-card>
</template>
<style scoped lang="scss"></style>
@@ -0,0 +1,69 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ApiSaveSet } from '@/api/comment'
import { ElMessage } from 'element-plus'
import { configStore } from '@/stores'
const props = defineProps<{
data: any
}>()
const webFormData = ref({
wechat_pay_app_id: '',
wechat_pay_mch_id: '',
wechat_pay_secret_key: '',
wechat_pay_private_cert: '',
wechat_pay_certificate: ''
})
watch(
() => props.data,
() => {
webFormData.value.wechat_pay_app_id = props.data.wechat_pay_app_id
webFormData.value.wechat_pay_mch_id = props.data.wechat_pay_mch_id
webFormData.value.wechat_pay_secret_key = props.data.wechat_pay_secret_key
webFormData.value.wechat_pay_private_cert = props.data.wechat_pay_private_cert
webFormData.value.wechat_pay_certificate = props.data.wechat_pay_certificate
},
{
deep: true,
immediate: true
}
)
const clickSubmit = () => {
ApiSaveSet(webFormData.value).then(() => {
ElMessage.success('保存成功')
configStore.refreshConfig()
})
}
</script>
<template>
<el-card>
<div style="width: 500px">
<div>
<div class="margin-b-10" style="margin-top: 20px">微信商户appId</div>
<el-input v-model="webFormData.wechat_pay_app_id" placeholder="请输入微信商户appId"></el-input>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">微信商户号</div>
<el-input v-model="webFormData.wechat_pay_mch_id" placeholder="请输入微信商户号"></el-input>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">微信支付密钥</div>
<el-input v-model="webFormData.wechat_pay_secret_key" placeholder="请输入微信支付密钥"></el-input>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">微信支付私钥证书</div>
<el-input v-model="webFormData.wechat_pay_private_cert" placeholder="请输入微信支付私钥证书"></el-input>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">微信支付公钥证书</div>
<el-input v-model="webFormData.wechat_pay_certificate" placeholder="请输入微信支付公钥证书"></el-input>
</div>
<div class="m-b-20 text-center" style="margin-top: 60px">
<el-button type="primary" size="large" @click="clickSubmit">保存</el-button>
</div>
</div>
</el-card>
</template>
<style scoped lang="scss"></style>
@@ -0,0 +1,93 @@
<script setup lang="ts">
import { ApiVipList } from '@/api/super'
import { onMounted, ref, watch } from 'vue'
import { ApiSaveSet } from '@/api/comment'
import { ElMessage } from 'element-plus'
import { configStore } from '@/stores'
const props = defineProps<{
data: any
}>()
const formData = ref({
is_give_vip: false,
give_vip_id: undefined,
give_vip_days: 0,
recommend_commission_1: 0,
recommend_commission_2: 0,
member_pay_commission_1: 0,
member_pay_commission_2: 0
})
watch(
() => props.data,
() => {
formData.value.is_give_vip = props.data.is_give_vip
formData.value.give_vip_id = props.data.give_vip_id
formData.value.give_vip_days = props.data.give_vip_days
formData.value.recommend_commission_1 = props.data.recommend_commission_1
formData.value.recommend_commission_2 = props.data.recommend_commission_2
formData.value.member_pay_commission_1 = props.data.member_pay_commission_1
formData.value.member_pay_commission_2 = props.data.member_pay_commission_2
},
{
deep: true,
immediate: true
}
)
const vipPackages = ref<any>([])
const clickSubmit = () => {
ApiSaveSet(formData.value).then(() => {
ElMessage.success('保存成功')
configStore.refreshConfig()
})
}
onMounted(() => {
ApiVipList().then((res: any) => {
vipPackages.value = vipPackages.value.concat(res)
})
})
</script>
<template>
<el-card>
<div style="width: 500px">
<div>
<div class="margin-b-10" style="margin-top: 20px">是否开启赠送会员</div>
<el-switch style="width: 100%" v-model="formData.is_give_vip"></el-switch>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">注册赠送会员</div>
<el-select v-model="formData.give_vip_id" placeholder="注册赠送会员" style="width: 100%">
<el-option v-for="vip in vipPackages" :key="vip.id" :label="vip.name" :value="vip.id" />
</el-select>
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">注册赠送天数</div>
<el-input-number style="width: 100%" v-model="formData.give_vip_days" :min="1" :max="365" />
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">一级邀请注册佣金</div>
<el-input-number style="width: 100%" v-model="formData.recommend_commission_1" :min="0" />
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">二级邀请注册佣金</div>
<el-input-number style="width: 100%" v-model="formData.recommend_commission_2" :min="0" />
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">一级分销%</div>
<el-input-number style="width: 100%" v-model="formData.member_pay_commission_1" />
</div>
<div>
<div class="margin-b-10" style="margin-top: 20px">二级分销%</div>
<el-input-number style="width: 100%" v-model="formData.member_pay_commission_2" />
</div>
<div class="m-b-20 text-center" style="margin-top: 60px">
<el-button type="primary" size="large" @click="clickSubmit">保存</el-button>
</div>
</div>
</el-card>
</template>
<style scoped lang="scss"></style>
@@ -0,0 +1,126 @@
<script setup lang="ts">
import OssImage from '@/components/OssImage.vue'
import UploadImage from '@/components/uploadImage.vue'
import MaterialSelect from '@/components/MaterialSelect/MaterialSelect.vue'
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { ApiSaveSet } from '@/api/comment'
import { configStore } from '@/stores'
const props = defineProps<{
data: any
}>()
const webFormData = ref({
web_site_title: '',
web_site_logo: '',
web_site_bottom_logo: '',
web_site_customer_service: ''
})
watch(
() => props.data,
() => {
webFormData.value.web_site_title = props.data.web_site_title
webFormData.value.web_site_logo = props.data.web_site_logo
webFormData.value.web_site_bottom_logo = props.data.web_site_bottom_logo
webFormData.value.web_site_customer_service = props.data.web_site_customer_service
},
{
deep: true,
immediate: true
}
)
const clickSubmit = () => {
ApiSaveSet(webFormData.value).then(() => {
ElMessage.success('保存成功')
configStore.refreshConfig()
})
}
</script>
<template>
<el-card>
<div style="width: 500px">
<div class="margin-b-10" style="margin-top: 20px">网站标题</div>
<el-input v-model="webFormData.web_site_title" placeholder="请输入网站标题"></el-input>
<div class="m-b-20 m-t-20">顶部LOGO图片信息</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_logo ? [webFormData.web_site_logo] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_logo"
></upload-image>
<material-select v-model="webFormData.web_site_logo" class="margin-right-20"></material-select>
</div>
<span class="tip">只能上传jpg/png建议大小100*100且不超过1Mb</span>
</div>
</div>
<div class="m-b-20 m-t-20">底部LOGO图片信息</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_bottom_logo ? [webFormData.web_site_bottom_logo] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_bottom_logo"
></upload-image>
<material-select v-model="webFormData.web_site_bottom_logo" class="margin-right-20"></material-select>
</div>
<span class="tip">只能上传jpg/png且不超过1Mb</span>
</div>
</div>
<div class="m-b-20 m-t-20">上传客服二维码</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_customer_service ? [webFormData.web_site_customer_service] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_customer_service"
></upload-image>
<material-select v-model="webFormData.web_site_customer_service" class="margin-right-20"></material-select>
</div>
<span class="tip">只能上传jpg/png建议大小100*100且不超过1Mb</span>
</div>
</div>
<div class="m-b-20 text-center" style="margin-top: 60px">
<el-button type="primary" size="large" @click="clickSubmit">保存</el-button>
</div>
</div>
</el-card>
</template>
<style scoped lang="scss">
.item-box {
display: flex;
align-items: center;
}
.function-img {
margin-top: 10px;
display: flex;
align-items: center;
}
</style>
@@ -1,56 +0,0 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { ApiGetSetByType, ApiSaveSetByType } from '@/api/comment'
import { ElMessage } from 'element-plus'
const formData = ref<any>({
credit_sub_agent_yuanma: 0,
credit_template_code: '',
credit_notice_less: '',
credit_notice_tel: ''
})
const formLoading = ref(false)
const clickSubmit = () => {
formLoading.value = true
ApiSaveSetByType('credit', formData.value)
.then(() => {
ElMessage.success('保存成功')
})
.finally(() => {
formLoading.value = false
})
}
onMounted(() => {
formLoading.value = true
ApiGetSetByType('credit')
.then((res: any) => {
formData.value = res
})
.finally(() => {
formLoading.value = false
})
})
</script>
<template>
<el-card header="积分设置" v-loading="formLoading">
<el-form label-width="200px" :disabled="formLoading">
<el-form-item label="积分不足短信模版">
<el-input v-model="formData.credit_template_code" style="width: 200px" />
</el-form-item>
<el-form-item label="最低积分不足通知">
<el-input v-model="formData.credit_notice_less" style="width: 200px" />
</el-form-item>
<el-form-item label="积分不足通知手机号">
<el-input v-model="formData.credit_notice_tel" style="width: 200px" />
</el-form-item>
<el-divider />
<el-form-item>
<el-button type="primary" @click="clickSubmit" :loading="formLoading">保存</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<style scoped lang="scss"></style>
+25 -302
View File
@@ -1,318 +1,41 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { ApiGetSetByType, ApiSaveSetByType } from '@/api/comment'
import { ApiVipList } from '@/api/super'
import { ElMessage } from 'element-plus'
import UploadImage from '@/components/uploadImage.vue'
import MaterialSelect from '@/components/MaterialSelect/MaterialSelect.vue'
import OssImage from '@/components/OssImage.vue'
import { configStore } from '@/stores'
import { ApiGetSetALL } from '@/api/comment'
import Web from '@/views/super/setting/components/web.vue'
import CodeSetUp from '@/views/super/setting/components/codeSetUp.vue'
import Pay from '@/views/super/setting/components/pay.vue'
import Sales from '@/views/super/setting/components/sales.vue'
const formData = ref<any>({})
const vipPackages = ref<any>([])
const formLoading = ref(false)
const webFormData = ref<any>({})
const clickSubmit = () => {
formLoading.value = true
ApiSaveSetByType('base', formData.value)
.then(() => {
ElMessage.success('保存成功')
})
.finally(() => {
formLoading.value = false
})
}
const saveSubmit = () => {
if (webFormData.value.verify_code_is_open) {
if (!webFormData.value.send_code_mode ){
ElMessage.error('请选择发送方式')
return
}
if (webFormData.value.send_code_mode === 1) {
if (!webFormData.value.ali_sms_key) {
ElMessage.error('请填写阿里短信key')
return
}
if (!webFormData.value.ali_sms_secret) {
ElMessage.error('请填写阿里短信secret')
return
}
if (!webFormData.value.ali_sms_secret) {
ElMessage.error('请填写阿里短信secret')
return
}
} else if (webFormData.value === 2) {
if (!webFormData.value.mail_from_name) {
ElMessage.error('请填写发信名称')
return
}
if (!webFormData.value.mail_host) {
ElMessage.error('请填写服务器地址')
return
}
if (!webFormData.value.mail_port) {
ElMessage.error('请填写端口')
return
}
if (!webFormData.value.mail_from_address) {
ElMessage.error('请填写发信地址')
return
}
if (!webFormData.value.mail_username) {
ElMessage.error('请填写邮箱账号')
return
}
if (!webFormData.value.mail_password) {
ElMessage.error('请填写邮箱密码')
return
}
}
}
formLoading.value = true
ApiSaveSetByType('web_site', webFormData.value)
.then(() => {
ElMessage.success('保存成功')
configStore.refreshConfig()
})
.finally(() => {
formLoading.value = false
})
}
onMounted(() => {
formLoading.value = true
ApiGetSetByType('base')
.then((res: any) => {
formData.value = res
})
.finally(() => {
formLoading.value = false
})
ApiGetSetByType('web_site').then((res: any) => {
webFormData.value = res
})
ApiVipList().then((res: any) => {
vipPackages.value = vipPackages.value.concat(res)
ApiGetSetALL().then((res: any) => {
formData.value = res
})
})
const tab = ref('web')
</script>
<template>
<div>
<el-card title="基础配置">
<el-row :gutter="20">
<el-col :xs="24" :sm="12" :md="8">
<div class="m-b-20">顶部LOGO图片信息</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_logo ? [webFormData.web_site_logo] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_logo"
></upload-image>
<material-select
v-model="webFormData.web_site_logo"
class="margin-right-20"
></material-select>
</div>
<span class="tip">只能上传jpg/png建议大小100*100且不超过1Mb</span>
</div>
</div>
</el-col>
<el-col :xs="24" :sm="12" :md="8">
<div class="m-b-20">底部LOGO图片信息</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_bottom_logo ? [webFormData.web_site_bottom_logo] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_bottom_logo"
></upload-image>
<material-select v-model="webFormData.web_site_bottom_logo" class="margin-right-20"></material-select>
</div>
<span class="tip">只能上传jpg/png且不超过1Mb</span>
</div>
</div>
</el-col>
<el-col :xs="24" :sm="12" :md="8">
<div class="m-b-20">上传客服二维码</div>
<div class="item-box">
<oss-image
class="margin-right-20"
:paths="webFormData.web_site_customer_service ? [webFormData.web_site_customer_service] : []"
:width="100"
:height="100"
></oss-image>
<div>
<div class="function-img m-b-20">
<upload-image
class="margin-right-10"
:type="['image/jpg', 'image/jpeg', 'image/png']"
:size="1"
v-model="webFormData.web_site_customer_service"
></upload-image>
<material-select
v-model="webFormData.web_site_customer_service"
class="margin-right-20"
></material-select>
</div>
<span class="tip">只能上传jpg/png建议大小100*100且不超过1Mb</span>
</div>
</div>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">网站标题</div>
<el-input v-model="webFormData.web_site_title" placeholder="请输入网站标题"></el-input>
</el-col>
<el-divider content-position="left">验证码</el-divider>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">是否开启验证码</div>
<el-switch style="width: 100%" :active-value="1" :inactive-value="0" v-model="webFormData.verify_code_is_open"></el-switch>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.verify_code_is_open">
<div class="margin-b-10" style="margin-top: 20px">验证码发送方式</div>
<el-select style="width: 100%" v-model="webFormData.send_code_mode" placeholder="请选择验证码发送方式">
<el-option label="短信" :value="1" />
<el-option label="邮箱" :value="2" />
</el-select>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信key</div>
<el-input v-model="webFormData.ali_sms_key" placeholder="请输入阿里短信key"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信secret</div>
<el-input v-model="webFormData.ali_sms_secret" placeholder="请输入阿里短信secret"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 1">
<div class="margin-b-10" style="margin-top: 20px">阿里短信签名</div>
<el-input v-model="webFormData.ali_sms_sign_name" placeholder="请输入阿里短信签名"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信名称</div>
<el-input v-model="webFormData.mail_from_name" placeholder="请输入发信名称"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">服务器地址</div>
<el-input v-model="webFormData.mail_host" placeholder="请输入服务器地址"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">端口</div>
<el-input v-model="webFormData.mail_port" placeholder="端口"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信地址</div>
<el-input v-model="webFormData.mail_from_address" placeholder="请输入发信地址"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信账号</div>
<el-input v-model="webFormData.mail_username" placeholder="请输入发信账号"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6" v-if="webFormData.send_code_mode === 2">
<div class="margin-b-10" style="margin-top: 20px">发信密码</div>
<el-input v-model="webFormData.mail_password" placeholder="请输入发信密码"></el-input>
</el-col>
<el-divider content-position="left"> 支付配置</el-divider>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">微信商户appId</div>
<el-input v-model="webFormData.wechat_pay_app_id" placeholder="请输入微信商户appId"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">微信商户号</div>
<el-input v-model="webFormData.wechat_pay_mch_id" placeholder="请输入微信商户号"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">微信支付密钥</div>
<el-input v-model="webFormData.wechat_pay_secret_key" placeholder="请输入微信支付密钥"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">微信支付私钥证书</div>
<el-input v-model="webFormData.wechat_pay_private_cert" placeholder="请输入微信支付私钥证书"></el-input>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">微信支付公钥证书</div>
<el-input v-model="webFormData.wechat_pay_certificate" placeholder="请输入微信支付公钥证书"></el-input>
</el-col>
</el-row>
<div class="text-center m-t-30">
<el-button type="primary" style="width: 200px" @click="saveSubmit" :loading="formLoading">保存</el-button>
</div>
</el-card>
<el-card v-loading="formLoading" title="分销配置" class="m-t-20">
<el-form label-width="200px" :disabled="formLoading">
<el-row :gutter="20">
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">是否开启赠送会员</div>
<el-switch style="width: 100%" v-model="formData.is_give_vip"></el-switch>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">注册赠送会员</div>
<el-select v-model="formData.give_vip_id" placeholder="注册赠送会员" style="width: 100%">
<el-option v-for="vip in vipPackages" :key="vip.id" :label="vip.name" :value="vip.id" />
</el-select>
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">注册赠送天数</div>
<el-input-number style="width: 100%" v-model="formData.give_vip_days" :min="1" :max="365" />
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">一级邀请注册佣金</div>
<el-input-number style="width: 100%" v-model="formData.recommend_commission_1" :min="0" />
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">二级邀请注册佣金</div>
<el-input-number style="width: 100%" v-model="formData.recommend_commission_2" :min="0" />
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">一级分销%</div>
<el-input-number style="width: 100%" v-model="formData.member_pay_commission_1" />
</el-col>
<el-col :xs="24" :sm="12" :md="6">
<div class="margin-b-10" style="margin-top: 20px">二级分销%</div>
<el-input-number style="width: 100%" v-model="formData.member_pay_commission_2" />
</el-col>
</el-row>
</el-form>
<div class="text-center m-t-30">
<el-button type="primary" style="width: 200px" @click="clickSubmit" :loading="formLoading">保存</el-button>
</div>
<el-card>
<el-tabs type="card" class="demo-tabs" v-model="tab">
<el-tab-pane label="网站配置" name="web">
<Web :data="formData"></Web>
</el-tab-pane>
<el-tab-pane label="验证码配置" name="code">
<CodeSetUp :data="formData"></CodeSetUp>
</el-tab-pane>
<el-tab-pane label="支付配置" name="pay">
<Pay :data="formData"></Pay>
</el-tab-pane>
<el-tab-pane label="分销配置" name="sales">
<Sales :data="formData"></Sales>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<style scoped lang="scss">
.item-box {
display: flex;
align-items: center;
}
.function-img {
margin-top: 10px;
display: flex;
align-items: center;
}
</style>
<style scoped lang="scss"></style>
+53 -1
View File
@@ -19,12 +19,39 @@ class BaseConfig implements SimpleForm
'recommend_commission_2' => 'nullable|integer',
'member_pay_commission_1' => 'nullable|integer', // 一级邀请人消费提成 1%
'member_pay_commission_2' => 'nullable|integer', // 二级邀请人消费提成 1%
'web_site_customer_service' => 'nullable',
'web_site_title' => 'nullable',
'web_site_logo' => 'nullable',
'web_site_bottom_logo' => 'nullable',
'verify_code_is_open' => 'nullable',
'send_code_mode' => 'nullable|integer|in:1,2', // 1短信2邮箱
'ali_sms_key' => 'nullable',
'ali_sms_secret' => 'nullable',
'ali_sms_sign_name' => 'nullable',
'mail_from_name' => 'nullable',
'mail_host' => 'nullable',
'mail_port' => 'nullable',
'mail_from_address' => 'nullable',
'mail_username' => 'nullable',
'mail_password' => 'nullable',
'wechat_pay_app_id' => 'nullable',
'wechat_pay_mch_id' => 'nullable',
'wechat_pay_secret_key' => 'nullable',
'wechat_pay_private_cert' => 'nullable',
'wechat_pay_certificate' => 'nullable',
]);
}
// 保存
public function handle(array $input): void
{
array_filter($input);
SystemConfig::set($input);
}
@@ -38,7 +65,32 @@ class BaseConfig implements SimpleForm
'recommend_commission_2' => SystemConfig::get('recommend_commission_2'),
'member_pay_commission_1' => SystemConfig::get('member_pay_commission_1'),
'member_pay_commission_2' => SystemConfig::get('member_pay_commission_2'),
'send_code_mode' => SystemConfig::get('send_code_mode'),
'web_site_customer_service' => SystemConfig::get('web_site_customer_service'),
'web_site_title' => SystemConfig::get('web_site_title'),
'web_site_logo' => SystemConfig::get('web_site_logo'),
'web_site_bottom_logo' => SystemConfig::get('web_site_bottom_logo'),
'verify_code_is_open' => SystemConfig::get('verify_code_is_open'), // 开启
'send_code_mode' => SystemConfig::get('send_code_mode'), //
'ali_sms_key' => SystemConfig::get('ali_sms_key'),
'ali_sms_secret' => SystemConfig::get('ali_sms_secret'),
'ali_sms_sign_name' => SystemConfig::get('ali_sms_sign_name'),
'mail_from_name' => SystemConfig::get('mail_from_name'),
'mail_host' => SystemConfig::get('mail_host'),
'mail_port' => SystemConfig::get('mail_port'),
'mail_from_address' => SystemConfig::get('mail_from_address'),
'mail_username' => SystemConfig::get('mail_username'),
'mail_password' => SystemConfig::get('mail_password'),
'wechat_pay_app_id' => SystemConfig::get('wechat_pay_app_id'),
'wechat_pay_mch_id' => SystemConfig::get('wechat_pay_mch_id'),
'wechat_pay_secret_key' => SystemConfig::get('wechat_pay_secret_key'),
'wechat_pay_private_cert' => SystemConfig::get('wechat_pay_secret_key'), // 私钥证书
'wechat_pay_certificate' => SystemConfig::get('wechat_pay_certificate'), // 公钥证书
];
}
}
@@ -3,13 +3,49 @@
namespace App\Http\Controllers\Api;
use App\Forms\BaseConfig;
use App\Forms\WebSite;
use Ugly\Base\Http\Controllers\SimpleFormController;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Ugly\Base\Traits\ApiResource;
class ConfigController extends SimpleFormController
class ConfigController extends Controller
{
protected array $form = [
'base' => BaseConfig::class,
'web_site' => WebSite::class,
];
use ApiResource;
/**
* 表单配置.
*/
protected array $form = [];
/**
* 获取表单默认值.
*
* @return JsonResponse|void
*/
public function getForm(string $type)
{
$form = new BaseConfig;
return $this->success($form->default());
}
/**
* 更新表单.
*
* @return JsonResponse|void
*
* @throws \Throwable
*/
public function saveForm(Request $request)
{
return $this->success(
DB::transaction(function () use ($request) {
$form = new BaseConfig;
$form->handle($form->policy($request));
return $form->default();
})
);
}
}
@@ -113,6 +113,7 @@ class IndexController extends Controller
{
$configs = [
'code_mode' => SystemConfig::get('send_code_mode'),
'verify_code_is_open' => SystemConfig::get('verify_code_is_open'),
'package' => VipPackage::query()->orderBy('level')->get(['id', 'name', 'price', 'config']),
'web_site_customer_service' => SystemConfig::get('web_site_customer_service'),
'web_site_title' => SystemConfig::get('web_site_title'),
+1 -1
View File
@@ -87,7 +87,7 @@ Route::middleware(ApiAuth::class.':admin')->group(function (Router $router) {
// 设置
$router->get('config/{type}', [ConfigController::class, 'getForm']);
$router->put('config/{type}', [ConfigController::class, 'saveForm']);
$router->put('config', [ConfigController::class, 'saveForm']);
// 用户
$router->apiResource('users', UserController::class)->only(['index', 'store', 'update']);
$router->get('agent-tree', [UserController::class, 'agent_tree']);