Commit 21c10e86 authored by ddl's avatar ddl

首次提交:发布藏品、藏品列表、藏品详情

parent ca373411
......@@ -12,3 +12,4 @@ $RECYCLE.BIN/
# Node.js
node_modules/
miniprogram_npm/
......@@ -20,7 +20,9 @@
"lib/home/index",
"pages/wiki/wiki",
"pages/webview/webview",
"pages/book/list/list"
"pages/book/list/list",
"pages/publish/index",
"pages/publishGoods/goods"
],
"window": {
"navigationBarBackgroundColor": "#fff",
......@@ -57,6 +59,10 @@
{
"pagePath": "pages/ucenter/index/index",
"text": "我的"
},
{
"pagePath": "pages/publish/index",
"text": "发布收藏"
}
]
},
......
......@@ -2,9 +2,9 @@
// 本机开发API地址
// var WxApiRoot = 'http://localhost:8383/demo/wx/';
// 测试环境部署api地址
var WxApiRoot = 'http://127.0.0.1:8383/demo/wx/';
// var WxApiRoot = 'http://127.0.0.1:8383/demo/wx/';
// 线上云平台api地址
// var WxApiRoot = 'https://quanku.wanwudezhi.com/demo/wx/';
var WxApiRoot = 'https://quanku.wanwudezhi.com/demo/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
......@@ -105,5 +105,11 @@ module.exports = {
ExtractList: WxApiRoot + 'brokerage/extractList',//佣金账号提现记录
ArticleDetail: WxApiRoot + 'article/detail',//公告详情
ApplyAgency: WxApiRoot + 'user/applyAgency',//代理申请
GetSharedUrl: WxApiRoot + 'user/getSharedUrl' //获取推广二维码
GetSharedUrl: WxApiRoot + 'user/getSharedUrl', //获取推广二维码
PublishCoin: WxApiRoot + 'ugc_coin/add', // 发布钱币
PublishList: WxApiRoot + 'ugc_coin/list', // 我的发布列表
deletePublishList: WxApiRoot + 'ugc_coin/delete', // 删除我的发布列表
publishDetail: WxApiRoot + 'ugc_coin/detail', // 我的发布详情
uploadMulti: WxApiRoot + 'storage/uploadMulti', // 批量上传图片
publishEdit: WxApiRoot + 'ugc_coin/update' // 编辑发布藏品
};
\ No newline at end of file
......@@ -3,7 +3,6 @@ Component({
selected: 0,
color: "#7A7E83",
selectedColor: "#015C61",
tempFiles: [],
list: [
{
pagePath: "/pages/index/index",
......@@ -18,7 +17,7 @@ Component({
text: "泉典"
},
{
pagePath: "/pages/index/index",
pagePath: "/pages/publish/index",
iconPath: "../static/images/add.png",
selectedIconPath: "../static/images/add.png",
text: "",
......@@ -43,83 +42,8 @@ Component({
methods: {
switchTab(e) {
const data = e.currentTarget.dataset
console.log(data)
if (!data.click) {
const url = data.path
wx.switchTab({ url })
this.setData({
selected: data.index
})
} else {
var that = this;
wx.showActionSheet({
itemList: ['相册', '拍照', '从聊天记录选择'],
itemColor: "#000000",
success: function (res) {
if (!res.cancel) {
if (res.tapIndex == 0) {
that.chooseWxImage('album')
} else if (res.tapIndex == 1) {
that.chooseWxImage('camera')
} else if (res.tapIndex == 2) {
that.chooseFromChat()
}
}
}
})
}
},
chooseWxImage: function (source) {
var that = this
wx.chooseMedia({
mediaType: ['image','video'],
sourceType: [source],
maxDuration: 30,
camera: 'back',
count: 9,
success: function (res) {
console.log(res)
that.setData({
tempFiles: res.tempFiles,
})
}
})
},
chooseFromChat: function () {
var that = this
wx.chooseMessageFile({
count: 9,
type: 'all',
success: function (res) {
console.log(res)
that.setData({
tempFiles: res.tempFiles,
})
}
})
},
savePhone: function () {
// wx.getImageInfo({
// src: this.data.tempFilePaths[0],
// success: function (res) {
// var path = res.path
// wx.saveImageToPhotosAlbum({
// filePath: path,
// success: function () {
// wx.showToast({
// title: '保存成功',
// })
// },
// fail: function (res) {
// wx.showToast({
// title: '保存失败',
// icon: 'none'
// })
// }
// })
// }
// })
const url = data.path
wx.switchTab({url})
}
},
}
})
\ No newline at end of file
<!--miniprogram/custom-tab-bar/index.wxml-->
<view class="tab-bar">
<view class="tab-bar-border"></view>
<block wx:for="{{list}}" wx:key="index">
<view wx:if="{{item.isSpecial}}" class="tab-bar-item" data-path="{{item.pagePath}}" data-click="{{ item.isSpecial || false }}" data-index="{{index}}" bindtap="switchTab">
<view class="special-image">
<image class="special-image-pic" mode="aspectFit" src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
</view>
<view style="color: {{selected === index ? selectedColor : color}}" class="special-text tab-text">{{item.text}}</view>
</view>
<view wx:else class="tab-bar-item" data-path="{{item.pagePath}}" data-click="{{ item.isSpecial }}" data-index="{{index}}" bindtap="switchTab">
<image class="item-image" mode="aspectFit" src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
<view class="tab-text" style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
</view>
</block>
</view>
\ No newline at end of file
<cover-view class="tab-bar">
<cover-view class="tab-bar-border"></cover-view>
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
<cover-image class="{{item.isSpecial?'special-image-pic':''}}" src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></cover-image>
<cover-view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</cover-view>
</cover-view>
</cover-view>
......@@ -3,7 +3,7 @@
bottom: 0;
left: 0;
right: 0;
height: 96rpx;
height: 48px;
background: white;
display: flex;
padding-bottom: env(safe-area-inset-bottom);
......@@ -15,7 +15,7 @@
left: 0;
top: 0;
width: 100%;
height: 2rpx;
height: 1px;
transform: scaleY(0.5);
}
......@@ -28,27 +28,15 @@
flex-direction: column;
}
.tab-bar-item .item-image {
width: 52rpx;
height: 52rpx;
}
.tab-bar-item .special-image {
position: absolute;
top: 0rpx;
width: 96rpx;
height: 96rpx;
/* border-radius: 50%;
border-top: 2rpx solid #f2f2f3; */
/* background-color: #fff; */
text-align: center;
/* box-sizing: border-box; */
/* padding: 6rpx; */
}
.tab-bar-item .special-image .special-image-pic {
width: 100%;
height: 100%;
.tab-bar-item cover-image {
width: 27px;
height: 27px;
}
.tab-bar-item .tab-text {
font-weight: 10rpx;
.tab-bar-item cover-view {
font-size: 10px;
}
.special-image-pic {
width: 106rpx!important;
height: 76rpx!important;
}
{
"name": "qk_wx_miniprogram",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vant/weapp": {
"version": "1.10.14",
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.14.tgz",
"integrity": "sha512-5usuhoN1kiOV6pzrdVzHrAux6DupKlGd9w+yYc992Zy1n1wHLZMb1dGM3+xtbNE3tpWE2qv95vIFSMpJRFyE7Q=="
}
}
}
{
"name": "qk_wx_miniprogram",
"version": "1.0.0",
"description": "",
"main": "app.js",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://codeup.aliyun.com/64003488e9f200d37adbd095/qk_wx_miniprogram.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@vant/weapp": "^1.10.14"
}
}
// pages/book/list/list.js
const app = getApp();
const util = require('../../../utils/util.js');
const api = require('../../../config/api.js');
const user = require('../../../utils/user.js');
Page({
/**
......@@ -13,6 +16,23 @@ Page({
winHeight: 0,
// tab切换
currentTab: 0,
page:1,
size:20,
total:0,
goodsList: []
},
onDelete(item) {
if (item && item.detail) {
let that = this;
util.request(api.deletePublishList, {
id: item.detail
}).then(function(res) {
if (res.code === 1001) {
that.initList()
}
});
}
},
onLoad: function () {
var that = this;
......@@ -35,6 +55,24 @@ Page({
var that = this;
that.setData({ currentTab: e.detail.current });
},
getGoodsList: function() {
let userInfo = wx.getStorageSync('userInfo');
if (userInfo && userInfo.userId) {
let that = this;
util.request(api.PublishList, {
page: that.data.page,
size: that.data.size,
userId: userInfo.userId,
}).then(function(res) {
if (res.code === 1001) {
that.setData({
goodsList: that.data.goodsList.concat(res.data),
total: res.total
});
}
});
}
},
/**
* 点击tab切换
*/
......@@ -46,6 +84,7 @@ Page({
that.setData({
currentTab: e.target.dataset.current
})
that.initList()
}
},
......@@ -53,7 +92,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
......@@ -62,12 +101,25 @@ Page({
onReady() {
},
initList:function() {
if (this.data.currentTab == 0) {
this.setData({
page:1,
goodsList:[]
})
this.getGoodsList()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if(typeof this.getTabBar === 'function' && this.getTabBar) {
this.getTabBar().setData({
selected:1
})
}
this.initList()
},
/**
......@@ -94,8 +146,20 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
onReachBottom:function() {
if (this.data.total > this.data.goodsList.length) {
this.setData({
page: this.data.page + 1
});
} else {
wx.showToast({
title: '已经到底了!',
icon: 'none',
duration: 2000
});
return false;
}
this.getGoodsList();
},
/**
......
{
"usingComponents": {}
"usingComponents": {
"publishCard": "../../component/publishCard/index"
}
}
\ No newline at end of file
......@@ -4,7 +4,11 @@
<view class="swiper-tab-list {{currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="swichNav">我买的</view>
<view class="swiper-tab-list {{currentTab==2 ? 'on' : ''}}" data-current="2" bindtap="swichNav">平台推荐</view>
</view>
<swiper current="{{currentTab}}" class="swiper-box" duration="300" bindchange="bindChange">
<view v-if="currentTab==0">
<publishCard goods-list="{{goodsList}}" bind:onDelete="onDelete"/>
<view class="empty__wrap"></view>
</view>
<!-- <swiper current="{{currentTab}}" class="swiper-box" duration="300" bindchange="bindChange">
<swiper-item>
<view>我是哈哈</view>
</swiper-item>
......@@ -15,5 +19,5 @@
<swiper-item>
<view>我是嘿嘿</view>
</swiper-item>
</swiper>
</swiper-item> -->
<!-- </swiper> -->
......@@ -13,4 +13,8 @@
.swiper-box{ display: block; height: 100%; width: 100%; overflow: hidden; }
.swiper-box view{
text-align: center;
}
.empty__wrap {
width: 100%;
height: 82px;
}
\ No newline at end of file
'use strict';
Component({
properties: {
goodsList: {
type: Array,
value: [],
observer: function(newVal, oldVal) {
console.log(newVal, oldVal,'----newVal, oldVal')
// 属性值变化时执行
}
}
}
});
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<view class="cate-item">
<view class="b">
<navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
<image class="img" src="{{iitem.topImage}}" background-size="cover"><text class="year">{{iitem.bidTime}}</text></image>
<text class="name">{{iitem.name}}</text>
<text class="price" wx:if="{{iitem.price}}">¥{{iitem.price}}</text>
<text class="price" wx:if="{{!iitem.price}}">未成交</text>
</navigator>
</view>
</view>
.cate-item {
height: auto;
overflow: hidden;
}
.cate-item .h {
height: 145rpx;
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.cate-item .h .name {
display: block;
height: 35rpx;
margin-bottom: 18rpx;
font-weight:bold;
font-size: 30rpx;
color: #333;
}
.cate-item .item .year {
display: block;
height: 20rpx;
font-weight: bold;
margin-bottom: 0rpx;
font-size: 20rpx;
color: rgb(241, 149, 10);
}
.cate-item .h .desc {
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}
.cate-item .b {
width: 750rpx;
padding: 0 6.25rpx;
height: auto;
overflow: hidden;
}
.cate-item .list-filter {
height: 80rpx;
width: 100%;
background: #fff;
margin-bottom: 6.25rpx;
}
.cate-item .b .item {
float: left;
background: #fff;
width: 365rpx;
margin-bottom: 6.25rpx;
padding-bottom: 33.333rpx;
height: auto;
overflow: hidden;
text-align: center;
}
.cate-item .b .item-b {
margin-left: 6.25rpx;
}
.cate-item .item .img {
width: 370rpx;
height: 370rpx;
}
.cate-item .item .year {
position: absolute;
margin-top: -30rpx;
margin-left: 10rpx;
height: 20rpx;
margin-bottom: 0rpx;
font-size: 20rpx;
color: rgb(255, 154, 2);
}
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 36rpx;
margin: 0 0 0 0;
text-align: center;
font-weight: bold;
overflow: hidden;
padding: 0 0rpx;
font-size: 32rpx;
color: #333;
}
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
font-weight: bold;
margin-top: 2rpx;
font-size: 32rpx;
color: #ec4223;
}
\ No newline at end of file
Component({
properties: {
goodsList: {
type: Array,
value: [],
observer: function (newVal, oldVal) {
// 属性值变化时执行
}
}
},
methods: {
onEdit:function(e) {
let item = e.currentTarget.dataset.iitem || null
if (item && item.id) {
let url = `/pages/publish/index?id=${item.id}`
wx.reLaunch({
url: url
});
}
},
onDelete: function (e) {
let item = e.currentTarget.dataset.iitem || null
if (item && item.id) {
this.triggerEvent('onDelete', item.id)
}
}
}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<view class="cate-item">
<view class="b">
<navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/publishGoods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
<image class="img" src="{{iitem.images && iitem.images[0]}}" background-size="cover"><text class="year">{{_getTime(iitem.bidTime)}}</text></image>
<text class="name">{{iitem.name}}</text>
<view class="flex__price">
<text class="price">¥{{iitem.price?iitem.price/100:0 }}</text>
<view>
<text class="flex_s" catchtap="onDelete" data-iitem="{{iitem}}">删除</text>
<text class="flex_s ml10" catchtap="onEdit" data-iitem="{{iitem}}">编辑</text>
</view>
</view>
</navigator>
</view>
</view>
.cate-item {
height: auto;
overflow: hidden;
}
.cate-item .h {
height: 145rpx;
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.cate-item .h .name {
display: block;
height: 35rpx;
margin-bottom: 18rpx;
font-weight:bold;
font-size: 30rpx;
color: #333;
}
.cate-item .item .year {
display: block;
height: 20rpx;
font-weight: bold;
margin-bottom: 0rpx;
font-size: 20rpx;
color: rgb(241, 149, 10);
}
.cate-item .h .desc {
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}
.cate-item .b {
width: 750rpx;
padding: 0 6.25rpx;
height: auto;
overflow: hidden;
}
.cate-item .list-filter {
height: 80rpx;
width: 100%;
background: #fff;
margin-bottom: 6.25rpx;
}
.cate-item .b .item {
float: left;
background: #fff;
width: 365rpx;
margin-bottom: 6.25rpx;
padding-bottom: 33.333rpx;
height: auto;
overflow: hidden;
text-align: center;
}
.cate-item .b .item-b {
margin-left: 6.25rpx;
}
.cate-item .item .img {
width: 370rpx;
height: 370rpx;
}
.cate-item .item .year {
position: absolute;
margin-top: -30rpx;
margin-left: 10rpx;
height: 20rpx;
margin-bottom: 0rpx;
font-size: 20rpx;
color: rgb(255, 154, 2);
}
.cate-item .item .name {
display: block;
width: 365.625rpx;
/* height: 36rpx; */
margin: 0 0 0 0;
text-align: left;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 5rpx;
font-size: 32rpx;
color: #333;
}
.cate-item .item .price {
display: block;
/* width: 365.625rpx;
height: 30rpx; */
text-align: left;
font-weight: bold;
margin-top: 2rpx;
font-size: 32rpx;
color: #ec4223;
}
.flex__price {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 5rpx;
}
.flex_s {
flex-shrink: 0;
margin-right: 5rpx;
}
.ml10 {
margin-left: 10rpx;
}
\ No newline at end of file
......@@ -125,12 +125,17 @@ Page({
// 页面渲染完成
let that = this;
let userInfo = wx.getStorageSync('userInfo');
if (userInfo && that.data.coupon.length > 0) {
if (userInfo && that.data.coupon && that.data.coupon.length > 0) {
that.setData({ window: true });
}
},
onShow: function() {
app.getCurrentTabbar(0,this);
if(typeof this.getTabBar === 'function' && this.getTabBar) {
this.getTabBar().setData({
selected:0
})
}
},
onHide: function() {
// 页面隐藏
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"zan-capsule": "../../lib/zanui-weapp/capsule/index",
"coupon-window": "../../lib/coupon-window/index",
"home": "../../lib/home/index"
"home": "../../lib/home/index",
"goodsCard": "../component/goodsCard/index"
}
}
\ No newline at end of file
......@@ -20,16 +20,7 @@
</navigator>
</view>
<view class="search-result">
<view class="cate-item">
<view class="b">
<navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
<image class="img" src="{{iitem.topImage}}" background-size="cover"><text class="year">{{iitem.bidTime}}</text></image>
<text class="name">{{iitem.name}}</text>
<text class="price" wx:if="{{iitem.price}}">¥{{iitem.price}}</text>
<text class="price" wx:if="{{!iitem.price}}">未成交</text>
</navigator>
</view>
</view>
<goodsCard goods-list="{{goodsList}}" />
</view>
</view>
......
const util = require('../../utils/util.js');
const api = require('../../config/api.js');
const user = require('../../utils/user.js');
//获取应用实例
const app = getApp();
Page({
data: {
form: {
bidTime: new Date().getTime()
},
currentDate: new Date().getTime(),
showVo: {},
bidTime: '',
images: [],
orgTime: '',
orgId: ''
},
onClose() {
this.setData({
showVo: {
show: false
}
})
},
// 选择时间
onSelectTime() {
this.setData({
showVo: {
show: true
},
})
},
getTime(time) {
let date = new Date(time); // 参数需要毫秒数,所以这里将秒数乘于 1000
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + h + m + s
},
// 点击确定时间
onSubmitTime(val) {
if (val && val.detail) {
let time = this.getTime(val.detail)
this.setData({
bidTime: time,
orgTime: val.detail,
showVo: {
show: false
}
})
}
},
formSubmit: function (e) {
let form = e.detail.value
if (!form.name) { // 名称
wx.showToast({
title: '请填写藏品名称!',
icon: 'none',
});
return
} else if (form.price) {
form.price = form.price && (form.price - 0).toFixed(2)
form.price = (form.price - 0) * 100
}
let data = {
bidTime: this.data.orgTime / 1000,
name: form.name,
detail: form.detail,
images: this.data.images,
price: form.price,
}
if (this.data.orgId) {
data.id = this.data.orgId
}
let that = this
wx.showLoading({
title: that.data.orgId ? '更新中...' : '发布中...'
})
util.request(that.data.orgId ? api.publishEdit : api.PublishCoin, data, 'POST').then(function (res) {
if (res.code == 1001) {
wx.showToast({
title: that.data.orgId?'更新成功!':"发布成功!"
});
that.setData({
form: {},
bidTime: '',
orgTime: '',
images: []
})
wx.redirectTo({
url: "/pages/book/list/list"
});
} else {
util.showErrorToast(res.errmsg || '发布失败!')
}
wx.hideLoading()
}).catch(() => {
wx.hideLoading()
})
},
chooseImage: function (e) {
let that = this;
if (this.data.images.length >= 10) {
util.showErrorToast('最多上传十张图片')
return false;
}
wx.showActionSheet({
itemList: ['相册', '拍照', '从聊天记录选择'],
itemColor: "#000000",
success: function (res) {
if (!res.cancel) {
if (res.tapIndex == 0) {
that.chooseWxImage('album')
} else if (res.tapIndex == 1) {
that.chooseWxImage('camera')
} else if (res.tapIndex == 2) {
that.chooseFromChat()
}
}
}
})
},
uploadFile: function (path) {
let that = this
wx.uploadFile({
filePath: path,
name: 'file',
url: api.StorageUpload,
header: {
"Content-Type": "multipart/form-data",
'accept': 'application/json',
'X-Dts-Token': wx.getStorageSync('token')
},
success: function (res) {
if (res && res.data) {
let data = JSON.parse(res.data);
let list = that.data.images
if (data.data && data.data.url) {
list.push(data.data.url)
that.setData({
images: list
})
}
} else {
util.showErrorToast('上传失败!')
}
}
})
},
onDelete: function(e) {
let index = e.currentTarget && e.currentTarget.dataset &&e.currentTarget.dataset.index
let list = this.data.images
list.splice(index,1)
this.setData({
images:list
})
},
chooseWxImage: function (source) {
var that = this
wx.chooseMedia({
mediaType: ['image'],
sourceType: [source],
maxDuration: 30,
camera: 'back',
count: 9,
success: function (res) {
if (res && res.tempFiles && res.tempFiles.length) {
if(res.tempFiles.length+that.data.images.length>10) {
return util.showErrorToast('最多上传十张图片')
}
for (let i = 0; i < res.tempFiles.length; i++) {
that.uploadFile(res.tempFiles[i].tempFilePath)
}
}
}
})
},
chooseFromChat: function () {
var that = this
wx.chooseMessageFile({
count: 9,
type: 'all',
success: function (res) {
if (res && res.tempFiles && res.tempFiles.length) {
if(res.tempFiles.length+that.data.images.length>10) {
return util.showErrorToast('最多上传十张图片')
}
for (let i = 0; i < res.tempFiles.length; i++) {
that.uploadFile(res.tempFiles[i].path)
}
}
}
})
},
previewImage: function (e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.images // 需要预览的图片http链接列表
})
},
onShareAppMessage: function () {
},
onPullDownRefresh() {
this.onClear()
},
onLoad: function (option) {
if (option && option.id) { // 编辑
this.getDetail(option.id)
}
},
getDetail: function (id) {
let that = this;
util.request(api.publishDetail, {
id: id
}).then(function (res) {
if (res.code === 1001) {
let data = res.data
let bidTime = util.formatTime(new Date(data.bidTime * 1000)) // 变为年月日用作展示
data.price = data.price / 100
data.bidTime = data.bidTime * 1000
that.setData({
form: {
...data
},
bidTime: bidTime,
orgId: id,
orgTime: data.bidTime * 1000,
images: data.images
})
} else {
util.showErrorToast('获取详情失败!')
}
});
},
onReady: function () {
},
onShow: function () {
if (typeof this.getTabBar === 'function' && this.getTabBar) {
this.getTabBar().setData({
selected: 2
})
}
},
onClear: function() {
this.setData({
form: {
bidTime: new Date().getTime()
},
currentDate: new Date().getTime(),
showVo: {},
bidTime: '',
images: [],
orgTime: '',
orgId: ''
})
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
},
})
\ No newline at end of file
{
"navigationBarTitleText": "须弥泉典",
"usingComponents": {
"zan-capsule": "../../lib/zanui-weapp/capsule/index",
"coupon-window": "../../lib/coupon-window/index",
"home": "../../lib/home/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index"
}
}
\ No newline at end of file
<!--publish.wxml-->
<view class="container__wrap">
<form bindsubmit="formSubmit">
<view class="form__des">
<view class="form__wrap flex f-ai-c mb20">
<i class="form__icon">
*
</i>
<input class="text" placeholder="请输入藏品名称" value="{{form.name}}" name="name" style="width:100%" maxlength="20"/>
</view>
<view class="mb20">
<textarea maxlength="500" class="form__textarea" value="{{form.detail}}" name="detail" placeholder="请输入藏品来源、特点等简要信息" />
</view>
</view>
<view class="form__des mb20">
<view class="weui-uploader__files flex" id="uploaderFiles">
<block wx:for="{{images}}" wx:key="*this">
<view class="weui-uploader__file flex " bindtap="previewImage" id="{{item}}" wx:if="{{ images && images.length>0 }}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" name="detail" wx:if="{{item}}"/>
<view class='iconfont icon-guanbi3 close__icon' catchtap='onDelete' wx:key="index" data-index="{{index}}" wx:if="{{item}}"></view>
</view>
</block>
<view class="weui-uploader__input-box" wx:if="{{ images.length < 9 }}" bindtap="chooseImage">
<view class="weui-uploader__input"></view>
<view class="upload__text">
上传照片
</view>
</view>
</view>
</view>
<view class="form__wrap flex f-ai-c f-jc-sb mb20">
<view class="form__title">
藏品价格
</view>
<input class="form__input--num" type="digit" name="price" value="{{form.price}}" placeholder="请输入入手价或交易价格" />
</view>
<view class="form__wrap flex f-ai-c f-jc-sb mb20">
<view class="form__title">
购买时间
</view>
<view bindtap="onSelectTime">{{bidTime || '选择时间'}}</view>
</view>
<button class="mini-btn" type="default" size="mini" bindtap="onClear">清空</button>
<button formType="submit" class="submit__btn">
发布收藏
</button>
</form>
<van-popup show="{{ showVo.show }}" bind:close="onClose" position="bottom">
<van-datetime-picker type="datetime" value="{{ form.bidTime }}" bind:confirm="onSubmitTime" />
</van-popup>
<view class="empty__bottom"></view>
</view>
\ No newline at end of file
.container__wrap {
width: 100%;
background-color: #fff;
padding: 0 20rpx;
height: 100vh;
overflow-y: scroll;
position: relative;
}
.form__des {
width: 100%;
padding: 15rpx;
background-color: #fff;
border-radius: 8rpx;
}
.form__textarea {
width: 100%;
height: 320rpx;
}
.form__icon {
color: #F93C3C;
font-size: 32rpx;
margin: 5rpx 4rpx 0 0;
}
.form__wrap {
padding-bottom: 20rpx;
border-bottom: 1px solid #EAEBED;
}
.form__input {
width: 80%;
height: 40rpx;
/* border: 1px solid #CACAD3; */
border-radius: 4rpx;
padding: 5rpx;
}
.form__title {
font-weight: 500;
flood-color: #333;
margin-right: 10rpx;
font-size: 30rpx;
}
.submit__btn {
/* width: 100%; */
height: 96rpx;
background: #17191C;
border-radius: 8rpx;
color: #fff;
line-height: 96rpx;
text-align: center;
position: fixed;
bottom: 200rpx;
left: 24rpx;
right: 24rpx;
}
.weui-uploader__input-box {
position: relative;
/* margin-right: 9px;
margin-bottom: 9px; */
width: 160rpx;
height: 160rpx;
background: #F6F6F7;
border-radius: 4px;
flex-shrink: 0;
}
.upload__text {
position: absolute;
bottom: 10%;
width: 100%;
text-align: center;
}
.weui-uploader__img {
display: block;
width: 160rpx;
height: 160rpx;
margin: 0 10rpx 10rpx 0;
flex-shrink: 0;
}
.weui-uploader__input-box:after, .weui-uploader__input-box:before {
content: " ";
position: absolute;
top: 35%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #17191C;
}
.weui-uploader__input-box:before {
width: 2px;
height: 30px;
}
.weui-uploader__input-box:after {
width: 30px;
height: 2px;
}
.weui-uploader__input-box:active {
border-color: #999;
}
.weui-uploader__input-box:active:after, .weui-uploader__input-box:active:before {
background-color: #999;
}
.form__input--num {
width: 350rpx;
text-align: right;
}
.mb20 {
margin-bottom: 20rpx;
}
.f-jc-sb {
justify-content: space-between;
}
.f-ai-c {
align-items: center;
}
.weui-uploader__file {
flex-wrap: wrap;
position: relative;
}
.flex{
display: flex;
}
.weui-uploader__files {
width: 100%;
flex-wrap: wrap;
}
.close__icon {
font-size: 30rpx;
position: absolute;
right: 20rpx;
top: 10rpx;
}
.empty__bottom {
width: 100%;
height: 650rpx;
}
\ No newline at end of file
var app = getApp();
var WxParse = require('../../lib/wxParse/wxParse.js');
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var user = require('../../utils/user.js');
Page({
data: {
id: 0,
goods: {},
issueList: [],
comment: [],
userHasCollect: 0,
openShare: false,
noCollectImage: '/static/images/icon_like.png',
hasCollectImage: '/static/images/icon_like_checked.png',
collectImage: '/static/images/icon_like.png',
shareImage: '',
canWrite: false, //用户是否获取了保存相册的权限
},
handlePrevewImage(event) {
const current = event.currentTarget.dataset.url; // urls 第一张图
// 1. 先构造要预览的图片数组
const urls = this.data.goods.images.map(v => v); // 是一个数组,预览时可左右翻页
const showmenu = true;
wx.previewImage({
current,
urls,
showmenu
})
},
// 页面分享
onShareAppMessage: function() {
let that = this;
let userInfo = wx.getStorageSync('userInfo');
let shareUserId = 1;
if (userInfo) {
shareUserId = userInfo.userId;
}
return {
title: that.data.goods.name,
desc: '钱币分享',
path: '/pages/goods/goods?id=' + this.data.id + '&shareUserId=' + shareUserId
}
},
shareFriendOrCircle: function() {
let that = this;
util.request(api.CreateShareImg, {
shareObjId: that.data.id,
type:1 //商品类型的海报图
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.setData({
shareImage: res.data.shareUrl
});
}
});
if (this.data.openShare === false) {
this.setData({
openShare: !this.data.openShare
});
} else {
return false;
}
},
handleSetting: function(e) {
var that = this;
if (!e.detail.authSetting['scope.writePhotosAlbum']) {
wx.showModal({
title: '警告',
content: '不授权无法保存',
showCancel: false
})
that.setData({
canWrite: false
})
} else {
wx.showToast({
title: '保存成功'
})
that.setData({
canWrite: true
})
}
},
// 保存分享图
saveShare: function() {
let that = this;
wx.downloadFile({
url: that.data.shareImage,
success: function(res) {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
wx.showModal({
title: '存图成功',
content: '图片成功保存到相册了,可以分享到朋友圈了',
showCancel: false,
confirmText: '好的',
confirmColor: '#a78845',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
})
},
fail: function(res) {
console.log('fail')
}
})
},
fail: function() {
console.log('fail')
}
})
},
getTime: function(val) {
return val
},
// 获取商品信息
getGoodsInfo: function() {
let that = this;
util.request(api.publishDetail, {
id: that.data.id
}).then(function(res) {
let data = res.data
data.bidTime = util.formatTime(new Date(data.bidTime*1000))
if (res.code === 1001) {
that.setData({
goods: data,
});
}
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
if (options.id) {
this.setData({
id: parseInt(options.id)
});
this.getGoodsInfo();
}
if (options.grouponId) {
this.setData({
isGroupon: true,
});
this.getGrouponInfo(options.grouponId);
}
},
onShow: function() {
},
//添加或是取消收藏
addCollectOrNot: function() {
let that = this;
util.request(api.CollectAddOrDelete, {
type: 0,
valueId: this.data.id
}, "POST")
.then(function(res) {
let _res = res;
if (_res.errno == 0) {
if (_res.data.type == 'add') {
that.setData({
collectImage: that.data.hasCollectImage
});
} else {
that.setData({
collectImage: that.data.noCollectImage
});
}
} else {
wx.showToast({
image: '/static/images/icon_error.png',
title: _res.errmsg,
mask: true
});
}
});
},
goToSrc: function() {
wx.navigateTo({
url: "/pages/out/out?targetUrl="+encodeURIComponent(this.data.goods.url),
})
},
cutNumber: function() {
this.setData({
number: (this.data.number - 1 > 1) ? this.data.number - 1 : 1
});
},
addNumber: function() {
this.setData({
number: this.data.number + 1
});
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchAttrPop: function() {
if (this.data.openAttr == false) {
this.setData({
openAttr: !this.data.openAttr
});
}
},
closeAttr: function() {
this.setData({
openAttr: false,
});
},
closeShare: function() {
this.setData({
openShare: false,
});
},
onReady: function() {
// 页面渲染完成
},
// 下拉刷新
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getGoodsInfo();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
//根据已选的值,计算其它值的状态
setSpecValueStatus: function() {
},
})
\ No newline at end of file
{
"navigationBarTitleText": "钱币详情",
"enablePullDownRefresh": true
}
\ No newline at end of file
<view class="container">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.images}}" wx:key="*this" bindtap="handlePrevewImage">
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper>
<view class="share-pop-box" hidden="{{!openShare}}">
<view class="share-pop">
<view class="close" bindtap="closeShare">
<image class="icon" src="/static/images/icon_close.png"></image>
</view>
<view class='share-info'>
<button class="sharebtn" open-type="share">
<image class='sharebtn_image' src='/static/images/wechat.png'></image>
<view class='sharebtn_text'>分享给好友</view>
</button>
<button class="savesharebtn" open-type="openSetting" bindopensetting="handleSetting" wx:if="{{!canWrite}}" >
<image class='sharebtn_image' src='/static/images/friend.png'></image>
<view class='sharebtn_text'>保存海报到相册</view>
</button>
<button class="savesharebtn" bindtap="saveShare" wx:if="{{canWrite}}">
<image class='sharebtn_image' src='/static/images/friend.png'></image>
<view class='sharebtn_text'>保存海报到相册</view>
</button>
</view>
</view>
</view>
<view class="goods__title">
{{goods.name}}
</view>
<view class="goods-info">
<view class="c flex">
<view class="price">
<view class="retailPrice jhx_f8" wx:if="{{goods.price}}"><p style="font-size: 30rpx; font-weight: 100;">成交价:</p>¥{{goods.price/100}}</view>
<view class="retailPrice jhx_f8" wx:if="{{!goods.price}}">未成交</view>
</view>
<view class="retailPrice jhx_f8" wx:if="{{goods.price && goods.bidTime}}"><p style="font-size: 30rpx; font-weight: 10; color: black;">成交于<i>{{goods.bidTime}}</i></p></view>
</view>
</view>
<view class="comments" wx:if="{{comment.count > 0}}">
<view class="h">
<navigator url="/pages/comment/comment?valueId={{goods.id}}&type=0">
<text class="t jhx_f4">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
<text class="i jhx_f6">查看全部</text>
</navigator>
</view>
<view class="b">
<view class="item" wx:for="{{comment.data}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.avatar}}"></image>
<text>{{item.nickname}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="content">
{{item.content}}
</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="iitem" src="{{iitem}} "></image>
</view>
</view>
</view>
</view>
<view class="line"></view>
<view class="detail">
{{goods.detail}}
</view>
</view>
\ No newline at end of file
This diff is collapsed.
......@@ -64,6 +64,11 @@ Page({
},
onShow:function(){
if(typeof this.getTabBar === 'function' && this.getTabBar) {
this.getTabBar().setData({
selected:4
})
}
//获取用户的登录信息
if (app.globalData.hasLogin) {
let userInfo = wx.getStorageSync('userInfo');
......
......@@ -33,6 +33,11 @@ Page({
onShow() {
// 判断进入场景
console.log(app.globalData.isBackOriginalTab)
if(typeof this.getTabBar === 'function' && this.getTabBar) {
this.getTabBar().setData({
selected:3
})
}
if (!app.globalData.isBackOriginalTab) {
// 刚进入tab,页面初次加载
wx.showLoading({ title: '加载中...' })
......
......@@ -3,7 +3,7 @@
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"enhance": true,
"postcss": true,
"minified": true,
"newFeature": true,
......@@ -16,7 +16,15 @@
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"ignoreUploadUnusedFiles": true,
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
]
},
"compileType": "miniprogram",
"libVersion": "2.16.0",
......@@ -227,6 +235,16 @@
"pathName": "pages/index/index",
"query": "shareUserId=100",
"scene": 1011
},
{
"name": "发布收藏",
"pathName": "pages/publish/index",
"query": ""
},
{
"name": "发布藏品详情",
"pathName": "pages/publishGoods/goods",
"query": "id=3070579"
}
]
}
......
......@@ -4,5 +4,225 @@
"setting": {
"compileHotReLoad": true,
"urlCheck": false
},
"libVersion": "2.25.4",
"condition": {
"miniprogram": {
"list": [
{
"name": "首页",
"pathName": "pages/index/index",
"query": ""
},
{
"name": "专题",
"pathName": "pages/topic/topic",
"query": ""
},
{
"name": "专题详情",
"pathName": "pages/topicDetail/topicDetail",
"query": "id=314"
},
{
"name": "专题评论列表",
"pathName": "pages/topicComment/topicComment",
"query": "valueId=314&type=1"
},
{
"name": "专题评论添加",
"pathName": "pages/topicCommentPost/topicCommentPost",
"query": "valueId=314&type=1"
},
{
"name": "品牌",
"pathName": "pages/brand/brand",
"query": ""
},
{
"name": "品牌详情",
"pathName": "pages/brandDetail/brandDetail",
"query": "id=1001000"
},
{
"name": "人气推荐",
"pathName": "pages/hotGoods/hotGoods",
"query": ""
},
{
"name": "新品首发",
"pathName": "pages/newGoods/newGoods",
"query": ""
},
{
"name": "分类",
"pathName": "pages/catalog/catalog",
"query": ""
},
{
"name": "分类详情",
"pathName": "pages/category/category",
"query": "id=1008002"
},
{
"name": "分类详情",
"pathName": "pages/subcategory/subcategory",
"query": "id=1008002"
},
{
"name": "查找",
"pathName": "pages/search/search",
"query": ""
},
{
"name": "商品",
"pathName": "pages/goods/goods",
"query": "id=1181003"
},
{
"name": "商品评论列表",
"pathName": "pages/comment/comment",
"query": "valueId=1181000&type=0"
},
{
"name": "购物车",
"pathName": "pages/cart/cart",
"query": ""
},
{
"name": "下单",
"pathName": "pages/checkout/checkout",
"query": ""
},
{
"name": "支付结果",
"pathName": "pages/payResult/payResult",
"query": ""
},
{
"name": "我的",
"pathName": "pages/ucenter/index/index",
"query": ""
},
{
"name": "我的订单列表",
"pathName": "pages/ucenter/order/order",
"query": ""
},
{
"name": "我的订单详情",
"pathName": "pages/ucenter/orderDetail/orderDetail",
"query": "id=1"
},
{
"name": "待评价的订单详情",
"pathName": "pages/ucenter/orderDetail/orderDetail",
"query": "id=1"
},
{
"name": "购买商品评价",
"pathName": "pages/commentPost/commentPost",
"query": "orderId=2&type=0&valueId=1116011"
},
{
"name": "我的优惠券",
"pathName": "pages/ucenter/couponList/couponList",
"query": ""
},
{
"name": "我的收藏",
"pathName": "pages/ucenter/collect/collect",
"query": ""
},
{
"name": "我的足迹",
"pathName": "pages/ucenter/footprint/footprint",
"query": ""
},
{
"name": "我的地址",
"pathName": "pages/ucenter/address/address",
"query": ""
},
{
"name": "我的地址添加",
"pathName": "pages/ucenter/addressAdd/addressAdd",
"query": ""
},
{
"name": "登录",
"pathName": "pages/auth/login/login",
"query": ""
},
{
"name": "账号登录",
"pathName": "pages/auth/accountLogin/accountLogin",
"query": ""
},
{
"name": "注册",
"pathName": "pages/auth/register/register",
"query": ""
},
{
"name": "找回密码",
"pathName": "pages/auth/reset/reset",
"query": ""
},
{
"name": "关于",
"pathName": "pages/about/about",
"query": ""
},
{
"name": "测试更新",
"pathName": "pages/index/index",
"query": ""
},
{
"name": "意见反馈",
"pathName": "pages/ucenter/feedback/feedback",
"query": ""
},
{
"name": "团购专区",
"pathName": "pages/groupon/grouponList/grouponList",
"query": ""
},
{
"name": "选择优惠券",
"pathName": "pages/ucenter/couponSelect/couponSelect",
"query": ""
},
{
"name": "我的优惠券列表",
"pathName": "pages/ucenter/couponList/couponList",
"query": ""
},
{
"name": "优惠券列表",
"pathName": "pages/coupon/coupon",
"query": ""
},
{
"name": "QcCode",
"pathName": "pages/index/index",
"query": "shareUserId=100",
"scene": 1011
},
{
"name": "发布收藏",
"pathName": "pages/publish/index",
"query": "id=3070579",
"launchMode": "default",
"scene": null
},
{
"name": "发布藏品详情",
"pathName": "pages/publishGoods/goods",
"query": "id=3070579"
}
]
}
}
}
\ 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