Commit 6b21958e authored by GuanHua's avatar GuanHua

fix: 渠道模板装修接口添加参数

parent 1fbb162d
......@@ -9,6 +9,7 @@ import { topBarConfig, topAdvertConfig, headerConfig, mainNavConfig, bannerAdver
import Loading from '../components/Loading'
import { menuData } from './defaultMenu'
import { PublicApi } from '@/services/api'
import { getAuth } from '@/utils/auth'
import styles from './index.less'
interface ChannelPreviewPropsType {
......@@ -30,6 +31,7 @@ const TemplateList = ['science']
const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
const { query: { id, template } } = props.location
const userInfo = getAuth() || {}
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-channel-science')
const [componentConfigs, setComponentConfigs] = useState({})
......@@ -47,7 +49,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
return new Promise((resolve) => {
const params: any = {
templateId: id,
type: 1
type: 1,
memberId: userInfo.memberId
}
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
......@@ -64,7 +67,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
return new Promise((resolve) => {
const params: any = {
templateId: id,
type: 2
type: 2,
memberId: userInfo.memberId
}
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
......@@ -82,7 +86,10 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplateChannelFindAllFirstCategory().then(res => {
const params: any = {
memberId: userInfo.memberId
}
PublicApi.getTemplateChannelFindAllFirstCategory(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......@@ -97,7 +104,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
return new Promise((resolve) => {
const param: any = {
templateId: id,
categoryId
categoryId,
memberId: userInfo.memberId
}
PublicApi.getTemplateChannelFindFirstCategoryDetail(param).then(res => {
......@@ -112,7 +120,10 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
*/
const fetchShopInfo = () => {
return new Promise((resolve) => {
PublicApi.getTemplateChannelFindChannel().then(res => {
const params: any = {
memberId: userInfo.memberId
}
PublicApi.getTemplateChannelFindChannel(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......
......@@ -13,7 +13,7 @@ export function isObject(obj: any) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
export function formatTimeString(date, format: string = 'YYYY-MM-DD HH:mm:ss') {
export function formatTimeString(date, format = 'YYYY-MM-DD HH:mm:ss') {
return date ? moment(date).format(format) : ''
}
......@@ -115,7 +115,7 @@ export function timeRange(val: number) {
export const arrayGroupsByCount = (array, count) => {
let index = 0;
let newArray = [];
const newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, index += count));
}
......@@ -139,7 +139,7 @@ export function isPrimeNum(num) {
if (!isThree(num)) {
return false;
}
for (var i = 2; i < num / 5 + 1; i++) {
for (let i = 2; i < num / 5 + 1; i++) {
if (num % i == 0) {
return false;
}
......@@ -154,13 +154,13 @@ function isNum(num) {
}
function isDual(num) {
var num = num.toString();
var lastNum = num.substring(num.length - 1, num.length);
const lastNum = num.substring(num.length - 1, num.length);
return lastNum % 2 == 0 || lastNum % 5 == 0 ? false : true;
}
function isThree(num) {
var str = num.toString();
var sum = 0;
for (var i = 0; i < str.length; i++) {
const str = num.toString();
let sum = 0;
for (let i = 0; i < str.length; i++) {
sum += +str.substring(i, i + 1);
};
return sum % 3 == 0 ? false : true;
......@@ -443,7 +443,7 @@ export interface FileData {
url: string;
};
/**
/**
* 初始化 Upload 数据
*/
export function normalizeFiledata(url: string): FileData
......@@ -458,7 +458,7 @@ export function normalizeFiledata(url: any): any {
uid: Math.random().toFixed(16).slice(2, 10),
name: fileName,
status: 'done',
url,
url,
data: url, // formily Upload value 需要这个字段
};
};
......@@ -502,16 +502,16 @@ export const isJSONStr = str => {
* @param {array} item 需要赋值的值
*/
export const coverColFiltersItem = (
data: Array<{[key: string]: any}>,
dataIndex: string,
data: Array<{[key: string]: any}>,
dataIndex: string,
item: {[key: string]: any}
) => {
const index = data.findIndex(i => i.dataIndex === dataIndex);
if (index !== -1) {
data.splice(index, 1, {
...data[index],
filters: item,
filters: item,
});
}
};
......@@ -528,7 +528,7 @@ export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): nu
}
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (!Boolean(data[i][customKey])) {
if (!data[i][customKey]) {
index = i - 1;
}
// 循环到最后如果 index 还是为 0 的话,说明工作流全部跑完了,此时 index 为 data.length - 1
......@@ -543,4 +543,4 @@ export default {
isArray,
isObject,
omit,
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment