优化页面

This commit is contained in:
pengxiaolong
2025-05-27 13:06:24 +08:00
parent 728dfd501f
commit cf8728f0d7
29 changed files with 357 additions and 137 deletions

View File

@@ -8,8 +8,12 @@
<view class="name">{{ userinfo.nickName }}</view>
</view>
<view class="Settings" @click="goSetting">
<image class="SettingsIcon" src="../../static/Settings.png" mode="scaleToFill"/>
</view>
<image class="SettingsIcon" src="../../static/Settings.png" mode="scaleToFill" />
</view>
</view>
<view>
<view class="logout" @click="logout">退出登录</view>
</view>
</view>
<view class="tabBar">
@@ -26,7 +30,7 @@ export default {
};
},
onShow() {
uni.getStorage({
uni.getStorage({
key: "userinfo",
success: (res) => {
this.userinfo = res.data;
@@ -35,10 +39,27 @@ export default {
},
methods: {
goSetting() {
uni.navigateTo({
url: '/pages/Setting/Setting'
});
},
uni.navigateTo({
url: "/pages/Setting/Setting",
});
},
logout() {
uni.removeStorage({
key: "chatInfo",
});
uni.removeStorage({
key: "userinfo",
});
uni.removeStorage({
key: "userSig",
});
uni.removeStorage({
key: "lastPage",
});
uni.reLaunch({
url: "/pages/login/login",
});
}
},
components: {
tabBar,
@@ -62,6 +83,7 @@ export default {
width: 100%;
}
.header {
background: #ffffff;
margin-left: 50rpx;
width: 100rpx;
height: 100rpx;

View File

@@ -153,7 +153,7 @@ export default {
}
};
},
onLoad() {
mounted() {
uni.getStorage({
key: "userinfo",
success: (res) => {
@@ -236,13 +236,13 @@ export default {
method: "POST",
data: {
anchorId: this.nameAnchor,
pk_time: this.datetimesingle,
pkTime: this.sendingTime,
sex: this.genders,
country: this.countrys,
coin: this.numberCoins,
remark: this.remarks,
status: 0,
sender_id: this.id,
senderId: this.id,
anchorIcon: "",
},
userInfo: true,

View File

@@ -15,11 +15,11 @@
<script>
import request from "../../components/request.js";
import postFile from "../../components/postFile.js";
import generateFileName from "../../components/generateFileName.js";
import postFile from "../../components/postFile.js";
import generateFileName from "../../components/generateFileName.js";
export default {
inject: ['$global'],
inject: ["$global"],
data() {
return {
userinfo:
@@ -29,6 +29,8 @@ export default {
info: {},
userSig: "",
lastPage: "",
picture: "",
Filename: generateFileName(),
};
},
onLoad(option) {
@@ -47,12 +49,12 @@ export default {
uni.getStorage({
key: "lastPage",
success: (res) => {
this.lastPage = "/"+res.data;
this.lastPage = "/" + res.data;
},
fail: () => {
this.lastPage = "/pages/Home/Home";
},
})
});
// const { info } = option;
// this.id = JSON.parse(info).id
},
@@ -72,61 +74,51 @@ export default {
title: "登录中...",
mask: true,
});
const { code } = await uni.login({
provider: "weixin",
onlyAuthorize: true,
});
postFile({
path: this.userinfo,
name:generateFileName(),
}).then((res) => {
this.userinfo = res;
}).catch((err) => {
const { code } = await uni.login({
provider: "weixin",
onlyAuthorize: true,
});
postFile({
path: this.userinfo,
name: this.Filename,
})
.then((ress) => {
this.picture = ress;
const res = request({
url: "user/inputUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: this.Filename,
nickName: this.name,
code,
usersig: this.userSig.userSig,
},
userInfo: false,
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.setStorageSync("userinfo", res.data.info);
uni.hideLoading();
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
uni.reLaunch({
url: this.lastPage,
});
//````````````````````````````````````````````````````````````````````
} else {
uni.showToast({
title: "登录失败",
icon: "none",
});
}
});
})
.catch((err) => {
console.log(err);
});
if (this.userinfo) {
const res = await request({
url: "user/inputUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: this.userinfo,
nickName: this.name,
code,
usersig: this.userSig.userSig,
},
userInfo: false,
});
if (res.code === 200) {
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.setStorageSync("userinfo", res.data.info);
uni.hideLoading();
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
uni.reLaunch({
url: this.lastPage,
});
//````````````````````````````````````````````````````````````````````
} else {
uni.showToast({
title: "登录失败",
icon: "none",
});
}
}else{
uni.showToast({
title: "上传失败",
icon: "none",
});
}
},
},
};

View File

@@ -21,6 +21,7 @@ export default {
info: {},
userSig: "",
lastPage: "",
myuserSig: "",
};
},
onLoad() {
@@ -58,6 +59,7 @@ export default {
userInfo: false,
});
this.info = res;
console.log("登录信息", this.info);
const sdkAppID = Number(this.info.data.chatInfo.appId);
const userID ="administrator";
this.userSig = genTestUserSig({
@@ -65,6 +67,13 @@ export default {
SECRETKEY:this.info.data.chatInfo.appKey,
userID: userID,
})
this.myuserSig = genTestUserSig({
SDKAPPID : sdkAppID,
SECRETKEY:this.info.data.chatInfo.appKey,
userID: String(res.data.info.id),
})
console.log("userSig",this.myuserSig.userSig);
uni.setStorageSync("myuserSig", this.myuserSig)
uni.setStorageSync("chatInfo", this.info.data.chatInfo)
uni.setStorageSync("userSig", this.userSig)
uni.setStorageSync("userinfo", this.info.data.info);
@@ -73,10 +82,12 @@ export default {
uni.reLaunch({
url: "/pages/UserInformation/UserInformation",
});
TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.id,this.myuserSig.userSig)
uni.hideLoading();
} else {
uni.setStorageSync("userinfo", this.info.data.info);
TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.id,this.myuserSig.userSig)
uni.hideLoading();
TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.id,this.userSig.userSig)
//跳转原来页面否则首页
console.log("跳的地址", this.lastPage);
uni.reLaunch({

View File

@@ -37,22 +37,37 @@
<!-- 弹窗 -->
<uni-popup ref="popup" type="center" border-radius="10px 10px 0 0">
<view class="popup-content">
<view class="popup-title">您确定要邀请主播PK吗</view>
<view class="popup-title">
<scroll-view scroll-y="true" class="scroll">
<!-- <uni-card v-for="(item, index) in list"> -->
<view class="card" v-for="(item, index) in list">
<view class="card-content">
</view>
</view>
<!-- `````````````` -->
</scroll-view>
</view>
<view class="popup-btn">
<button class="invite" type="primary" @click="invite()">邀请</button>
<button class="cancel" type="default" @click="close()">取消</button>
</view>
</view>
</uni-popup>
<NewAddedPk class="createModule" ref="createModule"></NewAddedPk>
</template>
<script>
import formatDate from "../../components/formatDate.js";
import VerifyLogin from "../../components/VerifyLogin.js";
import NewAddedPk from "../../pages/NewAddedPk/NewAddedPk.vue";
import request from "../../components/request.js";
export default {
data() {
return {
item: {},
id: 0,
list: [],
};
},
onLoad(options) {
@@ -63,7 +78,13 @@ export default {
this.item = data.item; // 将接收到的数据赋值给item
console.log("接收到的数据:", this.item);
});
uni.getStorage({
key: "userinfo",
success: (res) => {
this.id = res.data.id;
},
});
},
methods: {
formatDate: formatDate,
@@ -74,6 +95,7 @@ export default {
},
open() {
this.$refs.popup.open("center");
this.userlist()
},
invite() {
// 发送邀请消息
@@ -91,7 +113,46 @@ export default {
});
});
},
async userlist() {
uni.showLoading({
title: "加载中...",
mask: true,
});
const res = await request({
url: "pk/queryMyPkData",
method: "POST",
data: {
userId: this.id,
},
userInfo: true,
});
if (res.code === 200) {
if(res.data.length !== 0){
uni.hideLoading();
console.log("res.data",res.data);
this.list = res.data;
}else{
uni.hideLoading();
this.openPopupQuantity()
}
} else {
uni.hideLoading();
uni.showToast({
title: "加载失败",
icon: "none",
duration: 2000,
});
}
},
openPopupQuantity() {
this.$refs.createModule.open();
},
},
components: {
NewAddedPk
}
};
</script>
@@ -135,7 +196,7 @@ export default {
}
.popup-content {
width: 500rpx;
height: 300rpx;
height: 700rpx;
background-color: #fff;
border-radius: 10px;
display: flex;
@@ -169,4 +230,31 @@ export default {
margin-left: 30rpx;
border-radius: 20rpx;
}
.scroll {
width: 470rpx;
height: 500rpx;
border: 1px solid #afafaf;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.card {
margin-top: 10rpx;
margin-left: 10rpx;
}
.card-content {
width: 445rpx;
height: 70rpx;
border: 1px solid #afafaf;
border-radius: 10px;
}
.createModule{
position: fixed;
bottom: 0;
right: 0;
z-index: 998;
width: 100vw;
}
</style>