Browse Source

修改资讯中心

master
liaoxinyu 2 years ago
parent
commit
2406816eb4
  1. 4
      config.js
  2. 196
      js_sdk/mmmm-image-tools/index.js
  3. 11
      js_sdk/mmmm-image-tools/package.json
  4. 2
      pages.json
  5. 64
      pages/category/consulting/detail.vue
  6. 190
      pages/category/consulting/list.vue
  7. 36
      pages/category/index.vue
  8. 12
      pages/user/shopcart/index.vue
  9. 24
      uni_modules/q-previewImage/changelog.md
  10. 136
      uni_modules/q-previewImage/components/q-previewImage/q-previewImage.vue
  11. 81
      uni_modules/q-previewImage/package.json
  12. 244
      uni_modules/q-previewImage/readme.md
  13. 93
      utils/json/information.json
  14. 13
      utils/json/readmore.json

4
config.js

@ -12,8 +12,8 @@ module.exports = {
// product env // product env
// apiUrl: "http://10.24.4.14:80/", // apiUrl: "http://10.24.4.14:80/",
// apiUrl: "http://10.24.4.156/", // apiUrl: "http://10.24.4.156/",
apiUrl: "./kk/", // apiUrl: "./kk/",
// apiUrl: "http://192.168.66.219:8081/kk/", apiUrl: "http://192.168.66.219:8081/kk/",
/** /**
* 是否启用商城设置缓存 * 是否启用商城设置缓存

196
js_sdk/mmmm-image-tools/index.js

@ -0,0 +1,196 @@
function getLocalFilePath(path) {
if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
return path
}
if (path.indexOf('file://') === 0) {
return path
}
if (path.indexOf('/storage/emulated/0/') === 0) {
return path
}
if (path.indexOf('/') === 0) {
var localFilePath = plus.io.convertAbsoluteFileSystem(path)
if (localFilePath !== path) {
return localFilePath
} else {
path = path.substr(1)
}
}
return '_www/' + path
}
function dataUrlToBase64(str) {
var array = str.split(',')
return array[array.length - 1]
}
var index = 0
function getNewFileId() {
return Date.now() + String(index++)
}
function biggerThan(v1, v2) {
var v1Array = v1.split('.')
var v2Array = v2.split('.')
var update = false
for (var index = 0; index < v2Array.length; index++) {
var diff = v1Array[index] - v2Array[index]
if (diff !== 0) {
update = diff > 0
break
}
}
return update
}
export function pathToBase64(path) {
return new Promise(function(resolve, reject) {
if (typeof window === 'object' && 'document' in window) {
if (typeof FileReader === 'function') {
var xhr = new XMLHttpRequest()
xhr.open('GET', path, true)
xhr.responseType = 'blob'
xhr.onload = function() {
if (this.status === 200) {
let fileReader = new FileReader()
fileReader.onload = function(e) {
resolve(e.target.result)
}
fileReader.onerror = reject
fileReader.readAsDataURL(this.response)
}
}
xhr.onerror = reject
xhr.send()
return
}
var canvas = document.createElement('canvas')
var c2x = canvas.getContext('2d')
var img = new Image
img.onload = function() {
canvas.width = img.width
canvas.height = img.height
c2x.drawImage(img, 0, 0)
resolve(canvas.toDataURL())
canvas.height = canvas.width = 0
}
img.onerror = reject
img.src = path
return
}
if (typeof plus === 'object') {
plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
entry.file(function(file) {
var fileReader = new plus.io.FileReader()
fileReader.onload = function(data) {
resolve(data.target.result)
}
fileReader.onerror = function(error) {
reject(error)
}
fileReader.readAsDataURL(file)
}, function(error) {
reject(error)
})
}, function(error) {
reject(error)
})
return
}
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
wx.getFileSystemManager().readFile({
filePath: path,
encoding: 'base64',
success: function(res) {
resolve('data:image/png;base64,' + res.data)
},
fail: function(error) {
reject(error)
}
})
return
}
reject(new Error('not support'))
})
}
export function base64ToPath(base64) {
return new Promise(function(resolve, reject) {
if (typeof window === 'object' && 'document' in window) {
base64 = base64.split(',')
var type = base64[0].match(/:(.*?);/)[1]
var str = atob(base64[1])
var n = str.length
var array = new Uint8Array(n)
while (n--) {
array[n] = str.charCodeAt(n)
}
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type })))
}
var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/)
if (extName) {
extName = extName[1]
} else {
reject(new Error('base64 error'))
}
var fileName = getNewFileId() + '.' + extName
if (typeof plus === 'object') {
var basePath = '_doc'
var dirPath = 'uniapp_temp'
var filePath = basePath + '/' + dirPath + '/' + fileName
if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) {
plus.io.resolveLocalFileSystemURL(basePath, function(entry) {
entry.getDirectory(dirPath, {
create: true,
exclusive: false,
}, function(entry) {
entry.getFile(fileName, {
create: true,
exclusive: false,
}, function(entry) {
entry.createWriter(function(writer) {
writer.onwrite = function() {
resolve(filePath)
}
writer.onerror = reject
writer.seek(0)
writer.writeAsBinary(dataUrlToBase64(base64))
}, reject)
}, reject)
}, reject)
}, reject)
return
}
var bitmap = new plus.nativeObj.Bitmap(fileName)
bitmap.loadBase64Data(base64, function() {
bitmap.save(filePath, {}, function() {
bitmap.clear()
resolve(filePath)
}, function(error) {
bitmap.clear()
reject(error)
})
}, function(error) {
bitmap.clear()
reject(error)
})
return
}
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
var filePath = wx.env.USER_DATA_PATH + '/' + fileName
wx.getFileSystemManager().writeFile({
filePath: filePath,
data: dataUrlToBase64(base64),
encoding: 'base64',
success: function() {
resolve(filePath)
},
fail: function(error) {
reject(error)
}
})
return
}
reject(new Error('not support'))
})
}

11
js_sdk/mmmm-image-tools/package.json

@ -0,0 +1,11 @@
{
"id": "mmmm-image-tools",
"name": "image-tools",
"version": "1.4.0",
"description": "图像转换工具,可用于图像和base64的转换",
"keywords": [
"base64",
"保存",
"图像"
]
}

2
pages.json

@ -45,6 +45,8 @@
"path": "pages/category/consulting/list", "path": "pages/category/consulting/list",
"style": { "style": {
"navigationBarTitleText": "资讯中心", "navigationBarTitleText": "资讯中心",
"navigationBarBackgroundColor": "#1c223b",
"navigationBarTextStyle": "white",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
}, },

64
pages/category/consulting/detail.vue

@ -4,13 +4,13 @@
<!-- 二级分类 20 --> <!-- 二级分类 20 -->
<view class="cate-content"> <view class="cate-content">
<!-- 左侧 一级分类 --> <!-- 左侧 一级分类 -->
<scroll-view class="cate-left" scroll-y="true"> <!-- <scroll-view class="cate-left" scroll-y="true">
<view class="type-nav" :class="{ selected: curIndex == index }" v-for="(item, index) in informationList" :key="index" <view class="type-nav" :class="{ selected: curIndex == index }" v-for="(item, index) in informationList" :key="index"
@click="handleSelectNav(index,item.consultingId)"> @click="handleSelectNav(index,item.consultingId)">
<image class="cate-left-image" :src="'./static/tabbar/recommend-cate.png'"></image> <image class="cate-left-image" :src="'./static/tabbar/recommend-cate.png'"></image>
<text class="cate-left-text">{{ item.consultingName }}</text> <text class="cate-left-text">{{ item.consultingName }}</text>
</view> </view>
</scroll-view> </scroll-view> -->
<!-- 右侧 二级分类 --> <!-- 右侧 二级分类 -->
<scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }"> <scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }">
<view v-if="list" class="cate-right-cont"> <view v-if="list" class="cate-right-cont">
@ -22,9 +22,11 @@
<text v-if="list.contextTitle">{{list.contextTitle}}</text> <text v-if="list.contextTitle">{{list.contextTitle}}</text>
<text v-else>无标题信息</text> <text v-else>无标题信息</text>
</view> </view>
<view class="cate-cont-time" v-if="list.contextTitle">发布时间{{list.contextCreationTime}}</view>
<view class="cate-cont-context"> <view class="cate-cont-context">
<rich-text :nodes="list.context"></rich-text> <rich-text :nodes="list.context" @click.stop="previewImage"></rich-text>
</view> </view>
<q-previewImage ref="previewImage" :urls="imgList"></q-previewImage>
</view> </view>
</view> </view>
</view> </view>
@ -57,6 +59,9 @@ import * as CategoryApi from '@/api/category'
import Empty from '@/components/empty' import Empty from '@/components/empty'
import Secondary from './../components/secondary' import Secondary from './../components/secondary'
import { rpx2px,base64ToUint8Array} from '@/utils/util' import { rpx2px,base64ToUint8Array} from '@/utils/util'
import readmore from 'utils/json/readmore.json'
//
import {pathToBase64,base64ToPath} from '@/js_sdk/mmmm-image-tools/index.js'
// //
let limit=4; let limit=4;
@ -78,6 +83,7 @@ export default {
informationList: [], informationList: [],
// //
list: [], list: [],
// list: readmore.data,
// //
setting: {}, setting: {},
// //
@ -92,6 +98,8 @@ export default {
scrollTop: 0, scrollTop: 0,
// id // id
contextId: '', contextId: '',
//
imgList:[]
} }
}, },
@ -121,6 +129,32 @@ export default {
this.setListHeight() this.setListHeight()
}, },
methods: { methods: {
previewImage(){
//
let richText = this.list.context
// img
let tagsImage = richText.match(/<img[^>]+>/g)
let base64Arr = []
for (let i = 0; i < tagsImage.length; i++) {
tagsImage[i].replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
base64Arr.push(capture)
})
}
//
// base64Arr = base64Arr.reverse()
// console.log(base64Arr)
// ,base64url
base64Arr.reduce((promise, path) => promise.then(res => base64ToPath(path).then(base64 => (res.push(base64), res))), Promise.resolve([])).then(res => {
// url
this.imgList = res
this.$nextTick(()=>{
this.$refs.previewImage.open(res); // ($nextTick)
})
})
.catch(error => {
console.error(error)
})
},
// //
setListHeight() { setListHeight() {
const { windowHeight } = uni.getSystemInfoSync() const { windowHeight } = uni.getSystemInfoSync()
@ -149,13 +183,13 @@ export default {
// //
getConsultingContextSelection() { getConsultingContextSelection() {
const app = this const app = this
CategoryApi.consultingContextSelection().then(res=>{ // CategoryApi.consultingContextSelection().then(res=>{
if (res.resultCode == '00000000') { // if (res.resultCode == '00000000') {
app.informationList = res.data // app.informationList = res.data
} else { // } else {
app.$error('获取资讯信息失败') // app.$error('')
} // }
}) // })
}, },
} }
} }
@ -200,7 +234,7 @@ page {
width: 100%; width: 100%;
.cate-cont { .cate-cont {
width: 96%; width: 100%;
height: 100%; height: 100%;
padding: 16rpx; padding: 16rpx;
margin-top: 20rpx; margin-top: 20rpx;
@ -220,9 +254,15 @@ page {
border-radius: 10rpx; border-radius: 10rpx;
padding: 0rpx 20rpx 0rpx 20rpx; padding: 0rpx 20rpx 0rpx 20rpx;
color: #0b0b0b; color: #0b0b0b;
background-color: #a8a8a8; font-size: 30rpx;
// background-color: #a8a8a8;
text-align: center; text-align: center;
} }
.cate-cont-time{
text-align: center;
margin-top: 30rpx;
margin-bottom: 30rpx;
}
} }
} }

190
pages/category/consulting/list.vue

@ -1,16 +1,30 @@
<template> <template>
<view class="container"> <view class="container">
<view class="secondary"> <view class="secondary">
<!-- 搜索 -->
<view class="search">
<view class="search-wrapper">
<view class="index-search">
<view class="index-cont-search t-c">
<text class="search-icon iconfont icon-search"></text>
<text class="search-text">
<input type="text" placeholder="请输入搜索关键字" v-model="searchValue">
</text>
<button class="search-text-bu" @click="onSearch">搜索</button>
</view>
</view>
</view>
</view>
<!-- 二级分类 20 --> <!-- 二级分类 20 -->
<view class="cate-content"> <view class="cate-content">
<!-- 左侧 一级分类 --> <!-- 左侧 一级分类 -->
<scroll-view class="cate-left" scroll-y="true"> <!-- <scroll-view class="cate-left" scroll-y="true">
<view class="type-nav" :class="{ selected: curIndex == index }" v-for="(item, index) in informationList" :key="index" <view class="type-nav" :class="{ selected: curIndex == index }" v-for="(item, index) in informationList" :key="index"
@click="handleSelectNav(index,item.consultingId)"> @click="handleSelectNav(index,item.consultingId)">
<image class="cate-left-image" :src="'./static/tabbar/recommend-cate.png'"></image> <image class="cate-left-image" :src="'./static/tabbar/recommend-cate.png'"></image>
<text class="cate-left-text">{{ item.consultingName }}</text> <text class="cate-left-text">{{ item.consultingName }}</text>
</view> </view>
</scroll-view> </scroll-view> -->
<!-- 右侧 二级分类 --> <!-- 右侧 二级分类 -->
<scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }"> <scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption" @up="upCallback"> <mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption" @up="upCallback">
@ -20,16 +34,16 @@
<view class="flex-three" v-for="(item, idx) in list" :key="idx" > <view class="flex-three" v-for="(item, idx) in list" :key="idx" >
<view class="cate-cont"> <view class="cate-cont">
<view class="cate-title"> <view class="cate-title">
<text class="cate-title-label">标题名称</text> <view class="cate-title-label">标题名称</view>
{{item.contextTitle}} <view style="width: 480rpx;height: 90rpx;">{{item.contextTitle}}</view>
</view>
<view class="cate-date">
<text class="cate-title-label">发布时间</text>
{{item.contextCreationTime}}
</view>
<view class="cate-bt">
<button @click="onConsulting(item.contextId,curIndex)">阅读全文</button>
</view> </view>
<view style="display: flex;align-items: center;justify-content: space-between;margin-top: 100rpx;">
<view class="cate-date">
<text class="cate-title-label" style="color: #8e908e;">发布时间</text>
{{item.contextCreationTime}}
</view>
<view class="cate-bt" @click="onConsulting(item.contextId,curIndex)">阅读全文</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -37,7 +51,7 @@
</view> </view>
<!-- 空白提示 --> <!-- 空白提示 -->
<view v-else class="cate-right-cont"> <view v-else class="cate-right-cont">
<view class="empty-content"> <view class="empty-content" style="text-align: center;">
<view class="empty-icon"> <view class="empty-icon">
<image class="image" src="/static/empty.png" mode="widthFix"></image> <image class="image" src="/static/empty.png" mode="widthFix"></image>
</view> </view>
@ -64,7 +78,8 @@
import Empty from '@/components/empty' import Empty from '@/components/empty'
import Secondary from './../components/secondary' import Secondary from './../components/secondary'
import { rpx2px,base64ToUint8Array} from '@/utils/util' import { rpx2px,base64ToUint8Array} from '@/utils/util'
import information from 'utils/json/information.json'
// //
let pageSize = 10 let pageSize = 10
@ -85,8 +100,10 @@
PageCategoryStyleEnum, PageCategoryStyleEnum,
// //
informationList: [], informationList: [],
// informationList: information.data,
// //
list: [], list: [],
// list: information.data.pageDataList,
// //
setting: {}, setting: {},
// //
@ -112,6 +129,7 @@
tip: '暂无记录' tip: '暂无记录'
} }
}, },
searchValue: '',
} }
}, },
@ -124,6 +142,10 @@
// //
this.getConsultingContextSelection() this.getConsultingContextSelection()
this.onRefreshPage() this.onRefreshPage()
uni.setNavigationBarTitle({
title: options.name
});
}, },
/** /**
@ -141,6 +163,15 @@
this.setListHeight() this.setListHeight()
}, },
methods: { methods: {
//
async onSearch() {
if (this.searchValue == '') {
this.$error('请输入搜索关键词');
} else {
await this.getGoodsList()
await this.getHomeListImage()
}
},
// //
setListHeight() { setListHeight() {
const { windowHeight } = uni.getSystemInfoSync() const { windowHeight } = uni.getSystemInfoSync()
@ -186,6 +217,9 @@
// //
getCatList(pageIndex = 1){ getCatList(pageIndex = 1){
const app = this const app = this
if (app.searchValue != '') {
param.goods_name = app.searchValue
}
let param = { let param = {
pageIndex : pageIndex, pageIndex : pageIndex,
pageRows : pageSize, pageRows : pageSize,
@ -208,18 +242,18 @@
// //
getConsultingContextSelection() { getConsultingContextSelection() {
const app = this const app = this
CategoryApi.consultingContextSelection().then(res=>{ // CategoryApi.consultingContextSelection().then(res=>{
if (res.resultCode == '00000000') { // if (res.resultCode == '00000000') {
app.informationList = res.data // app.informationList = res.data
app.informationList.forEach((items,key) => { // app.informationList.forEach((items,key) => {
if (items.consultingId === app.consultingId) { // if (items.consultingId === app.consultingId) {
app.curIndex = key // app.curIndex = key
} // }
}) // })
} else { // } else {
app.$error('获取资讯信息失败') // app.$error('')
} // }
}) // })
}, },
} }
} }
@ -232,7 +266,6 @@
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.secondary{ .secondary{
z-index: 19; z-index: 19;
height: 100vh; height: 100vh;
@ -240,11 +273,12 @@
// //
.cate-content { .cate-content {
display: flex; // display: flex;
z-index: 1; z-index: 1;
background: #fff; background: #fff;
padding-top: 6rpx; // padding-top: 6rpx;
height: 100%; margin-top: 120rpx;
height: 90%;
} }
// + 20 // + 20
@ -264,36 +298,44 @@
width: 100%; width: 100%;
.cate-cont { .cate-cont {
width: 96%; width: 90%;
height: 300rpx; height: 300rpx;
padding: 16rpx 16rpx 0rpx 16rpx; padding: 16rpx 16rpx 0rpx 16rpx;
margin-top: 20rpx; margin: 0rpx 36rpx 20rpx 36rpx;
margin-right: 60rpx; // padding-top: 20rpx;
color: #8e908e; // margin-right: 60rpx;
color: #000;
background-color: #f7f7f7; background-color: #f7f7f7;
display: block; display: block;
position: relative; position: relative;
.cate-title { .cate-title {
margin-right: 20rpx; // margin-right: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
display: flex;
} }
.cate-title-label { .cate-title-label {
color: #0b0b0b; width: 150rpx;
color: #000;
font-weight: bold; font-weight: bold;
// display: inline-block;
} }
.cate-date { .cate-date {
position: absolute; color: #8e908e;
top: 190rpx; // position: absolute;
// top: 190rpx;
} }
.cate-bt { .cate-bt {
position: absolute; // position: absolute;
top: 240rpx; // top: 240rpx;
left: 385rpx; // left: 385rpx;
width: 110rpx; width: 120rpx;
height: 53rpx; height: 53rpx;
line-height: 53rpx;
border-radius: 5rpx; border-radius: 5rpx;
border: 1rpx #8e908e solid; color: #000;
// border: 1rpx #8e908e solid;
background-color: #f7f7f7; background-color: #f7f7f7;
button { button {
@ -305,6 +347,68 @@
} }
} }
} }
//
.search {
position: fixed;
float: top;
top: var(--window-top);
left: var(--window-left);
right: var(--window-right);
z-index: 19;
.search-wrapper {
background: #1c223b;
padding: 0rpx 20rpx 20rpx 20rpx;
}
.index-search {
border-bottom: 0;
background: #fff;
border-radius: 50rpx;
overflow: hidden;
font-size: 28rpx;
color: #6d6d6d;
box-sizing: border-box;
height: 74rpx;
line-height: 74rpx;
.index-cont-search {
width: 100%;
font-size: 28rpx;
background: #f7f7f7;
display: flex;
justify-content: center;
align-items: center;
.search-icon {
font-size: 34rpx;
margin-left: 50rpx;
}
.search-text {
text-align: left;
float: left;
margin-left: 20rpx;
width: 100%;
input {
font-size: 20rpx;
}
}
.search-text-bu {
margin-right: 20rpx;
color: #ffffff;
background-color: #1c223b;
font-size: 20rpx;
width: 120rpx;
height: 50rpx;
text-align: center;
border-radius: 50rpx;
}
}
}
}
// //
.type-nav { .type-nav {

36
pages/category/index.vue

@ -56,9 +56,10 @@
<view v-else-if="informationList.length>0 && type==2" class="cate-right-cont"> <view v-else-if="informationList.length>0 && type==2" class="cate-right-cont">
<view class="cate-two-box"> <view class="cate-two-box">
<view class="cate-cont-box"> <view class="cate-cont-box">
<view class="flex-three" v-for="(item, idx) in informationList" :key="idx" @click="onConsulting(item.consultingId)"> <view class="flex-three" v-for="(item, idx) in informationList" :key="idx" @click="onConsulting(item.consultingId,item.consultingName)">
<view class="cate-selected"> <view class="cate-selected">
{{item.consultingName}} <view style="width: 200rpx;height: 200rpx;"><img src="" /></view>
<view>{{item.consultingName}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -176,8 +177,8 @@
// //
menus, menus,
type: 0, type: 0,
informationList: [], // selected // informationList: [], // selected
// informationList: Informationlist.data, // selected informationList: Informationlist.data, // selected
serviceProvidersList: [], // serviceProvidersList: [], //
// serviceProvidersList: temp.data, // // serviceProvidersList: temp.data, //
transactionList: transaction.data, // transactionList: transaction.data, //
@ -245,7 +246,7 @@
// //
await app.getCatList(page.num) await app.getCatList(page.num)
.then(list => { .then(list => {
console.log('list',list) // console.log('list',list)
const curPageLen = list.data.length const curPageLen = list.data.length
const totalSize = list.total const totalSize = list.total
app.mescroll.endBySize(curPageLen, totalSize) app.mescroll.endBySize(curPageLen, totalSize)
@ -318,8 +319,8 @@
} }
}, },
// //
onConsulting(consultingId){ onConsulting(consultingId,name){
this.$navTo('pages/category/consulting/list', { consultingId }) this.$navTo('pages/category/consulting/list', { consultingId,name })
}, },
// //
onTradingentity(name){ onTradingentity(name){
@ -369,13 +370,13 @@
// //
getConsultingContextSelection() { getConsultingContextSelection() {
const app = this const app = this
CategoryApi.consultingContextSelection().then(res=>{ // CategoryApi.consultingContextSelection().then(res=>{
if (res.resultCode == '00000000') { // if (res.resultCode == '00000000') {
app.informationList = res.data // app.informationList = res.data
} else { // } else {
app.$error('获取资讯信息失败') // app.$error('')
} // }
}); // });
}, },
// //
getServiceProviders() { getServiceProviders() {
@ -468,10 +469,13 @@
color: #8e908e; color: #8e908e;
background-color: #f7f7f7; background-color: #f7f7f7;
margin-top: 20rpx; margin-top: 20rpx;
padding-top: 70rpx; // padding-top: 70rpx;
font-size: 45rpx; font-size: 45rpx;
text-align: center; // text-align: center;
font-weight: 520; font-weight: 520;
display: flex;
justify-content: space-around;
align-items: center;
} }
.cate-name { .cate-name {

12
pages/user/shopcart/index.vue

@ -20,13 +20,13 @@
<text class="goods-title-name">{{ item.detail.goods_name }}</text> <text class="goods-title-name">{{ item.detail.goods_name }}</text>
<text class="goods-title-content">交易方式{{ item.detail.goods_entrust?'转让':'授权' }}</text> <text class="goods-title-content">交易方式{{ item.detail.goods_entrust?'转让':'授权' }}</text>
<text class="goods-title-content">购买年限{{ item.use_years }}</text> <text class="goods-title-content">购买年限{{ item.use_years }}</text>
<text class="goods-title-content">单价{{ item.goods_price }}</text> <text class="goods-title-content">单价{{ item.detail.price_str }}</text>
</view> </view>
<view class="item-foot"> <view class="item-foot">
<view class="goods-price"> <view class="goods-price">
<text>合计</text> <text>合计</text>
<text class="unit"></text> <text class="unit"></text>
<text class="value">{{ item.use_years * item.goods_price }}</text> <text class="value">{{ item.total_money_str }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -71,6 +71,7 @@
import { inArray, arrayIntersect, debounce } from '@/utils/util' import { inArray, arrayIntersect, debounce } from '@/utils/util'
import { checkLogin, setCartTotalNum, setCartTabBadge } from '@/core/app' import { checkLogin, setCartTotalNum, setCartTabBadge } from '@/core/app'
import * as UserApi from '@/api/user' import * as UserApi from '@/api/user'
import {formatAmount} from '@/api/order/comment'
import EmptyCart from '@/components/empty-cart' import EmptyCart from '@/components/empty-cart'
import uniIcons from '../../../uni_modules/uni-icons/components/uni-icons/uni-icons' import uniIcons from '../../../uni_modules/uni-icons/components/uni-icons/uni-icons'
import {createOrder, delShopCart} from "../../../api/user"; import {createOrder, delShopCart} from "../../../api/user";
@ -159,6 +160,10 @@ export default {
if (result.code == '200') { if (result.code == '200') {
app.list = result.data app.list = result.data
app.total = result.data.length app.total = result.data.length
app.list.forEach(item => {
item.total_money_str = formatAmount(item.total_money)
item.detail.price_str = formatAmount(Number(item.detail.price))
})
} }
// checkedIdsID // checkedIdsID
app.onClearInvalidId() app.onClearInvalidId()
@ -241,7 +246,6 @@ export default {
let new_shop_Name = paramArr.new_shop_Name.join(","); let new_shop_Name = paramArr.new_shop_Name.join(",");
let new_userName = paramArr.new_userName.join(","); //,, let new_userName = paramArr.new_userName.join(","); //,,
let new_company = paramArr.new_company.join(","); // let new_company = paramArr.new_company.join(","); //
// //
let company_Number = null; let company_Number = null;
if (new_company.split(",").includes("北京玖扬博文文化发展有限公司")) { if (new_company.split(",").includes("北京玖扬博文文化发展有限公司")) {
@ -540,4 +544,4 @@ page {
} }
} }
</style> </style>

24
uni_modules/q-previewImage/changelog.md

@ -0,0 +1,24 @@
## 1.1.1(2023-08-01)
优化文档
## 1.1.0(2023-08-01)
优化文档
## 1.0.9(2023-07-10)
优化文档
## 1.0.8(2023-06-25)
优化文档
## 1.0.7(2023-06-25)
优化文档
## 1.0.6(2023-05-26)
优化文档
## 1.0.5(2023-05-22)
优化文档
## 1.0.4(2023-04-30)
新增图片放大功能,解决原生组件和tabbar导航栏等无法覆盖的问题
## 1.0.3(2023-04-28)
优化文档
## 1.0.2(2023-04-28)
优化文档
## 1.0.1(2023-04-28)
新增长按事件
## 1.0.0(2023-04-28)
插件上线

136
uni_modules/q-previewImage/components/q-previewImage/q-previewImage.vue

@ -0,0 +1,136 @@
<template>
<view class="previewImage" v-if="show" @tap="close">
<!-- <view class="previewImage" v-if="show"> -->
<view class="page" v-if="urls.length > 0">
<text class="text">{{ current + 1 }} / {{ urls.length }}</text>
</view>
<view class="texts">×</view>
<swiper class="swiper" :current="current" @change="swiperChange" @touchstart="handleTouchStart" @touchend="handleTouchEnd">
<swiper-item v-for="(item, index) in urls" :key="index">
<movable-area class="movable-area" scale-area>
<movable-view class="movable-view" direction="all" :inertia="true" damping="100" scale="true" scale-min="1" scale-max="4" :scale-value="scale">
<scroll-view scroll-y="true" class="uni-scroll-view">
<view class="scroll-view"><image :key="index" class="image" :src="item" mode="widthFix" @longpress="onLongpress(item)" /></view>
</scroll-view>
</movable-view>
</movable-area>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
props: {
urls: {
type: Array,
required: true,
default: () => {
return [];
}
}
},
data() {
return {
show: false,
current: 0, //
scale: 1,
isZooming: false //
};
},
methods: {
//
open(current) {
this.current = this.urls.findIndex(item => item === current);
this.show = true;
this.$emit('open');
},
//
close() {
if (!this.isZooming) {
this.show = false;
this.current = 0;
this.$emit('close');
}
},
//
swiperChange(e) {
this.current = e.detail.current;
},
//
onLongpress(e) {
this.$emit('onLongpress', e);
},
handleTouchStart() {
this.isZooming = true;
},
handleTouchEnd() {
this.isZooming = false;
}
}
};
</script>
<style lang="scss" scoped>
.previewImage {
z-index: 9999;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
.swiper {
width: 100%;
height: 100vh;
swiper-item {
.movable-area {
height: 100%;
width: 100%;
.movable-view {
width: 100%;
min-height: 100%;
.scroll-view {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
.image {
width: 100%;
height: auto;
}
}
}
}
}
}
.page {
position: absolute;
z-index: 9999;
width: 100%;
top: 60rpx;
text-align: center;
.text {
color: #fff;
font-size: 32rpx;
background-color: rgba(0, 0, 0, 0.5);
padding: 3rpx 16rpx;
border-radius: 20rpx;
user-select: none;
}
}
.texts{
font-size: 23px;
width: 28px;
height: 28px;
line-height: 28px;
position: absolute;
top: 55rpx;
right: 50rpx;
color: #fff;
text-align: center;
border: 1px solid #fff;
border-radius: 50%;
}
}
</style>

81
uni_modules/q-previewImage/package.json

@ -0,0 +1,81 @@
{
"id": "q-previewImage",
"displayName": "图片预览、多图左右滑动、图片放大、支持覆盖原生组件、原生导航栏、tabbar",
"version": "1.1.1",
"description": "最简洁的模拟图片预览,支持长按事件,多图左右滑动,大图上下滑动查看,支持图片放大,支持覆盖原生组件/原生导航栏/tabbar 支持vue2/vue3/app/小程序/h5",
"keywords": [
"图片预览"
],
"repository": "",
"engines": {
"HBuilderX": "^3.4.14"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

244
uni_modules/q-previewImage/readme.md

@ -0,0 +1,244 @@
# 最简洁的模拟图片预览,支持长按事件,多图左右滑动,大图上下滑动查看,支持图片放大,支持覆盖原生组件/原生导航栏/tabbar 支持vue2/vue3/app/小程序/h5
- 为了解决项目中因一些特殊原因无法使用uni.previewImage,例如App.onShow或者页面的oShow中写了方法。
- 如果用uni.previewImage,每次预览图片都会进到onShow的方法里
- 可以基本实现官方的预览图片功能,但是体验不如uni.previewImage()
- 如没有特殊原因,还是推荐官方的uni.previewImage()
## 安装指引
##1. 在插件市场打开本插件页面,在右侧点击`使用 HBuilderX 导入插件`,选择要导入的项目点击确定
##2. 使用方法 vue2写法
```
<template>
<view>
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
<image v-for="(item, index) in imgs" :key="index" :src="item" @click="preview(item)"></image>
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
</view>
</template>
<script>
export default {
data() {
return {
videoShow:true,//video组件是否显示
imgs: [],
};
},
methods: {
preview(url) {
this.imgs = ['https://web-assets.dcloud.net.cn/unidoc/zh/multiport-20210812.png', 'https://web-assets.dcloud.net.cn/unidoc/zh/uni-function-diagram.png'] //设置图片数组
// #ifdef MP-WEIXIN
this.$nextTick(()=>{
this.$refs.previewImage.open(url); // 传入当前选中的图片地址(小程序必须添加$nextTick,解决组件首次加载无图)
})
// #endif
// #ifndef MP-WEIXIN
this.$refs.previewImage.open(url); // 传入当前选中的图片地址
// #endif
},
onLongpress(e){ //长按事件
console.log('当前长按的图片是' + e);
uni.showActionSheet({
itemList: ['转发给朋友', '保存到手机'],
success: function (res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function (res) {
console.log(res.errMsg);
}
});
},
/* open和close方法一般用不到,但是在一些特殊场景会用到,
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
*/
open(){ //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
// uni.hideTabBar()
// uni.setNavigationBarColor({
// frontColor: '#000000', // 设置前景色为黑色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// this.videoShow = false
},
close(){ //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
// uni.showTabBar()
// uni.setNavigationBarColor({
// frontColor: '#ffffff', // 设置前景色为白色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// this.videoShow = true
}
}
};
</script>
```
##3. vue3 setup写法
```
<template>
<view>
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
<image v-for="(item, index) in imgs" :key="index" :src="item" @click="preview(item)"></image>
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
</view>
</template>
<script setup>
import { reactive, ref, toRefs,nextTick } from 'vue';
const data = reactive({
videoShow:true,//video组件是否显示
imgs: [],
});
const previewImage = ref(null);
const { imgs,videoShow } = toRefs(data)// 解构
const preview = url => {
data.imgs = ['https://web-assets.dcloud.net.cn/unidoc/zh/multiport-20210812.png', 'https://web-assets.dcloud.net.cn/unidoc/zh/uni-function-diagram.png'] //设置图片数组
// #ifdef MP-WEIXIN
nextTick(()=>{
previewImage.value.open(url); // 传入当前选中的图片地址(小程序必须添加nextTick,解决组件首次加载无图)
})
// #endif
// #ifndef MP-WEIXIN
previewImage.value.open(url); // 传入当前选中的图片地址
// #endif
};
const onLongpress = e =>{
console.log('当前长按的图片是' + e);
uni.showActionSheet({
itemList: ['转发给朋友', '保存到手机'],
success: function (res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function (res) {
console.log(res.errMsg);
}
});
}
/* open和close方法一般用不到,但是在一些特殊场景会用到,
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
*/
const open = () => { //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
// uni.hideTabBar()
// uni.setNavigationBarColor({
// frontColor: '#000000', // 设置前景色为黑色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// data.videoShow = false
}
const close = () => { //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
// uni.showTabBar()
// uni.setNavigationBarColor({
// frontColor: '#ffffff', // 设置前景色为白色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// data.videoShow = true
}
</script>
```
##4. 项目示例 (一般返回的数据图片是以逗号或特殊字符分割的字符串,点击时就需要传两个参数,一个是图片数组,一个是当前图片的index)
## 注意q-previewImage不要写在循环体中,imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
```
<template>
<view>
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
<view v-for="(item, index) in list" :key="index" class="list">
<image :src="i" mode="aspectFill" v-for="(i,imgindex) in item.urls.split(',')" @click.stop="preimg(item.urls.split(','),imgindex)"></image>
<view>
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
</view>
</template>
<script>
export default {
data() {
return {
videoShow:true,//是否显示video组件
imgs: [],//imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
};
},
methods: {
preimg(urls,index){
this.imgs = urls //imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
// #ifdef MP-WEIXIN
this.$nextTick(()=>{
this.$refs.previewImage.open(this.imgs[index]); // 传入当前选中的图片地址(小程序必须添加$nextTick,解决组件首次加载无图)
})
// #endif
// #ifndef MP-WEIXIN
this.$refs.previewImage.open(this.imgs[index]); // 传入当前选中的图片地址
// #endif
},
onLongpress(e){ //长按事件
console.log('当前长按的图片是' + e);
uni.showActionSheet({
itemList: ['转发给朋友', '保存到手机'],
success: function (res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function (res) {
console.log(res.errMsg);
}
});
},
/* open和close方法一般用不到,但是在一些特殊场景会用到,
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
*/
open(){ //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
// uni.hideTabBar()
// uni.setNavigationBarColor({
// frontColor: '#000000', // 设置前景色为黑色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// this.videoShow = false
},
close(){ //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
// uni.showTabBar()
// uni.setNavigationBarColor({
// frontColor: '#ffffff', // 设置前景色为白色
// backgroundColor: '#000000', // 设置背景色为黑色
// })
// this.videoShow = true
}
}
};
</script>
```
## 如果插件对您有一点帮助,请给个五星好评,感谢支持
## 如有问题,请加qq 965969604

93
utils/json/information.json

@ -0,0 +1,93 @@
{
"resultCode": "00000000",
"resultMsg": "SUCCESS",
"data": {
"pageRows": 10,
"pageIndex": 1,
"pageOrder": null,
"pageDataSize": 324,
"pageSize": 33,
"pageDataList": [
{
"contextId": "972135119269793820",
"contextConsultingId": "762033233176170504",
"contextTitle": "公告丨全国文化大数据交易中心文化资源数据标的成交公告",
"contextCreationTime": "2024-04-01 11:18:59",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "971038085523574834",
"contextConsultingId": "762033233176170504",
"contextTitle": "数据超市丨《水浒传》系列精品文化资源数据类标的:吴学究双掌连环计 宋公明三打祝家庄",
"contextCreationTime": "2024-03-29 10:39:46",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "969606242278445102",
"contextConsultingId": "762033233176170504",
"contextTitle": "公告丨全国文化大数据交易中心交易主体进场公告【腾讯云计算(北京)有限责任公司】",
"contextCreationTime": "2024-03-25 11:50:08",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "968499733108756490",
"contextConsultingId": "762033233176170504",
"contextTitle": "公告丨全国文化大数据交易中心交易主体进场公告【深圳市其域创新科技有限公司】",
"contextCreationTime": "2024-03-22 10:33:15",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "967135031296397373",
"contextConsultingId": "762033233176170504",
"contextTitle": "数据超市丨《水浒传》系列精品文化资源数据类标的:卢俊义分兵歙州道 宋公明大战乌龙岭",
"contextCreationTime": "2024-03-18 16:10:25",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "962763066871779370",
"contextConsultingId": "762033233176170504",
"contextTitle": "数据超市丨《三国演义》系列精品文化资源数据类标的:曹操平定汉中地,张辽威震逍遥津",
"contextCreationTime": "2024-03-06 14:37:48",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "960885697982631998",
"contextConsultingId": "762033233176170504",
"contextTitle": "数据超市丨《红楼梦》系列精品文化资源数据类标的:“真假”宝玉会面,地藏庵劝惜春出家",
"contextCreationTime": "2024-03-01 10:17:48",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "959808218010357765",
"contextConsultingId": "762033233176170504",
"contextTitle": "热血水浒丨柴进门招天下客,林冲棒打洪教头",
"contextCreationTime": "2024-02-27 10:56:17",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "957250035354046480",
"contextConsultingId": "762033233176170504",
"contextTitle": "梦回红楼丨比通灵金莺微露意,探宝钗黛玉半含酸",
"contextCreationTime": "2024-02-20 09:30:58",
"contextStatus": 0,
"contextUsername": "chanpin"
},
{
"contextId": "952901732248195122",
"contextConsultingId": "762033233176170504",
"contextTitle": "公告丨全国文化大数据交易中心交易主体进场公告【西安当时商业运营管理有限责任公司】",
"contextCreationTime": "2024-02-08 09:32:22",
"contextStatus": 0,
"contextUsername": "chanpin"
}
]
}
}

13
utils/json/readmore.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save