Merge branch 'xie0928'

This commit is contained in:
@fawn-nine
2023-10-07 17:01:03 +08:00
3 changed files with 213 additions and 146 deletions

View File

@@ -75,7 +75,7 @@
<image :src="item.images" mode="aspectFit"></image> <image :src="item.images" mode="aspectFit"></image>
</view> </view>
<text style="padding-right: 10rpx;">{{item.name}}</text> <text style="padding-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.canListen == 'true'" name="volume" color="#71d5a1" size="24" <u-icon v-if="item.canListen == true" name="volume" color="#71d5a1" size="24"
@click="goToListen(item.id)"></u-icon> @click="goToListen(item.id)"></u-icon>
<u-icon v-else name="volume" color="#71d5a1" size="24" <u-icon v-else name="volume" color="#71d5a1" size="24"
@click="goToListenNone(item.id)"></u-icon> @click="goToListenNone(item.id)"></u-icon>

View File

@@ -52,7 +52,7 @@
<view class="playList" v-if="libLIst.length > 0"> <view class="playList" v-if="libLIst.length > 0">
<view class="item" v-for="(item,index) in libLIst" :key="index" > <view class="item" v-for="(item,index) in libLIst" :key="index" >
<view > <view >
<view v-if="3 > index" <view v-if="item.isFree == 1"
:class="[ :class="[
userInfo.playingInfo.bookId==item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '']" @click="listenOne(item, index)"> userInfo.playingInfo.bookId==item.bookId && userInfo.playingInfo.id == item.id ? 'playing' : '']" @click="listenOne(item, index)">
<span :class="['graytitle']">{{item.chapter}}</span>&nbsp;&nbsp; <span :class="['graytitle']">{{item.chapter}}</span>&nbsp;&nbsp;
@@ -155,7 +155,9 @@
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
}, },
onHide() {
this.libLIst = []
},
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
this.bookId = e.Id this.bookId = e.Id
@@ -302,8 +304,14 @@
.then(res => { .then(res => {
if(res.code == 0){ if(res.code == 0){
console.log(res,999) console.log(res,999)
if(res.BookCatalogue.length > 0){ if(res.BookCatalogue.length > 0){
this.libLIst = res.BookCatalogue res.BookCatalogue.map( item => {
if(item.isFree == 1){
this.libLIst.push(item)
}
})
console.log('改变后的试听目录',this.libLIst)
//this.libLIst = res.BookCatalogue
// this.fengImg = res.images // this.fengImg = res.images
} }
} }

View File

@@ -50,8 +50,8 @@
<view class="tanchu"> <view class="tanchu">
<view class="dp_title">请输入昵称</view> <view class="dp_title">请输入昵称</view>
<u--input v-model="userMes.nickname" placeholder="请输入昵称" border="surround" clearable></u--input> <u--input v-model="userMes.nickname" placeholder="请输入昵称" border="surround" clearable></u--input>
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="choseNickname(userMes.nickname)" <u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定"
style="margin-top: 50rpx;"></u-button> @click="choseNickname(userMes.nickname)" style="margin-top: 50rpx;"></u-button>
<view @click="nicknameShow=false" class="dp_canBtn">取消</view> <view @click="nicknameShow=false" class="dp_canBtn">取消</view>
</view> </view>
</u-popup> </u-popup>
@@ -88,16 +88,21 @@
</u-popup> </u-popup>
<!-- 密码 --> <!-- 密码 -->
<u-popup :show="passwordShow" :round="10" @close="passwordShow=false"> <u-popup :show="passwordShow" :round="10" @close="cancelPass">
<view class="tanchu"> <view class="tanchu">
<view class="dp_title">请修改密码</view> <view class="dp_title">请修改密码</view>
<u--input v-model="userMes.password" placeholder="请输入新密码" :password="true" border="surround" clearable> <u--input v-model="userMes.password" placeholder="请输入新密码" :password="true" border="surround" clearable
@input="inputMethod(userMes.password)">
</u--input> </u--input>
<view class="" style="font-size: 28rpx; color: #999;">
<p v-if="note != ''">{{note}}</p>
<p v-html="str2" style="margin-top: 10rpx;"></p>
</view>
<u--input v-model="userMes.Repassword" placeholder="请再确认密码" :password="true" border="surround" clearable <u--input v-model="userMes.Repassword" placeholder="请再确认密码" :password="true" border="surround" clearable
style="margin-top: 20rpx;"></u--input> style="margin-top: 20rpx;"></u--input>
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="chosePassword()" <u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="chosePassword()"
style="margin-top: 50rpx;"></u-button> style="margin-top: 50rpx;"></u-button>
<view @click="passwordShow=false" class="dp_canBtn">取消</view> <view @click="cancelPass" class="dp_canBtn">取消</view>
</view> </view>
</u-popup> </u-popup>
<!-- <view class="btn_box"> <!-- <view class="btn_box">
@@ -113,10 +118,18 @@
import { import {
mapState mapState
} from 'vuex'; } from 'vuex';
// 密码验证的正则
//1、密码为八位及以上并且字母数字特殊字符三项都包括
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
//2、密码为八位及以上并且字母、数字、特殊字符三项中有两项强度是中等
var mediumRegex = new RegExp(
"^(?=.{8,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[a-z])(?=.*\\W))|((?=.*[0-9])(?=.*\\W))|((?=.*[A-Z])(?=.*\\W))).*$",
"g");
var enoughRegex = new RegExp("(?=.{8,}).*", "g");
export default { export default {
data() { data() {
return { return {
playData:{}, playData: {},
userMes: { userMes: {
id: '', id: '',
age: '', age: '',
@@ -125,7 +138,7 @@
tel: '', tel: '',
password: '', password: '',
Repassword: '', Repassword: '',
oldName:'', // 老的用户名 oldName: '', // 老的用户名
}, },
avatarShow: false, avatarShow: false,
nicknameShow: false, nicknameShow: false,
@@ -142,6 +155,9 @@
id: 0, id: 0,
} }
], ],
note: '',
str2: '',
passwordOk:false, // 密码是否满足规则
}; };
}, },
//第一次加载 //第一次加载
@@ -158,8 +174,8 @@
uni.hideTabBar(); uni.hideTabBar();
this.getData(); this.getData();
}, },
components:{ components: {
musicPlay musicPlay
}, },
//方法 //方法
methods: { methods: {
@@ -181,146 +197,190 @@
}); });
} }
}, },
cancelPass(){
// 头像 this.passwordShow = false,
choseAvatar(e) { this.userMes.password = '',
let that = this this.userMes.Repassword = ''
if (that.fileAvatar.length == 0) { this.note = '',
uni.showToast({ this.str2 = ''
title: "请选择图片",
icon: 'none'
});
return
}
that.userMes.avatar = that.fileAvatar[0].url
that.choseData()
that.avatarShow = false
that.fileAvatar.splice(0, 1)
}, },
// 年龄 // 密码验证
choseAge(e) { inputMethod(value) {
let that = this this.passwordOk = false
if(that.userMes.age<=0){ console.log('输入的值为:', value)
uni.showToast({ if (strongRegex.test(value)) {
title: "年龄不能小于0", //console.log('强密码-----',value)
icon: 'none' this.str2 = "<span style='color:#18bc37'>密码强度很不错哦!</span>"
}); // this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
return this.note = ''
} this.passwordOk = true
that.choseData() } else if (mediumRegex.test(value)) {
that.ageShow = false //console.log('中等密码-----',value)
}, this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
this.str2 = "<span style='color:#2979ff'>密码强度中等!</span>"
// 昵称 this.passwordOk = true
choseNickname(e) { } else if (enoughRegex.test(value)) {
let that = this //console.log('弱密码-----',value)
if(e && e != ''){ this.str2 = "<span style='color:#f3a73f'>密码强度太弱!</span>"
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
that.choseData() } else {
that.nicknameShow = false this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
}else{ //console.log('密码-----',value)
that.userMes.nickname = that.userMes.oldName }
console.log(that.userMes.nickname) },
uni.showToast({ // 头像
title:'昵称不可为空', choseAvatar(e) {
icon:'none' let that = this
}) if (that.fileAvatar.length == 0) {
} uni.showToast({
}, title: "请选择图片",
icon: 'none'
// 性别 });
choseSex(e) { return
let that = this }
that.userMes.sex = e that.userMes.avatar = that.fileAvatar[0].url
that.choseData() that.choseData()
that.sexShow = false that.avatarShow = false
}, that.fileAvatar.splice(0, 1)
// 修改密码
chosePassword() {
let that = this
if (that.userMes.Repassword == '' || that.userMes.password == '') {
uni.showToast({
icon: "none",
title: "请输入密码!"
});
return
}
if (that.userMes.Repassword != that.userMes.password) {
uni.showToast({
icon: "none",
title: "两次密码输入不一致!"
});
return
}
that.choseData()
that.passwordShow = false
},
// 修改个人资料
choseData() {
let that = this
$http.request({
url: "book/user/update",
method: "POST",
data: that.userMes,
header: {
'Content-Type': 'application/json'
}, },
}).then(function(res) { // 年龄
if (res.code == 0) { choseAge(e) {
uni.showToast({ let that = this
title: "修改成功" if (that.userMes.age <= 0) {
uni.showToast({
title: "年龄不能小于0",
icon: 'none'
});
return
}
that.choseData()
that.ageShow = false
},
// 昵称
choseNickname(e) {
let that = this
if (e && e != '') {
that.choseData()
that.nicknameShow = false
} else {
that.userMes.nickname = that.userMes.oldName
console.log(that.userMes.nickname)
uni.showToast({
title: '昵称不可为空',
icon: 'none'
})
}
},
// 性别
choseSex(e) {
let that = this
that.userMes.sex = e
that.choseData()
that.sexShow = false
},
// 修改密码
chosePassword() {
if(!this.passwordOk){
console.log('不满足密码格式',this.note)
uni.showToast({
title:this.note,
icon: 'none'
})
return
}
let that = this
if (that.userMes.Repassword == '' || that.userMes.password == '') {
uni.showToast({
icon: "none",
title: "请输入密码!"
});
return
}
if (that.userMes.Repassword != that.userMes.password) {
uni.showToast({
icon: "none",
title: "两次密码输入不一致!"
});
return
}
that.choseData()
that.passwordShow = false
},
// 修改个人资料
choseData() {
let that = this
$http.request({
url: "book/user/update",
method: "POST",
data: that.userMes,
header: {
'Content-Type': 'application/json'
},
}).then(function(res) {
if (res.code == 0) {
uni.showToast({
title: "修改成功,退出登陆后生效"
});
}
}).catch(function(error) {
console.log(error);
}); });
} },
}).catch(function(error) {
console.log(error);
});
},
// 头像上传 // 头像上传
afterRead(e) { afterRead(e) {
let that = this let that = this
uni.uploadFile({ uni.uploadFile({
url: this.$baseUrl + 'oss/fileoss', url: this.$baseUrl + 'oss/fileoss',
filePath: e.file[0].url, filePath: e.file[0].url,
name: 'file', name: 'file',
formData: {}, formData: {},
success: (res) => { success: (res) => {
that.fileAvatar.push({ that.fileAvatar.push({
url: JSON.parse(res.data).url url: JSON.parse(res.data).url
}) })
} }
}); });
}, },
// 删除图片 // 删除图片
deletePic() { deletePic() {
let that = this let that = this
that.fileAvatar.splice(0, 1) that.fileAvatar.splice(0, 1)
},
}, },
}, };
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.btn_box {
margin-top: 40rpx;
padding: 10px;
button {
font-size: 32rpx;
background-color: #e5e5e5;
color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
&.active { .btn_box {
@include theme('btn_bg') color: #fff; margin-top: 40rpx;
} padding: 10px;
button {
font-size: 32rpx;
background-color: #e5e5e5;
color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
&.active {
@include theme('btn_bg') color: #fff;
} }
} }
}
.tabulate { .tabulate {
.per_list { .per_list {
font-size: 30rpx; font-size: 30rpx;
@@ -420,10 +480,9 @@
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
margin-top: 25rpx; margin-top: 25rpx;
color: #888; color: #888;
} }
} }
.submit{
.submit {}
} </style>
</style>