Compare commits

..

7 Commits

22 changed files with 509 additions and 40 deletions

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.member.controller.admin.promoter.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @Title:AppPromoterCreateReqVO
* @Description: app广
* @author: tangqian
* @date: 2023/6/5 14:21
* @version: V1.0.0
*/
@Data
public class AppPromoterCreateReqVO implements Serializable {
@Schema(description = "推广员名称", required = true, example = "5841")
@NotEmpty(message = "推广员名称不能为空")
@Size(max = 10,message = "推广员名称最长不能超过{max}")
private String nickname;
@Schema(description = "推广员手机号", example = "15601691300")
@Mobile
@NotEmpty(message = "推广员手机号不能为空")
private String mobile;
/**
*
* <p>
* {@link CommonStatusEnum}
*/
@Schema(description = "帐号状态")
@NotNull
private Integer status;
@Schema(description = "注册来源,通过字典获取:source_type")
@NotEmpty(message = "注册来源不能为空")
private String sourceType;
}

View File

@ -37,5 +37,8 @@ public class PromoterBaseVO {
@Schema(description = "帐号状态")
@NotNull
private Integer status;
@Schema(description = "注册来源,通过字典获取:source_type")
@NotEmpty(message = "注册来源不能为空")
private String sourceType;
}

View File

@ -18,4 +18,6 @@ public class PromoterRespVO extends PromoterBaseVO {
@Schema(description = "组织简称", required = true, example = "18443")
private String deptName;
@Schema(description = "注册来源", required = true, example = "1")
private String sourceType;
}

View File

@ -4,6 +4,8 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.AppPromoterCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AppUserInfoReqVO;
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO;
@ -13,8 +15,8 @@ import cn.iocoder.yudao.module.member.convert.user.UserConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -22,7 +24,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
@ -82,6 +83,7 @@ public class AppUserController {
appUserInfoRespVO.setUserType(UserTypeEnum.MEMBER);
}
appUserInfoRespVO.setUserId(user.getId());
appUserInfoRespVO.setIsPromoter(promoterService.checkIsPromoterByUserId(user.getId()));
return success(appUserInfoRespVO);
}
@ -120,5 +122,11 @@ public class AppUserController {
list.add(userSpreadBannerVO);
return CommonResult.success(list);
}
@PostMapping("/create")
@Operation(summary = "扫码创建推广员")
public CommonResult<Long> appCreatePromoter(@Valid @RequestBody AppPromoterCreateReqVO createReqVO) {
return success(promoterService.appCreatePromoter(createReqVO));
}
}

View File

@ -31,4 +31,9 @@ public class AppUserInfoRespVO {
@Schema(description = "组织全称", required = true, example = "15601691300")
private String parentDeptName;
@Schema(description = "是否是推广员", required = true, example = "15601691300")
private Boolean isPromoter;
}

View File

@ -42,4 +42,8 @@ public class PromoterDO implements Serializable {
private LocalDateTime createTime;
/**
*
*/
private String sourceType;
}

View File

@ -89,4 +89,5 @@ public interface PromoterService {
PromoterImportRespVO importUserList(List<PromoterImportExcelVO> importUsers, boolean isUpdateSupport);
PromoterDO getPromoterDOByUserId(Long userId);
Long appCreatePromoter(AppPromoterCreateReqVO createReqVO);
}

View File

@ -93,6 +93,41 @@ public class PromoterServiceImpl implements PromoterService {
return promoter.getId();
}
@Override
public Long appCreatePromoter(AppPromoterCreateReqVO createReqVO) {
//判断手机号是否注册
MemberUserDO memberUserDO = memberUserService.getUserByMobile(createReqVO.getMobile());
if (memberUserDO == null) {
//创建用户
memberUserDO = new MemberUserDO();
memberUserDO.setNickname(createReqVO.getNickname());
memberUserDO.setMobile(createReqVO.getMobile());
memberUserDO.setStatus(createReqVO.getStatus());
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length() - 6));
memberUserDO = memberUserService.createUserIfAbsent(createReqVO.getMobile(), createReqVO.getNickname(), getClientIP());
}
if(!TenantContextHolder.getTenantId().equals(memberUserDO.getTenantId())){
throw new ServiceException(PROMOTER_EXISTS_OTHER);
}
if (checkIsPromoterByUserId(memberUserDO.getId())) {
throw new ServiceException(PROMOTER_EXISTS);
}
// 插入
Long tenantId = TenantContextHolder.getTenantId();
DeptRespDTO deptRespDTO = deptApi.findParentDept(tenantId);
PromoterDO promoter = new PromoterDO();
promoter.setDeptId(deptRespDTO.getId());
promoter.setUserId(memberUserDO.getId());
promoter.setTenantId(tenantId);
promoter.setCreateTime(LocalDateTime.now());
promoter.setSourceType(createReqVO.getSourceType());
promoterMapper.insert(promoter);
// 返回
return promoter.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updatePromoter(PromoterUpdateReqVO updateReqVO) {
@ -226,6 +261,7 @@ public class PromoterServiceImpl implements PromoterService {
promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
promoter.setUserId(userIfAbsent.getId());
promoter.setCreateTime(LocalDateTime.now());
promoter.setSourceType("1");
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, memberUserDO.getId()));
if (count > 0) {
respVO.getFailureUsernames().put(importUser.getNickName(), "已经是推广员");

View File

@ -99,8 +99,6 @@ public class MemberUserServiceImpl implements MemberUserService {
}
private MemberUserDO createUser(String mobile, String realName, String registerIp,Long promoterId) {
// 生成密码
String password = IdUtil.fastSimpleUUID();
// 插入用户
MemberUserDO user = new MemberUserDO();
user.setMobile(mobile);

View File

@ -26,6 +26,9 @@
<if test="data.mobile!=null and data.mobile!=''">
and b.mobile like CONCAT('%',#{data.mobile},'%')
</if>
<if test="data.sourceType!=null">
and b.source_type =#{data.sourceType}
</if>
</where>
</select>

View File

@ -342,7 +342,7 @@ export default {
this.resetForm('form');
},
handleQRCode(row) {
const url =`${config.spreadDomain}${config.spreadLink}?redirectUrl=${config.spreadDomain}&tenantId=${row.id}`
const url =`${config.spreadDomain}${config.spreadLink}?redirectUrl=${config.spreadDomain}&tenantId=${row.id}&isProperty=1`
QRCode.toCanvas(document.getElementById(`id-${row.id}`), url, {
scale: 2
}, function (error) {

View File

@ -186,6 +186,7 @@
methods: {
async initLoad() {
this.isQRCode()
// this.isProperty()
this.setSpreadId()
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
await this.$store.dispatch('USERINFO');
@ -215,6 +216,13 @@
`${wechatUrl}&redirect_uri=${redirectUrl}/pages/member_application/index?tenantId=${tenantId}&spreadId=${spreadId}&response_type=code&scope=snsapi_base#wechat_redirect`
}
},
//
isProperty() {
const is_property = this.$route.query.isProperty || false
if(parseInt(is_property) === 1){
this.$store.commit("SET_IS_PROPERTY", !!is_property)
}
},
//
getTenantInfo() {
fetchTenantInfo(this.tenantId).then(res => {

View File

@ -59,6 +59,11 @@ export function register(data) {
return request.post("member/auth/register", data, { noAuth : true });
}
// 注册推广员
export function registerPromoter(data) {
return request.post("member/user/create", data, { noAuth : true });
}
/**
* 用户手机号修改密码
* @param data object 用户手机号 验证码 密码

View File

@ -10,6 +10,8 @@ module.exports = {
OPEN_ID: 'OPEN_ID',
// 推广员ID
SPREAD_ID: 'SPREAD_ID',
// 是否扫物业推广码
IS_PROPERTY: 'IS_PROPERTY',
//用户信息
USER_INFO: 'USER_INFO',
//租户信息

View File

@ -75,7 +75,6 @@ export function _toLogin(push, pathLogin) {
export function isWhiteList(){
let path = prePage();
console.log('path111', path)
return whiteListPage.indexOf(path) > -1
}

View File

@ -452,6 +452,12 @@
"navigationBarTitleText": "登录"
}
},
{
"path": "promoter/index",
"style": {
"navigationBarTitleText": "推广员申请"
}
},
{
"path": "goods_comment_list/index",
"style": {

View File

@ -56,7 +56,7 @@
</view>
<view class="money-box money-time">
<text>返费结束时间</text>
<text class="money-text">{{dateConvert(item.startTime)}}</text>
<text class="money-text">{{item.startTime}}</text>
</view>
</view>
</view>

View File

@ -35,8 +35,10 @@
</div>
</form>
</div>
<u-button class="logon" @click="loginMobile" v-if="current !== 0" :loading="loading" loading-text="登录中" :disabled="loading"></u-button>
<u-button class="logon" @click="submit" v-if="current === 0" :loading="loading" loading-text="登录中" :disabled="loading"></u-button>
<u-button class="logon" @click="loginMobile" v-if="current !== 0" :loading="loading" loading-text=""
:disabled="loading">登录</u-button>
<u-button class="logon" @click="submit" v-if="current === 0" :loading="loading" loading-text=""
:disabled="loading">登录</u-button>
<div class="tips">
<!-- <div @click="jumpRegister"></div> -->
<div @click="current = current === 1 ? 0 : 1">{{ current === 1 ? '账号密码登录' : '短信验证码登录' }}</div>
@ -79,7 +81,9 @@
import {
VUE_APP_API_URL
} from "@/utils";
import {
mapGetters
} from 'vuex'
const BACK_URL = "login_back_url";
export default {
@ -97,6 +101,9 @@
loading: false
};
},
computed: {
...mapGetters(['isProperty'])
},
mounted: function() {
// this.getLogoImage();
},
@ -104,7 +111,7 @@
},
methods: {
onLinkUserPrivacy(){
onLinkUserPrivacy() {
uni.navigateTo({
url: '/pages/users/privacy/index'
})
@ -120,7 +127,8 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile))
return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
@ -129,7 +137,7 @@
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
title: '请输入正确的验证码'
});
if(that.checked.length === 0) return that.$util.Tips({
if (that.checked.length === 0) return that.$util.Tips({
title: '请勾选同意用户协议'
});
that.loading = true
@ -151,7 +159,7 @@
that.$util.Tips({
title: res
});
}).finally(()=>{
}).finally(() => {
that.loading = false
})
},
@ -161,7 +169,8 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile))
return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
@ -209,7 +218,8 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile))
return that.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify(that.mobile, 1)
@ -239,7 +249,7 @@
if (!that.password) return that.$util.Tips({
title: '请填写密码'
});
if(that.checked.length === 0) return that.$util.Tips({
if (that.checked.length === 0) return that.$util.Tips({
title: '请勾选同意用户协议'
});
that.loading = true
@ -261,7 +271,7 @@
that.$util.Tips({
title: e
});
}).finally(()=>{
}).finally(() => {
that.loading = false
})
},
@ -274,15 +284,20 @@
getUserInfo().then(res => {
this.$store.commit("UPDATE_USERINFO", res.data);
// let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
let backUrl = "/pages/member_application/index";
// let backUrl = "/pages/index/index";
// if (backUrl.indexOf('/pages/users/login/index') !== -1) {
// backUrl = '/pages/index/index';
// }
let backUrl = ''
if (this.isProperty && !res.data.isPromoter) {
backUrl = "/pages/users/promoter/index"
} else {
backUrl = "/pages/member_application/index"
}
uni.reLaunch({
url: backUrl
});
}).finally(()=>{
}).finally(() => {
uni.hideLoading()
})
}
@ -381,13 +396,14 @@
.login-wrapper {
padding: 30rpx 52rpx;
background: url('@/static/images/bg-linear.png') center 0 no-repeat;
background-size:100% 672rpx;
background-size: 100% 672rpx;
.logo-wrap {
margin: 185rpx 0 85rpx 0;
display:flex;
align-items:center;
img{
display: flex;
align-items: center;
img {
margin-right: 20rpx;
}
}
@ -430,6 +446,7 @@
margin-bottom: 38rpx;
height: 98rpx;
display: flex;
&:last-child {
margin-bottom: 0;
}
@ -498,14 +515,16 @@
justify-content: space-between;
}
.protocol-wrap{
.protocol-wrap {
margin: 131rpx 0 80rpx 0;
display: flex;
justify-content: center;
.text{
.text {
font-size: 24rpx;
color: #000;
.link{
.link {
color: #F35981;
}
}

View File

@ -0,0 +1,319 @@
<template>
<div class="login-wrapper">
<div class="logo-wrap">
<img src="/static/images/mallLogo.png" style="width:105rpx;height:105rpx;"></image>
<img src="/static/images/mall.png" style="width:233rpx;height:43rpx;"></image>
</div>
<view class="title">注册推广员</view>
<div class="whiteBg">
<div class="list">
<form @submit.prevent="submit">
<div class="item">
<div class="acea-row row-middle">
<text class="label">所属公司</text>
<input type="text" disabled class="texts" :value="tenantInfo.name || '--'"/>
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<text class="label">手机号</text>
<input type="text" class="texts" :value="userInfo.mobile || '--'" disabled />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<text class="label">姓名</text>
<input type="text" v-model="nickname" maxlength="10" class="texts" placeholder="请输入" />
</div>
</div>
</form>
</div>
<button class="logon" @click="onRegister" :disabled="loading" :loading="loading">注册推广员</button>
</div>
<div class="bottom"></div>
</div>
</template>
<script>
import {
mapGetters
} from 'vuex'
import {
registerPromoter
} from "@/api/user"
export default {
name: 'Register',
data() {
return {
loading: false,
nickname: ''
}
},
computed: {
...mapGetters(['tenantInfo', 'userInfo'])
},
methods: {
async onRegister() {
this.loading = true
try {
const res = await registerPromoter({
nickname: this.nickname,
mobile: this.userInfo.mobile,
status: 1,
sourceType: 2
})
this.$util.Tips({
title: res.code === 0 ? '注册成功' : res.msg
}, {
tab: 1,
url: '/pages/member_application/index'
})
} catch (err) {
//TODO handle the exception
this.$util.Tips({
title: err
})
} finally {
this.loading = false
}
}
}
}
</script>
<style lang="scss" scoped>
page {
background: #fff;
}
.appLogin {
margin-top: 60rpx;
.hds {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
color: #B4B4B4;
.line {
width: 68rpx;
height: 1rpx;
background: #CCCCCC;
}
p {
margin: 0 20rpx;
}
}
.btn-wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30rpx;
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 68rpx;
height: 68rpx;
border-radius: 50%;
}
.apple-btn {
display: flex;
align-items: center;
justify-content: center;
margin-left: 30rpx;
background: #000;
border-radius: 34rpx;
font-size: 40rpx;
.icon-s-pingguo {
color: #fff;
font-size: 40rpx;
}
}
.iconfont {
font-size: 40rpx;
color: #fff;
}
.wx {
margin-right: 30rpx;
background-color: #61C64F;
}
.mima {
background-color: #28B3E9;
}
.yanzheng {
background-color: #F89C23;
}
}
}
.code img {
width: 100%;
height: 100%;
}
.acea-row.row-middle {
input {
margin-left: 20rpx;
display: block;
}
}
.login-wrapper {
padding: 30rpx 52rpx;
background: url('@/static/images/bg-linear.png') center 0 no-repeat;
background-size:100% 672rpx;
.logo-wrap {
margin: 185rpx 0 85rpx 0;
display:flex;
align-items:center;
img{
margin-right: 20rpx;
}
}
.title {
font-size: 40rpx;
font-weight: 400;
color: #000;
}
.shading {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
/* #ifdef APP-VUE */
margin-top: 50rpx;
/* #endif */
/* #ifndef APP-VUE */
margin-top: 200rpx;
/* #endif */
image {
width: 180rpx;
height: 180rpx;
}
}
.whiteBg {
margin-top: 46rpx;
.list {
overflow: hidden;
.item {
margin-bottom: 38rpx;
height: 98rpx;
display: flex;
&:last-child {
margin-bottom: 0;
}
.code {
width: 197rpx;
text-align: center;
line-height: 96rpx;
background: #FFF3F6;
border: 1px solid #F54275;
border-radius: 15rpx;
font-size: 28rpx;
color: #F03A76;
margin-left: 19rpx;
}
.row-middle {
position: relative;
padding: 28rpx;
background: #fff;
border: 1px solid #BFBFBF;
border-radius: 15rpx;
flex: 1;
&.clear{
border: 0;
}
.label{
width: 120rpx;
margin-right: 20rpx;
}
.texts {
flex: 1;
font-size: 28rpx;
height: 42rpx;
line-height: 42rpx;
display: flex;
justify-content: center;
align-items: center;
}
input {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
.logon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 87rpx;
margin-top: 99rpx;
color: #FFFFFF;
font-size: 32rpx;
background: linear-gradient(0deg, #E63163 0%, #FF819F 100%);
border-radius: 44rpx;
font-size: 30rpx;
}
.tips {
margin: 125rpx 20rpx 0 20rpx;
font-size: 24rpx;
color: #000;
display: flex;
justify-content: space-between;
}
.protocol-wrap {
margin: 131rpx 0 80rpx 0;
display: flex;
justify-content: center;
.text {
font-size: 24rpx;
color: #000;
.link {
color: #F35981;
}
}
}
}
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<view class="register-success-wrap">
<image src="@/static/images/logo.png" class="icon"></image>
<image src="@/static/images/mallLogo.png" class="icon"></image>
<view class="text">恭喜您注册成功</view>
<u-button class="logon" @click="onBackLogin"></u-button>
<u-button class="logon" @click="onBackLogin"></u-button>
</view>
</template>
@ -16,7 +16,7 @@
methods: {
onBackLogin() {
uni.navigateTo({
url: '/pages/users/login/index'
url: '/pages/member_application/index'
})
}
}

View File

@ -8,6 +8,7 @@ export default {
tenantId: state => state.app.tenantId,
openId: state => state.app.openId,
spreadId: state => state.app.spreadId,
isProperty: state => state.app.isProperty,
homeActive: state => state.app.homeActive,
home: state => state.app.home,
chatUrl: state => state.app.chatUrl,

View File

@ -6,6 +6,7 @@ import {
REFRESH_TOKEN,
UID,
TENANT_ID,
IS_PROPERTY,
OPEN_ID,
SPREAD_ID,
PLATFORM
@ -26,6 +27,7 @@ const state = {
tenantId: Cache.get(TENANT_ID) || '',
spreadId: Cache.get(SPREAD_ID) || '',
openId: Cache.get(OPEN_ID) || '',
isProperty: false,
homeActive: false,
chatUrl: Cache.get('chatUrl') || '',
systemPlatform: Cache.get(PLATFORM)?Cache.get(PLATFORM):'',
@ -62,6 +64,9 @@ const mutations = {
UPDATE_LOGIN(state, token) {
state.token = token;
},
SET_IS_PROPERTY(state, value){
state.isProperty = value
},
LOGOUT(state) {
state.token = undefined;
state.uid = undefined