diff --git a/api/my/index.js b/api/my/index.js new file mode 100644 index 0000000..fededd5 --- /dev/null +++ b/api/my/index.js @@ -0,0 +1,17 @@ +import { + ApiHttp +} from '@/utils/request.js' + + +// 新增用户反馈 +const addUserFeedback = (params) => { + return ApiHttp('/xinrenli/userFeedback', params, 'POST') +} +// 查询优惠卷列表 +const couponListGet = (params) =>{ + return ApiHttp('/xinrenli/coupon/list',params,'GET') +} +export { + addUserFeedback, + couponListGet +} \ No newline at end of file diff --git a/api/order/index.js b/api/order/index.js new file mode 100644 index 0000000..c3633c2 --- /dev/null +++ b/api/order/index.js @@ -0,0 +1,25 @@ +import { + ApiHttp +} from '@/utils/request.js' +//查询文章列表 +const userArticleGet = (params) => { + return ApiHttp('/xinrenli/article/list',params,'GET') +} +// 获取文章详细信息 +const articleDetail = (params) => { + return ApiHttp(`/xinrenli/article/${params}`,'GET') +} +// 查询用户评论列表 +const userEvaluateGet = (params) => { + return ApiHttp('/xinrenli/userComment/list',params,'GET') +} +// 新增用户评论 +const addUserEvaluate = (params) => { + return ApiHttp('/xinrenli/userComment',params,'POST') +} +export { + userArticleGet, + articleDetail, + userEvaluateGet, + addUserEvaluate +} \ No newline at end of file diff --git a/api/system/index.js b/api/system/index.js new file mode 100644 index 0000000..0da4385 --- /dev/null +++ b/api/system/index.js @@ -0,0 +1,17 @@ +import { + ApiHttp +} from '@/utils/request.js' + +//用户需求广场 +const userNeedSquare = (params) => { + return ApiHttp('/xinrenli/order/userDemandSquare',params,'GET') +} +// 获取订单详细信息 +const orderDetailMsg = (params) => { + return ApiHttp('/xinrenli/article',params,'GET') +} + +export { + userNeedSquare, + orderDetailMsg +} \ No newline at end of file diff --git a/components/comment/comment.vue b/components/comment/comment.vue index 7c82e3f..fc5b962 100644 --- a/components/comment/comment.vue +++ b/components/comment/comment.vue @@ -1,11 +1,11 @@ <template> <view> <view class="d-flex margin-top-two" v-for="(item,index) in personEvalList"> - <img class="avatar-img" :src="item.avatar" alt=""> + <img class="avatar-img" :src="item.userHead" alt=""> <view class="flex-1 margin-left-one"> <view class="d-flex a-center j-sb"> - <view class="nickname">{{item.nickname}}</view> - <view class="font">{{item.date}}</view> + <view class="nickname">{{item.createUser ? item.createUser : ''}}</view> + <view class="font">{{item.createTime | formatDate}}</view> </view> <view class="evaluateText">{{item.content}}</view> </view> diff --git a/components/evaluate.vue b/components/evaluate.vue index eb002d1..ab2e361 100644 --- a/components/evaluate.vue +++ b/components/evaluate.vue @@ -3,27 +3,29 @@ <!-- 评价 --> <view class="evaluate"> <view class="evaluateCenter"> - <view class="evaluateItem" v-for="(item, index) in list" :key="index"> - <view class="evaluateTip d-flex a-center j-sb"> + <view class="evaluateItem" v-for="(item, index) in list" :key="index" @click="handleLookId(item)"> + <view class="evaluateTip d-flex j-sb a-center"> <view class="d-flex a-center"> - <image class="img" :src="item.image" mode="widthFix"></image> - <view class="evaluate-name">{{ item.name}}</view> + <image class="img" src="../static/logoLogin.png" mode="widthFix"></image> + <view class="evaluate-name">{{ item.createUser}}</view> </view> - - <view class="font">{{item.time}}</view> + <view class="font">{{item.createTime | formatDate}}</view> </view> - <view class="evaluate-title">这是文章标题!</view> + <view class="evaluate-title">{{item.title}}</view> <view class="evaluateText" :class="{lineclamp2:item.contentAll}"> {{item.content}} </view> <!-- <view class="" v-if="item.isMore"> <view class="rightText" v-if="item.contentAll" @click="changeAllFun(item, index)">全部</view> <view class="rightText" v-else @click="changeAllFun(item, index)">收起</view> </view> --> <view class="evaluateListImg"> - <view class="evaluateListImgItem" v-for="(itm, ind) in item.imageList" :key="ind" + <view class="evaluateListImgItem" v-for="(itm, ind) in item.fileVos" :key="ind" @click.stop="handlePreview(index,ind)"> <image :src="itm.url" mode="scaleToFill"></image> </view> </view> + <view class="margin-top-two"> + <comment-list :personEvalList="item.commentVos"></comment-list> + </view> </view> </view> </view> @@ -72,17 +74,23 @@ }) this.list = list }, + //点击获取id + handleLookId(data) { + this.$emit('getId', data.id) + }, //图片预览 handlePreview(index, inx) { + console.log(index, inx) let that = this - var photoList = that.list[index].imageList.map(item => { // item 获取到的图片地址 + var photoList = that.list[index].fileVos.map(item => { // item 获取到的图片地址 return item.url; }); - uni.previewImage({ - current: inx, - urls: photoList, - loop: true - }) + console.log(photoList, '第三') + // uni.previewImage({ + // current: inx, + // urls: photoList, + // loop: true + // }) } } @@ -91,7 +99,7 @@ <style lang="scss" scoped> .evaluate .evaluateCenter .evaluateItem { - display: inline-block; + // display: inline-block; } // 展开收起 diff --git a/config/index.js b/config/index.js index 9767e77..f6dfce4 100644 --- a/config/index.js +++ b/config/index.js @@ -1,14 +1,14 @@ -// let hostUrl = 'https://baiyingroup.nyinhong.com', // 测试 -// // let hostUrl = 'https://baiyin-uat.nyinhong.com', // UAT +let hostUrl = 'http://xinrenli.nyinhong.com', // 测试 +// let hostUrl = 'http://192.168.0.109:7001', // UAT // // let hostUrl = 'https://pepsibdp.masterkong.com.cn', // prd -// api = '/api', -// imgApi = '/admimage/'; - -let hostUrl = '', - api = '', + api = '/api', imgApi = '/admimage/'; +// let hostUrl = '', +// api = '', +// imgApi = '/admimage/'; + switch (process.env.UNI_BASE_ENV) { case 'development': hostUrl = process.env.UNI_BASE_URL; diff --git a/home/index/index.vue b/home/index/index.vue index b783fcf..709e9e6 100644 --- a/home/index/index.vue +++ b/home/index/index.vue @@ -1,191 +1,201 @@ -<template> - <view class="content"> - <view class="content-textarea"> - <view class=""> - 标题 - </view> - <view class=""> - 灯泡坏了 - </view> - </view> - <view class="content-textarea"> - <view class=""> - 成交金额 - </view> - <view class=""> - 270 - </view> - </view> - <view class="content-photograph"> - <view class=""> - 图片说明 - </view> - <view class="content-photograph-photo"> - <image class="content-photograph-photo-graph" src="../../static/logo.png" mode="" - v-for="(v ,index) in 5" :key="index"></image> - </view> - </view> - <view class="content-frequency"> - <view class=""> - 视频说明 - </view> - <view v-for="(v ,index) in 2" :key="index"> - <video 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" - @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls - :show-fullscreen-btn='false'></video> - </view> - </view> - <view class="content-voice"> - <view class=""> - 语音说明 - </view> - <view class="content-voice-audio" @click="doPlay()"> - - </view> - </view> - <view class="content-remarks"> - <view class=""> - 备注说明 - </view> - <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> - </view> - </view> - </view> -</template> - -<script> - import apiBaseConfig from '@/config/index.js'; - export default { - data() { - return { - imgBgUrl: apiBaseConfig.imgBgUrl, - globalData: getApp().globalData, - scrollTopHeader: 0 - }; - }, - onLoad() { - this.timer = null; - this.innerAudioContext = uni.createInnerAudioContext(); - // 监听音频进入可以播放状态的事件 - this.innerAudioContext.onCanplay(() => { - this.innerAudioContext.duration; - // 延迟大约300ms以上才能获取音频总时长 - setTimeout(() => { - // 获取音频总时长 - this.duration = this.formatSeconds(this.innerAudioContext.duration); - }, 300) - }); - // 监听音频播放 - this.innerAudioContext.onPlay(() => { - // 获取当前音频的播放时间 - this.timer = setInterval(() => { - this.currentTime = this.formatSeconds(this.innerAudioContext.currentTime); - }, 1000) - - }) - }, - methods: { - // 播放 - doPlay() { - if (!this.innerAudioContext.src) { - // 音频地址 - this.innerAudioContext.src = - "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3"; - } - this.innerAudioContext.play(); - }, - // 暂停 - doPause() { - this.innerAudioContext.pause(); - // 清除定时器 - clearInterval(this.timer); - }, - // 将秒转换成03:30格式 - formatSeconds(value) { - let minute = parseInt(value / 60); - let second = parseInt(value % 60); - if (minute < 10) { - minute = "0" + minute - } - if (second < 10) { - second = "0" + second - } - return minute + ":" + second; - } - } - } -</script> - -<style lang="scss" scoped> - .content { - padding: 0rpx 40rpx 160rpx; - - &-textarea { - display: flex; - justify-content: space-between; - padding: 30rpx 10rpx; - border-bottom: 1rpx solid #E7E7E7; - - >view { - font-size: 26rpx; - font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi; - font-weight: 400; - color: #333333; - } - } - - &-photograph { - padding: 30rpx 0rpx; - - &-photo { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - - &-graph { - margin-top: 20rpx; - margin-right: 20rpx; - width: 210rpx; - height: 210rpx; - } - - &-graph:nth-child(3n) { - margin-right: 0rpx; - } - } - - } - - &-frequency { - padding: 30rpx 0rpx; - - >view { - display: flex; - - >video { - margin-top: 20rpx; - width: 373rpx; - height: 210rpx; - } - } - } - - &-voice { - padding: 30rpx 0rpx; - - &-audio { - margin-top: 20rpx; - background: #F5F5F5; - border-radius: 6rpx; - height: 68rpx; - } - } - - &-remarks { - >view { - margin-bottom: 20rpx; - } - } - } +<template> + <view class="content"> + <view class="content-textarea"> + <view class=""> + 标题 + </view> + <view class=""> + 灯泡坏了 + </view> + </view> + <view class="content-textarea"> + <view class=""> + 成交金额 + </view> + <view class=""> + 270 + </view> + </view> + <view class="content-photograph"> + <view class=""> + 图片说明 + </view> + <view class="content-photograph-photo"> + <image class="content-photograph-photo-graph" src="../../static/logo.png" mode="" + v-for="(v ,index) in 5" :key="index"></image> + </view> + </view> + <view class="content-frequency"> + <view class=""> + 视频说明 + </view> + <view v-for="(v ,index) in 2" :key="index"> + <video 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" + @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls + :show-fullscreen-btn='false'></video> + </view> + </view> + <view class="content-voice"> + <view class=""> + 语音说明 + </view> + <view class="content-voice-audio" @click="doPlay()"> + + </view> + </view> + <view class="content-remarks"> + <view class=""> + 备注说明 + </view> + <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> + </view> + </view> + </view> +</template> + +<script> + import { + orderDetailMsg + } from '../../api/system/index.js' + import apiBaseConfig from '@/config/index.js'; + export default { + data() { + return { + imgBgUrl: apiBaseConfig.imgBgUrl, + globalData: getApp().globalData, + scrollTopHeader: 0 + }; + }, + onLoad(option) { + console.log(option.id,'结束') + this.getDetailData(option.id) + this.timer = null; + this.innerAudioContext = uni.createInnerAudioContext(); + // 监听音频进入可以播放状态的事件 + this.innerAudioContext.onCanplay(() => { + this.innerAudioContext.duration; + // 延迟大约300ms以上才能获取音频总时长 + setTimeout(() => { + // 获取音频总时长 + this.duration = this.formatSeconds(this.innerAudioContext.duration); + }, 300) + }); + // 监听音频播放 + this.innerAudioContext.onPlay(() => { + // 获取当前音频的播放时间 + this.timer = setInterval(() => { + this.currentTime = this.formatSeconds(this.innerAudioContext.currentTime); + }, 1000) + + }) + }, + methods: { + getDetailData(id){ + orderDetailMsg({id:id}).then(res=>{ + console.log(res,'详情') + }) + }, + // 播放 + doPlay() { + if (!this.innerAudioContext.src) { + // 音频地址 + this.innerAudioContext.src = + "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3"; + } + this.innerAudioContext.play(); + }, + // 暂停 + doPause() { + this.innerAudioContext.pause(); + // 清除定时器 + clearInterval(this.timer); + }, + // 将秒转换成03:30格式 + formatSeconds(value) { + let minute = parseInt(value / 60); + let second = parseInt(value % 60); + if (minute < 10) { + minute = "0" + minute + } + if (second < 10) { + second = "0" + second + } + return minute + ":" + second; + } + } + } +</script> + +<style lang="scss" scoped> + .content { + padding: 0rpx 40rpx 160rpx; + + &-textarea { + display: flex; + justify-content: space-between; + padding: 30rpx 10rpx; + border-bottom: 1rpx solid #E7E7E7; + + >view { + font-size: 26rpx; + font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi; + font-weight: 400; + color: #333333; + } + } + + &-photograph { + padding: 30rpx 0rpx; + + &-photo { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + + &-graph { + margin-top: 20rpx; + margin-right: 20rpx; + width: 210rpx; + height: 210rpx; + } + + &-graph:nth-child(3n) { + margin-right: 0rpx; + } + } + + } + + &-frequency { + padding: 30rpx 0rpx; + + >view { + display: flex; + + >video { + margin-top: 20rpx; + width: 373rpx; + height: 210rpx; + } + } + } + + &-voice { + padding: 30rpx 0rpx; + + &-audio { + margin-top: 20rpx; + background: #F5F5F5; + border-radius: 6rpx; + height: 68rpx; + } + } + + &-remarks { + >view { + margin-bottom: 20rpx; + } + } + } </style> diff --git a/main.js b/main.js index f8c9644..f91539a 100644 --- a/main.js +++ b/main.js @@ -1,61 +1,70 @@ -import App from './App' -import store from './store'; - -import uView from 'uview-ui'; -Vue.use(uView); - - -import uniGo from '@/utils/unIGO.js'; -Vue.prototype.$uniGo = uniGo; - -import utilsMethods from '@/utils/utils.js'; -Vue.prototype.$utilsMethods = utilsMethods; -// 底部导航 -import comTabbar from '@/components/tabbar/tabbar'; -Vue.component('com-tabbar', comTabbar) - -// 上传 -import comUpload from '@/components/upload/aIndex.vue'; -Vue.component('com-upload', comUpload) - -// 头部导航 -import comNavBar from '@/components/navBar/aIndex'; +import App from './App' +import store from './store'; + +import uView from 'uview-ui'; +Vue.use(uView); + + +import uniGo from '@/utils/unIGO.js'; +Vue.prototype.$uniGo = uniGo; + +import utilsMethods from '@/utils/utils.js'; +Vue.prototype.$utilsMethods = utilsMethods; +// 底部导航 +import comTabbar from '@/components/tabbar/tabbar'; +Vue.component('com-tabbar', comTabbar) + +// 上传 +import comUpload from '@/components/upload/aIndex.vue'; +Vue.component('com-upload', comUpload) + +// 头部导航 +import comNavBar from '@/components/navBar/aIndex'; Vue.component('com-navbar', comNavBar) //人员评论列表 import commentList from '@/components/comment/comment.vue' -Vue.component('comment-list',commentList) -uni.$u.setConfig({ - config: { - unit: 'rpx' - }, - props: { - radio: { - size: 15 - } - } -}) - -// #ifndef VUE3 -import Vue from 'vue' -Vue.config.productionTip = false -App.mpType = 'app' -const app = new Vue({ - ...App, - store -}) -app.$mount() -// #endif - -// #ifdef VUE3 -import { - createSSRApp -} from 'vue' -export function createApp() { - const app = createSSRApp(App) - return { - app, - store - } -} +Vue.component('comment-list', commentList) + +// 时间过滤器 +Vue.filter('formatDate', date => { + let newDate = new Date(date); + let year = newDate.getFullYear(); + let month = newDate.getMonth().toString().padStart(2, 0); + let day = newDate.getDay().toString().padStart(2, 0); + return year + '-' + month + '-' + day; +}) +uni.$u.setConfig({ + config: { + unit: 'rpx' + }, + props: { + radio: { + size: 15 + } + } +}) + +// #ifndef VUE3 +import Vue from 'vue' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App, + store +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { + createSSRApp +} from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app, + store + } +} // #endif diff --git a/my/coupon/index.vue b/my/coupon/index.vue index 1cc180c..7ac3e5d 100644 --- a/my/coupon/index.vue +++ b/my/coupon/index.vue @@ -69,13 +69,11 @@ </view> </template> -<script> - import apiBaseConfig from '@/config/index.js'; +<script> + import {couponListGet} from '../../api/my/index.js' export default { data() { return { - imgBgUrl: apiBaseConfig.imgBgUrl, - globalData: getApp().globalData, scrollTopHeader: 0, optionData: {}, title: '' @@ -85,9 +83,15 @@ let self = this; self.optionData = option; console.log(option) - self.initial(); + self.initial(); + self.getCoupon() }, - methods: { + methods: { + getCoupon(){ + couponListGet().then(res=>{ + console.log('优惠券',res) + }) + }, initial() { let self = this; switch (self.optionData.type) { diff --git a/my/feedback/index.vue b/my/feedback/index.vue index cc6c71e..42c36d7 100644 --- a/my/feedback/index.vue +++ b/my/feedback/index.vue @@ -1,94 +1,131 @@ -<template> - <view class="content"> - <view class="content-form"> - <u--form label-position="top" labelWidth="100" :model="model" :rules="rules" ref="form"> - <u-form-item - required - label="标题" - prop="title" - borderBottom - :customStyle="{ - 'flex-direction': 'row !important' - }" - > - <u--input inputAlign="right" maxlength="-1" border="none" v-model="model.title" placeholder="请填写标题"></u--input> - </u-form-item> - <u-form-item required label="备注" prop="remarks" borderBottom> - <u--textarea - :customStyle="{ - marginTop: '20rpx', - background: '#F5F5F5', - border: 'none' - }" - v-model="model.remarks" - placeholder="备注说明" - height="128rpx" - ></u--textarea> - </u-form-item> - </u--form> - </view> - <u-button - text="提交反馈" - color="#2C66FF" - :customStyle="{ - width: '710rpx', - height: '80rpx', - borderRadius: '10rpx', - padding: '0rpx', - position: 'absolute', - bottom: '142rpx', - left: '20rpx' - }" - ></u-button> - </view> -</template> - -<script> -import apiBaseConfig from '@/config/index.js'; -export default { - data() { - return { - imgBgUrl: apiBaseConfig.imgBgUrl, - globalData: getApp().globalData, - scrollTopHeader: 0, - model: { - title: '', - remarks: '' - }, - rules: { - title: { - type: 'string', - required: true, - message: '请填写标题', - trigger: ['blur', 'change'] - }, - remarks: { - type: 'string', - required: true, - message: '请填写备注说明', - trigger: ['blur', 'change'] - } - } - }; - }, - onLoad() {}, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.form.setRules(this.rules); - }, - methods: {} -}; -</script> - -<style lang="scss" scoped> -.content { - &-form { - margin: 30rpx 20rpx; - width: calc(100% - 20rpx * 2); - /deep/ .u-form { - width: calc(100% - 20rpx * 2); - margin: 0rpx 20rpx; - } - } -} +<template> + <view class="content"> + <view class="content-form"> + <u--form label-position="top" labelWidth="100" :model="model" :rules="rules" ref="form"> + <u-form-item required label="标题" prop="title" borderBottom :customStyle="{ + 'flex-direction': 'row !important' + }"> + <u--input inputAlign="right" maxlength="-1" border="none" v-model="model.title" placeholder="请填写标题"> + </u--input> + </u-form-item> + <u-form-item required label="备注" prop="content" borderBottom> + <u--textarea :customStyle="{ + marginTop: '20rpx', + background: '#F5F5F5', + border: 'none' + }" v-model="model.content" placeholder="备注说明" height="128rpx"></u--textarea> + </u-form-item> + </u--form> + </view> + <u-button @click="handleSubmit" text="提交反馈" color="#2C66FF" :customStyle="{ + width: '710rpx', + height: '80rpx', + borderRadius: '10rpx', + padding: '0rpx', + position: 'absolute', + bottom: '142rpx', + left: '20rpx' + }"></u-button> + </view> +</template> + +<script> + // import apiBaseConfig from '@/config/index.js'; + import { + addUserFeedback + } from '@/api/my/index.js' + export default { + data() { + return { + // imgBgUrl: apiBaseConfig.imgBgUrl, + globalData: getApp().globalData, + scrollTopHeader: 0, + model: { + title: '', + content: '', + userId:'111', + modifyTime:'2021-12-03 09:30:11', + deleteStatus:0, + createUser:'李哈哈', + modifyUser:'杜小渣' + }, + rules: { + title: { + type: 'string', + required: true, + message: '请填写标题', + trigger: ['blur', 'change'] + }, + content: { + type: 'string', + required: true, + message: '请填写备注说明', + trigger: ['blur', 'change'] + } + } + }; + }, + onLoad() {}, + onReady() { + //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + this.$refs.form.setRules(this.rules); + }, + methods: { + handleSubmit() { + let that = this + that.model = { + ...that.model, + content:that.model.content.trim() + } + that.$refs.form.validate().then(res => { + addUserFeedback(that.model).then(res=>{ + if(res.code == 200){ + uni.showToast({ + title:'提交成功!', + icon:'none', + duration:2000, + success() { + setTimeout(()=>{ + that.$uniGo.navigateBack({ + delta: 1 + }); + that.resetForm() + },1000) + } + }) + } + }) + // uni.$u.toast('校验通过') + }).catch(errors => { + uni.$u.toast('请完善信息') + }) + + }, + resetForm(){ + this.model = { + title: '', + content: '', + userId:'111', + modifyTime:'2021-12-03 09:30:11', + deleteStatus:0, + createUser:'李哈哈', + modifyUser:'杜小渣' + } + } + } + }; +</script> + +<style lang="scss" scoped> + .content { + &-form { + margin: 30rpx 20rpx; + width: calc(100% - 20rpx * 2); + + /deep/ .u-form { + width: calc(100% - 20rpx * 2); + margin: 0rpx 20rpx; + } + } + } </style> diff --git a/order/detail/detail.vue b/order/detail/detail.vue index e1af82e..6ea2f55 100644 --- a/order/detail/detail.vue +++ b/order/detail/detail.vue @@ -10,7 +10,7 @@ </view> <view class="paddding-x-two"> <view class="eval-box"> - <view class="evaluate-title">文章标题文章标题文章标题文章标题文章标题</view> + <view class="evaluate-title">{{articleData.title}}</view> <view class="d-flex a-center j-sb margin-top-two"> <view class="d-flex a-center"> <image class="img" @@ -19,23 +19,23 @@ <view class="evaluate-name">张三</view> </view> - <view class="eval-time">发布于2022-11-16</view> + <view class="eval-time">发布于{{ articleData.createTime | formatDate}}</view> </view> <view class="evaluateText text-indent"> - 评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容 + {{articleData.content}} </view> </view> </view> <view class="bgWhite"> <view class="padding-aval"> - <comment-list :personEvalList="personEvalList"></comment-list> + <comment-list :personEvalList="userEvalList"></comment-list> </view> </view> </view> <view class="comment-box"> <view class="paddding-x-two comment-box-height d-flex a-center j-sb"> - <input class="send-input" type="text" placeholder="评论一下吧"> - <view class="send-btn-box">发送</view> + <input v-model="content" class="send-input" type="text" placeholder="评论一下吧"> + <view class="send-btn-box" @click="handleSend">发送</view> </view> </view> @@ -43,6 +43,7 @@ </template> <script> + import {articleDetail,userEvaluateGet,addUserEvaluate} from '../../api/order/index.js' export default { data() { return { @@ -76,11 +77,59 @@ date: '2022-05-11', content: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容' }, - ] + ], + articleData:{}, + userQuery:{ + pageNum:1, + pageSize:10, + articleId:null + }, + userEvalList:[], + content:'',//评论的内容 } }, + onLoad(option) { + console.log(option.id,'接受的') + this.getDetail(option.id) + this.getUserEvalList(option.id) + }, methods: { - + getDetail(id){ + let that = this + articleDetail(id).then(res=>{ + console.log(res,'文章详情') + if(res.code == 200){ + that.articleData = res.data + } + }) + }, + getUserEvalList(id){ + let that = this + that.userQuery.articleId = id + userEvaluateGet(that.userQuery).then(res=>{ + console.log(res,'用户评论列表') + if(res.code == 200){ + if(res.total > 0){ + this.userEvalList = res.rows + } + } + }) + }, + handleSend(){ + let that = this + that.content = that.content.trim() + if(that.content){ + addUserEvaluate({content:this.content.trim()}).then(res=>{ + console.log('发送',res) + }) + }else{ + return uni.showToast({ + title:'不可发布空白内容', + icon:'none' + }) + } + + } } } </script> diff --git a/pages/home/index.vue b/pages/home/index.vue index e9ea003..4f0b8fe 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -16,19 +16,19 @@ <view></view> <view>用户需求广场</view> </view> - <view class="" v-if="arr && arr.length"> - <view class="content-matter-marketplace" v-for="(v , index) in 10" @click="clickJump" :key="index"> - <image src="/static//icon/sytb.png" mode=""></image> - <view class="content-matter-marketplace-bazaar"> + <view class="" v-if="userNeedList && userNeedList.length"> + <view class="content-matter-marketplace" v-for="(v , index) in userNeedList" @click="clickJump(v)" :key="index"> + <image :src="v.fileVos[0].url" mode=""></image> + <view class="content-matter-marketplace-bazaar d-flex flex-column j-center"> <view class=""> - 灯泡灯芯坏了 + {{v.title}} </view> <view class=""> - 说明:有一个字不是特别亮,希望换一盏灯希望换一盏灯希望换一盏灯 + 说明:{{v.remark}} </view> <view class=""> <text>维修时间:</text> - <text>2023-02-23</text> + <text>{{v.repairTime}}</text> </view> </view> </view> @@ -46,16 +46,14 @@ </view> </template> -<script> - import apiBaseConfig from '@/config/index.js'; +<script> + import { userNeedSquare } from '@/api/system/index.js' export default { data() { return { title: 'Hello', - imgBgUrl: apiBaseConfig.imgBgUrl, globalData: getApp().globalData, scrollTopHeader: 0, - arr: [], tabBarList: [{ name: "首页", // name icon: "/static/tabbar/tb1.png", // 图标 @@ -86,18 +84,31 @@ selectIcon: "/static/tabbar/td4.png", // 选中图标 url: "/pages/my/index", type: 'type' - }], + }], + userNeedList:[],//需求广场列表 } }, - onLoad() {}, + onLoad() { + this.getSquare() + }, onPageScroll(res) { // console.log('页面滚动了onPageScroll-app', res.scrollTop); this.scrollTopHeader = res.scrollTop; }, - methods: { - clickJump() { + methods: { + getSquare(){ + userNeedSquare().then(res=>{ + console.log(res,'需求广场') + if(res.code == 200){ + if(res.total > 0){ + this.userNeedList = res.rows + } + } + }) + }, + clickJump(info) { this.$uniGo.navigateTo({ - url: `/home/index/index` + url: `/home/index/index?id=${info.id}` }); }, } diff --git a/pages/order/index.vue b/pages/order/index.vue index 700a97e..1793530 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -2,11 +2,8 @@ <view class="content"> <view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 130rpx)` }"></view> - <view class="friends-list-box" @click="handleDetail"> - <evaluateList :list="evaluateList"></evaluateList> - <view class="margin-top-two"> - <comment-list :personEvalList="personEvalList"></comment-list> - </view> + <view class="friends-list-box"> + <evaluateList :list="articleList" @getId="handleDetail"></evaluateList> </view> <com-navbar :leftIcon="false" :homeShow="false" bgColor="#fff" title="动态" :titleStyle="{ color: '#000', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" /> @@ -45,6 +42,7 @@ </template> <script> + import {userArticleGet} from '../../api/order/index.js' import evaluateList from '../../components/evaluate.vue' export default { components: { @@ -53,6 +51,13 @@ data() { return { globalData: getApp().globalData, + queryParams:{ + pageNum:1,//当前页数 + pageSize:10,//分页大小 + }, + articleList:[],//文章列表 + total:0,//总数 + evaluateList: [{ name: '马保国', image: 'https://slzh-oss.oss-cn-beijing.aliyuncs.com/usercenter/template/2c94809a787cec070179e01ec0ba02a9.jpg', @@ -97,35 +102,31 @@ date: '2022-01-31', content: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容' }, - { - avatar: 'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', - nickname: '李小乖', - date: '2022-05-11', - content: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容' - }, - { - avatar: 'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', - nickname: '李哈哈', - date: '2022-01-31', - content: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容' - }, - { - avatar: 'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', - nickname: '李小乖', - date: '2022-05-11', - content: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容' - }, ] } }, onLoad() { - + this.getArticleList() }, methods: { - handleDetail() { + getArticleList(){ + let that = this + userArticleGet(that.queryParams).then(res=>{ + console.log('文章列表',res.rows) + if(res.code == 200){ + if(res.total > 0){ + that.articleList = res.rows + that.total = res.total + } + } + }) + }, + + + handleDetail(id) { let that = this that.$uniGo.navigateTo({ - url: '/order/detail/detail' + url: '/order/detail/detail?id='+id }) } diff --git a/utils/request.js b/utils/request.js index 3b3e423..61045d0 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,106 +1,107 @@ -import store from '@/store' -import apiBaseConfig from '@/config/index.js' - -function httpBaseUrl() { - // #ifdef MP-WEIXIN - return '/dev-api' - // #endif -} - -function switchMethod(method) { - let header = {}; - switch (method) { - case 'POST': - header = { - // 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - 'Content-Type': 'application/json;charset=UTF-8', - } - break; - case 'GET': - header = { - 'Content-Type': 'application/json;charset=UTF-8', - } - break; - } - return header -} - -/** - * url 接口地址 - * params 参数 - * method 请求方式,必须全大写 - * isToken 请求头是否设置token,默认true - **/ -const ApiHttp = (url, params, method, isToken = true) => { - let header = {}, - token = store.state.login.token || null; - header = switchMethod(method) - // console.log(store.state.login.token,'================token') - if (isToken) { - header = { - ...header, - 'Authorization': `Bearer ${token}` - } - } - return new Promise((resolve, reject) => { - // uni.showLoading({ - // title: '加载中...', - // mask: true, - // }); - uni.request({ - url: `${apiBaseConfig.domain}${url}`, - method, - data: params, - header, - success: (res) => { - const { - data - } = res; - const { - code, - msg - } = data; - if (code === 200) { - resolve(data); - } else if (code === 401) { - resolve(data); - } else { - if (url == '/group-buy/by-consumer-order/leader/refunde' || - url == '/group-buy/by-collective-leader/releaseOrder' || - url == '/group-buy/by-collective-leader-authentication/apply/leader') { - resolve(data); - return - } - uni.showToast({ - title: msg || '系统内部错误', - icon: "none" - }) - if (url == '/system/xcxLogin' || url == 'system/getPhone') { - uni.clearStorageSync(); - store.dispatch('loginOut') - } - - } - }, - fail: (err) => { - console.log(err, 'pppppppppppp') - uni.showToast({ - title: err.errMsg, - icon: "none" - }) - if (url == '/system/xcxLogin' || url == 'system/getPhone') { - uni.clearStorageSync(); - store.dispatch('loginOut') - } - reject(err) - }, - complete: () => { - // uni.hideLoading(); - } - }) - }) -} - -export { - ApiHttp +import store from '@/store' +import apiBaseConfig from '@/config/index.js' + +function httpBaseUrl() { + // #ifdef MP-WEIXIN + return '/dev-api' + // #endif +} + +function switchMethod(method) { + let header = {}; + switch (method) { + case 'POST': + header = { + // 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', + 'Content-Type': 'application/json;charset=UTF-8', + } + break; + case 'GET': + header = { + 'Content-Type': 'application/json;charset=UTF-8', + } + break; + } + return header +} + +/** + * url 接口地址 + * params 参数 + * method 请求方式,必须全大写 + * isToken 请求头是否设置token,默认true + **/ +const ApiHttp = (url, params, method, isToken = true) => { + let header = {}, + token = store.state.login.token || null; + header = switchMethod(method) + // console.log(store.state.login.token,'================token') + if (isToken) { + header = { + ...header, + 'Authorization': `Bearer ${token}` + } + } + return new Promise((resolve, reject) => { + // uni.showLoading({ + // title: '加载中...', + // mask: true, + // }); + uni.request({ + url: `${apiBaseConfig.domain}${url}`, + method, + data: params, + header, + success: (res) => { + console.log(res,'封装接口成功') + const { + data + } = res; + const { + code, + msg + } = data; + if (code === 200) { + resolve(data); + } else if (code === 401) { + resolve(data); + } else { + if (url == '/group-buy/by-consumer-order/leader/refunde' || + url == '/group-buy/by-collective-leader/releaseOrder' || + url == '/group-buy/by-collective-leader-authentication/apply/leader') { + resolve(data); + return + } + uni.showToast({ + title: msg || '系统内部错误', + icon: "none" + }) + if (url == '/system/xcxLogin' || url == 'system/getPhone') { + uni.clearStorageSync(); + store.dispatch('loginOut') + } + + } + }, + fail: (err) => { + console.log(err, 'pppppppppppp') + uni.showToast({ + title: err.errMsg, + icon: "none" + }) + if (url == '/system/xcxLogin' || url == 'system/getPhone') { + uni.clearStorageSync(); + store.dispatch('loginOut') + } + reject(err) + }, + complete: () => { + // uni.hideLoading(); + } + }) + }) +} + +export { + ApiHttp } diff --git a/utils/rules.js b/utils/rules.js new file mode 100644 index 0000000..8e473c1 --- /dev/null +++ b/utils/rules.js @@ -0,0 +1,36 @@ +const isEmojiCharacter = (substring) => { + for (var i = 0; i < substring.length; i++) { + var hs = substring.charCodeAt(i); + if (0xd800 <= hs && hs <= 0xdbff) { + if (substring.length > 1) { + var ls = substring.charCodeAt(i + 1); + var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; + if (0x1d000 <= uc && uc <= 0x1f77f) { + return true; + } + } + } else if (substring.length > 1) { + var ls = substring.charCodeAt(i + 1); + if (ls == 0x20e3) { + return true; + } + } else { + if (0x2100 <= hs && hs <= 0x27ff) { + return true; + } else if (0x2B05 <= hs && hs <= 0x2b07) { + return true; + } else if (0x2934 <= hs && hs <= 0x2935) { + return true; + } else if (0x3297 <= hs && hs <= 0x3299) { + return true; + } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || + hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || + hs == 0x2b50) { + return true; + } + } + } +} +export { + isEmojiCharacter +}