Commit 2c74a842 authored by ganke's avatar ganke

解决srm 加工物流的bug修复

parent a923f562
......@@ -15,14 +15,14 @@ module.exports = {
exact: true,
Component: () => (require('@/page/aboutUs').default),
controller: 'page',
handler: 'index'
handler: 'aboutUs'
},
{
path: '/searchResult',
exact: true,
Component: () => (require('@/page/searchResult').default),
controller: 'page',
handler: 'index'
handler: 'searchResult'
}
],
baseDir: resolvePath('../../../'),
......
......@@ -43,51 +43,26 @@ export class Page {
this.ctx.logger.error(`Page Controller renderToStream Error`, error)
}
}
}
@Provide()
@Controller('/user')
export class User {
@Inject()
ctx: Context
@Get('/')
async index () {
try {
const authCookie = this.ctx.cookies.get('AUTH', { signed: false })
const authRolesCookie = this.ctx.cookies.get('AUTH_ROLES', { signed: false })
// Page为webpack打包的chunkName,项目默认的entry为Page
this.ctx.type = 'text/html'
this.ctx.status = 200
// this.ctx.getUserInfo = await this.service.getUserInfo(authCookie) // 将service挂载到上下文对象
this.ctx.authCookie = authCookie
this.ctx.authRolesCookie = authRolesCookie
const keyword = '瓴犀平台'
const description = '瓴犀平台'
const title = '瓴犀平台'
const themeName = 'theme-mall-science'
const config = Object.assign(this.ctx.app.config, ssrConfig, { keyword, description, title, themeName })
// let authInfo = {}
// if (authString) {
// authInfo = Base64.decode(authString)
// }
const stream = await renderToStream(this.ctx, config)
this.ctx.body = stream
} catch (error) {
this.ctx.logger.error(`Page Controller renderToStream Error`, error)
}
}
@Get('/aboutUs/:id')
async aboutUs () {
try {
this.ctx.type = 'text/html'
this.ctx.status = 200
const keyword = '关于我们'
const description = '关于我们'
const title = `关于我们`
let keyword = '关于我们'
let description = '关于我们'
let title = `关于我们`
const themeName = 'theme-mall-science'
const { id } = this.ctx.params
if (id) {
const { shopInfo } = await this.service.getShopInfo(id)
console.log(shopInfo);
if (shopInfo && shopInfo.aboutSeo) {
title = shopInfo.aboutSeo.title
keyword = shopInfo.aboutSeo.keywords
description = shopInfo.aboutSeo.description
}
}
const config = Object.assign(this.ctx.app.config, ssrConfig, { keyword, description, title, themeName })
const stream = await renderToStream(this.ctx, config)
this.ctx.body = stream
......@@ -114,3 +89,14 @@ export class User {
}
}
@Provide()
@Controller('/user')
export class User {
@Inject()
ctx: Context
}
......@@ -17,5 +17,6 @@ export interface IApiService {
[x: string]: any;
index (): Promise<IApiResult>,
getUserInfo (auth: string): Promise<{ userInfo: any}>,
getPlatfromSeo (): Promise<PlatformSelApiResult>
getPlatfromSeo (): Promise<PlatformSelApiResult>,
getShopInfo (shopId: number): Promise<any>,
}
......@@ -43,7 +43,7 @@ export class ApiService implements IApiService {
})
}
/**
* 获取资讯首页seo信息
* 获取物流首页seo信息
*/
async getPlatfromSeo (): Promise<PlatformSelApiResult> {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/manage/seo/byType`, {
......@@ -57,4 +57,21 @@ export class ApiService implements IApiService {
seoInfo: result.data.data
})
}
/**
*
* @param id
* 获取商店信息
*/
async getShopInfo (id: number): Promise<any> {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/template/web/memberLogisticsWeb/memberLogisticsMain`, {
method: 'GET',
data: {
id,
},
dataType: 'json'
})
return Promise.resolve({
shopInfo: result.data.data
})
}
}
......@@ -10,20 +10,23 @@ interface Props {
}
function Album(props: Props) {
const { albumTitle,albumImg} = props
const { albumTitle, albumImg } = props
return (
<ul className={styles['album-main']}>
<li className={styles['album-title']}>
{albumTitle}
</li>
<li className={styles['album-img-warp']}>
{
albumImg.map((item:any,index:number)=>{
return <img width={item.width?item.width:''} height={item.height?item.height:''} className={styles['album-img-item']} src={item.url} alt="" key={index + albumTitle} />
})
}
</li>
</ul>
albumImg.length > 0 ?
<ul className={styles['album-main']}>
<li className={styles['album-title']}>
{albumTitle}
</li>
<li className={styles['album-img-warp']}>
{
albumImg.map((item: any, index: number) => {
return <img width={item.width ? item.width : ''} height={item.height ? item.height : ''} className={styles['album-img-item']} src={item.url} alt="" key={index + albumTitle} />
})
}
</li>
</ul>
:
<div></div>
)
}
......
......@@ -34,7 +34,6 @@ function CompanyTitle(props: Props) {
const [MemberMessage, setMemberMessage] = useState<any>({});
/**
* 是否会员
*/
......@@ -43,7 +42,6 @@ function CompanyTitle(props: Props) {
upperMemberId: memberId,
upperRoleId: roleId,
}
console.log(obj);
if (!memberId) {
return;
}
......@@ -82,10 +80,13 @@ function CompanyTitle(props: Props) {
{
userInfo &&
<li className={styles['company-right']}>
<Button style={{ marginRight: '16px' }} onClick={fnChangeStatusNew}>
{collectStatus ? "取消收藏" : '加入收藏'}
</Button>
{
userInfo.memberId !== memberId &&
userInfo.memberRoleId !== roleId &&
<Button style={{ marginRight: '16px' }} onClick={fnChangeStatusNew}>
{collectStatus ? "取消收藏" : '加入收藏'}
</Button>
}
{
MemberMessage && MemberMessage.show &&
<>
......
......@@ -27,7 +27,7 @@ const mockData: MockData = {
interface Props {
newsDetail: string,
userInfo:any
userInfo: any
}
const { Link } = Anchor;
const briefListDesc = [
......@@ -39,12 +39,12 @@ const briefListDesc = [
const News: SFC<Props> = (props: any) => {
const [mewssage, setMessage] = useState<any>('10');
const [briefList, setBriefList] = useState<any>(briefListDesc);
const [HonorPics, setHonorPics] = useState<any>([]);
const [companyPics, setCompanyPics] = useState<any>([]);
const [ismember,setIsMember] = useState(false);
const [ismember, setIsMember] = useState(false);
const { id } = props.match?.params || {}
const { userInfo } = props;
......@@ -58,10 +58,10 @@ const News: SFC<Props> = (props: any) => {
setMessage(messageDesc)
briefList[0].secondTitle = messageDesc.areas; // 地区
briefList[1].secondTitle = integrationTime(messageDesc.createTime,'YMD'); // 成立年份
briefList[1].secondTitle = integrationTime(messageDesc.createTime, 'YMD'); // 成立年份
setBriefList([...briefList])
try {
const honorPicsDescArr = messageDesc.honorPics.map((item:any)=>{
const honorPicsDescArr = messageDesc.honorPics.map((item: any) => {
let obj = {
url: item,
width: '238px',
......@@ -75,7 +75,7 @@ const News: SFC<Props> = (props: any) => {
}
try {
const companyPicsDescArr = messageDesc.companyPics.map((item:any)=>{
const companyPicsDescArr = messageDesc.companyPics.map((item: any) => {
let obj = {
url: item,
width: '238px',
......@@ -89,38 +89,39 @@ const News: SFC<Props> = (props: any) => {
}
})
}
const fnGetUserStatus = ()=>{
if (!mewssage.memberId){
const fnGetUserStatus = () => {
if (!mewssage.memberId) {
return;
}
let obj = {
memberId: mewssage.memberId,
roleId: mewssage.roleId,
}
PublicApi.getMemberMainpageUpperInquiry(obj).then((res)=>{
console.log(res);
setIsMember(res.data)
let obj = {
memberId: mewssage.memberId,
roleId: mewssage.roleId,
}
PublicApi.getMemberMainpageUpperInquiry(obj).then((res) => {
console.log(res);
setIsMember(res.data)
})
}
}
/**
* 修改收藏
*/
const fnChangeStatus = ()=>{
const fnChangeStatus = () => {
const obj = {
id: mewssage.id,
status:mewssage.collectStatus?false:true
id: mewssage.id,
status: mewssage.collectStatus ? false : true
}
PublicApi.postTemplateWebMemberLogisticsWebCollect(obj).then((res:any)=>{
console.log(res);
fnGetMessage();
PublicApi.postTemplateWebMemberLogisticsWebCollect(obj).then((res: any) => {
console.log(res);
fnGetMessage();
})
}
}
useEffect(() => {
fnGetMessage();
console.log('111')
}, [])
useEffect(() => {
console.log(mewssage);
fnGetUserStatus();
}, [mewssage])
......@@ -129,7 +130,7 @@ const News: SFC<Props> = (props: any) => {
<div className={styles['about-main']}>
<div className={styles['login-main']}>
<div className={styles['login-warp']}>
<a href="/" style={{ display: 'inlineBlock' }}>
<a href="/" style={{ display: 'inlineBlock' }}>
<img src={logo} alt="" />
</a>
</div>
......@@ -143,14 +144,25 @@ const News: SFC<Props> = (props: any) => {
<IconFont type='icon-gongsi' className={styles['detail-icon']} />
公司简介
</div>} />
<Link href="#album" title={<div>
<PictureOutlined translate={0} className={styles['detail-icon']} />
{
companyPics.length > 0 ?
<Link href="#album" title={<div>
<PictureOutlined translate={0} className={styles['detail-icon']} />
公司相册
</div>} />
<Link href="#honor" title={<div>
<IconFont type='icon-badge' className={styles['detail-icon']} />
资质荣誉
</div>} />
:
<div></div>
}
{
HonorPics.length > 0 ?
<Link href="#honor" title={<div>
<IconFont type='icon-badge' className={styles['detail-icon']} />
资质荣誉
</div>} />
:
<div></div>
}
<Link href="#propaganda" title={<div>
<IconFont type='icon-data' className={styles['detail-icon']} />
宣传手册
......@@ -159,19 +171,19 @@ const News: SFC<Props> = (props: any) => {
</div>
<div className={styles['detail-right']}>
<CompanyTitle
companyName={mewssage.memberName}
companyNumber={mewssage.creditPoint}
companyTime={mewssage.registerYears}
identification={mewssage.avgTradeCommentStar}
fnChangeStatus={fnChangeStatus}
collectStatus={mewssage.collectStatus}
useStatus={ismember}
userInfo={userInfo}
memberId={mewssage?.memberId}
roleId={mewssage?.roleId}
companyName={mewssage.memberName}
companyNumber={mewssage.creditPoint}
companyTime={mewssage.registerYears}
identification={mewssage.avgTradeCommentStar}
fnChangeStatus={fnChangeStatus}
collectStatus={mewssage.collectStatus}
useStatus={ismember}
userInfo={userInfo}
memberId={mewssage?.memberId}
roleId={mewssage?.roleId}
></CompanyTitle>
<div className={styles['compont-bot']} id="brief">
<CompanyBrief
<CompanyBrief
companyBrief={mewssage.describe}
companyBusiness={mewssage.mainBusiness}
briefList={briefList}
......
......@@ -15,14 +15,14 @@ module.exports = {
exact: true,
Component: () => (require('@/page/aboutUs').default),
controller: 'page',
handler: 'index'
handler: 'aboutUs'
},
{
path: '/searchResult',
exact: true,
Component: () => (require('@/page/searchResult').default),
controller: 'page',
handler: 'index'
handler: 'searchResult'
}
],
baseDir: resolvePath('../../../'),
......
......@@ -43,51 +43,26 @@ export class Page {
this.ctx.logger.error(`Page Controller renderToStream Error`, error)
}
}
}
@Provide()
@Controller('/user')
export class User {
@Inject()
ctx: Context
@Get('/')
async index () {
try {
const authCookie = this.ctx.cookies.get('AUTH', { signed: false })
const authRolesCookie = this.ctx.cookies.get('AUTH_ROLES', { signed: false })
// Page为webpack打包的chunkName,项目默认的entry为Page
this.ctx.type = 'text/html'
this.ctx.status = 200
// this.ctx.getUserInfo = await this.service.getUserInfo(authCookie) // 将service挂载到上下文对象
this.ctx.authCookie = authCookie
this.ctx.authRolesCookie = authRolesCookie
const keyword = '瓴犀平台'
const description = '瓴犀平台'
const title = '瓴犀平台'
const themeName = 'theme-mall-science'
const config = Object.assign(this.ctx.app.config, ssrConfig, { keyword, description, title, themeName })
// let authInfo = {}
// if (authString) {
// authInfo = Base64.decode(authString)
// }
const stream = await renderToStream(this.ctx, config)
this.ctx.body = stream
} catch (error) {
this.ctx.logger.error(`Page Controller renderToStream Error`, error)
}
}
@Get('/aboutUs/:id')
async aboutUs () {
try {
this.ctx.type = 'text/html'
this.ctx.status = 200
const keyword = '关于我们'
const description = '关于我们'
const title = `关于我们`
let keyword = '关于我们'
let description = '关于我们'
let title = `关于我们`
const themeName = 'theme-mall-science'
const { id } = this.ctx.params
if (id) {
const { shopInfo } = await this.service.getShopInfo(id)
console.log(shopInfo);
if (shopInfo && shopInfo.aboutSeo) {
title = shopInfo.aboutSeo.title
keyword = shopInfo.aboutSeo.keywords
description = shopInfo.aboutSeo.description
}
}
const config = Object.assign(this.ctx.app.config, ssrConfig, { keyword, description, title, themeName })
const stream = await renderToStream(this.ctx, config)
this.ctx.body = stream
......@@ -112,5 +87,4 @@ export class User {
this.ctx.logger.error(`Page Controller renderToStream Error`, error)
}
}
}
......@@ -17,4 +17,5 @@ export interface IApiService {
index (): Promise<IApiResult>,
getUserInfo (auth: string): Promise<{ userInfo: any}>,
getPlatfromSeo (): Promise<PlatformSelApiResult>
getShopInfo (shopId: number): Promise<any>,
}
......@@ -43,7 +43,7 @@ export class ApiService implements IApiService {
})
}
/**
* 获取平台首页seo信息
* 获取加工seo信息
*/
async getPlatfromSeo (): Promise<PlatformSelApiResult> {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/manage/seo/byType`, {
......@@ -57,4 +57,21 @@ export class ApiService implements IApiService {
seoInfo: result.data.data
})
}
/**
*
* @param id
* 获取商店信息
*/
async getShopInfo (id: number): Promise<any> {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/template/web/memberProcessWeb/memberProcessMain`, {
method: 'GET',
data: {
id,
},
dataType: 'json'
})
return Promise.resolve({
shopInfo: result.data.data
})
}
}
......@@ -12,18 +12,21 @@ interface Props {
function Album(props: Props) {
const { albumTitle,albumImg} = props
return (
<ul className={styles['album-main']}>
<li className={styles['album-title']}>
{albumTitle}
</li>
<li className={styles['album-img-warp']}>
{
albumImg.map((item:any,index:number)=>{
return <img width={item.width?item.width:''} height={item.height?item.height:''} className={styles['album-img-item']} src={item.url} alt="" key={index + albumTitle} />
})
}
</li>
</ul>
albumImg.length > 0 ?
<ul className={styles['album-main']}>
<li className={styles['album-title']}>
{albumTitle}
</li>
<li className={styles['album-img-warp']}>
{
albumImg.map((item: any, index: number) => {
return <img width={item.width ? item.width : ''} height={item.height ? item.height : ''} className={styles['album-img-item']} src={item.url} alt="" key={index + albumTitle} />
})
}
</li>
</ul>
:
<div></div>
)
}
......
......@@ -6,52 +6,52 @@ import Satisfaction from '../Satisfaction'
import { MEMBER_CENTER_URL } from '@/constants'
import { PublicApi } from '@/services/api'
interface Props {
interface Props {
companyName?: string,
companyNumber?: string,
companyTime?: string,
identification?: string,
fnChangeStatus?:Function,
collectStatus?:boolean,
useStatus?:boolean,
userInfo:any,
fnChangeStatus?: Function,
collectStatus?: boolean,
useStatus?: boolean,
userInfo: any,
roleId?: string,
memberId?:string,
memberId?: string,
}
function CompanyTitle(props: Props) {
const {
companyName='-',
companyNumber='-',
companyTime='3',
identification='4.9',
const {
companyName = '-',
companyNumber = '-',
companyTime = '3',
identification = '4.9',
fnChangeStatus,
collectStatus=false,
collectStatus = false,
userInfo,
memberId,
roleId
} = props
const [MemberMessage,setMemberMessage] = useState<any>({});
const [MemberMessage, setMemberMessage] = useState<any>({});
/**
* 是否会员
*/
const fnGetUserStatus = ()=>{
let obj = {
upperMemberId: memberId,
upperRoleId: roleId,
}
if (!memberId){
return;
const fnGetUserStatus = () => {
let obj = {
upperMemberId: memberId,
upperRoleId: roleId,
}
if (!memberId) {
return;
}
PublicApi.getMemberAbilityInfoApplyCondition(obj).then((res) => {
setMemberMessage(res.data)
})
}
PublicApi.getMemberAbilityInfoApplyCondition(obj).then((res)=>{
setMemberMessage(res.data)
})
}
const fnChangeStatusNew = ()=>{
if (fnChangeStatus){
const fnChangeStatusNew = () => {
if (fnChangeStatus) {
fnChangeStatus();
}
}
......@@ -71,7 +71,7 @@ function CompanyTitle(props: Props) {
<div className={styles['company-time']}>
入驻 {companyTime + 1}
</div>
<div style={{marginLeft:'8px'}}>
<div style={{ marginLeft: '8px' }}>
<Satisfaction identification={identification} hasKey={false}></Satisfaction>
</div>
</div>
......@@ -79,30 +79,33 @@ function CompanyTitle(props: Props) {
{
userInfo &&
<li className={styles['company-right']}>
<Button style={{marginRight:'16px'}} onClick={fnChangeStatusNew}>
{collectStatus?"取消收藏":'加入收藏'}
</Button>
{
MemberMessage && MemberMessage.show &&
<>
{
MemberMessage && MemberMessage.status==2?
<Button style={{background:'#00B37A',color:'#ffffff'}}>
立即派单
userInfo.memberId !== memberId &&
userInfo.memberRoleId !== roleId &&
<Button style={{ marginRight: '16px' }} onClick={fnChangeStatusNew}>
{collectStatus ? "取消收藏" : '加入收藏'}
</Button>
}
{
MemberMessage && MemberMessage.show &&
<>
{
MemberMessage && MemberMessage.status == 2 ?
<Button style={{ background: '#00B37A', color: '#ffffff' }}>
立即派单
<a href={`${MEMBER_CENTER_URL}/memberCenter/handling/assign/tobeAddQuery`} className='all-jump'></a>
</Button>
:
<Button style={{background:'#00B37A',color:'#ffffff'}}>
邀请成为会员
</Button>
:
<Button style={{ background: '#00B37A', color: '#ffffff' }}>
邀请成为会员
<a href={`${MEMBER_CENTER_URL}/memberCenter/memberAbility/profile/query`} className='all-jump'></a>
</Button>
}
</Button>
}
</>
}
</li>
}
{/* {
useStatus?
<li className={styles['company-tips-warp']}>
......@@ -113,8 +116,8 @@ function CompanyTitle(props: Props) {
该公司还不是我的会员?
</li>
} */}
</ul>
)
}
......
......@@ -138,14 +138,24 @@ const News: SFC<Props> = (props: any) => {
<IconFont type='icon-gongsi' className={styles['detail-icon']} />
公司简介
</div>} />
<Link href="#album" title={<div>
<PictureOutlined translate={0} className={styles['detail-icon']} />
{
companyPics.length > 0 ?
<Link href="#album" title={<div>
<PictureOutlined translate={0} className={styles['detail-icon']} />
公司相册
</div>} />
<Link href="#honor" title={<div>
<IconFont type='icon-badge' className={styles['detail-icon']} />
资质荣誉
</div>} />
:
<div></div>
}
{
HonorPics.length > 0 ?
<Link href="#honor" title={<div>
<IconFont type='icon-badge' className={styles['detail-icon']} />
资质荣誉
</div>} />
:
<div></div>
}
<Link href="#propaganda" title={<div>
<IconFont type='icon-data' className={styles['detail-icon']} />
宣传手册
......
// import { App, Configuration } from '@midwayjs/decorator';
// import { ILifeCycle } from '@midwayjs/core';
// import { Application } from 'egg';
// import { join } from 'path';
import { App, Configuration } from '@midwayjs/decorator';
import { ILifeCycle } from '@midwayjs/core';
import { Application } from 'egg';
import { join } from 'path';
// @Configuration({
// importConfigs: [
// join(__dirname, './config/')
// ],
// conflictCheck: true, // 开启命名冲突检查
// })
// export class ContainerLifeCycle implements ILifeCycle {
// @App()
// app: Application;
@Configuration({
importConfigs: [
join(__dirname, './config/')
],
conflictCheck: true, // 开启命名冲突检查
})
export class ContainerLifeCycle implements ILifeCycle {
@App()
app: Application;
// async onReady () {
// console.log('onReady')
// }
// }
async onReady () {
console.log('onReady')
}
}
......@@ -121,7 +121,7 @@
top: 0;
left: 188px;
border: 2px solid var(--mall_main_color);
height: 512px;
height: 400px;
width: 750px;
background-color: #FFF;
z-index: 2;
......
......@@ -35,9 +35,7 @@
font-size: 14px;
font-weight: 500;
&:hover {
color: #303133 !important;
}
}
&:hover{
background: #008C65;
......
var fs = require('fs');
fs.writeFileSync('.package.json', 'utf8', function (err, data) {
console.log(data);
});
\ 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