登录、注册接口修改,新闻详情页面

This commit is contained in:
itgaojian 2023-02-27 17:55:45 +08:00
parent 57b4d1df94
commit 64d61a9db0
20 changed files with 6092 additions and 1721 deletions

View File

@ -1,8 +1,7 @@
<template>
<view class="list" v-if="list.length > 0">
<navigator :url="'/pages/news/newsdetail?url='+item.templateRecordUrl" class="item"
v-for="(item, index) in list" :key="index" hover-class="none"
v-if="0 == item.newsConfigWebSwitch || 2 ==item.newsConfigWebSwitch">
<navigator :url="'/pages/news/newsdetail?id='+item.newsContentId" class="item" v-for="(item, index) in list"
:key="index" hover-class="none" v-if="0 == item.newsConfigWebSwitch || 2 ==item.newsConfigWebSwitch">
<!-- 多张图片 -->
<view class="info-multi" v-if='"key_1" == item.typesettingCode'>
<view class="text-multi">
@ -134,8 +133,8 @@
},
data() {
return {
baseurl: "http://121.36.71.250:58037/qmywzs/",
imgUrl: "http://121.36.71.250:58037/qmywzs/route/file/download/true/"
baseurl: "http://192.168.0.10:7019/qmywzs/",
imgUrl: "http://192.168.0.10:7019/qmywzs/route/file/download/true/"
};
},
};

View File

@ -21,6 +21,7 @@ let api = {
NEWS_MAIN_FUNC: "f367f74b-3778-4801-a0c5-b85377a12a0b",
imgUrl: apiRoot + clinetNews + "route/file/download/true/",
getMainFunc: apiRoot + clinetNews + "app/newsdirectories/listnewsdirectoriesrelease", //获取首页功能
getNewsDetail: apiRoot + clinetNews + "app/newscontent/getnewscontentbyidrelease/", //获取新闻详情
},
duty: {
@ -58,9 +59,9 @@ let api = {
favoriteList: apiRoot + "article/favoriteList.html",
},
user: {
getVerifyCode: apiRoot + clinetUser + "api/sms/getverificationcode/", //get 获取验证码
doLogin: apiRoot + clinetUser + "app/sign/default", //post 登录
doRegister: apiRoot + clinetUser + "app/register/saveregisteruser", //post 注册
getVerifyCode: apiRoot + clinetUser + "app/sms/verify-code/", //get 获取验证码
doLogin: apiRoot + clinetUser + "app/sign/phone", //post 登录
doRegister: apiRoot + clinetUser + "app/register/phone", //post 注册
doChangePhone: apiRoot + clinetUser + "app/user/updatephoneusername", //修改手机号 put
doChangePwd: apiRoot + clinetUser + "app/user/update-password", //put 修改密码
getUserInfo: apiRoot + clinetUser + "app/user/get-app-user", //获取用户基础信息

View File

@ -55,8 +55,6 @@
{
"path": "pages/news/newsdetail",
"style": {
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "详情",
"enablePullDownRefresh": false
}
@ -246,7 +244,6 @@
"navigationBarTitleText": "新闻",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {

View File

@ -19,7 +19,7 @@
indicator-active-color="#009749" :circular="true">
<swiper-item v-for="(item, index) in slider" :key="index">
<navigator class="swiper-item" hover-class="none"
:url="'/pages/news/newsdetail?url='+item.templateRecordUrl">
:url="'/pages/news/newsdetail?id='+item.newsContentId">
<image :lazy-load="true" :src="item.imageUrl" mode="scaleToFill"></image>
</navigator>

View File

@ -1,20 +1,265 @@
<template>
<web-view :src="content"></web-view>
<view class="page">
<view class="content">
<view class="news-title">{{bean.newsContentTitle}}</view>
<view class="news-type">
<view class="type">发布时间:{{bean.newsContentPublishTime}}</view>
<view class="type">来源:{{bean.newsContentResource}}</view>
</view>
<view class="news-content">
<rich-text :nodes="bean.newsContentContent"></rich-text>
</view>
<!-- 图文新闻 -->
<block v-if="'2'==bean.newsContentType">
<swiper class="swiper" :autoplay="true" indicator-color="#E4E4E4" style="margin-top: 30rpx;"
indicator-active-color="#009749" :circular="true">
<swiper-item class="swiper-item" v-for="(item, index) in bean.fileList" :key="index"
@click="showImg(item)">
<view class="img-box">{{index+1}}/{{bean.fileList.length}}</view>
<image :lazy-load="true" :src="imgUrl+item.contentFileFileId" mode="scaleToFill"></image>
<view class="title">
<text>{{item.contentFileText}}</text>
</view>
</swiper-item>
</swiper>
</block>
<!-- 音频新闻 -->
<block v-else-if="'3'==bean.newsContentType">
<view v-for="(item,index) in bean.fileList" :key="index" style="margin-top: 30rpx;">
<audio style="text-align: left" :src="imgUrl+item.contentFileFileId"
poster="/static/images/ic_audio_poster" :name="item.contentFileText" controls></audio>
</view>
</block>
<!-- 视频新闻 -->
<block v-else-if="'4'==bean.newsContentType">
<view style="margin-top: 30rpx;">
<video :title="currentTitle" :src="imgUrl+currentVideoUrl" style="width: 100%;"></video>
<scroll-view scroll-x="true"
style="white-space: nowrap;background: #f2f2f2;border: 1rpx solid #f2f2f2;">
<view v-for="(item,index) in bean.fileList" :key="index" @click="changeVideo(item)"
class="video-tab" :class="currentVideoUrl == item.contentFileFileId? 'tab-active':''">
{{item.contentFileText}}
</view>
</scroll-view>
</view>
</block>
<!-- 文章新闻 -->
<block v-else>
<block v-if="bean.newsContentCoverList">
<view style="margin-top: 30rpx;" v-for="(item,index) in bean.newsContentCoverList" :key="index">
<image :src="imgUrl+item.contentCoverId" mode="widthFix" style="width: 100%;"></image>
</view>
</block>
</block>
</view>
<pageLoading v-if=" showPageLoading"></pageLoading>
</view>
</template>
<script>
import pageLoading from '@/components/loading/pageLoading.vue';
export default {
components: {
pageLoading
},
data() {
return {
content: ""
newsId: '',
showPageLoading: true,
bean: {},
imgUrl: this.$api.common.imgUrl,
currentVideoUrl: '',
currentTitle: ''
}
},
onShow() {},
onLoad(e) {
this.content = e.url
onLoad(res) {
this.newsId = res.id
console.log(this.newsId)
this.getNewsDetail()
},
methods: {
showImg(item) {
var url = this.imgUrl + item.contentFileFileId
uni.previewImage({
urls: [url]
})
},
changeVideo(item) {
this.currentVideoUrl = item.contentFileFileId;
this.currentTitle = item.contentFileText;
},
getNewsDetail() {
console.log('获取详情')
var _self = this;
_self.$app.request({
url: _self.$api.news.getNewsDetail + _self.newsId,
method: 'GET',
dataType: 'json',
success: res => {
console.log(res)
if (res) {
if (res.newsContentType == '4') {
_self.currentVideoUrl = res.fileList[0].contentFileFileId
_self.currentTitle = res.fileList[0].contentFileText
console.log(_self.currentTitle)
}
_self.bean = res
} else {
_self.$alert('网络错误')
}
},
fail: res => {
_self.$alert('网络错误')
},
complete: res => {
_self.showPageLoading = false
}
});
}
}
}
</script>
<style>
<style lang="scss">
page {
height: 100%;
}
.page {
display: flex;
flex: 1;
flex-direction: column;
overflow: auto;
height: 100%;
}
.content {
flex: 1;
height: 100rpx;
padding: 30rpx;
}
.news-title {
font-size: 40rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #333333;
line-height: 70rpx;
}
.news-type {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
margin-top: 30rpx;
.type {
font-size: 24rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #919191;
line-height: 40rpx;
}
.type:nth-of-type(n+2) {
margin-left: 20rpx;
}
}
.news-content {
margin-top: 30rpx;
font-size: 32rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #333333;
line-height: 53rpx
}
/*幻灯片广告 */
.swiper {
height: 800rpx;
image {
height: 800rpx;
width: 100%;
border-radius: 15rpx;
//box-shadow: 0 0 12px #dddee1;
}
.current {
width: 98%;
height: 800rpx;
transition: all 0.2s ease-in 0s;
}
.swiper-item {
position: relative;
image {
height: 800rpx;
width: 100%;
border-radius: 15rpx;
//box-shadow: 0 0 12px #dddee1;
}
.title {
position: absolute;
left: 0;
bottom: 0;
display: flex;
background-color: #202020b5;
justify-content: center;
width: 100%;
text {
display: flex;
align-items: center;
//background-image: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3));
//background-image: linear-gradient(90deg,rgba(255, 181, 19,.8),rgba(255, 181, 19,.2));
color: #fff;
display: -webkit-box;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 34rpx;
padding: 14rpx 20rpx;
max-width: 610rpx;
line-height: 1.3;
border-radius: 5rpx;
}
}
}
}
.video-tab {
width: fit-content;
display: inline-block;
text-align: center;
padding: 20rpx;
}
.tab-active {
background: #fff;
color: #53B584;
}
.img-box {
color: #53B584;
background: #ffffffcf;
position: absolute;
top: 20rpx;
right: 20rpx;
padding: 10rpx;
border-radius: 50%;
font-size: 28rpx;
z-index: 10;
}
</style>

View File

@ -16,8 +16,8 @@
</view>
<view style="width: 90%;background: #f2f2f2;height: 1rpx;align-self: center;"></view>
<view class="item-box">
<view class="item-title">身份证号码</view>
<input @input="inputBaseIdCard" :value="idcard" placeholder="请输入身份证号码" class="item-content"
<view class="item-title">邮箱</view>
<input @input="inputBaseIdCard" :value="email" placeholder="请输入邮箱" class="item-content"
placeholder-class="item-input" />
</view>
</view>
@ -41,6 +41,7 @@
name: "",
phone: "",
idcard: "",
email: '',
showPageLoading: true,
userInfo: {}
};
@ -53,7 +54,7 @@
this.phone = event.target.value
},
inputBaseIdCard(event) {
this.idcard = event.target.value
this.email = event.target.value
},
doSave() {
var _self = this;
@ -69,7 +70,7 @@
},
data: {
"avatar": _self.userInfo.avatar,
"email": _self.userInfo.email,
"email": _self.email,
"name": _self.name,
"phone": _self.phone
},
@ -77,12 +78,17 @@
uni.hideLoading()
uni.showToast({
icon: "success",
title: "保存成功"
title: "保存成功",
success() {
setTimeout(function() {
let pages = getCurrentPages(); //
let beforePage = pages[pages.length - 2]; //
beforePage.$vm.isRefresh = true;
uni.navigateBack()
}, 1000)
}
})
let pages = getCurrentPages(); //
let beforePage = pages[pages.length - 2]; //
beforePage.$vm.isRefresh = true;
uni.navigateBack()
},
fail: res => {
uni.hideLoading()
@ -134,6 +140,7 @@
_self.userInfo = res;
_self.name = _self.userInfo.name;
_self.phone = _self.userInfo.phone;
_self.email = _self.userInfo.email;
}
},
complete: res => {

View File

@ -22,7 +22,7 @@
<view class="num">{{certifNum}}</view>
<view>我的证书</view>
</view>
<view class="item" @click="openPage('/pages/duty/activitylist?index=2')">
<view class="item" @click="openPage('/pages/duty/activityminelist')">
<view class="num">{{dutyNum}}</view>
<view>尽责参与</view>
</view>
@ -44,7 +44,7 @@
<image src="../../static/images/ic_arrow_right.png" mode="aspectFill"></image>
</view> -->
<view class="line"></view>
<view class="item" @click="openPage('/pages/duty/activitylist?index=2')">
<view class="item" @click="openPage('/pages/duty/activityminelist')">
<view class="item-content">
<image src="../../static/images/ic_order_icon.png" mode="aspectFill"></image>
<text>我的劳动参与</text>

View File

@ -10,10 +10,12 @@
<iconfont type="mobile"></iconfont>
<input class="input" v-model="mobile" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
<view class="item">
<iconfont type="pwd"></iconfont>
<input class="input" v-model="password" type="text" maxlength="32" placeholder="请输入密码"
password="true" />
<view class="item verify-item">
<view class="verfiy-code-icon">
<iconfont type="verify-code"></iconfont>
</view>
<input class="input" v-model="verify_code" type="text" placeholder="请输入验证码" />
<view class="verify-btn" @tap="getVerifyCode">{{verify_text}}</view>
</view>
</view>
<view class="button" hover-class="button-hover" @tap="bindLogin"><text>登录</text></view>
@ -32,19 +34,26 @@
import iconfont from '@/components/iconfont/iconfont.vue';
import validator from '@/common/validator';
import md5 from "@/common/md5";
var that, js;
export default {
components: {
iconfont
},
data() {
return {
mobile: '',
password: '',
originUrl: '',
hasLogin: false
hasLogin: false,
verify_code: '',
second: 0
};
},
onUnload() {
clearInterval(js)
this.second = 0;
if (this.originUrl.search('/pages/user/login') != '-1') {
uni.reLaunch({
url: '../news/index'
@ -62,7 +71,19 @@
console.log(this.originUrl);
}
},
computed: mapState(['isLogin']),
computed: {
verify_text() {
if (this.second == 0) {
return '获取验证码';
} else {
if (this.second < 10) {
return '0' + this.second + '秒后重新获取';
} else {
return this.second + '秒后重新获取';
}
}
}
},
methods: {
...mapMutations(['login']),
getUserInfo() {
@ -86,25 +107,20 @@
bindLogin() {
if (!validator.checkMobile(this.mobile)) {
return;
} else if (this.password == '') {
this.$alert('请输入码');
} else if (this.verify_code == '') {
this.$alert('请输入验证码');
return;
}
uni.showLoading({
title: '登录中…'
});
var md5Pwd = md5(md5(md5(this.password)))
console.log(md5Pwd)
this.$app.request({
url: this.$api.user.doLogin,
data: {
username: this.mobile,
password: md5Pwd,
appVersion: 12
verificationCode: this.verify_code,
},
method: 'POST',
dataType: 'json',
success: res => {
uni.hideLoading();
console.log(res.msg != undefined)
@ -138,9 +154,49 @@
} else {
this.$alert(res.msg);
}
},
fail(e) {
uni.hideLoading()
if (e.data) {
this.$alert(res.data.msg)
} else {
this.$alert('系统错误')
}
}
});
}
},
/*获取验证码*/
getVerifyCode() {
if (this.second > 0) {
return;
}
if (!validator.checkMobile(this.mobile)) {
return;
}
var _self = this;
this.$app.request({
url: this.$api.user.getVerifyCode + this.mobile,
method: 'GET',
dataType: 'json',
success: (res) => {
console.log(res)
if (res.statusCode != 200) {
_self.second = 120;
_self.$alert('获取成功');
js = setInterval(function() {
that.second--;
if (that.second == 0) {
clearInterval(js)
}
}, 1000)
}
},
fail(e) {
_self.$alert(e.data.msg);
}
});
},
}
};
</script>
@ -165,7 +221,7 @@
.list {
display: flex;
flex-direction: column;
padding-top: 120rpx;
padding-top: 40rpx;
padding-left: 100rpx;
padding-right: 100rpx;
@ -183,6 +239,14 @@
font-size: 40rpx;
}
.verfiy-code-icon {
.icon {
font-size: 52rpx;
margin-right: -6rpx;
margin-left: -4rpx;
}
}
.input {
flex: 1;
text-align: left;
@ -190,6 +254,19 @@
margin-left: 16rpx;
}
}
.verify-item {
position: relative;
.verify-btn {
position: absolute;
top: 22rpx;
right: 10rpx;
color: #8CC7B5;
font-size: 30rpx;
z-index: 9999;
}
}
}
.button {

View File

@ -10,7 +10,7 @@
<iconfont type="mobile"></iconfont>
<input class="input" v-model="mobile" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
<view class="item">
<!-- <view class="item">
<iconfont type="pwd"></iconfont>
<input class="input" v-model="password" type="text" maxlength="32" placeholder="请输入密码"
password="true" />
@ -19,12 +19,12 @@
<iconfont type="pwd"></iconfont>
<input class="input" v-model="confirmPwd" type="text" maxlength="32" placeholder="请确认密码"
password="true" />
</view>
</view> -->
<view class="item verify-item">
<view class="verfiy-code-icon">
<iconfont type="verify-code"></iconfont>
</view>
<input class="input" v-model="verify_code" type="text" maxlength="4" placeholder="请输入验证码" />
<input class="input" v-model="verify_code" type="text" placeholder="请输入验证码" />
<view class="verify-btn" @tap="getVerifyCode">{{verify_text}}</view>
</view>
</view>
@ -107,73 +107,73 @@
if (!validator.checkMobile(this.mobile)) {
return;
}
this.second = 60;
js = setInterval(function() {
that.second--;
if (that.second == 0) {
clearInterval(js)
}
}, 1000)
var _self = this;
this.$app.request({
url: this.$api.user.getVerifyCode + this.mobile,
method: 'GET',
dataType: 'json',
success: (res) => {
console.log(res)
if (res.statusCode != 200) {
this.$alert(res.msg);
_self.second = 120;
_self.$alert('获取成功');
js = setInterval(function() {
that.second--;
if (that.second == 0) {
clearInterval(js)
}
}, 1000)
}
},
fail(e) {
_self.$alert(e.data.msg);
}
});
},
/*注册*/
register() {
if (!validator.checkMobile(this.mobile)) {
return;
} else if (!validator.checkPassword(this.password)) {
return;
} else if (!validator.checkConfirmPwd(this.confirmPwd)) {
return;
} else if (this.confirmPwd != this.password) {
uni.showToast({
icon: 'none',
title: '输入的密码不一致'
})
return;
} else if (!validator.checkVerifyCode(this.verify_code)) {
} else if ('' == this.verify_code) {
this.$alert('请输入验证码')
return;
}
var md5Pwd = md5(md5(md5(this.password)))
// var md5Pwd = md5(md5(md5(this.password)))
uni.showLoading({
title: '注册中…'
})
this.$app.request({
url: this.$api.user.register,
url: this.$api.user.doRegister,
data: {
phone: this.mobile,
password: this.password,
verify_code: this.verify_code
verifyCode: this.verify_code
},
method: 'POST',
dataType: 'json',
success: (res) => {
console.log(res)
if (res.code == 0) {
uni.hideLoading();
this.$alert('注册成功');
uni.hideLoading();
this.$alert('注册成功');
/*更新登录状态,保存用户数据*/
this.login(res.data);
/*更新登录状态,保存用户数据*/
this.login(res.data);
/*跳转首页*/
setTimeout(() => {
uni.switchTab({
url: '/pages/user/index'
})
}, 1500)
/*跳转首页*/
setTimeout(() => {
uni.switchTab({
url: '/pages/user/index'
})
}, 1500)
},
fail(e) {
if (e.data) {
this.$alert(e.data.msg)
} else {
this.$alert(res.msg);
this.$alert('网络错误')
}
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB