提交修改
@@ -1,6 +1,6 @@
|
||||
// const baseUrl = "https://api.collect.hs.hnzhwlkj.club/"; //这里放置url域名32044
|
||||
// const baseUrl = "https://api.collect.xyh.muzili.top/"; //这里放置url域名32044
|
||||
const baseUrl = "https://cb.hnxinyouhe.com/"; //这里放置url域名32044
|
||||
const baseUrl = "https://bsh.info.yw.hnzhwlkj.cn/"; //这里放置url域名32044
|
||||
// const baseUrl = "https://114.215.24.240:8106/api/v1/"; //这里放置url域名32044
|
||||
export function request(options){//封装的requset
|
||||
let { url,data,method } = options;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="content" @click="handleView">
|
||||
<view class="content">
|
||||
<u-read-more :showHeight="80" ref="uReadMore" color="#999999" closeText="查看更多">
|
||||
<rich-text :nodes="item.content" @load="handleContentLoad"></rich-text>
|
||||
</u-read-more>
|
||||
@@ -190,12 +190,13 @@ export default {
|
||||
color: #3BC6BD;
|
||||
}
|
||||
.chat-btn2{
|
||||
background: rgb(255 0 0 / 20%);
|
||||
color: #fff;
|
||||
}
|
||||
.chat-btn3{
|
||||
background: rgb(62 94 215 / 20%);
|
||||
color: #3E5ED7;
|
||||
|
||||
}
|
||||
.chat-btn3{
|
||||
background: rgb(255 0 0 / 20%);
|
||||
color: #FF0000;
|
||||
}
|
||||
.chat-btn4{
|
||||
background: rgb(105 105 105 / 20%);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
animationDuration: item.speed + 's',
|
||||
color: item.color
|
||||
}"
|
||||
@animationend="finishDanmu(item.id, item.lane)"
|
||||
>
|
||||
{{ item.text }}
|
||||
</view>
|
||||
@@ -26,7 +27,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
danmuItems: [],
|
||||
laneBusy: [] // 轨道是否被占用
|
||||
laneBusy: [], // 轨道是否被占用
|
||||
pendingQueue: [] // 等待队列
|
||||
}
|
||||
},
|
||||
|
||||
@@ -39,30 +41,35 @@ export default {
|
||||
startDanmu() {
|
||||
let index = 0
|
||||
setInterval(() => {
|
||||
const text = this.list[index].content
|
||||
this.createDanmu(text)
|
||||
index = (index + 1) % this.list.length
|
||||
}, 1500)
|
||||
if (this.list && this.list.length > 0) {
|
||||
const text = this.list[index].content
|
||||
this.createDanmu(text)
|
||||
index = (index + 1) % this.list.length
|
||||
}
|
||||
}, 2200)
|
||||
},
|
||||
|
||||
createDanmu(text) {
|
||||
const lane = this.getFreeLane()
|
||||
|
||||
// 如果没有空闲轨道,加入等待队列
|
||||
if (lane === -1) {
|
||||
this.pendingQueue.push(text)
|
||||
return
|
||||
}
|
||||
|
||||
const id = Date.now() + Math.random()
|
||||
|
||||
const item = {
|
||||
id,
|
||||
text,
|
||||
top: lane * 100, // 每条轨道高度 60rpx
|
||||
speed: 6 + Math.random()*2,
|
||||
top: lane * 80 + 20, // 每条轨道高度 80rpx,顶部留20rpx间距
|
||||
speed: 14 + Math.random()*6,
|
||||
color: this.randomColor(),
|
||||
lane
|
||||
}
|
||||
|
||||
this.danmuItems.push(item)
|
||||
|
||||
setTimeout(() => {
|
||||
this.finishDanmu(id, lane)
|
||||
}, item.speed * 1000)
|
||||
},
|
||||
|
||||
getFreeLane() {
|
||||
@@ -73,15 +80,26 @@ export default {
|
||||
return i
|
||||
}
|
||||
}
|
||||
// 如果都满了,就随机一个
|
||||
return Math.floor(Math.random() * this.row)
|
||||
// 如果都满了,返回-1,不创建弹幕
|
||||
return -1
|
||||
},
|
||||
|
||||
finishDanmu(id, lane) {
|
||||
// 移除弹幕项
|
||||
this.danmuItems = this.danmuItems.filter(i => i.id !== id)
|
||||
|
||||
// 整个动画跑完后释放轨道
|
||||
this.laneBusy[lane] = false
|
||||
|
||||
// 释放轨道
|
||||
if (lane !== undefined && lane >= 0) {
|
||||
this.laneBusy[lane] = false
|
||||
|
||||
// 检查等待队列,如果有等待的弹幕,立即创建
|
||||
if (this.pendingQueue.length > 0) {
|
||||
const text = this.pendingQueue.shift()
|
||||
this.$nextTick(() => {
|
||||
this.createDanmu(text)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
randomColor() {
|
||||
@@ -96,7 +114,7 @@ export default {
|
||||
.danmu-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 88rpx;
|
||||
top: 450rpx;
|
||||
width: 100%;
|
||||
height: 600rpx;
|
||||
overflow: hidden;
|
||||
@@ -115,10 +133,14 @@ export default {
|
||||
background: rgb(0 0 0 / 60%);
|
||||
padding: 5px 14px;
|
||||
border-radius: 20px;
|
||||
line-height: 1.5;
|
||||
max-width: 600rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@keyframes danmu-move {
|
||||
from { transform: translateX(0); }
|
||||
to { transform: translateX(-1200rpx); }
|
||||
to { transform: translateX(-150vw); }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -94,22 +94,18 @@
|
||||
"versionCode" : 100
|
||||
},
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx2f5476b2243ae858",
|
||||
"appid" : "wx62c3f16d37f2c2a2",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true,
|
||||
"postcss" : true
|
||||
},
|
||||
"permission": {
|
||||
"scope.userFuzzyLocation": {
|
||||
"desc": "用于为你推荐附近内容/门店"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": [
|
||||
"getFuzzyLocation",
|
||||
"chooseLocation",
|
||||
"chooseAddress"
|
||||
],
|
||||
"permission" : {
|
||||
"scope.userFuzzyLocation" : {
|
||||
"desc" : "用于为你推荐附近内容/门店"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos" : [ "getFuzzyLocation", "chooseLocation", "chooseAddress" ],
|
||||
"usingComponents" : true,
|
||||
"uniStatistics" : {
|
||||
"enable" : true
|
||||
|
||||
@@ -182,18 +182,18 @@
|
||||
"selectedIconPath": "/static/image/classify.png",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/publish/index",
|
||||
"iconPath": "/static/image/publish1.png",
|
||||
"selectedIconPath": "/static/image/publish.png",
|
||||
"text": "发布"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/square/index",
|
||||
"iconPath": "/static/image/square1.png",
|
||||
"selectedIconPath": "/static/image/square.png",
|
||||
"text": "广场"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/publish/index",
|
||||
"iconPath": "/static/image/publish1.png",
|
||||
"selectedIconPath": "/static/image/publish.png",
|
||||
"text": "发布"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/mine",
|
||||
"iconPath": "/static/image/mine1.png",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#000" backgroundColor="#fff" :statusBar="true" title="样机分类"></uni-nav-bar>
|
||||
|
||||
<!--搜索 -->
|
||||
<view class="search">
|
||||
<uni-search-bar @confirm="search" v-model="searchValue" cancelButton="none" @blur="search"></uni-search-bar>
|
||||
</view>
|
||||
<!-- 顶部 tabs -->
|
||||
<view class="tabs">
|
||||
<view :class="['tab', currentTab==='latest'?'on':'']" @click="switchTab('latest')">最新发布</view>
|
||||
@@ -97,6 +100,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchValue:'',
|
||||
showlogin: false,
|
||||
tabs: [
|
||||
{ key: 'latest', label: '最新发布' },
|
||||
@@ -229,9 +233,9 @@ export default {
|
||||
// 分类切换事件
|
||||
onCategoryChange(categoryId) {
|
||||
// 如果点击的是当前分类且已有数据,不重复加载
|
||||
if (this.currentCategoryId === categoryId && this.slist.length > 0) {
|
||||
return;
|
||||
}
|
||||
// if (this.currentCategoryId === categoryId && this.slist.length > 0) {
|
||||
// return;
|
||||
// }
|
||||
// 切换分类时,重置所有状态
|
||||
this.currentCategoryId = categoryId;
|
||||
this.page = 1;
|
||||
@@ -242,6 +246,10 @@ export default {
|
||||
this.slist = []; // 先清空数据
|
||||
this.loadCategoryData(categoryId, false);
|
||||
},
|
||||
search(res){
|
||||
console.log(res.value)
|
||||
this.loadCategoryData('', false);
|
||||
},
|
||||
|
||||
// 根据分类id加载分类下的内容
|
||||
loadCategoryData(categoryId, isLoadMore = false) {
|
||||
@@ -272,7 +280,8 @@ export default {
|
||||
current:this.page,
|
||||
size:10,
|
||||
status:1,
|
||||
category_id:categoryId
|
||||
category_id:categoryId,
|
||||
keyword:this.searchValue
|
||||
};
|
||||
// 添加排序参数(如果后端支持)
|
||||
if(this.currentTab=='near'){
|
||||
@@ -334,6 +343,32 @@ export default {
|
||||
},
|
||||
// tab 切换
|
||||
switchTab(key) {
|
||||
if((this.longitude==''||this.latitude=='')&&key=='near'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请先授权地理位!',
|
||||
content: '请在设置中开启模糊定位权限',
|
||||
confirmText: '去设置',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.openSetting({
|
||||
success: (setRes) => {
|
||||
if (setRes.authSetting['scope.userFuzzyLocation']) {
|
||||
that.getFuzzy().then(res => {
|
||||
that.latitude = res.latitude
|
||||
that.longitude = res.longitude
|
||||
console.log(res);
|
||||
}).catch(err => console.error(err));
|
||||
} else {
|
||||
reject(new Error('未开启模糊定位权限'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.currentTab === key) return
|
||||
this.currentTab = key
|
||||
this.onRefresh()
|
||||
@@ -477,6 +512,9 @@ page,
|
||||
height: 100%;
|
||||
/* background: #f7f7f7; */
|
||||
}
|
||||
.search{
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
height: 80rpx;
|
||||
@@ -520,17 +558,18 @@ page,
|
||||
}
|
||||
|
||||
.content-con {
|
||||
height: calc(100% - 80rpx);
|
||||
height: calc(100% - 260rpx);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.left-aside {
|
||||
width: 200rpx;
|
||||
width: 22%;
|
||||
background: #3BC6BD;
|
||||
color: #000;
|
||||
}
|
||||
.f-item {
|
||||
height: 96rpx;
|
||||
width: 100%;
|
||||
/* padding-left: 28rpx; */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -554,7 +593,8 @@ page,
|
||||
color: #000;
|
||||
}
|
||||
.right-aside {
|
||||
flex: 1;
|
||||
/* flex: 1; */
|
||||
width: 78%;
|
||||
/* background: #fff; */
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,23 @@
|
||||
<view class="page">
|
||||
<z-paging ref="paging" :auto="false" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
||||
<!-- 顶部背景 -->
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" color="#000000" backgroundColor="#3BC8BE" :statusBar="true" title="西门子样机福利平台"></uni-nav-bar>
|
||||
<view class="header">
|
||||
<image src="/static/image/homebg.png" mode="aspectFill" class="bg"></image>
|
||||
|
||||
<!-- 弹幕组件 -->
|
||||
<danmu :list="danmuList" :row="5" :visible="danmuVisible"></danmu>
|
||||
|
||||
<!-- 标题 -->
|
||||
<view class="title">
|
||||
<view>西门子样机</view>
|
||||
<view>福利平台</view>
|
||||
<swiper class="banner-swiper" circular autoplay :interval="4000" indicator-dots indicator-color="rgba(255,255,255,.4)"
|
||||
indicator-active-color="#3F435B">
|
||||
<swiper-item v-for="(banner,index) in bannerList" :key="index">
|
||||
<image class="banner-img" :src="banner.image_url_pull" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="homemap">
|
||||
<image
|
||||
class="homemap-img"
|
||||
:src="homemapurl"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<!-- 弹幕组件 -->
|
||||
<danmu :list="danmuList" :row="6" :visible="danmuVisible"></danmu>
|
||||
|
||||
<!-- 右侧按钮 -->
|
||||
<view class="right-btns">
|
||||
@@ -74,18 +80,26 @@ export default {
|
||||
content:'',
|
||||
list:[],
|
||||
danmuList: [],
|
||||
bannerList:[],
|
||||
latitude:'',
|
||||
longitude:''
|
||||
longitude:'',
|
||||
bannerurl:'',
|
||||
banner:uni.getStorageSync('banner'),
|
||||
homemapurl:''
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 数据加载逻辑
|
||||
if (!uni.getStorageSync('token')) {
|
||||
this.mini_login().then(() => {
|
||||
this.bannerListfn()
|
||||
this.configListfn()
|
||||
this.barragelist()
|
||||
this.$refs.paging && this.$refs.paging.reload()
|
||||
})
|
||||
}else{
|
||||
this.bannerListfn()
|
||||
this.configListfn()
|
||||
this.barragelist()
|
||||
this.$refs.paging && this.$refs.paging.reload()
|
||||
}
|
||||
@@ -97,7 +111,82 @@ export default {
|
||||
console.log(res);
|
||||
}).catch(err => console.error(err));
|
||||
},
|
||||
onTabItemTap() {
|
||||
this.reloadPage()
|
||||
},
|
||||
methods: {
|
||||
configListfn(){
|
||||
request({
|
||||
url:'common/config/find',
|
||||
method:'get',
|
||||
data:{
|
||||
code:'home_map'
|
||||
}
|
||||
}).then(res => {
|
||||
const homemapurl = res.data.data.value_pull
|
||||
const EXPIRE_TIME = 2 * 60 * 60 * 1000
|
||||
const cache = uni.getStorageSync('homemapurl')
|
||||
let useCache = false
|
||||
// 1️⃣ 缓存存在 + 未过期 + url 相同 → 用缓存
|
||||
if (
|
||||
cache &&
|
||||
cache.time &&
|
||||
Date.now() - cache.time < EXPIRE_TIME &&
|
||||
cache.data === homemapurl
|
||||
) {
|
||||
useCache = true
|
||||
this.homemapurl = uni.getStorageSync('homemapurl')
|
||||
}
|
||||
// 2️⃣ 否则更新缓存
|
||||
if (!useCache) {
|
||||
uni.setStorageSync('banner', {
|
||||
data: homemapurl,
|
||||
time: Date.now()
|
||||
})
|
||||
uni.setStorageSync('homemapurl', homemapurl)
|
||||
this.homemapurl = homemapurl
|
||||
}
|
||||
})
|
||||
},
|
||||
bannerListfn(){
|
||||
request({
|
||||
url:'common/banner/list',
|
||||
method:'get',
|
||||
data:{
|
||||
module:'home_module'
|
||||
}
|
||||
}).then(res => {
|
||||
const bannerList = res.data.data || []
|
||||
this.bannerList = bannerList
|
||||
// if (!bannerList.length) return
|
||||
// const banner = bannerList[0]
|
||||
// const EXPIRE_TIME = 2 * 60 * 60 * 1000
|
||||
// const cache = uni.getStorageSync('banner')
|
||||
// let useCache = false
|
||||
// // 1️⃣ 缓存存在 + 未过期 + url 相同 → 用缓存
|
||||
// if (
|
||||
// cache &&
|
||||
// cache.time &&
|
||||
// Date.now() - cache.time < EXPIRE_TIME &&
|
||||
// cache.data === banner.image_url
|
||||
// ) {
|
||||
// useCache = true
|
||||
// this.bannerurl = uni.getStorageSync('bannerurl')
|
||||
// }
|
||||
// // 2️⃣ 否则更新缓存
|
||||
// if (!useCache) {
|
||||
// uni.setStorageSync('banner', {
|
||||
// data: banner.image_url,
|
||||
// time: Date.now()
|
||||
// })
|
||||
// uni.setStorageSync('bannerurl', banner.image_url_pull)
|
||||
// this.bannerurl = banner.image_url_pull
|
||||
// }
|
||||
})
|
||||
},
|
||||
reloadPage() {
|
||||
this.$refs.paging.reload()
|
||||
},
|
||||
getFuzzy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getSetting({
|
||||
@@ -122,17 +211,44 @@ export default {
|
||||
});
|
||||
},
|
||||
tabclick(item){
|
||||
const that = this
|
||||
if((this.longitude==''||this.latitude=='')&&item==1){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请先授权地理位!',
|
||||
content: '请在设置中开启模糊定位权限',
|
||||
confirmText: '去设置',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.openSetting({
|
||||
success: (setRes) => {
|
||||
if (setRes.authSetting['scope.userFuzzyLocation']) {
|
||||
that.getFuzzy().then(res => {
|
||||
that.latitude = res.latitude
|
||||
that.longitude = res.longitude
|
||||
console.log(res);
|
||||
}).catch(err => console.error(err));
|
||||
} else {
|
||||
reject(new Error('未开启模糊定位权限'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.activeTab = item;
|
||||
this.$refs.paging && this.$refs.paging.reload()
|
||||
},
|
||||
//获取弹幕
|
||||
barragelist(){
|
||||
request({
|
||||
url: 'admin/barrage/list',
|
||||
url: 'common/barrage/all',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
if (res.data.code === 200) {
|
||||
this.danmuList = res.data.data.records
|
||||
this.danmuList = res.data.data
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -234,7 +350,7 @@ export default {
|
||||
return {
|
||||
title: '西门子样机福利平台',
|
||||
path: '/pages/index/index?from=share',
|
||||
imageUrl: "/static/image/share.jpg" // 封面图
|
||||
imageUrl: this.bannerList[0].image_url_pull // 封面图
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -247,29 +363,28 @@ export default {
|
||||
|
||||
.header {
|
||||
position: relative;
|
||||
height: 720rpx;
|
||||
}
|
||||
.bg {
|
||||
.banner-swiper{
|
||||
width: 100%;
|
||||
height: 430rpx;
|
||||
}
|
||||
.banner-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-bottom-left-radius: 30rpx;
|
||||
border-bottom-right-radius: 30rpx;
|
||||
}
|
||||
.homemap {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
left: 40rpx;
|
||||
top: 300rpx;
|
||||
font-size: 68rpx;
|
||||
line-height: 1.2;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
.homemap-img {
|
||||
width: 100%;
|
||||
display: block; /* 防止底部留白 */
|
||||
}
|
||||
|
||||
.right-btns {
|
||||
position: absolute;
|
||||
right: 40rpx;
|
||||
bottom: 100rpx;
|
||||
top: 420rpx;
|
||||
|
||||
.circle-btn {
|
||||
margin-top: 20rpx;
|
||||
@@ -298,7 +413,7 @@ export default {
|
||||
}
|
||||
.main-box {
|
||||
margin: 20rpx 30rpx;
|
||||
margin-top: -60rpx;
|
||||
// margin-top: -60rpx;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-radius: 30rpx;
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
uploadfn(imgUrl){
|
||||
var that = this;
|
||||
uni.uploadFile({
|
||||
url: 'https://bsh.info.hb.hnzhwlkj.cn/upload/image?scene=userinfo',
|
||||
url: 'https://bsh.info.yw.hnzhwlkj.cn/upload/image?scene=userinfo',
|
||||
filePath: imgUrl,
|
||||
name: 'image',
|
||||
header:{'content-type': 'application/x-www-form-urlencoded','Fdesk-Auth-Token': 'Bearer ' + uni.getStorageSync('token'),'Fdesk-Language': uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh','Fdesk-Login-Type': 'wechat','Fdesk-System-Code':'wechat'},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<text>{{ formatContent(item.post && item.post.content) }}</text>
|
||||
</view>
|
||||
<view class="msg-text1">
|
||||
<text>{{ item.comment.content }} </text>
|
||||
<text>{{ item.comment.content?item.comment.content:'' }} </text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="publish-page">
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="样机发布"></uni-nav-bar>
|
||||
<view class="form-card">
|
||||
<view class="select-input gradient-bg" @click="showSelect1 = true">
|
||||
<view class="select-input gradient-bg" @click="onSelectCategory()">
|
||||
<view class="category-content">
|
||||
<text class="category-text">{{form.category || '请输入/选择型号'}}</text>
|
||||
</view>
|
||||
@@ -10,12 +10,12 @@
|
||||
</view>
|
||||
<view class="conts mag-top">
|
||||
<view class="">
|
||||
<textarea v-model="form.content" class="content-textarea" placeholder="请输入文字内容"
|
||||
:maxlength="maxWords" @input="handleContentInput" />
|
||||
<textarea v-model="form.content" class="content-textarea" placeholder="例如:西门子 超氧 十字门冰箱,门店展示样机,位于郑州市商都路品牌店,展示年限不足1年外观全新、配件齐全;"
|
||||
:maxlength="maxWords" @input="handleContentInput" @focus="checkLogin()" />
|
||||
</view>
|
||||
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker fileMediatype="image" limit="9" @select="selectMedia" @delete="delfn" :imageStyles="imageStyles">
|
||||
<uni-file-picker ref="mediaPicker" fileMediatype="image" limit="9" :disabled="!isLogin" @select="selectMedia" @delete="delfn" :imageStyles="imageStyles">
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/photo.png" mode="" class="addimg"></image>
|
||||
</view>
|
||||
@@ -23,11 +23,11 @@
|
||||
</view>
|
||||
<view class="help-text">
|
||||
<u-icon name="info-circle" size="18" color="#A6ABB7"></u-icon>
|
||||
<text>文字不多于2000字,图片不多于9张</text>
|
||||
<text>请上传产品实物的正、侧、背多角度照片(禁止效果图),图片不多于9张</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mag-top">
|
||||
<picker mode="selector" :range="conditionOptions" range-key="name" @change="onCategoryChange">
|
||||
<picker mode="selector" :range="conditionOptions" range-key="name" :disabled="!isLogin" @tap="checkLogin()" @change="onCategoryChange">
|
||||
<view class="select-input gradient-bg">
|
||||
<view class="category-content">
|
||||
<text class="category-text">{{form.agename || '请选择样机新旧程度'}}</text>
|
||||
@@ -37,9 +37,30 @@
|
||||
</picker>
|
||||
</view>
|
||||
<view class="mag-top">
|
||||
<input class="uni-input" focus v-model="form.price" placeholder="请输入折扣价格" />
|
||||
<input class="uni-input" focus v-model="form.price" @focus="checkLogin()" placeholder="请输入折扣价格" />
|
||||
</view>
|
||||
<view class="detils">
|
||||
<view class="mag-top">
|
||||
<view style="margin-bottom: 10rpx;">是否包邮:</view>
|
||||
<uni-data-checkbox v-model="form.is_free" :localdata="freeshipping" />
|
||||
</view>
|
||||
|
||||
<view class="detils" v-if="skudetils!=''">
|
||||
<view class="product-card">
|
||||
<view class="title">产品名称:{{skudetils.product_name}}</view>
|
||||
<view class="price-row">
|
||||
<text class="spec-label">零售价:</text>
|
||||
<text class="spec-value">{{ skudetils.price }}</text>
|
||||
<!-- <text class="model">产品型号:{{ skudetils.model }}</text> -->
|
||||
</view>
|
||||
<view class="spec-row">
|
||||
<text class="spec-label">品牌:</text>
|
||||
<text class="spec-value">{{ skudetils.brand }}</text>
|
||||
</view>
|
||||
<view class="spec-row" v-for="(item, idx) in skudetils.spec_json" :key="idx">
|
||||
<text class="spec-label">{{item.attr_name}}:</text>
|
||||
<text class="spec-value">{{ item.attr_value }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<rich-text :nodes="productcontents"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -88,7 +109,7 @@
|
||||
<u-popup :show="showlogin" :closeOnClickOverlay="false" :round="20" mode="center">
|
||||
<view class="popupcontent">
|
||||
<image class="log1" src="/static/image/log1.png"></image>
|
||||
<view class="title">{{$t('home.loginmsg')}}</view>
|
||||
<view class="title">您还未登录!登录后方可发布内容!</view>
|
||||
<view class="yhxy">
|
||||
<checkbox-group name="" style="width: 28px;display: inline-block;">
|
||||
<label @tap="selfChangde()">
|
||||
@@ -120,18 +141,28 @@ export default {
|
||||
showSelect2:false,
|
||||
searchKey1:'',
|
||||
productcontents:'',
|
||||
skudetils:'',
|
||||
// 单选数据源
|
||||
freeshipping: [ {
|
||||
text: '全国包邮',
|
||||
value: 1
|
||||
}, {
|
||||
text: '省内包邮',
|
||||
value: 2
|
||||
}, {
|
||||
text: '邮费电联',
|
||||
value: 3
|
||||
}],
|
||||
categoryOptions:[],
|
||||
conditionOptions:[
|
||||
{name:'全新',value:'10'},
|
||||
{name:'9成新',value:'9'},
|
||||
{name:'8成新',value:'8'},
|
||||
{name:'7成新',value:'7'},
|
||||
{name:'6成新',value:'6'},
|
||||
{name:'5成新',value:'5'},
|
||||
{name:'4成新',value:'4'},
|
||||
{name:'3成新',value:'3'},
|
||||
{name:'2成新',value:'2'},
|
||||
{name:'1成新',value:'1'},
|
||||
{name:'全新(未开箱)',value:'10'},
|
||||
{name:'95%新(开箱无瑕)',value:'9'},
|
||||
{name:'90%新(外观轻损<2处)',value:'8'},
|
||||
{name:'85%新(外观轻损<3处)',value:'7'},
|
||||
{name:'75%新(外观轻损<5处)',value:'6'},
|
||||
{name:'70%新(外观轻损<6处)',value:'5'},
|
||||
{name:'60%新(外观轻损<7处)',value:'4'},
|
||||
{name:'不足60%新(外观损伤>7处)',value:'3'}
|
||||
],
|
||||
form:{
|
||||
agename:'',
|
||||
@@ -140,7 +171,8 @@ export default {
|
||||
sku_id:'',
|
||||
content:'',
|
||||
media:[],
|
||||
price:''
|
||||
price:'',
|
||||
is_free:1
|
||||
},
|
||||
selfChecked: false,
|
||||
showlogin:false,
|
||||
@@ -153,6 +185,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
isLogin() {
|
||||
return !!uni.getStorageSync('is_login')
|
||||
},
|
||||
canSubmit(){
|
||||
return this.agree && this.form.content.trim().length>0 && this.form.media.length>0
|
||||
},
|
||||
@@ -162,13 +197,30 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getcategory()
|
||||
},
|
||||
onShow() {
|
||||
|
||||
// this.getset()
|
||||
// this.syncTabbar()
|
||||
},
|
||||
methods:{
|
||||
onSelectCategory() {
|
||||
if (!uni.getStorageSync('is_login')) {
|
||||
this.showlogin = true
|
||||
return
|
||||
}
|
||||
this.getcategory()
|
||||
this.showSelect1 = true
|
||||
},
|
||||
checkLogin(cb) {
|
||||
if (!this.isLogin) {
|
||||
this.showlogin = true
|
||||
return
|
||||
}
|
||||
if (typeof cb === 'function') {
|
||||
cb()
|
||||
}
|
||||
},
|
||||
getlocation(){
|
||||
wx.getFuzzyLocation({
|
||||
type: 'wgs84',
|
||||
@@ -205,6 +257,7 @@ export default {
|
||||
})
|
||||
},
|
||||
selectCategory(item){
|
||||
this.skudetils = item
|
||||
this.form.category = item.model || ''
|
||||
this.form.sku_id = item.id || ''
|
||||
// 处理富文本,让图片自适应
|
||||
@@ -243,6 +296,7 @@ export default {
|
||||
phone_code: e.detail.code,
|
||||
}
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.data.code == -1) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
@@ -256,7 +310,7 @@ export default {
|
||||
});
|
||||
//返回数据接收成功
|
||||
uni.setStorageSync('is_login', true);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//商品下拉
|
||||
@@ -294,7 +348,7 @@ export default {
|
||||
uploadfn(imgUrl){
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: 'https://cb.hnxinyouhe.com/upload/image?scene=postlist',
|
||||
url: 'https://bsh.info.yw.hnzhwlkj.cn/upload/image?scene=postlist',
|
||||
filePath: imgUrl,
|
||||
name: 'image',
|
||||
header:{'content-type': 'application/x-www-form-urlencoded','Fdesk-Auth-Token': 'Bearer ' + uni.getStorageSync('token'),'Fdesk-Language': uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh','Fdesk-Login-Type': 'wechat','Fdesk-System-Code':'wechat'},
|
||||
@@ -359,6 +413,23 @@ export default {
|
||||
this.agree = true
|
||||
this.show = false
|
||||
},
|
||||
reset(){
|
||||
this.form.agename='';
|
||||
this.form.age='';
|
||||
this.form.category='';
|
||||
this.form.sku_id='';
|
||||
this.form.content='';
|
||||
this.form.media=[];
|
||||
this.form.price='';
|
||||
this.form.is_free=1;
|
||||
this.productcontents=''
|
||||
// 同步清理文件选择器内部的文件列表
|
||||
this.$nextTick(() => {
|
||||
if(this.$refs.mediaPicker && this.$refs.mediaPicker.clearFiles){
|
||||
this.$refs.mediaPicker.clearFiles()
|
||||
}
|
||||
})
|
||||
},
|
||||
submitForm(){
|
||||
// 必填校验
|
||||
if(!this.form.category || !this.form.sku_id){
|
||||
@@ -413,10 +484,12 @@ export default {
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
if(res.data.code ==200){
|
||||
this.reset()
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/square/index',// 替换为你要跳转的页面路径
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/my_favorites',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
@@ -563,6 +636,11 @@ export default {
|
||||
.mag-top{
|
||||
margin-top: 15px;
|
||||
}
|
||||
.free{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.content-textarea{
|
||||
width: 100%;
|
||||
// background: #F7F8FB;
|
||||
@@ -638,8 +716,9 @@ export default {
|
||||
.foot{
|
||||
background: #fff;
|
||||
position: fixed;
|
||||
bottom: 1rpx;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
z-index: 11;
|
||||
}
|
||||
.agreement{
|
||||
margin: 20px 12px;
|
||||
@@ -790,4 +869,51 @@ export default {
|
||||
line-height: 50px;
|
||||
}
|
||||
}
|
||||
.product-card {
|
||||
background: #fff;
|
||||
margin-top: 16rpx;
|
||||
padding: 24rpx 24rpx 12rpx;
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: #111;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.price-row {
|
||||
margin-top: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.price {
|
||||
font-size: 36rpx;
|
||||
color: #111;
|
||||
font-weight: 700;
|
||||
}
|
||||
.retail {
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
}
|
||||
.model {
|
||||
margin-left: auto;
|
||||
font-size: 22rpx;
|
||||
color: #777;
|
||||
}
|
||||
.spec-row {
|
||||
margin-top: 18rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
font-size: 26rpx;
|
||||
color: #555;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.spec-label {
|
||||
color: #777;
|
||||
}
|
||||
.spec-value {
|
||||
color: #444;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<!-- 图集 -->
|
||||
<view class="gallery">
|
||||
<image v-if="detail.media && detail.media.length > 0" class="main-img" :src="detail.media[currentIndex].url_pull" mode="aspectFit"></image>
|
||||
<image v-if="detail.media && detail.media.length > 0" class="main-img" @click.stop="previewImage(currentIndex)"
|
||||
@longpress.stop="downloadImage(detail.media[currentIndex])" :src="detail.media[currentIndex].url_pull" mode="aspectFit"></image>
|
||||
<scroll-view class="thumb-row" scroll-x>
|
||||
<view class="thumb-container">
|
||||
<image
|
||||
@@ -40,7 +41,18 @@
|
||||
<text class="spec-label">{{item.attr_name}}:</text>
|
||||
<text class="spec-value">{{ item.attr_value }}</text>
|
||||
</view>
|
||||
<view class="spec-row">
|
||||
<text class="spec-label">是否包邮:</text>
|
||||
<text class="spec-value">{{ detail.is_free==0?'不包邮':detail.is_free==1?'全国包邮':detail.is_free==2?'省内包邮':'邮费电联' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="product-card" v-if="detail.sku.point">
|
||||
<view class="product-point-title"> 产品卖点 </view>
|
||||
<view class="point-tabs" >
|
||||
<view class="tabs-txt" v-for="(item, idx) in detail.sku.point.attr_values" :key="idx">{{item}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- Tabs -->
|
||||
<view class="tabs">
|
||||
@@ -101,7 +113,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="bottom-bar">
|
||||
<view class="bottom-bar" v-if="currentTab === 'comment'">
|
||||
<view class="input-box">
|
||||
<uni-icons type="compose" size="20" color="#bbb"></uni-icons>
|
||||
<input class="input"
|
||||
@@ -701,6 +713,7 @@ page,
|
||||
margin-top: 12rpx;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.thumb-container {
|
||||
display: inline-flex;
|
||||
@@ -741,6 +754,20 @@ page,
|
||||
color: #111;
|
||||
font-weight: 700;
|
||||
}
|
||||
.product-point-title{
|
||||
font-weight: bold;
|
||||
}
|
||||
.point-tabs{
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.tabs-txt{
|
||||
padding: 20rpx;
|
||||
color: #3BC6BD;
|
||||
background:rgb(59 198 189 / 0.12);
|
||||
display: inline-block;
|
||||
margin: 6px 5px;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.retail {
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
|
||||
@@ -83,6 +83,11 @@ export default {
|
||||
// this.syncTabbar()
|
||||
},
|
||||
methods: {
|
||||
goto(item){
|
||||
uni.navigateTo({
|
||||
url: '/pages/square/detiles?id='+item.id
|
||||
});
|
||||
},
|
||||
getFuzzy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getSetting({
|
||||
@@ -114,12 +119,38 @@ export default {
|
||||
uni.makePhoneCall({ phoneNumber: num });
|
||||
},
|
||||
changeTab(key) {
|
||||
if (this.currentTab === key) return
|
||||
this.currentTab = key
|
||||
this.page = 1
|
||||
this.hasMore = true
|
||||
this.slist = []
|
||||
this.loadList()
|
||||
if((this.longitude==''||this.latitude=='')&&key=='near'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请先授权地理位!',
|
||||
content: '请在设置中开启模糊定位权限',
|
||||
confirmText: '去设置',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.openSetting({
|
||||
success: (setRes) => {
|
||||
if (setRes.authSetting['scope.userFuzzyLocation']) {
|
||||
that.getFuzzy().then(res => {
|
||||
that.latitude = res.latitude
|
||||
that.longitude = res.longitude
|
||||
console.log(res);
|
||||
}).catch(err => console.error(err));
|
||||
} else {
|
||||
reject(new Error('未开启模糊定位权限'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.currentTab === key) return
|
||||
this.currentTab = key
|
||||
this.page = 1
|
||||
this.hasMore = true
|
||||
this.slist = []
|
||||
this.loadList()
|
||||
},
|
||||
loadList(isLoadMore = false) {
|
||||
if (isLoadMore) {
|
||||
|
||||
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 853 B |