|
|
@@ -2,18 +2,28 @@
|
|
|
<view class="content">
|
|
|
<foot-tabs></foot-tabs>
|
|
|
<div class="self-inf">
|
|
|
- <div class="img-name-box" v-if="isAuth">
|
|
|
- <image :src="userHeadImg" alt="" class="heade-img" mode="aspectFill"></image>
|
|
|
- <p class="nickname">{{userNickName}}</p>
|
|
|
- </div>
|
|
|
- <view class="img-name-box" v-if="!isAuth">
|
|
|
- <button @click="goAuthPage()" class="auth-btn">点击去授权</button>
|
|
|
- </view>
|
|
|
+ <div class="img-name-box" v-if="isAuth">
|
|
|
+ <image
|
|
|
+ :src="userHeadImg"
|
|
|
+ alt=""
|
|
|
+ class="heade-img"
|
|
|
+ mode="aspectFill"
|
|
|
+ ></image>
|
|
|
+ <p class="nickname">{{ userNickName }}</p>
|
|
|
+ </div>
|
|
|
+ <view class="img-name-box" v-if="!isAuth">
|
|
|
+ <button @click="goAuthPage()" class="auth-btn">点击去授权</button>
|
|
|
+ </view>
|
|
|
<image class="bg-img" :src="swiperBackground" mode="aspectFill"></image>
|
|
|
- <image src="../../static/Intersect.svg" class="groove-img"></image>
|
|
|
+ <image src="../../static/Intersect.svg" class="groove-img"></image>
|
|
|
</div>
|
|
|
<div class="options">
|
|
|
- <div v-for="(item, idx) in list" :key="idx" class="options-item" @click="goDetailFn(idx)">
|
|
|
+ <div
|
|
|
+ v-for="(item, idx) in list"
|
|
|
+ :key="idx"
|
|
|
+ class="options-item"
|
|
|
+ @click="goDetailFn(idx, item.url)"
|
|
|
+ >
|
|
|
<div class="img-box">
|
|
|
<img :src="item.icoin" alt="" class="options-item-img" /><span></span>
|
|
|
</div>
|
|
|
@@ -29,155 +39,201 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import md5 from '@/common/md5.js';
|
|
|
+import md5 from "@/common/md5.js";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
message: "我的",
|
|
|
- isAuth:true,
|
|
|
- userHeadImg:'',
|
|
|
- userNickName:'',
|
|
|
+ isAuth: true,
|
|
|
+ userHeadImg: "",
|
|
|
+ userNickName: "",
|
|
|
list: [
|
|
|
{ icoin: "/static/selfCenter/suggest.png", name: "我的建议" },
|
|
|
{ icoin: "/static/selfCenter/sign.png", name: "我的报名" },
|
|
|
- { icoin: "/static/selfCenter/collection.png", name: "我的收藏" },
|
|
|
+ {
|
|
|
+ icoin: "/static/selfCenter/collection.png",
|
|
|
+ name: "我的收藏",
|
|
|
+ url: "/pages/selfCenter/collection",
|
|
|
+ },
|
|
|
{ icoin: "/static/selfCenter/back.png", name: "退出登录" },
|
|
|
],
|
|
|
- swiperBackground:'',
|
|
|
+ swiperBackground: "",
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.getSwiperList();
|
|
|
-
|
|
|
+ this.getSwiperList();
|
|
|
},
|
|
|
onShow() {
|
|
|
- // this.isAuth = getApp().globalData.isAuth;
|
|
|
- // if(this.isAuth){
|
|
|
- // this.userHeadImg = getApp().globalData.user_headUrl;
|
|
|
- // this.userNickName = getApp().globalData.user_name;
|
|
|
- // }
|
|
|
- this.getUserInfo()
|
|
|
+ // this.isAuth = getApp().globalData.isAuth;
|
|
|
+ // if(this.isAuth){
|
|
|
+ // this.userHeadImg = getApp().globalData.user_headUrl;
|
|
|
+ // this.userNickName = getApp().globalData.user_name;
|
|
|
+ // }
|
|
|
+ this.getUserInfo();
|
|
|
},
|
|
|
methods: {
|
|
|
- goAuthPage(){
|
|
|
- uni.navigateTo({
|
|
|
- url:'../auth/index'
|
|
|
- })
|
|
|
- },
|
|
|
- goDetailFn(index){
|
|
|
- let that = this;
|
|
|
- switch (index){
|
|
|
- case 0: //我的建议
|
|
|
- break;
|
|
|
- case 1: //我的报名
|
|
|
- break;
|
|
|
- case 2: //我的收藏
|
|
|
- break;
|
|
|
- case 3: //退出登录
|
|
|
- if(that.isAuth){
|
|
|
- uni.showModal({
|
|
|
- title:'确定退出登录吗?',
|
|
|
- success(res) {
|
|
|
- if(res.confirm){
|
|
|
- that.loginOut();
|
|
|
- }else if (res.cancel){
|
|
|
- console.log('用户点击取消');
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title:'您还没有登录',
|
|
|
- duration:2500,
|
|
|
- icon:'none'
|
|
|
- })
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- loginOut(){
|
|
|
- let md5Sign = md5("method="+'user'+"×tamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
|
|
|
- let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&action=logout×tamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
|
|
|
- uni.request({
|
|
|
- url:url,
|
|
|
- method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/x-www-form-urlencoded'
|
|
|
- },
|
|
|
- data: {
|
|
|
- openId:getApp().globalData.open_id
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if(res.data.code === 200){
|
|
|
- this.isAuth = false;
|
|
|
- getApp().globalData.isAuth = false;
|
|
|
- getApp().globalData.user_headUrl = '';
|
|
|
- getApp().globalData.user_name = '';
|
|
|
- getApp().globalData.user_phone = '';
|
|
|
- uni.showToast({
|
|
|
- title:'退出登录成功',
|
|
|
- duration:2500,
|
|
|
- icon:'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- console.log("连接失败");
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- getUserInfo(){
|
|
|
- let md5Sign = md5("method="+'user'+"×tamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
|
|
|
- let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&action=info_by_openid×tamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
|
|
|
- uni.request({
|
|
|
- url:url,
|
|
|
- method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/x-www-form-urlencoded'
|
|
|
- },
|
|
|
- data: {
|
|
|
- openId:getApp().globalData.open_id
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if(res.data.code === 200){
|
|
|
- if(res.data.data.nickname){
|
|
|
- this.isAuth = true;
|
|
|
- this.userHeadImg = res.data.data.headimg;
|
|
|
- this.userNickName = res.data.data.nickname;
|
|
|
- getApp().globalData.user_phone = res.data.data.phone;
|
|
|
- }else{
|
|
|
- this.isAuth = false;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- console.log("连接失败");
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- getSwiperList(){
|
|
|
- let md5Sign = md5("method="+'common'+"×tamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
|
|
|
- let url = getApp().globalData.shareUrl+'api/api.php'+'?method=common&source=main_pics&action=list×tamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
|
|
|
- uni.request({
|
|
|
- url:url,
|
|
|
- method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/x-www-form-urlencoded'
|
|
|
- },
|
|
|
- data: {
|
|
|
- order_by:"weight desc",
|
|
|
- s_status:1,
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if(res.data.code === 200){
|
|
|
- this.swiperBackground = getApp().globalData.shareUrl + res.data.data.list[0].pic_path
|
|
|
- }
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- console.log("连接失败");
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+ goAuthPage() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "../auth/index",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ goDetailFn(index, url) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url,
|
|
|
+ });
|
|
|
+ let that = this;
|
|
|
+ switch (index) {
|
|
|
+ case 0: //我的建议
|
|
|
+ break;
|
|
|
+ case 1: //我的报名
|
|
|
+ break;
|
|
|
+ case 2: //我的收藏
|
|
|
+ break;
|
|
|
+ case 3: //退出登录
|
|
|
+ if (that.isAuth) {
|
|
|
+ uni.showModal({
|
|
|
+ title: "确定退出登录吗?",
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ that.loginOut();
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log("用户点击取消");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "您还没有登录",
|
|
|
+ duration: 2500,
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loginOut() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&action=logout×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ openId: getApp().globalData.open_id,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.isAuth = false;
|
|
|
+ getApp().globalData.isAuth = false;
|
|
|
+ getApp().globalData.user_headUrl = "";
|
|
|
+ getApp().globalData.user_name = "";
|
|
|
+ getApp().globalData.user_phone = "";
|
|
|
+ uni.showToast({
|
|
|
+ title: "退出登录成功",
|
|
|
+ duration: 2500,
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getUserInfo() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&action=info_by_openid×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ openId: getApp().globalData.open_id,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ if (res.data.data.nickname) {
|
|
|
+ this.isAuth = true;
|
|
|
+ this.userHeadImg = res.data.data.headimg;
|
|
|
+ this.userNickName = res.data.data.nickname;
|
|
|
+ getApp().globalData.user_phone = res.data.data.phone;
|
|
|
+ } else {
|
|
|
+ this.isAuth = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getSwiperList() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "common" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=common&source=main_pics&action=list×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ order_by: "weight desc",
|
|
|
+ s_status: 1,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.swiperBackground =
|
|
|
+ getApp().globalData.shareUrl + res.data.data.list[0].pic_path;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -199,13 +255,13 @@ export default {
|
|
|
margin-top: 70rpx;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- .auth-btn {
|
|
|
- margin-left: 80rpx;
|
|
|
- margin-top: 50rpx;
|
|
|
- font-size: 28rpx;
|
|
|
- background-color: #02A7F0;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
+ .auth-btn {
|
|
|
+ margin-left: 80rpx;
|
|
|
+ margin-top: 50rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ background-color: #02a7f0;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
.heade-img {
|
|
|
z-index: 1;
|
|
|
width: 100rpx;
|
|
|
@@ -222,19 +278,19 @@ export default {
|
|
|
height: 100%;
|
|
|
// border-radius: 0rpx 0rpx 70rpx 70rpx;
|
|
|
}
|
|
|
- .groove-img {
|
|
|
- width: 100%;
|
|
|
- height: 100rpx;
|
|
|
- bottom: -22rpx;
|
|
|
- position: absolute;
|
|
|
- }
|
|
|
+ .groove-img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100rpx;
|
|
|
+ bottom: -22rpx;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
.nickname {
|
|
|
font-weight: 600;
|
|
|
- font-size: 28rpx;
|
|
|
- margin-left: 30rpx;
|
|
|
- margin-top: 20rpx;
|
|
|
- color: #ffffff;
|
|
|
- letter-spacing: 1rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ margin-left: 30rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ color: #ffffff;
|
|
|
+ letter-spacing: 1rpx;
|
|
|
}
|
|
|
}
|
|
|
.options {
|
|
|
@@ -258,10 +314,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.options-item-name {
|
|
|
- margin-left: 40rpx;
|
|
|
- font-weight: 600;
|
|
|
- font-size: 30rpx;
|
|
|
- margin-bottom: 10rpx;
|
|
|
+ margin-left: 40rpx;
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-bottom: 10rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|