Commit 6f616850 authored by liwei's avatar liwei

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

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