Commit 0d4e104b by honghong

支付时间倒计时,修改bug

parent dcb62df5
......@@ -86,11 +86,11 @@
return item.url;
});
console.log(photoList, '第三')
// uni.previewImage({
// current: inx,
// urls: photoList,
// loop: true
// })
uni.previewImage({
current: inx,
urls: photoList,
loop: true
})
}
}
......
......@@ -30,7 +30,8 @@
<u-datetime-picker ref="datePicker" :formatter="formatter" v-model="formInfo.repairTime"
:show="showTime" mode="date" @confirm="handleConfirmDate" @cancel="handleClose">
</u-datetime-picker>
<input type="text" v-model="formInfo.repairTime" placeholder="请选择时间">
<view class="time-text">{{formInfo.repairTime ? formInfo.repairTime : '请选择时间'}}</view>
<!-- <input type="text" v-model="formInfo.repairTime" placeholder="请选择时间"> -->
<u-icon name="arrow-down-fill" color="#000000" size="28"></u-icon>
</view>
</u--input>
......@@ -65,20 +66,20 @@
<view class="form-item-name">上传视频</view>
</view>
<view>
<view class="video-box" style="" v-if="formInfo.videoList.length">
<video id="myVideo" :src="formInfo.videoList[0].url"
@error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls
<video id="myVideo" :src="formInfo.videoList[0].url" @error="videoErrorCallback"
:danmu-list="danmuList" enable-danmu controls
:show-fullscreen-btn='false'></video>
<view class="position-icon" @click="delVideoList">
<u-icon name="close-circle-fill" color="#D9001B" size="32"></u-icon>
</view>
</view>
<comUpload v-else :afterWidth="350" @getVal="getVideoList"
ref="videoRef" :acceptType="acceptType" :maxCount="1" :multiple="isMultiple">
<comUpload v-else :afterWidth="350" @getVal="getVideoList" ref="videoRef"
:acceptType="acceptType" :maxCount="1" :multiple="isMultiple">
</comUpload>
</view>
......@@ -137,7 +138,12 @@
statusBtn: Number,
detailData: Object
},
data() {
const mobile = (rule, value, callback) => {
return /^1[3-9]\d{9}$/.test(value) ? callback() : callback(new Error('请输入正确的手机号码'))
}
return {
showTime: false, //时间选择器是否显示
acceptType: 'video',
......@@ -156,19 +162,36 @@
linkman: {
type: 'string',
required: true,
message: '请填写备注说明',
message: '请填写联系人',
trigger: ['blur', 'change']
},
phone: [{
type: 'string',
required: true,
message: '请输入正确的联系人手机号码',
max: 11,
min: 11,
trigger: 'blur'
},
{
// 自定义验证函数,见上说明
validator: mobile,
message: '手机号码不正确',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}
],
repairAddress: {
type: 'string',
required: true,
message: '请填写备注说明',
message: '请填写维修地址',
trigger: ['blur', 'change']
},
budget: {
type: 'string',
type: 'number',
required: true,
message: '请填写备注说明',
message: '请填写预算金额',
trigger: ['blur', 'change']
},
},
......@@ -176,6 +199,11 @@
};
},
//如果是自己封装的组件就是mounted()
//如果不是组件就是onReady()
mounted() {
this.$refs.form.setRules(this.rules);
},
watch: {
detailData: {
handler(newVal, oldVal) {
......@@ -216,6 +244,7 @@
url: data.url,
fileType: 'picture'
})
// that.formInfo.pictureList = photoList
},
//删除照片
delPhotoItem(index) {
......@@ -224,7 +253,6 @@
// 获取上传视频的值
getVideoList(data) {
let that = this
console.log(data, '有的哈桑')
let videoList = []
videoList.push({
url: data.url,
......@@ -232,27 +260,36 @@
})
that.formInfo.videoList = videoList
},
delVideoList(){
console.log('删除',this.formInfo.videoList)
delVideoList() {
this.formInfo.videoList.splice(0, 1)
console.log('删除后',this.formInfo.videoList)
},
// 上传音频事件
getVoiceList(data) {
let that = this
that.showPopup = false
console.log(data, '有的哈桑')
let voiceList = []
voiceList.push({
url: data.url,
fileType: 'video'
fileType: 'voice'
})
that.formInfo.voiceList = voiceList
},
//确认修改和重新发布按钮
handleUpdateForm() {
this.$emit('submit', this.formInfo)
let that = this
that.$refs.form.validate().then(res => {
if (res) {
if (that.formInfo.pictureList.length || that.formInfo.videoList.length || that.formInfo
.voiceList.length) {
that.$emit('submit', that.formInfo)
} else {
uni.$u.toast('图片、视频、音频选其一必填')
}
}
}).catch(errors => {
uni.$u.toast('校验失败')
})
},
async handleAdd() {
let that = this
......@@ -374,20 +411,23 @@
.video-box {
width: 373rpx;
height: 210rpx;
position:relative;
video{
width:100%;
height:100%
position: relative;
video {
width: 100%;
height: 100%
}
}
.position-icon {
position: absolute;
top:-10rpx;
right:-10rpx;
top: -10rpx;
right: -10rpx;
}
.time-text{
color:#666666;
font-size:24rpx;
}
@import url("@/css/form.css");
......
......@@ -84,8 +84,6 @@
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
console.log(lists,'点九三')
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
......@@ -115,11 +113,9 @@
'Authorization': `Bearer ${uni.getStorageSync('token')}`
},
success: (res) => {
console.log(res.data, '单价')
const {
data
} = JSON.parse(res.data);
console.log(data, '大街上可能')
this.$emit('getVal', data);
setTimeout(() => {
......
......@@ -24,34 +24,40 @@
<view class="">预算金额</view>
<view class="">{{detailData.budget}}</view>
</view>
<view class="content-photograph" v-if="detailData && detailData.pictureList && detailData.pictureList.length">
<view class="content-photograph" >
<view class="">上传图片
</view>
<view class="content-photograph-photo">
<image class="content-photograph-photo-img" :src="v.url" mode="" v-for="(v ,index) in detailData.pictureList"
:key="index"></image>
<view>
<view class="content-photograph-photo" v-if="detailData && detailData.pictureList && detailData.pictureList.length">
<image class="content-photograph-photo-img" :src="v.url" mode=""
v-for="(v ,index) in detailData.pictureList" :key="index"></image>
</view>
<view class="noData-text" v-else>暂无数据</view>
</view>
</view>
<view class="content-frequency" v-if="detailData && detailData.videoList && detailData.videoList.length">
<view class="">
上传视频
</view>
<view v-for="(v ,index) in detailData.videoList" :key="index">
<video id="myVideo"
:src="v.url"
@error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls
:show-fullscreen-btn='false'></video>
<view class="content-frequency" >
<view class="">
上传视频
</view>
<view v-if="detailData && detailData.videoList && detailData.videoList.length">
<view v-for="(v ,index) in detailData.videoList" :key="index">
<video class="video-box" id="myVideo" :src="v.url" @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu
controls :show-fullscreen-btn='false'></video>
</view>
</view>
<view class="noData-text" v-else>暂无数据</view>
</view>
</view>
<view class="content-voice" v-if="detailData && detailData.voiceList && detailData.voiceList.length">
<view class="content-voice" >
<view class="">
语音描述
</view>
<!-- class="content-voice-audio" -->
<view class="margin-y-two">
<free-audio
audioId='audio1' :url='detailData.voiceList[0].url' :isDel="false"></free-audio>
<view class="margin-y-two" v-if="detailData && detailData.voiceList && detailData.voiceList.length">
<free-audio audioId='audio1' :url='detailData.voiceList[0].url' :isDel="false"></free-audio>
</view>
<view class="noData-text" v-else>暂无数据</view>
</view>
<view class="content-remarks">
<view class="">
......@@ -63,7 +69,8 @@
<view class="font-bold">
<text></text>订单已驳回
</view>
<view class="paddding-x-two">驳回理由:{{detailData && detailData.reasonsForRejection ? detailData.reasonsForRejection : '暂无'}}</view>
<view class="paddding-x-two">
驳回理由:{{detailData && detailData.reasonsForRejection ? detailData.reasonsForRejection : '暂无'}}</view>
<!-- <u--textarea v-model="detailData.value1" placeholder="请输入内容" disabled></u--textarea> -->
</view>
<view class="content-reject" v-if="subscript == 3 && detailData.status== 5">
......@@ -175,15 +182,11 @@
&-frequency {
padding: 30rpx 0rpx;
>view {
display: flex;
>video {
.video-box {
margin-top: 20rpx;
width: 373rpx;
height: 210rpx;
}
}
}
&-voice {
......
......@@ -16,24 +16,23 @@
{{orderDetail && orderDetail.actualAmount ? orderDetail.actualAmount : ''}}
</view>
</view>
<view class="content-photograph" >
<view class="content-photograph">
<view class="">
图片说明
</view>
<view class="content-photograph-photo">
<view class="content-photograph-photo" v-if="orderDetail && orderDetail.pictureList.length">
<image class="content-photograph-photo-graph" :src="v.url" mode=""
v-for="(v ,index) in orderDetail.fileVos" :key="v.id" v-if="v.fileType == 'picture'"></image>
v-for="(v ,index) in orderDetail.pictureList" :key="v.id"></image>
</view>
<view class="noData-text">暂无数据</view>
<view v-else class="noData-text">暂无数据</view>
</view>
<view class="content-frequency">
<view class="">
视频说明
</view>
<view v-if="orderDetail && orderDetail.fileVos.length && v.fileType == 'video'" v-for="(v ,index) in orderDetail.fileVos" :key="v.id" >
<video v-if="v.fileType == 'video'" id="myVideo"
:src="v.url"
@error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls
<view v-if="orderDetail && orderDetail.videoList.length" v-for="(v ,index) in orderDetail.videoList"
:key="v.id">
<video :src="v.url" @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls
:show-fullscreen-btn='false'></video>
</view>
<view class="noData-text">暂无数据</view>
......@@ -42,11 +41,11 @@
<view class="">
语音说明
</view>
<view class="margin-top-two">
<free-audio startPic='../../static/stopStatus.png' endPic='../../static/startStatus.png' audioId='audio1'
:url='path' :isDel="false"></free-audio>
<view class="noData-text">暂无数据</view>
<view class="margin-top-two" v-if="orderDetail && orderDetail.voiceList.length">
<free-audio startPic='../../static/stopStatus.png' endPic='../../static/startStatus.png'
audioId='audio1' :url='orderDetail.voiceList[0].url' :isDel="false"></free-audio>
</view>
<view v-else class="noData-text">暂无数据</view>
<!-- <view class="content-voice-audio" @click="doPlay()"></view> -->
</view>
<view class="content-remarks">
......@@ -67,7 +66,7 @@
import apiBaseConfig from '@/config/index.js';
import freeAudio from '../../components/chengpeng-audio/free-audio.vue'
export default {
components:{
components: {
freeAudio
},
data() {
......@@ -75,12 +74,12 @@
imgBgUrl: apiBaseConfig.imgBgUrl,
globalData: getApp().globalData,
scrollTopHeader: 0,
orderDetail:{},
path:'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
orderDetail: {},
path: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
};
},
onLoad(option) {
console.log(option.id,'结束')
console.log(option.id, '结束')
this.getDetailData(option.id)
this.timer = null;
this.innerAudioContext = uni.createInnerAudioContext();
......@@ -103,11 +102,16 @@
})
},
methods: {
async getDetailData(id){
async getDetailData(id) {
let that = this
const data_back = await orderDetailMsgNew({id:id})
console.log(data_back,'返沪')
const {code,data} = data_back
const data_back = await orderDetailMsgNew({
id: id
})
console.log(data_back, '返沪')
const {
code,
data
} = data_back
that.orderDetail = data
// orderDetailMsgNew({id:id}).then(res=>{
// console.log(res.data,'详情')
......
......@@ -30,12 +30,16 @@ import commentList from '@/components/comment/comment.vue'
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;
Vue.filter("formatDate", (date) => {
let d = new Date(date);
let month = (d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : (d.getMonth() + 1);
let day = d.getDate() < 10 ? '0' + d.getDate() : d.getDate();
let hours = d.getHours() < 10 ? '0' + d.getHours() : d.getHours();
let min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes();
let sec = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds();
let times;
times = d.getFullYear() + '-' + month + '-' + day;
return times
})
uni.$u.setConfig({
config: {
......
<template>
<view class="index">
<com-navbar :title="title" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" />
<view class="index-content">
<view class="index-content" v-if="useCouponList.length && couponLoseList.length">
<view class="index-content-item" v-for="(item,index) in useCouponList">
<view class="index-content-item-nav baiyin-flex baiyin-flex-c-b">
<text></text>
......@@ -65,6 +65,12 @@
</view>
</view>
</view>
</view>
<view v-else class="diagram">
<image src="@/static/icon/qst.png" mode=""></image>
<view class="">
暂无优惠券
</view>
</view>
</view>
</template>
......@@ -394,6 +400,22 @@
}
}
}
}
.diagram {
text-align: center;
margin-top: 335rpx;
>image {
width: 396rpx;
height: 243rpx;
}
>view {
margin-top: 20rpx;
font-size: 24rpx;
font-weight: 400;
color: #444444;
}
}
}
</style>
......@@ -2,10 +2,8 @@
<view>
<view style="padding-bottom: 100rpx;">
<view class="padding-x-four d-flex flex-wrap j-sb flex-content">
<view v-for="item in 5">
<image class="evaluateListImgItem"
src="https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
mode="scaleToFill"></image>
<view v-for="(item,index) in articleData.fileVos" @click="handlePreview(item,index)">
<image class="evaluateListImgItem" :src="item.url" mode="scaleToFill"></image>
</view>
</view>
<view class="paddding-x-two">
......@@ -13,10 +11,9 @@
<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"
src="https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
mode="widthFix"></image>
<view class="evaluate-name">{{articleData.createUser ? articleData.createUser : '官方'}}</view>
<image class="img" src="../../static/logoLogin.png" mode="widthFix"></image>
<view class="evaluate-name">{{articleData.createUser ? articleData.createUser : '官方发布'}}
</view>
</view>
<view class="eval-time">发布于{{ articleData.createTime | formatDate}}</view>
......@@ -24,7 +21,7 @@
<view class="evaluateText text-indent" v-html="articleData.content"></view>
</view>
</view>
<view class="bgWhite">
<view class="bgWhite" v-if="userEvalList.length">
<view class="padding-aval">
<comment-list :personEvalList="userEvalList"></comment-list>
</view>
......@@ -41,21 +38,25 @@
</template>
<script>
import {articleDetail,userEvaluateGet,addUserEvaluate} from '../../api/order/index.js'
import {
articleDetail,
userEvaluateGet,
addUserEvaluate
} from '../../api/order/index.js'
export default {
data() {
return {
articleData:{},
userQuery:{
pageNum:1,
pageSize:10,
articleId:null
articleData: {},
userQuery: {
pageNum: 1,
pageSize: 10,
articleId: null
},
userEvalList:[],
evalQuery:{
content:'',//评论的内容
articleId:'',//文章id
deleteStatus:0
userEvalList: [],
evalQuery: {
content: '', //评论的内容
articleId: '', //文章id
deleteStatus: 0
}
}
},
......@@ -64,55 +65,69 @@
this.getUserEvalList(option.id)
},
methods: {
getDetail(id){
getDetail(id) {
let that = this
articleDetail(id).then(res=>{
if(res.code == 200){
articleDetail(id).then(res => {
if (res.code == 200) {
that.articleData = res.data
}
})
},
getUserEvalList(id){
getUserEvalList(id) {
let that = this
that.userQuery.articleId = id
userEvaluateGet(that.userQuery).then(res=>{
if(res.code == 200){
if(res.total > 0){
userEvaluateGet(that.userQuery).then(res => {
if (res.code == 200) {
if (res.total > 0) {
this.userEvalList = res.rows
}
}
})
},
async handleSend(){
async handleSend() {
let that = this
if(that.evalQuery.content){
that.$set(that.evalQuery,'content',that.evalQuery.content.trim())
that.$set(that.evalQuery,'articleId',that.articleData.id)
if (that.evalQuery.content) {
that.$set(that.evalQuery, 'content', that.evalQuery.content.trim())
that.$set(that.evalQuery, 'articleId', that.articleData.id)
const data_back = await addUserEvaluate(that.evalQuery)
const {code} = data_back
if(code === 200){
const {
code
} = data_back
if (code === 200) {
that.evalQuery.content = ''
uni.showToast({
title:'评论成功!',
icon:'none',
duration:2000,
title: '评论成功!',
icon: 'none',
duration: 2000,
success() {
let clearTime = setTimeout(() => {
clearTimeout(clearTime)
that.$uniGo.navigateBack({
delta:1
delta: 1
})
}, 1000)
}
})
}
}else{
} else {
return uni.showToast({
title:'不可发布空白内容',
icon:'none'
title: '不可发布空白内容',
icon: 'none'
})
}
},
//图片预览
handlePreview(item, index) {
let that = this
var photoList = that.articleData.fileVos.map(item => { // item 获取到的图片地址
return item.url;
});
uni.previewImage({
current: index,
urls: photoList,
loop: true
})
}
}
}
......
......@@ -38,7 +38,7 @@
已沟通审核通过,待支付<text>{{item.actualAmount ? item.actualAmount : 0}}</text>
</view>
<view class="">
截止1小时内支付完成<text>{{isEndTime}}</text>
截止1小时内支付完成<text v-if="isEndTime">{{isEndTime}}</text>
</view>
</view>
<view class="" @click.stop="payment(item)">
......@@ -47,8 +47,9 @@
</view>
<!-- // 已接单 -->
<view class="buttoncolor" v-if="subscript == '3'">
<button v-if="item.status == 3" style="background: red;" class="buttoncl" @click.stop="abolish(2,item)">退款</button>
<button v-else-if="item.status == 6" class="buttonclde buttonGray"
<button v-if="item.status == 3" style="background: red;" class="buttoncl"
@click.stop="abolish(2,item)">退款</button>
<button v-else-if="item.status == 6" class="buttonclde buttonGray"
@click.stop="abolish(4,item)">已退款</button>
<button class="buttoncl" @click.stop="abolish(3,item)">详情</button>
</view>
......@@ -78,36 +79,60 @@
data() {
return {
timer: "", //定时器
isEndTime: "01:00:00", //倒计时要有个初始值
isEndTime: "", //倒计时要有个初始值
imgBgUrl: apiBaseConfig.imgBgUrl,
globalData: getApp().globalData,
show: false,
title: '确认取消订单吗',
titbut: '取消订单',
currentId: '', //当前的id
actualAmount: 0, //实付金饿
actualAmount: 0, //实付金额
countdownh: '',
countdownm: '',
countdowns: '',
timer: null, //重复执行
}
},
mounted() {
this.timer = setInterval(() => {
this.countDown()
}, 1000)
if(this.subscript == 2){
this.list.map(item=>{
this.timer = setInterval(() => {
this.showtime(item.modifyTime)
}, 1000)
})
}
},
methods: {
// 1小时倒计时
countDown() {
let allTime = 0;
let h = this.isEndTime.substring(0, 2);
let m = this.isEndTime.substring(3, 5);
let s = this.isEndTime.substring(6, 8);
allTime = Number(h) * 60 * 60 + Number(m) * 60 + Number(s);
if (allTime <= 0) return clearInterval(this.timer); //执行倒计时结束逻辑
allTime--;
h = parseInt(allTime / 3600) < 10 ? '0' + String(parseInt(allTime / 3600)) : parseInt(allTime / 3600);
m = parseInt(allTime / 60) < 10 ? '0' + String(parseInt(allTime / 60)) : parseInt(allTime / 60);
s = allTime % 60 < 10 ? '0' + String(allTime % 60) : allTime % 60;
this.isEndTime = h + ":" + m + ":" + s;
showtime(modifyTime) {
//获取当前时间
var curTime = new Date();
var curTimeDate = curTime.getTime(); //当前时间戳
// 发起支付的时间
var startTime = new Date(modifyTime);
// 发起支付的时间+1小时
var addHour = startTime.setHours(startTime.getHours() + 1)
console.log(addHour,'大伤脑筋')
console.log(new Date(addHour),'大伤脑筋111')
var lefttime = addHour - curTimeDate,
leftd = Math.floor(lefttime / (1000 * 60 * 60 * 24)), //计算天数
lefth = Math.floor((lefttime / (1000 * 60 * 60) % 24) + leftd * 24) < 10 ? "0" + Math.floor((lefttime /
(1000 * 60 * 60) % 24) + leftd * 24) : Math.floor((lefttime / (1000 * 60 * 60) % 24) + leftd *
24), //计算小时数
leftm = Math.floor(lefttime / (1000 * 60) % 60) < 10 ? "0" + Math.floor(lefttime / (1000 * 60) % 60) :
Math.floor(lefttime / (1000 * 60) % 60), //计算分钟数
lefts = Math.floor(lefttime / 1000 % 60) < 10 ? "0" + Math.floor(lefttime / 1000 % 60) : Math.floor(
lefttime / 1000 % 60); //计算秒数
this.countdownh = lefth //返回倒计时的字符串
this.countdownm = leftm //返回倒计时的字符串
this.countdowns = lefts //返回倒计时的字符串
// 倒计时结束时,显示00:00:00
if (lefttime < 0) {
this.countdownh = this.countdownm = this.countdowns = "00"
}
this.isEndTime = this.countdownh + '时' + this.countdownm + '分' + this.countdowns + '秒'
},
// 跳转详情页
jump(data) {
......@@ -276,7 +301,8 @@
color: #FD0100;
line-height: 44rpx;
}
.buttonGray{
.buttonGray {
border: 1rpx solid #666666 !important;
color: #666666 !important;
}
......
......@@ -107,15 +107,26 @@
onReachBottom() {
let that = this
if(that.total < that.queryParams.pageNum * that.queryParams.pageSize) return that.nomore = 'nomore'
that.queryParams.pageNum++
that.getSquare()
},
methods: {
getSquare(){
let that = this
userNeedSquare(this.queryParams).then(res=>{
console.log(res,'需求广场')
if(res.code == 200){
if(res.total > 0){
this.userNeedList = res.rows
this.total = res.total
that.total = res.total
if(that.total <= that.queryParams.pageNum){
that.loadStatus = 'nomore'
}
if(that.queryParams.pageNum == 1){
that.userNeedList = res.rows
}else{
that.userNeedList = [...that.userNeedList,...res.rows]
}
}
}
})
......
<template>
<view class="content">
<image class="content-bg" src="@/static/icon/my01.png" mode=""></image>
<view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 158rpx)` }"></view>
<view class="content-in">
<view class="content-in-info baiyin-flex baiyin-flex-c-b">
<button class="content-in-info-l" type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar">
<image v-if="!headImgUrl" src="@/static/icon/my03.png" mode=""></image>
<image v-else :src="headImgUrl" mode=""></image>
</button>
<view v-if="token" class="content-in-info-r">
<view class="content-in-info-r-t baiyin-flex">
<text v-if="nameDisabled">{{nickname}}</text>
<input v-else confirm-type="确定" @confirm="inputNameConfirm" maxlength="15" type="text" :value="nickname" />
<image src="@/static/icon/my02.png" mode="" @click="nameDisabled = !nameDisabled"></image>
</view>
<view class="content-in-info-r-b" v-if="mobile">手机号:{{mobile}}</view>
</view>
<view class="content-in-info-r-b" v-else>
未登录
</view>
</view>
<view class="content-in-item baiyin-flex baiyin-flex-c-sb baiyin-flex-c-b" v-for="(item, index) in list" :key="index" @click="index != 0 ? clickJumpNPage(item) : null">
<!-- 联系客服生成 -->
<button class="content-in-item-btn" v-if="index === 0" open-type="contact"></button>
<view class="baiyin-flex baiyin-flex-c-b">
<image :src="item.icon" mode=""></image>
<text>{{ item.title }}</text>
</view>
<image src="@/static/icon/my09.png" mode=""></image>
</view>
<view class="content-in-btn" @click="handleLogin">
<u-button
:text="token ? '退出登录' : '登录'"
color="#EA654E"
:customStyle="{
width: '560rpx',
height: '80rpx',
borderRadius: '10rpx',
padding: '0rpx',
margin: '178rpx 0rpx 0rpx 65rpx'
}"
></u-button>
</view>
</view>
<com-navbar :leftIcon="false" bgColor="transparent" title="我的" :titleStyle="{ color: '#ffffff', fontSize: '34rpx' }" />
<com-tabbar
:list="[
{
name: '首页',
icon: '/static/tabbar/tb1.png',
selectIcon: '/static/tabbar/td1.png',
url: '/pages/home/index',
type: 'type'
},
{
name: '我的需求',
icon: '/static/tabbar/tb2.png',
selectIcon: '/static/tabbar/td2.png',
url: '/pages/demand/index',
type: 'type'
},
{
name: '发布',
icon: '/static/tabbar/fb.png',
selectIcon: '/static/tabbar/fb.png',
url: '/pages/release/index',
type: 'type'
},
{
name: '动态',
icon: '/static/tabbar/tb3.png',
selectIcon: '/static/tabbar/td3.png',
url: '/pages/order/index',
type: 'type'
},
{
name: '我的',
icon: '/static/tabbar/tb4.png',
selectIcon: '/static/tabbar/td4.png',
url: '',
type: 'myCenter'
}
]"
/>
</view>
</template>
<script>
import apiBaseConfig from '@/config/index.js';
import { mapMutations } from 'vuex';
import {updateUserMsg} from '@/api/system/index.js'
export default {
data() {
return {
imgBgUrl: apiBaseConfig.imgBgUrl,
globalData: getApp().globalData,
scrollTopHeader: 0,
nameDisabled: true,
nickname:'用户名称',
mobile:'',//手机号
list: [
{
icon: require('@/static/icon/my04.png'),
title: '联系客服'
},
{
icon: require('@/static/icon/my05.png'),
title: '意见反馈',
url: '/my/feedback/index'
},
{
icon: require('@/static/icon/my06.png'),
title: '我的邀请',
url: '/my/invite/index'
},
{
icon: require('@/static/icon/my07.png'),
title: '用户协议',
url: '/my/agreeOn/index'
},
{
icon: require('@/static/icon/my08.png'),
title: '我的优惠券',
url: '/my/coupon/index?type=coupon'
}
],
token:'',
uploadUrl: apiBaseConfig.upload,
headImgUrl:''
};
},
onLoad() {
let that = this
console.log(that.$store.state.login.userInfo.user,'打死你')
if(that.$store.state.login.userInfo && that.$store.state.login.userInfo.user && that.$store.state.login.userInfo.user.nickname){
that.nickname = that.$store.state.login.userInfo.user.nickname
}
if(that.$store.state.login.userInfo && that.$store.state.login.userInfo.user && that.$store.state.login.userInfo.user.headImgUrl){
that.headImgUrl = that.$store.state.login.userInfo.user.headImgUrl
}
let token = uni.getStorageSync('token')
console.log('token',token)
if(token){
that.token = token
}
let mobile = uni.getStorageSync('mobile')
that.mobile = mobile
},
methods: {
onChooseavatar(e) {
console.log(e,'1211');
// return;
let that = this;
const { avatarUrl } = e.detail;
that.fdsa = avatarUrl;
that.uploadFilePromise(avatarUrl)
},
uploadFilePromise(url) {
let that = this
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.uploadUrl, // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
header: {
'Authorization': `Bearer ${uni.getStorageSync('token')}`
<template>
<view class="content">
<image class="content-bg" src="@/static/icon/my01.png" mode=""></image>
<view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 158rpx)` }"></view>
<view class="content-in">
<view class="content-in-info baiyin-flex baiyin-flex-c-b">
<button class="content-in-info-l" type="balanced" open-type="chooseAvatar"
@chooseavatar="onChooseavatar">
<image v-if="!headImgUrl" src="@/static/icon/my03.png" mode=""></image>
<image v-else :src="headImgUrl" mode=""></image>
</button>
<view v-if="token" class="content-in-info-r flex-1">
<view class="content-in-info-r-t baiyin-flex">
<text class="flex-1" v-if="nameDisabled">{{nickname}}</text>
<input v-else confirm-type="确定" @confirm="inputNameConfirm" maxlength="15" type="text"
:value="nickname" />
<image src="@/static/icon/my02.png" mode="" @click="nameDisabled = !nameDisabled"></image>
</view>
<view class="content-in-info-r-b" v-if="mobile">手机号:{{mobile}}</view>
</view>
<view class="content-in-info-r-b" v-else>
未登录
</view>
</view>
<view class="content-in-item baiyin-flex baiyin-flex-c-sb baiyin-flex-c-b" v-for="(item, index) in list"
:key="index" @click="index != 0 ? clickJumpNPage(item) : null">
<!-- 联系客服生成 -->
<button class="content-in-item-btn" v-if="index === 0" open-type="contact"></button>
<view class="baiyin-flex baiyin-flex-c-b">
<image :src="item.icon" mode=""></image>
<text>{{ item.title }}</text>
</view>
<image src="@/static/icon/my09.png" mode=""></image>
</view>
<view class="content-in-btn" @click="handleLogin">
<u-button :text="token ? '退出登录' : '登录'" color="#EA654E" :customStyle="{
width: '560rpx',
height: '80rpx',
borderRadius: '10rpx',
padding: '0rpx',
margin: '178rpx 0rpx 0rpx 65rpx'
}"></u-button>
</view>
</view>
<com-navbar :leftIcon="false" bgColor="transparent" title="我的"
:titleStyle="{ color: '#ffffff', fontSize: '34rpx' }" />
<com-tabbar :list="[
{
name: '首页',
icon: '/static/tabbar/tb1.png',
selectIcon: '/static/tabbar/td1.png',
url: '/pages/home/index',
type: 'type'
},
{
name: '我的需求',
icon: '/static/tabbar/tb2.png',
selectIcon: '/static/tabbar/td2.png',
url: '/pages/demand/index',
type: 'type'
},
{
name: '发布',
icon: '/static/tabbar/fb.png',
selectIcon: '/static/tabbar/fb.png',
url: '/pages/release/index',
type: 'type'
},
{
name: '动态',
icon: '/static/tabbar/tb3.png',
selectIcon: '/static/tabbar/td3.png',
url: '/pages/order/index',
type: 'type'
},
{
name: '我的',
icon: '/static/tabbar/tb4.png',
selectIcon: '/static/tabbar/td4.png',
url: '',
type: 'myCenter'
}
]" />
</view>
</template>
<script>
import apiBaseConfig from '@/config/index.js';
import {
mapMutations
} from 'vuex';
import {
updateUserMsg
} from '@/api/system/index.js'
export default {
data() {
return {
imgBgUrl: apiBaseConfig.imgBgUrl,
globalData: getApp().globalData,
scrollTopHeader: 0,
nameDisabled: true,
nickname: '用户名称',
mobile: '', //手机号
list: [{
icon: require('@/static/icon/my04.png'),
title: '联系客服'
},
{
icon: require('@/static/icon/my05.png'),
title: '意见反馈',
url: '/my/feedback/index'
},
{
icon: require('@/static/icon/my06.png'),
title: '我的邀请',
url: '/my/invite/index'
},
success: (res) => {
const {
data
} = JSON.parse(res.data);
that.updateUser({headImgUrl:data.url})
setTimeout(() => {
resolve(data.url)
}, 1000)
{
icon: require('@/static/icon/my07.png'),
title: '用户协议',
url: '/my/agreeOn/index'
},
{
icon: require('@/static/icon/my08.png'),
title: '我的优惠券',
url: '/my/coupon/index?type=coupon'
}
});
})
},
inputNameConfirm(e) {
console.log('======inputNameConfirm:', e.detail.value);
],
token: '',
uploadUrl: apiBaseConfig.upload,
headImgUrl: ''
};
},
onLoad() {
let that = this
this.updateUser({nickname:e.detail.value})
},
async updateUser(data){
let that = this
const back_data = await updateUserMsg(data)
console.log(back_data)
const {code} = back_data
if(code === 200){
uni.showToast({
title:'修改成功!',
icon:'none'
console.log(that.$store.state.login.userInfo.user, '打死你')
if (that.$store.state.login.userInfo && that.$store.state.login.userInfo.user && that.$store.state.login
.userInfo.user.nickname) {
that.nickname = that.$store.state.login.userInfo.user.nickname
}
if (that.$store.state.login.userInfo && that.$store.state.login.userInfo.user && that.$store.state.login
.userInfo.user.headImgUrl) {
that.headImgUrl = that.$store.state.login.userInfo.user.headImgUrl
}
let token = uni.getStorageSync('token')
console.log('token', token)
if (token) {
that.token = token
}
let mobile = uni.getStorageSync('mobile')
that.mobile = mobile
},
methods: {
...mapMutations(['upDateUserInfoMount']),
onChooseavatar(e) {
console.log(e, '1211');
// return;
let that = this;
const {
avatarUrl
} = e.detail;
that.fdsa = avatarUrl;
that.uploadFilePromise(avatarUrl)
},
uploadFilePromise(url) {
let that = this
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.uploadUrl, // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
header: {
'Authorization': `Bearer ${uni.getStorageSync('token')}`
},
success: (res) => {
const {
data
} = JSON.parse(res.data);
this.headImgUrl = data.url
that.updateUser({
headImgUrl: data.url
})
setTimeout(() => {
resolve(data.url)
}, 1000)
}
});
})
}
},
clickJumpNPage(row) {
if (row.url) {
this.$uniGo.navigateTo({
url: row.url
});
}
},
handleLogin(){
if(this.token){
uni.showModal({
content: '是否要退出登录',
success: (res) => {
if (res.confirm) {
uni.showToast({
title:'退出成功!',
icon:'none'
})
//执行退出
uni.clearStorageSync()
this.token = uni.getStorageSync('token')
}
}
})
}else{
this.$uniGo.navigateTo({
url:'/my/login/login'
})
}
}
}
};
</script>
<style>
page {
background-color: #f7f8f9;
}
</style>
<style lang="scss" scoped>
.content {
&-bg {
width: 100%;
height: 340rpx;
position: absolute;
top: 0%;
left: 0%;
z-index: -1;
}
&-in {
width: calc(100% - 30rpx * 2);
margin: 0rpx 30rpx 0;
&-info {
padding: 35rpx 30rpx;
background-color: #ffffff;
border-radius: 14rpx;
margin-bottom: 16rpx;
&-l {
width: 120rpx;
height: 120rpx;
margin: 0 30rpx 0 0;
padding: 0rpx;
border: none;
outline: none;
background: transparent;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
&-l::after {
border: none;
}
&-r {
&-t {
margin-bottom: 17rpx;
input,
text {
font-size: 36rpx;
font-family: AlibabaPuHuiTi-Medium, AlibabaPuHuiTi;
font-weight: 500;
color: #666666;
margin-right: 34rpx;
}
image {
width: 32rpx;
height: 32rpx;
margin-top: 5rpx;
}
}
&-b {
font-size: 24rpx;
font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
font-weight: 400;
color: #666666;
}
}
}
&-item {
padding: 26rpx 22rpx;
background-color: #ffffff;
border-radius: 10rpx;
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(0, 0, 0, 0.05);
margin-bottom: 16rpx;
position: relative;
&-btn {
position: absolute;
top: 0%;
left: 0%;
padding: 0rpx;
width: 100%;
height: 100%;
outline: none;
border: none;
background: transparent;
border-radius: 10rpx;
}
&-btn::after {
outline: none;
border: none;
}
> image {
width: 34rpx;
height: 34rpx;
}
> view {
font-size: 24rpx;
font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
font-weight: 400;
color: #333333;
image {
margin-right: 12rpx;
width: 28rpx;
height: 28rpx;
}
}
}
&-item:last-child {
margin-bottom: 0rpx;
}
}
}
},
inputNameConfirm(e) {
console.log('======inputNameConfirm:', e.detail.value);
let that = this
this.updateUser({
nickname: e.detail.value
})
},
async updateUser(data) {
let that = this
const back_data = await updateUserMsg(data)
console.log(back_data)
const {
code
} = back_data
if (code === 200) {
uni.showToast({
title: '修改成功!',
icon: 'none'
})
that.upDateUserInfoMount()
}
},
clickJumpNPage(row) {
if (row.url) {
this.$uniGo.navigateTo({
url: row.url
});
}
},
handleLogin() {
if (this.token) {
uni.showModal({
content: '是否要退出登录',
success: (res) => {
if (res.confirm) {
uni.showToast({
title: '退出成功!',
icon: 'none'
})
//执行退出
uni.clearStorageSync()
this.token = uni.getStorageSync('token')
}
}
})
} else {
this.$uniGo.navigateTo({
url: '/my/login/login'
})
}
}
}
};
</script>
<style>
page {
background-color: #f7f8f9;
}
</style>
<style lang="scss" scoped>
.content {
&-bg {
width: 100%;
height: 340rpx;
position: absolute;
top: 0%;
left: 0%;
z-index: -1;
}
&-in {
width: calc(100% - 30rpx * 2);
margin: 0rpx 30rpx 0;
&-info {
padding: 35rpx 30rpx;
background-color: #ffffff;
border-radius: 14rpx;
margin-bottom: 16rpx;
&-l {
width: 120rpx;
height: 120rpx;
margin: 0 30rpx 0 0;
padding: 0rpx;
border: none;
outline: none;
background: transparent;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
&-l::after {
border: none;
}
&-r {
&-t {
margin-bottom: 17rpx;
input,
text {
font-size: 36rpx;
font-family: AlibabaPuHuiTi-Medium, AlibabaPuHuiTi;
font-weight: 500;
color: #666666;
margin-right: 34rpx;
}
image {
width: 32rpx;
height: 32rpx;
margin-top: 5rpx;
}
}
&-b {
font-size: 24rpx;
font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
font-weight: 400;
color: #666666;
}
}
}
&-item {
padding: 26rpx 22rpx;
background-color: #ffffff;
border-radius: 10rpx;
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(0, 0, 0, 0.05);
margin-bottom: 16rpx;
position: relative;
&-btn {
position: absolute;
top: 0%;
left: 0%;
padding: 0rpx;
width: 100%;
height: 100%;
outline: none;
border: none;
background: transparent;
border-radius: 10rpx;
}
&-btn::after {
outline: none;
border: none;
}
>image {
width: 34rpx;
height: 34rpx;
}
>view {
font-size: 24rpx;
font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
font-weight: 400;
color: #333333;
image {
margin-right: 12rpx;
width: 28rpx;
height: 28rpx;
}
}
}
&-item:last-child {
margin-bottom: 0rpx;
}
}
}
</style>
......@@ -11,6 +11,8 @@
暂无数据
</view>
</view>
<u-loadmore iconSize="50px" @loadmore="loadMore" color="#6A6C6F" fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" />
<com-navbar :leftIcon="false" :homeShow="false" bgColor="#fff" title="动态"
:titleStyle="{ color: '#000', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" />
<com-tabbar :list=" [{
......@@ -63,57 +65,14 @@
},
articleList:[],//文章列表
total:0,//总数
evaluateList: [{
name: '马保国',
image: 'https://slzh-oss.oss-cn-beijing.aliyuncs.com/usercenter/template/2c94809a787cec070179e01ec0ba02a9.jpg',
time: '2021.06.06',
content: '服务好,景色好,山河锦绣,树木茂盛,空气清新,鸟语花香,人杰地灵服务好,景色好,山河锦绣,树木茂盛,空气清新,鸟语花香,人杰地灵服务好,景色好,山河锦绣,树木茂盛,空气清新,鸟语花香,人杰地灵服务好,景色好,山河锦绣,树木茂盛,空气清新,鸟语花香,人杰地灵服务好,景色好,山河锦绣,树木茂盛,空气清新,鸟语花香,人杰地灵',
imageList: [{
url: 'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url: 'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url: 'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url: 'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url: 'https://img1.baidu.com/it/u=3486651663,3991438881&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
url: 'https://img2.baidu.com/it/u=955956276,3392954639&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
]
}],
personEvalList: [{
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: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容'
},
{
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: '评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容'
},
]
loadStatus:'loading',//加载时的状态(loadmore/ loading / nomore)
loadingText: '正在加载',
nomoreText: '已经到底了'
}
},
onReachBottom() {
let that = this
if(that.total <= that.queryParams.pageNum * that.queryParams.pageSize) return
if(that.total <= that.queryParams.pageNum * that.queryParams.pageSize) return that.loadStatus = 'nomore'
that.queryParams.pageNum++
that.getArticleList()
},
......@@ -126,8 +85,17 @@
const data_back = await userArticleGet(that.queryParams);
const {code,total,rows} = data_back;
if(code === 200 && total > 0) {
that.articleList = rows
that.total = total
if(that.total < that.queryParams.pageSize){
that.loadStatus = 'nomore'
}else{
that.loadStatus = 'loading'
}
if(that.queryParams.pageNum == 1){
that.articleList = rows
}else{
that.articleList = [...that.articleList,...rows]
}
}
},
......
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