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) { export function QRCodeByStoreId(query) {
return request({ return request({
url: '/business/storeInformation/qrCode/createStoreQrCode', url: '/business/storeInformation/qrCode/createStoreQrCode',
method: 'get', method: 'post',
params: query data: query
}) })
} }

View File

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

View File

@ -65,7 +65,7 @@ public class QrCodeUtils {
//使用工具类生成二维码 //使用工具类生成二维码
Image image = createQrCode(logoStream, url, 360, 360); Image image = createQrCode(logoStream, url, 360, 360);
//将小图片绘到大图片上,500,300 .表示你的小图片在大图片上的位置 //将小图片绘到大图片上,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)); g.setFont(new Font("TimesRoman", Font.BOLD, 40));
//设置颜色 //设置颜色

View File

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

View File

@ -21,7 +21,7 @@ public interface IQRCodeService extends IService<QRCode> {
*/ */
public IPage<QRCode> selectQRCodeList(Page page, QRCode 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查询二维码信息 * 根据店铺id查询二维码信息

View File

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