Commit 6f616850 authored by liwei's avatar liwei

修改了登录、我的、报名页面

parent 62068d95
......@@ -16,3 +16,13 @@ export function activityDetail(id) {
method: 'GET',
})
}
//报名
export function addApplication(data) {
return request({
url:'/cmsApplication/add',
method: 'POST',
data
})
}
import {request} from '../../util/api'
//请求接口路径
const apis = {
getUserInfo: "/suituser/getInfo",
login: "/wxMiniApp/validLogin",
phoneLogin: "/wxMiniApp/phoneLogin",
};
export function getUserInfo(data){
/**
* 设置授权信息
*/
export function setUserProfile(data){
return request({
url: apis.getUserInfo,
method: "get",
url: "/app/wxMiniApp/saveUserProfile?nickName="+data.nickName+"&avatarUrl="+data.avatarUrl+"&gender="+data.gender+"&address="+data.address,
method: "post",
});
};
// 第一次登录接口
/**
* 登录
*/
export function login(data){
return request({
url: apis.login,
url: "/app/wxMiniApp/validLogin",
method: "get",
needToken: false,
data,
});
};
// 手机号登录接口
/**
* 手机号登录
*/
export function phoneLogin(data){
return request({
method: "get",
url: '/wxMiniApp/phoneLogin?encryptedData='+data.encryptedData+'&iv='+data.iv+'&openId='+data.openId,
url: '/app/wxMiniApp/phoneLogin?encryptedData='+data.encryptedData+'&iv='+data.iv+'&openId='+data.openId,
needToken: false,
});
}
// 根据字典类型查询字典数据信息
export function getDicts(params) {
return request({
url: '/system/dict/data/list',
params: params,
method: 'get'
})
}
//获取公共文化
export function getPublicActivity(query){
return request({
url: '/system/activity/getPublicActivity',
method: 'get'
})
}
// 获取个人信息
export function getInfo(id) {
return request({
url: '/sysUserManage/memberDetail/' + id,
method: 'get'
})
}
// 应用全局配置
module.exports = {
baseUrl: 'http://localhost:8082'
baseUrl: 'http://localhost:8092'
}
// module.exports = {
// devServer: {
......
......@@ -2,8 +2,7 @@
<!-- 使用z-paging-swiper为根节点可以免计算高度 -->
<z-paging-swiper>
<view :class="['add',isOpen?'add2':'']">
<image @click='goPage("/pagescommunity/newsRelease/newsRelease")' src="../../static/images/102.png" mode="">
</image>
<image @click='goPage("/pagescommunity/newsRelease/newsRelease")' src="../../static/images/102.png" mode=""/>
</view>
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中 -->
<!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
......
......@@ -165,10 +165,10 @@
</view>
</view>
<!-- 授权弹窗-->
<u-popup u-popup :show="tipsShow" mode="center" round="12" :safeAreaInsetBottom="false">
<view class="popup-container">
<image class="pop-bgc" :src="img + '/img/home-pop-bg.png'"></image>
<image class="pop-bgc" src="../../static/images/me/home-pop-bg.png"></image>
<view class="div-popo">
<view class="pop-title">温馨提示</view>
<view class="tips-content">
......@@ -185,14 +185,16 @@
</view>
</u-popup>
</view>
</template>
<script>
import {setUserProfile} from '../../api/login/index'
export default {
data() {
return {
tipsShow:false,
nologin: '',
tipsShow:false,//授权弹窗
nologin: '',//登录标志
userInfo:{},//用户信息
token:'',//token
img: this.$BASE_URL,
bgColor: "rgba(255, 255, 255, 0)",
button: [
......@@ -226,25 +228,28 @@
}
},
numtwo: 0,
ownerId: null,
timeoutObj: null,
socketTask: null,
tipMsg: ""
};
},
onShow() {
if (uni.getStorageSync('token')) {
this.ownerId = uni.getStorageSync('info') != null ? uni.getStorageSync('info').id : null;
}
if (uni.getStorageSync('userInfo')) {
this.nologin = false
} else {
this.nologin = true
}
},
onHide() {
},
onShow(){
this.nologin = false
this.userInfo = uni.getStorageSync('userInfo')
this.token = uni.getStorageSync('token')
if (this.token && this.token != null && this.token !== ''){
//token存在,证明已登录
//判断授权
if (this.userInfo && this.userInfo.wxNickName !== '' && this.userInfo.wxNickName != null) {
//已授权过
this.tipsShow = false
} else {
//没授权过,需要授权
this.tipsShow = true
}
} else {
//token不存在,未登录,跳转到登录页面进行登录
this.nologin = true
}
},
methods: {
//获取用户信息
getUserInfo() {
......@@ -252,19 +257,39 @@
wx.getUserProfile({
desc: '用于完善会员资料',
success: res => {
console.log('userInfo========:',res)
const params = {
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl,
gender: res.userInfo.gender,
address: res.userInfo.country + res.userInfo.province + res.userInfo.city,//国家+省份+城市
}
setUserProfile(params).then(res => {
uni.setStorageSync('userInfo', res.data.data)
}).catch(err => {
console.log('err:',err)
})
},
fail: errinfo => {
console.log('errinfo1==========',errinfo)
console.log('授权失败,请稍后再试',errinfo)
}
});
} catch {
wx.getUserInfo({
success: resinfo => {
success: res => {
const params = {
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl,
gender: res.userInfo.gender,
address: res.userInfo.country + res.userInfo.province + res.userInfo.city,//国家+省份+城市
}
setUserProfile(params).then(res => {
uni.setStorageSync('userInfo', res.data.data)
}).catch(err => {
console.log('err:',err)
})
},
fail: errinfo => {
console.log('errinfo2==========',errinfo)
console.log('授权失败,请稍后再试',errinfo)
}
});
}
......@@ -272,6 +297,9 @@
//不同意授权
handleNoAgree() {
this.tipsShow = false;
uni.switchTab({
url: '/pages/tab/index'
});
},
//同意授权
handAgree() {
......@@ -284,13 +312,11 @@
})
},
gotolike(type) { //喜欢三个列表页面
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
},
whether(i) {
if (i == 0) {
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
} else if (i == 1) {
this.updateInformation();
} else if (i == 3) {
......@@ -314,8 +340,7 @@
})
},
goCommunity(){
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
},
}
......@@ -346,16 +371,7 @@
image{
width: calc(33% - 10rpx);
height: 198rpx;
// border: 1rpx solid #707070;
border-radius: 12rpx;
// &:first-child{
// border-bottom-left-radius: 12rpx;
// border-top-left-radius:12rpx;
// }
// &:last-child{
// border-bottom-right-radius: 12rpx;
// border-top-right-radius:12rpx;
// }
}
}
.strs{
......@@ -396,8 +412,6 @@
.box-bottom-text {
font-size: 28rpx;
// font-family: 'PingFang SC-Heavy, PingFang SC';
// font-weight: 400;
font-family: 'PingFang SC-Heavy';
font-weight: bolder;
color: rgba(45, 49, 50, 0.9);
......@@ -471,16 +485,6 @@
margin-left: 14rpx;
}
// .boxsname {
// height: 42rpx;
// font-size: 28rpx;
// font-family: 'PingFang SC-Heavy, PingFang SC';
// color: rgba(45, 49, 50, 0.9);
// font-weight: 400;
// line-height: 42rpx;
// margin-left: 14rpx;
// }
.boxsing {
display: flex;
align-items: center;
......@@ -555,7 +559,6 @@
justify-content: center;
align-items: center;
margin-top: 50rpx;
}
.sss {
......@@ -669,7 +672,6 @@
background: linear-gradient(180deg, #F4F5F9 0%, #F4F5F9 100%);
}
.bgc-img {
position: absolute;
top: -80rpx;
......@@ -695,4 +697,67 @@
width: 100%;
height: 100%;
}
.popup-container {
height: 562rpx;
width: 544rpx;
overflow: hidden;
.div-popo {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.pop-title {
color: rgba(45, 49, 50, 0.8);
font-size: 40rpx;
font-family: 'PingFang SC-Heavy, PingFang SC';
display: flex;
justify-content: center;
margin-top: 50rpx;
}
.tips-content {
width: 448rpx;
margin: auto;
text-align: left;
margin-top: 50rpx;
line-height: 56rpx;
color: #666;
font-size: 28rpx;
font-family: 'PingFang SC-Regular, PingFang SC';
.agreement-btn {
display: inline-block;
color: #5b83e8;
font-family: 'PingFang SC-Bold, PingFang SC';
text-decoration: underline;
}
}
.btn-c {
display: flex;
margin: auto;
margin-top: 64rpx;
justify-content: space-between;
width: 428rpx;
}
}
.pop-btn {
width: 204rpx;
height: 76rpx;
border-radius: 38rpx;
text-align: center;
line-height: 76rpx;
border: 2rpx solid #446cd2;
color: #5b83e8;
font-family: 'PingFang SC-Regular, PingFang SC';
&.agree {
border: none;
background: linear-gradient(86deg, #c2d2f9 0%, #c5c2f3 100%);
}
}
}
</style>
This diff is collapsed.
......@@ -26,7 +26,7 @@
openId: '',
};
},
async created() {
created() {
// 获取openId
this.usersLogin().catch(res => {
console.log("登录错误信息", res)
......@@ -36,9 +36,6 @@
uni.hideLoading()
})
},
onShow() {
},
methods: {
/**
* 用户登录
......@@ -63,7 +60,7 @@
this.openId = res.data.data.wxOpenid
this.userInfo = res.data.data
uni.setStorageSync('token', this.token)
uni.setStorageSync('userInfo', JSON.stringify(this.userInfo))
uni.setStorageSync('userInfo', this.userInfo)
//停止加载
uni.hideLoading()
uni.switchTab({
......@@ -144,7 +141,6 @@
// 判断是否获取到token
if (this.token) {
console.log('3333')
uni.hideLoading();
uni.switchTab({
url: '/pages/tab/index'
......
......@@ -4,7 +4,6 @@ import config from '@/config'
// #endif
// #ifndef H5
// 请求接口
//export const BASE_URL = 'https://www.wxmblog.com/wxmapi'; //正式接口
export const BASE_URL = config.baseUrl;
// #endif
......@@ -28,9 +27,9 @@ export const request = (options) => {
method: options.method || "GET",
data: options.data || {},
dataType: 'json',
// header: {
// Authorization:options.withToken? uni.getStorageSync("token"):'',
// },
header: {
Authorization:'Bearer '+ uni.getStorageSync("token"),
},
success: (res) => {
// if (res.data.code == 2) {
// uni.showToast({
......
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