hookehuyr

联调生成小程序二维码

1 /* 1 /*
2 * @Date: 2022-10-20 13:15:00 2 * @Date: 2022-10-20 13:15:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-26 11:36:29 4 + * @LastEditTime: 2022-10-28 17:34:06
5 * @FilePath: /swx/src/api/Activity/index.js 5 * @FilePath: /swx/src/api/Activity/index.js
6 * @Description: 活动信息 6 * @Description: 活动信息
7 */ 7 */
...@@ -13,6 +13,7 @@ const Api = { ...@@ -13,6 +13,7 @@ const Api = {
13 ACTIVITY_COPY: '/srv/?a=activity_copy', 13 ACTIVITY_COPY: '/srv/?a=activity_copy',
14 ACTIVITY_END: '/srv/?a=activity_end', 14 ACTIVITY_END: '/srv/?a=activity_end',
15 ACTIVITY_DEL: '/srv/?a=activity_del', 15 ACTIVITY_DEL: '/srv/?a=activity_del',
16 + ACTIVITY_QRCODE: '/srv/?a=activity_info_qrcode',
16 } 17 }
17 18
18 /** 19 /**
...@@ -44,3 +45,9 @@ export const endActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_END, params) ...@@ -44,3 +45,9 @@ export const endActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_END, params)
44 * @returns 45 * @returns
45 */ 46 */
46 export const delActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_DEL, params)); 47 export const delActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_DEL, params));
48 +
49 +/**
50 + * @description: 生成小程序码
51 + * @returns
52 + */
53 +export const qrCodeActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_QRCODE, params));
......
1 <!-- 1 <!--
2 * @Date: 2022-09-26 14:36:57 2 * @Date: 2022-09-26 14:36:57
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-28 13:50:13 4 + * @LastEditTime: 2022-10-28 17:56:57
5 * @FilePath: /swx/src/pages/activityDetail/index.vue 5 * @FilePath: /swx/src/pages/activityDetail/index.vue
6 * @Description: 活动详情页 6 * @Description: 活动详情页
7 --> 7 -->
...@@ -152,6 +152,7 @@ import PosterBuilder from '@/components/PosterBuilder/index.vue'; ...@@ -152,6 +152,7 @@ import PosterBuilder from '@/components/PosterBuilder/index.vue';
152 import { ref, onMounted } from "vue"; 152 import { ref, onMounted } from "vue";
153 import * as dayjs from 'dayjs' 153 import * as dayjs from 'dayjs'
154 import { infoUserAPI } from '@/api/User/index'; 154 import { infoUserAPI } from '@/api/User/index';
155 +import { qrCodeActivityAPI } from '@/api/Activity/index';
155 import icon_share from '@/images/icon/share.png' 156 import icon_share from '@/images/icon/share.png'
156 157
157 const nickname = ref(''); 158 const nickname = ref('');
...@@ -196,12 +197,15 @@ const onClickPost = () => { ...@@ -196,12 +197,15 @@ const onClickPost = () => {
196 const startDraw = ref(false) 197 const startDraw = ref(false)
197 const posterPath = ref('') 198 const posterPath = ref('')
198 let base = {} 199 let base = {}
199 - 200 +let qrcode_url = '';
200 const start = async () => { 201 const start = async () => {
201 const { code, data } = await activityInfoAPI({ i: getCurrentPageParam().id }); 202 const { code, data } = await activityInfoAPI({ i: getCurrentPageParam().id });
202 if (code) { 203 if (code) {
203 data.activity.activity_time = formatDate(data.activity.activity_time); 204 data.activity.activity_time = formatDate(data.activity.activity_time);
204 const activity = data.activity; 205 const activity = data.activity;
206 + const qrcode = await qrCodeActivityAPI({ i: getCurrentPageParam().id });
207 + if (qrcode.code) {
208 + qrcode_url = qrcode.data.qrcode_url;
205 base = { 209 base = {
206 width: 1024, 210 width: 1024,
207 height: 1334, 211 height: 1334,
...@@ -399,7 +403,7 @@ const start = async () => { ...@@ -399,7 +403,7 @@ const start = async () => {
399 zIndex: 10, 403 zIndex: 10,
400 }, 404 },
401 { 405 {
402 - url: 'https://pic.juncao.cc/cms/images/minapp.jpg', 406 + url: qrcode_url,
403 width: 170, 407 width: 170,
404 height: 170, 408 height: 170,
405 x: 750, 409 x: 750,
...@@ -423,6 +427,7 @@ const start = async () => { ...@@ -423,6 +427,7 @@ const start = async () => {
423 startDraw.value = true; 427 startDraw.value = true;
424 if (!posterPath.value) Taro.showLoading(); 428 if (!posterPath.value) Taro.showLoading();
425 } 429 }
430 + }
426 } 431 }
427 const drawSuccess = (result) => { 432 const drawSuccess = (result) => {
428 console.warn('绘制好了', result); 433 console.warn('绘制好了', result);
......