This commit is contained in:
cun-nan 2024-02-21 17:59:58 +08:00
parent 1c844fd619
commit 76e1a578ba
6 changed files with 25 additions and 18 deletions

View File

@ -13,8 +13,8 @@ export function listQRCode(query) {
export function QRCodeByStoreId(query) {
return request({
url: '/business/storeInformation/qrCode/createStoreQrCode',
method: 'get',
params: query
method: 'post',
data: query
})
}

View File

@ -34,7 +34,9 @@
<div slot="header" class="clearfix">
<span>油站二维码</span>
</div>
<img id="collection" class="qrcode" :src="collectionImg" /><br/>
<el-button style="margin-left: 200px" type="text" v-if="type==0" @click="getQRCodeInfoByStoreId(1)">切换样式</el-button><br/>
<el-button style="margin-left: 200px" type="text" v-if="type==1" @click="getQRCodeInfoByStoreId(0)">切换样式</el-button><br/>
<img id="collection" class="qrcode" :src="baseUrl + collectionImg" /><br/>
<el-button class="but" type="primary"
icon="el-icon-download"
@click="handleDownloadqrCode('collection')">
@ -58,7 +60,7 @@
<script>
import QRCode from 'qrcode'
import html2canvas from "html2canvas";
import {listQRCode} from "@/api/staff/qrcode";
import {listQRCode, QRCodeByStoreId} from "@/api/staff/qrcode";
import {ljStoreInfo, updateStore} from "@/api/staff/store";
import mapComponment from "@/components/map/mapComponent.vue";
import imgUpload from "@/components/ImageUpload/index.vue"
@ -114,10 +116,13 @@ export default {
//
options: [],
welfare:[],
type:0,
baseUrl:process.env.VUE_APP_BASE_API,
}
},
created() {
this.getQRCodeInfo();
// this.getQRCodeInfo();
this.getQRCodeInfoByStoreId(0);
this.getStore();
this.getForm()
},
@ -162,6 +167,7 @@ export default {
}
this.$refs.mapRef.initAMap();
this.flag = true;
})
},
@ -187,10 +193,10 @@ export default {
})
},
//
getQRCodeInfoByStoreId(){
listQRCode().then(response => {
this.qrcode = response.data.records;
this.getQRcode();
getQRCodeInfoByStoreId(type){
this.type = type
QRCodeByStoreId({type:type}).then(response => {
this.collectionImg = response.data;
})
},
// url
@ -252,12 +258,12 @@ export default {
margin: 15px auto;
}
.qrcode{
width: 180px;
height: 180px;
width: 300px;
margin-top: 15px;
}
.but{
margin-top: 15px;
margin-top: 20px;
margin-left: 50px;
width: 180px;
}
.copy{

View File

@ -65,7 +65,7 @@ public class QrCodeUtils {
//使用工具类生成二维码
Image image = createQrCode(logoStream, url, 360, 360);
//将小图片绘到大图片上,500,300 .表示你的小图片在大图片上的位置
g.drawImage(image, 260, 320, null);
g.drawImage(image, (bufImg.getWidth()-360)/2, 320, null);
// 设置字体样式字体大小
g.setFont(new Font("TimesRoman", Font.BOLD, 40));
//设置颜色

View File

@ -38,8 +38,7 @@ public class QRCodeController extends BaseController {
@PostMapping("/createStoreQrCode")
public ResponseObject createStoreQrCode(HttpServletRequest request, @RequestBody Map<String,String> map) throws Exception {
String type = map.get("type");
Integer storeId = Integer.valueOf(map.get("storeId"));
return getSuccessResult(iqrCodeService.createStoreQrCode(type,storeId,request));
return getSuccessResult(iqrCodeService.createStoreQrCode(type,request));
}
/**

View File

@ -21,7 +21,7 @@ public interface IQRCodeService extends IService<QRCode> {
*/
public IPage<QRCode> selectQRCodeList(Page page, QRCode qrCode);
String createStoreQrCode(String type,Integer storeId, HttpServletRequest request) throws Exception;
String createStoreQrCode(String type, HttpServletRequest request) throws Exception;
/**
* 根据店铺id查询二维码信息

View File

@ -52,7 +52,9 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
private BackendFileController backendFileController;
@Override
public String createStoreQrCode(String type, Integer storeId, HttpServletRequest request) throws Exception {
public String createStoreQrCode(String type, HttpServletRequest request) throws Exception {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
QRCode qrCode = selectQRCodeByStoreId(storeId);
// 根据id查询员工信息和店铺信息
LJStore store = storeService.selectStoreByStoreId(storeId);
@ -61,7 +63,7 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
if (type.equals("0")){
backgroundImage = "static/qrCodeImg/laigeyouhui_bg.jpg";
}else {
backgroundImage = "static/qrCodeImg/laigeyouhui_bg1.jpg";
backgroundImage = "static/qrCodeImg/laigeyouhui_bg1.png";
}
String logoImage = "static/qrCodeImg/logo.png";