feat: 推广员海报生成
parent
a0c0fc8437
commit
6ff2f26c2c
|
@ -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",
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
})
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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-button>
|
||||
<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
|
@ -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 => {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -4,6 +4,8 @@ module.exports = {
|
|||
REFRESH_TOKEN: 'REFRESH_TOKEN',
|
||||
// uid
|
||||
UID:'UID',
|
||||
// 租户ID
|
||||
TENANT_ID: 'TENANT_ID',
|
||||
//用户信息
|
||||
USER_INFO: 'USER_INFO',
|
||||
//token 过期时间
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,425 +1,428 @@
|
|||
<template>
|
||||
<view style="height: 100%;">
|
||||
<view class='distribution-posters'>
|
||||
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :circular="circular" :interval="interval"
|
||||
:duration="duration" @change="bindchange" previous-margin="40px" next-margin="40px">
|
||||
<block v-for="(item,index) in spreadList" :key="index">
|
||||
<swiper-item>
|
||||
<image :src="item.pic" class="slide-image" :class="swiperIndex == index ? 'active' : 'quiet'"
|
||||
mode='aspectFill' />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<!-- #ifdef MP -->
|
||||
<view class='keep bg-color' @click='savePosterPath'>保存海报</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<div class="preserve acea-row row-center-wrapper">
|
||||
<div class="line"></div>
|
||||
<div class="tip">长按保存图片</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
||||
<!-- #endif -->
|
||||
<view class="canvas" v-if="canvasStatus">
|
||||
<canvas style="width:750px;height:1190px;" canvas-id="canvasOne"></canvas>
|
||||
<canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}" />
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 100%;">
|
||||
<view class='distribution-posters'>
|
||||
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :circular="circular" :interval="interval"
|
||||
:duration="duration" @change="bindchange" previous-margin="40px" next-margin="40px">
|
||||
<block v-for="(item,index) in spreadList" :key="index">
|
||||
<swiper-item>
|
||||
<image :src="item.pic" class="slide-image" :class="swiperIndex == index ? 'active' : 'quiet'"
|
||||
mode='aspectFill' />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<!-- #ifdef MP -->
|
||||
<view class='keep bg-color' @click='savePosterPath'>保存海报</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<div class="preserve acea-row row-center-wrapper">
|
||||
<div class="line"></div>
|
||||
<div class="tip">长按保存图片</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
||||
<!-- #endif -->
|
||||
<view class="canvas" v-if="canvasStatus">
|
||||
<canvas style="width:750px;height:1190px;" canvas-id="canvasOne"></canvas>
|
||||
<canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef H5
|
||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||
// #endif
|
||||
import {
|
||||
getUserInfo,
|
||||
spreadBanner
|
||||
} from '@/api/user.js';
|
||||
import {
|
||||
toLogin
|
||||
} from '@/libs/login.js';
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
// #ifdef MP
|
||||
import {
|
||||
base64src
|
||||
} from '@/utils/base64src.js'
|
||||
import authorize from '@/components/Authorize';
|
||||
import {
|
||||
getQrcode
|
||||
} from '@/api/api.js';
|
||||
// #endif
|
||||
import home from '@/components/home';
|
||||
import {
|
||||
imageBase64
|
||||
} from "@/api/public";
|
||||
export default {
|
||||
components: {
|
||||
// #ifdef MP
|
||||
authorize,
|
||||
// #endif
|
||||
home
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgUrls: [],
|
||||
indicatorDots: false,
|
||||
circular: false,
|
||||
autoplay: false,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
swiperIndex: 0,
|
||||
spreadList: [],
|
||||
poster: '',
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
qrcodeSize: 1000,
|
||||
PromotionCode: '',
|
||||
base64List: [],
|
||||
canvasStatus: true //海报绘图标签
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'uid', 'userInfo']),
|
||||
watch: {
|
||||
isLogin: {
|
||||
handler: function(newV, oldV) {
|
||||
if (newV) {
|
||||
this.userSpreadBannerList();
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (this.isLogin) {
|
||||
this.userSpreadBannerList();
|
||||
} else {
|
||||
toLogin();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// #ifdef MP
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.userInfo.nickname + '-分销海报',
|
||||
imageUrl: this.spreadList[0].pic,
|
||||
path: '/pages/index/index?spid=' + this.uid,
|
||||
};
|
||||
},
|
||||
// #endif
|
||||
onReady() {},
|
||||
methods: {
|
||||
userSpreadBannerList: function() {
|
||||
let that = this;
|
||||
uni.showLoading({
|
||||
title: '获取中',
|
||||
mask: true,
|
||||
})
|
||||
spreadBanner({
|
||||
page: 1,
|
||||
limit: 5
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
that.$set(that, 'spreadList', res.data);
|
||||
that.getImageBase64(res.data);
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
getImageBase64: function(images) {
|
||||
uni.showLoading({
|
||||
title: '海报生成中',
|
||||
mask: true
|
||||
});
|
||||
let that = this;
|
||||
// #ifdef H5
|
||||
let spreadList = []
|
||||
// 生成一个Promise对象的数组
|
||||
images.forEach(item => {
|
||||
const oneApi = imageBase64({
|
||||
url: item.pic
|
||||
}).then(res => {
|
||||
return res.data.code;
|
||||
})
|
||||
spreadList.push(oneApi)
|
||||
})
|
||||
Promise.all(spreadList).then(result => {
|
||||
that.$set(that, 'base64List', result);
|
||||
that.make();
|
||||
that.setShareInfoStatus();
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||
// #endif
|
||||
import {
|
||||
getUserInfo,
|
||||
spreadBanner
|
||||
} from '@/api/user.js';
|
||||
import {
|
||||
toLogin
|
||||
} from '@/libs/login.js';
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
// #ifdef MP
|
||||
import {
|
||||
base64src
|
||||
} from '@/utils/base64src.js'
|
||||
import authorize from '@/components/Authorize';
|
||||
import {
|
||||
getQrcode
|
||||
} from '@/api/api.js';
|
||||
// #endif
|
||||
import home from '@/components/home';
|
||||
import {
|
||||
imageBase64
|
||||
} from "@/api/public";
|
||||
export default {
|
||||
components: {
|
||||
// #ifdef MP
|
||||
authorize,
|
||||
// #endif
|
||||
home
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgUrls: [],
|
||||
indicatorDots: false,
|
||||
circular: false,
|
||||
autoplay: false,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
swiperIndex: 0,
|
||||
spreadList: [],
|
||||
poster: '',
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
qrcodeSize: 1000,
|
||||
PromotionCode: '',
|
||||
base64List: [],
|
||||
canvasStatus: true //海报绘图标签
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'uid', 'userInfo']),
|
||||
watch: {
|
||||
isLogin: {
|
||||
handler: function(newV, oldV) {
|
||||
if (newV) {
|
||||
this.userSpreadBannerList();
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (this.isLogin) {
|
||||
this.userSpreadBannerList();
|
||||
} else {
|
||||
toLogin();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// #ifdef MP
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.userInfo.nickname + '-分销海报',
|
||||
imageUrl: this.spreadList[0].pic,
|
||||
path: '/pages/index/index?spid=' + this.uid,
|
||||
};
|
||||
},
|
||||
// #endif
|
||||
onReady() {},
|
||||
methods: {
|
||||
userSpreadBannerList: function() {
|
||||
let that = this;
|
||||
uni.showLoading({
|
||||
title: '获取中',
|
||||
mask: true,
|
||||
})
|
||||
spreadBanner({
|
||||
page: 1,
|
||||
limit: 5
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
const list = res.data.map((item) => item.pic)
|
||||
that.$set(that, 'spreadList', res.data);
|
||||
that.$set(that, 'base64List', list);
|
||||
that.make();
|
||||
// that.getImageBase64(res.data);
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
getImageBase64: function(images) {
|
||||
uni.showLoading({
|
||||
title: '海报生成中',
|
||||
mask: true
|
||||
});
|
||||
let that = this;
|
||||
// #ifdef H5
|
||||
let spreadList = []
|
||||
// 生成一个Promise对象的数组
|
||||
images.forEach(item => {
|
||||
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();
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef MP
|
||||
that.base64List = images.map(item => {
|
||||
return item.pic
|
||||
});
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
that.base64List = images.map(item => {
|
||||
return item.pic
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef MP
|
||||
that.getQrcode();
|
||||
// #endif
|
||||
},
|
||||
// 小程序二维码
|
||||
getQrcode() {
|
||||
let that = this;
|
||||
let data = {
|
||||
pid: that.uid,
|
||||
path: 'pages/index/index'
|
||||
}
|
||||
let arrImagesUrl = "";
|
||||
uni.downloadFile({
|
||||
url: this.base64List[0],
|
||||
success: (res) => {
|
||||
arrImagesUrl = res.tempFilePath;
|
||||
}
|
||||
});
|
||||
getQrcode(data).then(res => {
|
||||
base64src(res.data.code, res => {
|
||||
that.PromotionCode = res;
|
||||
});
|
||||
setTimeout(() => {
|
||||
that.PosterCanvas(arrImagesUrl, that.PromotionCode, that.userInfo.nickname, 0);
|
||||
}, 300);
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
that.$set(that, 'canvasStatus', false);
|
||||
});
|
||||
},
|
||||
// 生成二维码;
|
||||
make() {
|
||||
let that = this;
|
||||
let href = '';
|
||||
// #ifdef H5
|
||||
href = window.location.href.split('/pages')[0];
|
||||
// #endif
|
||||
uQRCode.make({
|
||||
canvasId: 'qrcode',
|
||||
text: href + '/pages/index/index?spread=' + that.uid,
|
||||
size: this.qrcodeSize,
|
||||
margin: 10,
|
||||
success: res => {
|
||||
that.PromotionCode = res;
|
||||
setTimeout(() => {
|
||||
that.PosterCanvas(this.base64List[0], that.PromotionCode, that.userInfo
|
||||
.nickname, 0);
|
||||
}, 300);
|
||||
},
|
||||
complete: (res) => {},
|
||||
fail: res => {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: '海报二维码生成失败!'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
PosterCanvas: function(arrImages, code, nickname, index) {
|
||||
let context = uni.createCanvasContext('canvasOne')
|
||||
context.clearRect(0, 0, 0, 0);
|
||||
let that = this;
|
||||
uni.getImageInfo({
|
||||
src: arrImages,
|
||||
success: function(res) {
|
||||
context.drawImage(arrImages, 0, 0, 750, 1190);
|
||||
context.save();
|
||||
context.drawImage(code, 110, 925, 140, 140);
|
||||
context.restore();
|
||||
context.setFontSize(28);
|
||||
context.fillText(nickname, 270, 980);
|
||||
context.fillText('邀请您加入', 270, 1020);
|
||||
setTimeout(() => {
|
||||
context.draw(true, function() {
|
||||
uni.canvasToTempFilePath({
|
||||
destWidth: 750,
|
||||
destHeight: 1190,
|
||||
canvasId: 'canvasOne',
|
||||
fileType: 'jpg',
|
||||
success: function(res) {
|
||||
// 在H5平台下,tempFilePath 为 base64
|
||||
uni.hideLoading();
|
||||
that.spreadList[index].pic = res
|
||||
.tempFilePath;
|
||||
that.$set(that, 'poster', res
|
||||
.tempFilePath);
|
||||
that.$set(that, 'canvasStatus', false);
|
||||
}
|
||||
})
|
||||
})
|
||||
}, 100);
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: '无法获取图片信息'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// #ifdef MP
|
||||
that.getQrcode();
|
||||
// #endif
|
||||
},
|
||||
// 小程序二维码
|
||||
getQrcode() {
|
||||
let that = this;
|
||||
let data = {
|
||||
pid: that.uid,
|
||||
path: 'pages/index/index'
|
||||
}
|
||||
let arrImagesUrl = "";
|
||||
uni.downloadFile({
|
||||
url: this.base64List[0],
|
||||
success: (res) => {
|
||||
arrImagesUrl = res.tempFilePath;
|
||||
}
|
||||
});
|
||||
getQrcode(data).then(res => {
|
||||
base64src(res.data.code, res => {
|
||||
that.PromotionCode = res;
|
||||
});
|
||||
setTimeout(() => {
|
||||
that.PosterCanvas(arrImagesUrl, that.PromotionCode, that.userInfo.nickname, 0);
|
||||
}, 300);
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
that.$set(that, 'canvasStatus', false);
|
||||
});
|
||||
},
|
||||
// 生成二维码;
|
||||
make() {
|
||||
let that = this;
|
||||
let href = '';
|
||||
// #ifdef H5
|
||||
href = window.location.href.split('/pages')[0];
|
||||
// #endif
|
||||
uQRCode.make({
|
||||
canvasId: 'qrcode',
|
||||
text: href + '/pages/index/index?spread=' + that.uid,
|
||||
size: this.qrcodeSize,
|
||||
margin: 10,
|
||||
success: res => {
|
||||
that.PromotionCode = res;
|
||||
setTimeout(() => {
|
||||
that.PosterCanvas(this.base64List[0], that.PromotionCode, that.userInfo
|
||||
.nickname, 0);
|
||||
}, 300);
|
||||
},
|
||||
complete: (res) => {},
|
||||
fail: res => {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: '海报二维码生成失败!'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
PosterCanvas: function(arrImages, code, nickname, index) {
|
||||
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) {
|
||||
context.drawImage(arrImages, 0, 0, 750, 1190);
|
||||
context.save();
|
||||
context.drawImage(code, 110, 925, 140, 140);
|
||||
context.restore();
|
||||
context.setFontSize(28);
|
||||
context.fillText(nickname, 270, 980);
|
||||
context.fillText('邀请您加入', 270, 1020);
|
||||
setTimeout(() => {
|
||||
context.draw(true, function() {
|
||||
uni.canvasToTempFilePath({
|
||||
destWidth: 750,
|
||||
destHeight: 1190,
|
||||
canvasId: 'canvasOne',
|
||||
fileType: 'jpg',
|
||||
success: function(res) {
|
||||
// 在H5平台下,tempFilePath 为 base64
|
||||
uni.hideLoading();
|
||||
that.spreadList[index].pic = res
|
||||
.tempFilePath;
|
||||
that.$set(that, 'poster', res
|
||||
.tempFilePath);
|
||||
that.$set(that, 'canvasStatus', false);
|
||||
}
|
||||
})
|
||||
})
|
||||
}, 100);
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
title: '无法获取图片信息'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
onLoadFun: function(e) {
|
||||
this.$set(this, 'userInfo', e);
|
||||
this.userSpreadBannerList();
|
||||
},
|
||||
// 授权关闭
|
||||
authColse: function(e) {
|
||||
this.isShowAuth = e
|
||||
},
|
||||
bindchange(e) {
|
||||
let base64List = this.base64List;
|
||||
let index = e.detail.current;
|
||||
this.swiperIndex = index;
|
||||
let arrImagesUrl = "";
|
||||
uni.downloadFile({
|
||||
url: base64List[index],
|
||||
success: (res) => {
|
||||
arrImagesUrl = res.tempFilePath;
|
||||
setTimeout(() => {
|
||||
this.$set(this, 'canvasStatus', true);
|
||||
this.PosterCanvas(arrImagesUrl, this.PromotionCode, this.userInfo.nickname,
|
||||
index);
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 点击保存海报
|
||||
savePosterPath: function() {
|
||||
let that = this;
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||
uni.authorize({
|
||||
scope: 'scope.writePhotosAlbum',
|
||||
success() {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: that.poster,
|
||||
success: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: that.poster,
|
||||
success: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
setShareInfoStatus: function() {
|
||||
if (this.$wechat.isWeixin()) {
|
||||
let configAppMessage = {
|
||||
desc: '分销海报',
|
||||
title: this.userInfo.nickname + '-分销海报',
|
||||
link: '/pages/index/index?spread=' + this.uid,
|
||||
imgUrl: this.spreadList[0].pic
|
||||
};
|
||||
this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
configAppMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoadFun: function(e) {
|
||||
this.$set(this, 'userInfo', e);
|
||||
this.userSpreadBannerList();
|
||||
},
|
||||
// 授权关闭
|
||||
authColse: function(e) {
|
||||
this.isShowAuth = e
|
||||
},
|
||||
bindchange(e) {
|
||||
let base64List = this.base64List;
|
||||
let index = e.detail.current;
|
||||
this.swiperIndex = index;
|
||||
let arrImagesUrl = "";
|
||||
uni.downloadFile({
|
||||
url: base64List[index],
|
||||
success: (res) => {
|
||||
arrImagesUrl = res.tempFilePath;
|
||||
setTimeout(() => {
|
||||
this.$set(this, 'canvasStatus', true);
|
||||
this.PosterCanvas(arrImagesUrl, this.PromotionCode, this.userInfo.nickname,
|
||||
index);
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 点击保存海报
|
||||
savePosterPath: function() {
|
||||
let that = this;
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||
uni.authorize({
|
||||
scope: 'scope.writePhotosAlbum',
|
||||
success() {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: that.poster,
|
||||
success: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: that.poster,
|
||||
success: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
that.$util.Tips({
|
||||
title: '保存失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
setShareInfoStatus: function() {
|
||||
if (this.$wechat.isWeixin()) {
|
||||
let configAppMessage = {
|
||||
desc: '分销海报',
|
||||
title: this.userInfo.nickname + '-分销海报',
|
||||
link: '/pages/index/index?spread=' + this.uid,
|
||||
imgUrl: this.spreadList[0].pic
|
||||
};
|
||||
this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
configAppMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #a3a3a3 !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
page {
|
||||
background-color: #a3a3a3 !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.canvas {
|
||||
position: relative;
|
||||
}
|
||||
.canvas {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.distribution-posters {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.distribution-posters {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.distribution-posters swiper {
|
||||
width: 100%;
|
||||
height: 1000rpx;
|
||||
position: relative;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
.distribution-posters swiper {
|
||||
width: 100%;
|
||||
height: 1000rpx;
|
||||
position: relative;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.distribution-posters .slide-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.distribution-posters .slide-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0 auto;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.distribution-posters .slide-image.active {
|
||||
transform: none;
|
||||
transition: all 0.2s ease-in 0s;
|
||||
}
|
||||
.distribution-posters .slide-image.active {
|
||||
transform: none;
|
||||
transition: all 0.2s ease-in 0s;
|
||||
}
|
||||
|
||||
.distribution-posters .slide-image.quiet {
|
||||
transform: scale(0.8333333);
|
||||
transition: all 0.2s ease-in 0s;
|
||||
}
|
||||
.distribution-posters .slide-image.quiet {
|
||||
transform: scale(0.8333333);
|
||||
transition: all 0.2s ease-in 0s;
|
||||
}
|
||||
|
||||
.distribution-posters .keep {
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
width: 600rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
margin: 38rpx auto;
|
||||
}
|
||||
.distribution-posters .keep {
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
width: 600rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
margin: 38rpx auto;
|
||||
}
|
||||
|
||||
.distribution-posters .preserve {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
margin-top: 38rpx;
|
||||
}
|
||||
.distribution-posters .preserve {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
margin-top: 38rpx;
|
||||
}
|
||||
|
||||
.distribution-posters .preserve .line {
|
||||
width: 100rpx;
|
||||
height: 1px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.distribution-posters .preserve .line {
|
||||
width: 100rpx;
|
||||
height: 1px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.distribution-posters .preserve .tip {
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
.distribution-posters .preserve .tip {
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue