This commit is contained in:
木瓜一块八 2025-08-04 13:33:44 +08:00
parent a6d2c4166f
commit 0f76206df4
8 changed files with 187 additions and 59 deletions

View File

@ -18,7 +18,7 @@ import SecurityGroupDetail
import ShowGpu from "@/views/product/productHome/capitalOnline/productItem/GpuProduct/ShowGpu/index.vue";
import ShowEip from "@/views/product/productHome/capitalOnline/Net/Eip/showEip/index.vue";
import CreateEip from "@/views/product/productHome/capitalOnline/Net/Eip/createEip/index.vue";
import { getHomePath } from '@/views/setting/tools'
Vue.use(Router);
// const originalPush = Router.prototype.push
@ -293,7 +293,7 @@ export const asyncRoutes = [
// },
{
path: "/homePage",
path: getHomePath()=='/ncmatchHome/index' ? "/ncmatchHome" : "/homePage",
component: () => import("@/views/homePage/indexLast.vue"),
name: "homePage",
redirect: "/homePage/index",

View File

@ -2,7 +2,7 @@
<div class="top-nav">
<div id="topContainer" class="container">
<div class="logo">
<img v-if="JSON.stringify(logoInfoNew)!=='{}'" @click="$router.push('/homePage/index')"
<img v-if="JSON.stringify(logoInfoNew)!=='{}'" @click="$router.push(homePath)"
style="cursor:pointer;margin-right: 71px" class="logoImg"
:src=" logoInfoNew.home.logoImg || '' "
alt="">
@ -10,7 +10,7 @@
<nav class="main-nav" v-if="!isNcmatchHome">
<ul >
<li :class="{ active: $route.path.includes('/index') }">
<a @click="$router.push('/homePage/index')">首页</a>
<a @click="$router.push(homePath)">首页</a>
</li>
<li @mouseleave="sildeOut" @mouseenter="sildeIn(product_service)"><a>产品与服务</a></li>
<!-- <li :class="{ active: $route.path.includes('/new') }" @mouseleave="sildeOut"-->
@ -203,11 +203,12 @@ import {getLogoAPI, getUserInfoAPI} from "@/api/login";
import {reqApplyChannel} from "@/api/customer/channel";
import store from "@/store";
import { windows } from 'codemirror/src/util/browser';
import { getHomePath } from '@/views/setting/tools'
export default Vue.extend({
name: "TopBox",
data() {
return {
homePath: getHomePath(),
isShowKbossCharge: false,
role: sessionStorage.getItem("jueseNew") == "admin" ? [] : sessionStorage.getItem("jueseNew"),
userId: sessionStorage.getItem("userId"),

View File

@ -1,6 +1,7 @@
<script lang="ts">
import Vue from 'vue'
import { reqPublishProductSearchFirstPage } from '@/api/ncmatch'
import {mapGetters, mapState} from "vuex";
export default Vue.extend({
name: "mainPage",
components: {
@ -12,6 +13,7 @@ export default Vue.extend({
},
data() {
return {
publish_type: null,
sendProductVisible: false,
currentHotMenu: "",
product: [],
@ -111,24 +113,56 @@ export default Vue.extend({
{ name: '一体机', icon: require('./img/computer.png'), product_list: ['昆仑芯', '天数智芯'] },
{ name: '硬件', icon: require('./img/ying.png'), product_list: ['机器人', 'AR眼镜'] },
{ name: 'AI应用', icon: require('./img/aiApp.png'), product_list: ['数字人', '智慧医疗', '智能客服'] },
]
],
current_page: 1,
page_size: 8,
}
},
computed: {
...mapGetters(["sidebar", "avatar", "device"]),
...mapState({
isShowPanel: (state) => state.product.showHomeNav,
navIndex: (state) => state.product.navIndex,
gridObj: state => state.operationAnalysis.gridObj,
mybalance: state => state.user.mybalance,
logoutUrl: state => state.login.logoutUrl,
loginStateVuex: state => state.login.loginState,
logoInfoNew: state => state.product.logoInfoNew,
}),
loginState() {
const userId = sessionStorage.getItem('userId');
return this.loginStateVuex || (userId !== null && userId !== 'null' && userId !== '');
},
},
methods: {
sendInfo(type) {
if (this.loginState) {
this.publish_type = type
this.sendProductVisible = true
} else {
this.$router.push('/login')
}
},
init_product_list() {
reqPublishProductSearchFirstPage({ url_link: window.location.href }).then(res => {
reqPublishProductSearchFirstPage({ publish_type: "1", url_link: window.location.href, to_page: 'first_page', page_size: this.page_size, current_page: this.current_page, product_type: this.currentHotMenu }).then(res => {
if (res.status) {
if(res.data.length > 0){
if (res.data.length > 0) {
this.currentHotMenu = res.data[0].id
this.hotProductList = res.data[0].product_list
this.product = res.data
}
}
})
},
sendProductSuccess() {
this.sendProductVisible = false; //
this.init_product_list()
},
clickNetMenu(menu) {
this.currentHotMenu = menu.id;
@ -183,7 +217,8 @@ export default Vue.extend({
<!-- 左侧分类导航 -->
<aside class="category-sidebar">
<ul class="category-list">
<li class="category-item" style="color: #E02020;"><img src="./img/hot.svg" style="margin-right: 10px;" alt=""> 热门推荐 / 活动促销</li>
<li class="category-item" style="color: #E02020;"><img src="./img/hot.svg" style="margin-right: 10px;"
alt=""> 热门推荐 / 活动促销</li>
<li v-for="category in categories" :key="category.name" class="category-item">
<span class="category-icon"> <img style="width: 24px;height: 24px;" :src="category.icon" alt=""> </span>
<span class="category-name">{{ category.name }}</span>
@ -218,8 +253,8 @@ export default Vue.extend({
<!-- 右侧用户信息栏 -->
<aside class="user-sidebar" style="background-color: #f8fbfe;padding: 10px;padding-top: 20px;">
<span class="publish-goods" @click="$router.push('/ncmatchHome/supplyAndDemandSquare')"> 算力供需广场</span>
<span class="publish-goods">发布需求</span>
<span class="publish-goods" @click="sendProductVisible = true">发布商品</span>
<span class="publish-goods" @click="sendInfo('2')">发布需求</span>
<span class="publish-goods" @click="sendInfo('1')">发布商品</span>
<ul class="userBtn">
<li><img src="./img/eye.png" alt="">浏览记录</li>
@ -240,8 +275,9 @@ export default Vue.extend({
<productCard :productList="hotProductList"></productCard>
<el-dialog title="发布商品" width="60vw" top="5vh" :visible.sync="sendProductVisible">
<sendProduct @success="sendProductSuccess"></sendProduct>
<el-dialog :title="publish_type === '2' ? '发布需求' : '发布商品'" width="60vw" top="5vh"
:visible.sync="sendProductVisible">
<sendProduct v-if="publish_type" @success="sendProductSuccess" :publish_type="publish_type"></sendProduct>
</el-dialog>
</div>
</div>
@ -293,6 +329,7 @@ export default Vue.extend({
.productList {
width: 1600px;
margin: 0 auto;
padding-bottom: 45px;
}
.publish-goods {
@ -525,6 +562,7 @@ export default Vue.extend({
&:nth-child(-n+3) {
color: #e1251b;
}
color: #666;
text-decoration: none;
font-size: 12px;
@ -566,7 +604,8 @@ export default Vue.extend({
border-radius: 10px;
overflow: hidden;
background-color: white;
height: 360px;
height: 360px;
.content-wrapper {
box-sizing: border-box;
display: grid;
@ -596,7 +635,8 @@ height: 360px;
padding: 4px 0;
cursor: pointer;
transition: all 0.3s;
padding: 0 10px;
padding: 0 10px;
&:hover {
color: #2c96fc;
background: #c3daee !important;

View File

@ -40,7 +40,7 @@
</div>
<div class="product-price">
<span class="price">¥{{ item.price }}</span>
<span class="price-unit">// (可短租)</span>
<span class="price-unit">{{ item.unit }} {{ item.short_term }} {{ item.short_term==='1' ? '(可短租)' : '' }} </span>
</div>
<button class="consult-btn" @click="openTalk">立即咨询</button>
</div>
@ -67,7 +67,7 @@
<span class="spec-value">{{ item.update_time }}</span>
</div>
<div class="spec-item">
<span class="spec-label">需求描述:</span>
<span class="spec-label">{{ publish_type === '1' ? '商品描述' : '需求描述' }}:</span>
<span class="spec-value showText">{{ item.requirement_summary }}</span>
</div>
@ -99,6 +99,10 @@ export default {
type: {
type: String,
default: 'homePage'
},
publish_type: {
type: String,
default: '1'
}
},
methods: {

View File

@ -2,7 +2,7 @@
<div class="form-container">
<el-form :model="form" :rules="rules" ref="form" label-width="120px" class="two-column-form">
<!-- 商品图片 - 单独一行 -->
<el-form-item label="商品图片" prop="img" class="full-width">
<el-form-item v-if="publish_type === '1'" :label="publish_type === '2' ? '需求图片' : '商品图片'" prop="img" class="full-width">
<div class="upload-area" @click="!selectedImage && triggerFileInput()">
<input ref="fileInput" type="file" accept="image/*" @change="handleFileChange"
style="display: none;">
@ -24,8 +24,8 @@
<el-button size="mini" type="danger" @click="removeImage">删除</el-button>
</div>
</el-form-item>
<el-form-item label="商品名称" prop="product_name" required>
<el-input v-model="form.product_name" placeholder="请输入商品名称"></el-input>
<el-form-item :label="publish_type === '2' ? '需求名称' : '商品名称'" prop="product_name" required>
<el-input v-model="form.product_name" :placeholder="publish_type === '2' ? '请输入需求名称' : '请输入商品名称'"></el-input>
</el-form-item>
<!-- 表单项直接排列 -->
<div class="form-row">
@ -71,43 +71,52 @@
</div>
<div class="form-row" v-if="current_product_category.cart_flag=='1'">
<el-form-item label="CPU" class="form-item-half">
<el-form-item label="CPU" prop="cpu" class="form-item-half">
<el-input v-model="form.cpu" placeholder="请输入CPU规格"></el-input>
</el-form-item>
<el-form-item label="内存" class="form-item-half">
<el-form-item label="内存" prop="memory" class="form-item-half">
<el-input v-model="form.memory" placeholder="请输入内存规格"></el-input>
</el-form-item>
</div>
<div class="form-row" v-if="current_product_category.cart_flag=='1'">
<el-form-item label="GPU" class="form-item-half">
<el-form-item label="GPU" prop="gpu" class="form-item-half">
<el-input v-model="form.gpu" placeholder="请输入GPU规格"></el-input>
</el-form-item>
<el-form-item label="系统盘" class="form-item-half">
<el-form-item label="系统盘" prop="sys_disk" class="form-item-half">
<el-input v-model="form.sys_disk" placeholder="请输入系统盘规格"></el-input>
</el-form-item>
</div>
<div class="form-row" v-if="current_product_category.cart_flag=='1'">
<el-form-item label="数据盘" class="form-item-half">
<el-form-item label="数据盘" prop="data_disk" class="form-item-half">
<el-input v-model="form.data_disk" placeholder="请输入数据盘规格"></el-input>
</el-form-item>
<el-form-item label="网卡" class="form-item-half">
<el-form-item label="网卡" prop="net_card" class="form-item-half">
<el-input v-model="form.net_card" placeholder="请输入网卡规格"></el-input>
</el-form-item>
</div>
<div class="form-row">
<el-form-item label="价格" prop="price" required class="form-item-half">
<el-input v-model="form.price" placeholder="请输入价格: 示例: xx元/台/月"></el-input>
<div class="price-unit-container">
<el-input v-model="form.price" placeholder="请输入价格" class="price-input"></el-input>
<el-input v-model="form.unit" placeholder="单位" class="unit-input"></el-input>
</div>
</el-form-item>
<el-form-item label="是否短租" prop="short_term" required class="form-item-half">
<el-radio-group v-model="form.short_term">
<el-radio label="1"></el-radio>
<el-radio label="2"></el-radio>
</el-radio-group>
</el-form-item>
</div>
<el-form-item label="商品概述" prop="requirement_summary" required class="full-width">
<el-input type="textarea" v-model="form.requirement_summary" :rows="6" placeholder="请输入商品概述"></el-input>
<el-form-item :label="publish_type === '2' ? '需求概述' : '商品概述'" prop="requirement_summary" required class="full-width">
<el-input type="textarea" v-model="form.requirement_summary" :rows="6" :placeholder="publish_type === '2' ? '请输入需求概述' : '请输入商品概述'"></el-input>
</el-form-item>
<el-form-item label="相关参数" prop="related_parameters" class="full-width">
@ -121,7 +130,7 @@
<!-- 提交按钮 -->
<div class="form-actions">
<el-button type="primary" @click="submitForm" size="large">提交</el-button>
<el-button type="primary" @click="submitForm" size="large">{{ publish_type === '2' ? '发布需求' : '发布商品' }}</el-button>
<el-button @click="resetForm" size="large">重置</el-button>
<!-- <el-button type="info" @click="getBinaryData" size="large">获取二进制数据</el-button> -->
</div>
@ -161,6 +170,12 @@ import { buildCaTree } from './buildCaTree'
import { reqGetProductCategorySearch, reqPublishProductAdd, reqCompanyCategorySearch } from '@/api/ncmatch'
export default {
name: 'sendProduct',
props: {
publish_type: {
type: String,
default: '1' // 'product'
}
},
components: {
VueCropper
},
@ -196,12 +211,19 @@ export default {
net_card: "",//
priority: "",//
price: "",//
unit: "",//
short_term: "",//
label: "",//
requirement_summary: "",//
related_parameters: "",//
application_scenario: "",//
unit: "",//
short_term: "",//
},
rules: {
product_name: [
{ required: true, message: '请输入商品名称', trigger: 'blur' }
],
product_category: [
{ required: true, message: '请选择所属类别', trigger: 'change' }
],
@ -240,7 +262,13 @@ export default {
{ required: true, message: '请输入网卡规格', trigger: 'blur' }
],
price: [
{ required: true, message: '请输入价格', trigger: 'blur' }
{ required: true, message: '请输入价格和单位', trigger: 'blur' }
],
unit: [
{ required: true, message: '请输入单位', trigger: 'blur' }
],
short_term: [
{ required: true, message: '请选择是否短租', trigger: 'change' }
],
img: [
{
@ -292,11 +320,11 @@ export default {
},
init_product_category() {
reqGetProductCategorySearch({ url_link: window.location.href,to_page: 'publish' }).then(res => {
// publish_type to_page
reqGetProductCategorySearch({ url_link: window.location.href, to_page: 'publish' }).then(res => {
if (res.status) {
this.typeList = buildCaTree(res.data)
console.log("2@@", this.typeList);
}
})
},
@ -436,15 +464,21 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
console.log('表单数据:', this.form)
console.log('发布类型:', this.publish_type)
let formdata = new FormData();
for (let key in this.form) {
formdata.append(key, this.form[key]);
}
formdata.append('publish_type', this.publish_type)
//
// formdata.append('publish_type', this.publish_type);
reqPublishProductAdd(formdata).then(res => {
if (res.status) {
this.$emit('success');
this.$message.success('添加产品成功!')
const successMessage = this.publish_type === '2' ? '添加需求成功!' : '添加产品成功!'
this.$message.success(successMessage)
}
})
} else {
@ -837,6 +871,26 @@ export default {
}
}
//
.price-unit-container {
display: flex;
align-items: center;
gap: 8px;
.price-input {
flex: 1;
}
.unit-input {
width: 80px;
.el-input__inner {
font-size: 12px;
padding: 0 8px;
}
}
}
//
:deep(.vue-cropper) {
width: 100% !important;

View File

@ -20,12 +20,12 @@
<!-- 新增的需求和商品radio按钮组 -->
<div class="radio-group-container">
<div class="radio-group">
<label class="radio-item" style="margin-right: 0px;" :class="{ active: selectedType === 'product' }">
<input type="radio" v-model="selectedType" value="product" @change="handleTypeChange">
<label class="radio-item" style="margin-right: 25px;" :class="{ active: publish_type === '1' }">
<input type="radio" v-model="publish_type" value="1" @change="handleTypeChange">
<span class="radio-text">企业商品</span>
</label>
<label class="radio-item" :class="{ active: selectedType === 'demand' }">
<input type="radio" v-model="selectedType" value="demand" @change="handleTypeChange">
<label class="radio-item" :class="{ active: publish_type === '2' }">
<input type="radio" v-model="publish_type" value="2" @change="handleTypeChange">
<span class="radio-text">企业需求</span>
</label>
@ -57,7 +57,7 @@
<!-- 产品 -->
<div class="product-card-container">
<productCard v-if="productList.length > 0" type="supplyAndDemandSquare" :productList="productList">
<productCard v-if="productList.length > 0" type="supplyAndDemandSquare" :publish_type="publish_type" :productList="productList">
</productCard>
<div v-else class="no-data">
<img style="width: 150px;height: 10px;" src="./img/empty.svg" alt="">
@ -76,6 +76,7 @@
<script>
import { reqGetProductCategorySearch, reqGetSupplyAndDemandSquareList, reqCompanyCategorySearch } from '@/api/ncmatch'
import { mapGetters, mapState } from 'vuex'
export default {
name: 'supplyAndDemandSquare',
components: {
@ -86,7 +87,7 @@ export default {
page_size: 8,
current_page: 1,
typeList: [],
selectedType: 'product', //
publish_type: '1', //
selectedCategory: '', //
selectedCompanies: [], //
categories: [],
@ -97,18 +98,43 @@ export default {
created() {
this.initAllData()
},
computed: {
isNcmatchHome() {
return window.location.href.includes('ncmatchHome')
},
...mapGetters(["sidebar", "avatar", "device"]),
...mapState({
isShowPanel: (state) => state.product.showHomeNav,
navIndex: (state) => state.product.navIndex,
gridObj: state => state.operationAnalysis.gridObj,
mybalance: state => state.user.mybalance,
logoutUrl: state => state.login.logoutUrl,
loginStateVuex: state => state.login.loginState,
logoInfoNew: state => state.product.logoInfoNew,
}),
loginState() {
const userId = sessionStorage.getItem('userId');
return this.loginStateVuex || (userId !== null && userId !== 'null' && userId !== '');
},
},
methods: {
initAllData() {
Promise.all([
this.init_product_category(),
this.init_company_category()
]).then(() => {
this.initData(this.selectedCategory)
// selectedCategory
this.init_product_category().then(() => {
//
this.init_company_category().then(() => {
// initData
this.initData()
})
})
},
init_company_category() {
reqCompanyCategorySearch({ url_link: window.location.href }).then(res => {
return reqCompanyCategorySearch({ url_link: window.location.href }).then(res => {
if (res.status) {
this.company_category_list = []
for (let item of res.data) {
@ -120,6 +146,7 @@ export default {
this.companies = this.company_category_list
}
return res
})
},
selectCategory(categoryId) {
@ -128,7 +155,7 @@ export default {
this.initData(this.selectedCategory)
},
init_product_category(product_category) {
reqGetProductCategorySearch({ url_link: window.location.href, to_page: 'publish' }).then(res => {
return reqGetProductCategorySearch({ url_link: window.location.href, to_page: 'show' }).then(res => {
if (res.status) {
let list = []
for (let item of res.data) {
@ -140,16 +167,17 @@ export default {
}
}
// this.selectedCategory = list[0].value
this.selectedCategory = list[0].value
this.typeList = list
}
return res
})
},
handleTypeChange() {
//
console.log('切换到:', this.selectedType)
//
console.log('切换到:', this.publish_type)
//
this.initData()
},
initData() {
let ploay = {
@ -158,7 +186,8 @@ export default {
url_link: window.location.href,
page_size: this.page_size,
current_page: this.current_page,
company_type: this.selectedCompanies.length > 0 ? this.selectedCompanies.join(",") : ""
company_type: this.selectedCompanies.length > 0 ? this.selectedCompanies.join(",") : "",
publish_type: this.publish_type
}
reqGetSupplyAndDemandSquareList(ploay).then(res => {
if (res.status) {

View File

@ -198,7 +198,7 @@ import './js/wxLogin.js'
import {Message} from "element-ui";
import router, {resetRouter} from "@/router";
import {reqNewHomeFestival} from "@/api/newHome";
import { getHomePath } from '@/views/setting/tools'
export default {
name: "indexNew",
components: {BeforeLogin, promotionalInvitationCode},
@ -597,7 +597,7 @@ export default {
// } else {
// window.location.href = 'https://www.opencomputing.cn/';
// }
this.$router.push('/homePage/index')
this.$router.push(getHomePath())
},
init() {
// let params = {

View File

@ -1,6 +1,6 @@
export function getHomePath() {
let homePath= "/homePage/index"
// let homePath= "/ncmatchHome/index"
// let homePath= "/homePage/index"
let homePath= "/ncmatchHome/index"
// 业主机构信息
let url_link = window.location.href || '';