|
|
@@ -31,7 +31,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isAuth: false,
|
|
|
+ isAuth: getApp().globalData.globalAuth,
|
|
|
userHeadImg: "/static/logo.png",
|
|
|
userNickName: "子众",
|
|
|
list: [
|
|
|
@@ -53,22 +53,55 @@ export default {
|
|
|
onLoad() {
|
|
|
},
|
|
|
onShow() {
|
|
|
- // this.isAuth = getApp().globalData.isAuth;
|
|
|
- // if(this.isAuth){
|
|
|
- // this.userHeadImg = getApp().globalData.user_headUrl;
|
|
|
- // this.userNickName = getApp().globalData.user_name;
|
|
|
- // }
|
|
|
- // this.getUserInfo();
|
|
|
+ // if(this.isAuth){
|
|
|
+ // this.userHeadImg = getApp().globalData.user_headUrl;
|
|
|
+ // this.userNickName = getApp().globalData.user_name;
|
|
|
+ // }
|
|
|
},
|
|
|
methods: {
|
|
|
+ uploadUserInfo(name,head){
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&action=update×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ nickname:name,
|
|
|
+ headimg:head,
|
|
|
+ openid:getApp().globalData.open_id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
getAuth() {
|
|
|
uni.getUserProfile({
|
|
|
desc:'登录',
|
|
|
success:(res)=> {
|
|
|
- // getApp().globalData.user_headUrl = res.userInfo.avatarUrl;
|
|
|
- // getApp().globalData.user_name = res.userInfo.nickName;
|
|
|
this.userHeadImg = res.userInfo.avatarUrl;
|
|
|
this.userNickName = res.userInfo.nickName;
|
|
|
+ this.uploadUserInfo(res.userInfo.nickName,res.userInfo.avatarUrl)
|
|
|
this.isAuth = true;
|
|
|
getApp().globalData.isAuth = true;
|
|
|
},
|
|
|
@@ -103,40 +136,7 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
- 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) {
|
|
|
- }
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- console.log("连接失败");
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|