feat: 推广员海报生成

pull/2/head
TianYu 2023-05-18 14:56:38 +08:00
parent a0c0fc8437
commit 6ff2f26c2c
15 changed files with 1513 additions and 1565 deletions

View File

@ -59,6 +59,7 @@
"jsencrypt": "3.3.1",
"min-dash": "3.5.2",
"nprogress": "0.2.0",
"qrcode": "^1.5.3",
"qrcode.vue": "^1.7.0",
"quill": "1.3.7",
"screenfull": "5.0.2",

View File

@ -8,7 +8,6 @@ export function createPromoter(data) {
data: data
})
}
// 更新推广员
export function updatePromoter(data) {
return request({
@ -18,6 +17,14 @@ export function updatePromoter(data) {
})
}
export function updatePassword(data) {
return request({
url: 'member/user/update-password',
method: 'post',
data: data
})
}
// 删除推广员
export function deletePromoter(id) {
return request({

View File

@ -4,7 +4,7 @@
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="所属组织" prop="orgId">
<treeselect style="width: 240px;" v-model="queryParams.orgId" :options="deptOptions" :show-count="true"
<treeselect style="width: 240px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer"/>
</el-form-item>
@ -62,7 +62,7 @@
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['member:promoter:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleUpdatePassword(scope.row)"
<el-button size="mini" type="text" icon="el-icon-key" @click="handleUpdatePassword(scope.row)"
v-hasPermi="['member:promoter:delete']">修改密码
</el-button>
</template>
@ -76,7 +76,7 @@
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="所属组织" prop="orgId">
<treeselect style="width: 240px;" v-model="form.orgId" :options="deptOptions" :show-count="true"
<treeselect style="width: 240px;" v-model="form.deptId" :options="deptOptions" :show-count="true"
:clearable="false"
placeholder="请选择所属组织" :normalizer="normalizer"/>
</el-form-item>
@ -95,7 +95,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="submitForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -117,22 +117,22 @@
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button type="primary" @click="submitFileForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<!-- 修改密码 -->
<el-dialog title="修改密码" :visible.sync="updatePassword.show" width="500px" append-to-body>
<el-form ref="form" :model="updatePasswordForm" :rules="passwrodRules" label-width="80px">
<el-form-item label="密码" prop="title">
<el-input v-model="form.title" placeholder="请输入"/>
<el-form ref="updatePasswordForm" :model="updatePasswordForm" :rules="passwrodRules" label-width="80px">
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="updatePasswordForm.password" placeholder="请输入"/>
</el-form-item>
<el-form-item label="确认密码" prop="picUrl">
<el-input v-model="form.title" placeholder="请输入"/>
<el-form-item label="确认密码" prop="checkPass">
<el-input type="password" v-model="updatePasswordForm.checkPass" placeholder="请输入"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="submitPasswordForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="updatePassword.show = false"> </el-button>
</div>
</el-dialog>
@ -147,7 +147,7 @@ import {
getPromoter,
getPromoterPage,
importTemplate,
exportPromoterExcel
exportPromoterExcel, updatePassword
} from '@/api/member/promoter';
import {
changeUserStatus
@ -173,9 +173,29 @@ export default {
Treeselect
},
data() {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (this.updatePasswordForm.checkPass !== '') {
this.$refs.updatePasswordForm.validateField('checkPass');
}
callback();
}
};
const validateCheckPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.updatePasswordForm.password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
//
loading: true,
submitLoading: false,
deptOptions: undefined,
//
exportLoading: false,
@ -208,6 +228,16 @@ export default {
show: false,
userId: ''
},
passwrodRules:{
password: [
{ required: true, message: "请输入密码", trigger: "blur" },
{ validator: validatePass, trigger: 'blur' }
],
checkPass: [
{ required: true, message: "请输入确认密码", trigger: "blur" },
{ validator: validateCheckPass, trigger: 'blur' }
],
},
updatePasswordForm: {},
//
queryParams: {
@ -337,19 +367,40 @@ export default {
this.open = true;
this.title = '修改推广员';
},
submitPasswordForm(){
this.$refs['updatePasswordForm'].validate(valid => {
if (!valid) {
return;
}
this.submitLoading = true
//
updatePassword({
id: this.updatePassword.userId,
password: this.updatePasswordForm.password
}).then(response => {
this.$modal.msgSuccess('修改成功');
this.updatePassword.show = false;
}).finally(()=>{
this.submitLoading = false
})
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (!valid) {
return;
}
this.submitLoading = true
//
if (this.form.id != null) {
updatePromoter(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
}).finally(()=>{
this.submitLoading = false
})
return;
}
//
@ -357,7 +408,9 @@ export default {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}).finally(()=>{
this.submitLoading = false
})
});
},
/** 删除按钮操作 */

View File

@ -39,7 +39,11 @@
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="用户昵称" align="center" prop="nickname" />
<el-table-column label="头像" align="center" prop="avatar" />
<el-table-column label="头像" align="center" prop="avatar">
<template v-slot="scope">
<img v-if="scope.row.avatar" :src="scope.row.avatar" width="50" height="50" />
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" >
<template v-slot="scope">
<span v-if="scope.row.status=='0'"></span>

View File

@ -76,18 +76,32 @@
<el-button size="mini" type="text" @click="handleUpdate(scope.row)"
v-hasPermi="['system:tenant:update']">编辑
</el-button>
<el-button size="mini" type="text" @click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">禁用
</el-button>
<el-button size="mini" type="text" @click="handleCommission(scope.row)"
v-hasPermi="['system:tenant:delete']">提成设置
</el-button>
<el-button size="mini" type="text" @click="handleNotice(scope.row)"
v-hasPermi="['system:tenant:delete']">通知公告
</el-button>
<el-button size="mini" type="text" @click="handleBanner(scope.row)"
v-hasPermi="['system:tenant:delete']">轮播图
<el-popover
placement="bottom-start"
title="推广码"
width="200"
trigger="click"
popper-class="qrcode-wrap"
>
<canvas :id="`id-${scope.row.id}`"></canvas>
<el-button slot="reference" size="mini" type="text" @click="handleQRCode(scope.row)"
v-hasPermi="['system:tenant:delete']">推广码
</el-button>
</el-popover>
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)"
v-hasPermi="['system:user:delete', 'system:user:update-password', 'system:permission:assign-user-role']">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleDisabled" size="mini" type="text" icon="el-icon-video-pause"
v-hasPermi="['system:tenant:delete']">禁用</el-dropdown-item>
<el-dropdown-item command="handleCommission" size="mini" type="text" icon="el-icon-set-up"
v-hasPermi="['system:tenant:delete']">提成设置</el-dropdown-item>
<el-dropdown-item command="handleNotice" size="mini" type="text" icon="el-icon-chat-round"
v-hasPermi="['system:tenant:delete']">通知公告</el-dropdown-item>
<el-dropdown-item command="handleBanner" size="mini" type="text" icon="el-icon-picture-outline"
v-hasPermi="['system:tenant:delete']">轮播图</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@ -190,6 +204,7 @@ import {
getTenantPage,
exportTenantExcel
} from '@/api/system/tenant';
import QRCode from 'qrcode'
import {CommonStatusEnum} from '@/utils/constants'
import {getTenantPackageList} from '@/api/system/tenantPackage';
import ImageUpload from '@/components/ImageUpload/index.vue';
@ -271,7 +286,7 @@ export default {
required: true,
message: '店铺负责人号码不能为空',
trigger: 'blur'
},{
}, {
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
@ -290,7 +305,7 @@ export default {
required: true,
message: '服务电话不能为空',
trigger: 'blur'
},{
}, {
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
message: '请输入正确的手机或座机号码',
trigger: 'blur'
@ -306,6 +321,9 @@ export default {
})
},
methods: {
handleCommand(command, index, row) {
this[command](row)
},
/** 查询列表 */
getList() {
this.loading = true;
@ -326,6 +344,12 @@ export default {
this.form = {}
this.resetForm('form');
},
handleQRCode(row) {
QRCode.toCanvas(document.getElementById(`id-${row.id}`), `http://192.168.1.149:8080?tenantId=${row.id}`, function (error) {
if (error) console.error(error)
console.log('success!');
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@ -401,7 +425,7 @@ export default {
});
},
/** 删除按钮操作 */
handleDelete(row) {
handleDisabled(row) {
const id = row.id;
this.$modal.confirm('是否确认删除店铺编号为"' + id + '"的数据项?').then(function () {
return deleteTenant(id);
@ -430,7 +454,13 @@ export default {
}
};
</script>
<style lang="scss">
.qrcode-wrap {
text-align: center;
}
</style>
<style lang="scss" scoped>
.upload-image {
:deep(.el-upload--picture-card) {
width: 80px;
@ -443,4 +473,7 @@ export default {
height: 80px;
}
}
.el-popover__reference-wrapper .el-button{
margin-left: 10px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -162,6 +162,9 @@
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
await this.$store.dispatch('USERINFO');
}
if(!this.$Cache.get('TENANT_ID') || this.$route.query.tenantId){
this.getTenantId()
}
setInterval(() => {
if (this.$store.getters.isLogin) {
this.setRefreshToken()
@ -169,6 +172,16 @@
}, 60000)
},
methods: {
getTenantId() {
const tenantId = this.$route.query.tenantId
if (tenantId) {
this.$store.commit("SET_TENANTID", tenantId);
} else {
this.$util.Tips({
title: '非法链接访问'
});
}
},
setRefreshToken() {
refreshToken(this.$Cache.get("REFRESH_TOKEN"))
.then(res => {

View File

@ -152,7 +152,7 @@ export function getIntegralList(q) {
*
*/
export function spreadBanner(data){
return request.get('user/spread/banner',data);
return request.get('member/user/spread/banner',data);
}
/**

View File

@ -1,12 +1,12 @@
let domain = 'http://192.168.1.188:48080'
let domain = 'http://192.168.1.147:48080'
module.exports = {
// 请求域名 格式: https://您的域名
// #ifdef MP
HTTP_REQUEST_URL: domain,
// #endif
HTTP_ADMIN_URL:'http://192.168.1.188:48080', //PC后台的API请求地址上传图片用
HTTP_ADMIN_URL:'http://192.168.1.147:48080', //PC后台的API请求地址上传图片用
// #ifdef H5
//H5接口是浏览器地址
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,

View File

@ -4,6 +4,8 @@ module.exports = {
REFRESH_TOKEN: 'REFRESH_TOKEN',
// uid
UID:'UID',
// 租户ID
TENANT_ID: 'TENANT_ID',
//用户信息
USER_INFO: 'USER_INFO',
//token 过期时间

View File

@ -96,7 +96,9 @@
<image :src="item.pic"></image>
<text>{{item.name}}</text>
</navigator> -->
<navigator class="item" :url="item.url" hover-class="none">
<navigator class="item" :url="item.url" hover-class="none"
v-if="!(item.url =='/pages/users/user_spread_user/index' && userInfo.userType !== 'PROMOTER')"
>
<image :src="item.pic"></image>
<text>{{item.name}}</text>
</navigator>

View File

@ -127,8 +127,11 @@
limit: 5
}).then(res => {
uni.hideLoading();
const list = res.data.map((item) => item.pic)
that.$set(that, 'spreadList', res.data);
that.getImageBase64(res.data);
that.$set(that, 'base64List', list);
that.make();
// that.getImageBase64(res.data);
}).catch(err => {
uni.hideLoading();
});
@ -143,14 +146,13 @@
let spreadList = []
// Promise
images.forEach(item => {
const oneApi = imageBase64({
url: item.pic
}).then(res => {
const oneApi = imageBase64(item.pic).then(res => {
return res.data.code;
})
spreadList.push(oneApi)
})
Promise.all(spreadList).then(result => {
console.log('result', result)
that.$set(that, 'base64List', result);
that.make();
that.setShareInfoStatus();
@ -228,6 +230,7 @@
let context = uni.createCanvasContext('canvasOne')
context.clearRect(0, 0, 0, 0);
let that = this;
console.log('arrImages', arrImages)
uni.getImageInfo({
src: arrImages,
success: function(res) {

View File

@ -4,6 +4,7 @@ export default {
backgroundColor: state => state.app.backgroundColor,
userInfo: state => state.app.userInfo || {},
uid: state => state.app.uid,
tenantId: state => state.app.tenantId,
homeActive: state => state.app.homeActive,
home: state => state.app.home,
chatUrl: state => state.app.chatUrl,

View File

@ -5,6 +5,7 @@ import {
LOGIN_STATUS,
REFRESH_TOKEN,
UID,
TENANT_ID,
PLATFORM
} from '../../config/cache';
import Cache from '../../utils/cache';
@ -18,6 +19,7 @@ const state = {
backgroundColor: "#fff",
userInfo: Cache.get(USER_INFO)?JSON.parse(Cache.get(USER_INFO)):null,
uid: Cache.get(UID) || null,
tenantId: Cache.get(TENANT_ID) || '',
homeActive: false,
chatUrl: Cache.get('chatUrl') || '',
systemPlatform: Cache.get(PLATFORM)?Cache.get(PLATFORM):'',
@ -35,6 +37,10 @@ const mutations = {
state.uid = val;
Cache.set(UID, val);
},
SET_TENANTID(state,val){
state.tenantId = val;
Cache.set(TENANT_ID, val);
},
UPDATE_LOGIN(state, token) {
state.token = token;
},

View File

@ -22,7 +22,7 @@ function baseRequest(url, method, data, {
// if (params != undefined) {
// header = HEADERPARAMS;
// }
header['tenant-id'] = 1
header['tenant-id'] = store.state.app.tenantId
if (!noAuth) {
//登录过期自动登录
if (!store.state.app.token && !checkLogin()) {