This commit is contained in:
cansnow
2025-11-27 03:55:38 +08:00
parent 1626f0c52a
commit 198c3dd4a5
24 changed files with 2043 additions and 201 deletions
+131
View File
@@ -0,0 +1,131 @@
<template>
<view style="display: flex;height: 100vh;align-items: center;flex-direction: column;">
<uni-nav-bar
style="width: 100%;"
statusBar
left-icon="left"
@clickLeft="goto(1)"
right-icon="more-filled"
@clickRight="scan"
:border="false"
backgroundColor="transparent"
title=""
>
</uni-nav-bar>
<view style="flex:1;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<view class="info_card">
<my-avatar :src="userInfo.faceURL" :desc="userInfo.nickname" size="64" />
<view class="id_row">
<text class="nickname">{{ userInfo.nickname }}</text>
<view class="id_row_copy" @click="copy">
<text class="id">{{ userInfo.userID }}</text>
<image style="width: 32rpx; height: 32rpx" src="@/static/images/id_copy.png" mode="" />
</view>
</view>
</view>
<canvas canvas-id="qrcode_canvas" id="qrcode_canvas" style="width: 600rpx; height: 600rpx"></canvas>
<view style="color: #b4b4b4;">扫一扫上面的二维码图案加我为朋友</view>
</view>
<view style="width: 80%;display: flex;align-items: center;justify-content: center;height: 20%;">
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2" @click="scan">扫一扫</u-button>
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2">换个样式</u-button>
<u-button type="default" plain :hairline="false" iconColor="#9aa2b2">保存图片</u-button>
</view>
</view>
</template>
<script>
import MyAvatar from "@/components/MyAvatar/index.vue";
import QRCode from "@/components/qrcode.js";
import UserBase from '@/components/User.vue';
import util from "@/util";
export default {
mixins:[UserBase],
components: {
MyAvatar,
},
data() {
return {
}
},
onLoad() {
console.log(this.userInfo)
this.createQrcode();
},
methods: {
...util,
createQrcode() {
const _this = this;
return new Promise((resolve, reject) => {
new QRCode({
context: _this, // 上下文环境
canvasId: 'qrcode_canvas', // canvas-id
usingComponents: true, // 是否是自定义组件
showLoading: false, // 是否显示loading
loadingText: "", // loading文字
text: "/pages/common/invite_register?code=", // 生成内容
size: 320, // 二维码大小
background: "#fff", // 背景色
foreground: '#000000', // 前景色
pdground: '#000000', // 定位角点颜色
correctLevel: 3, // 容错级别
image: "", // 二维码图标
imageSize: 40, // 二维码图标大小
cbResult: function(res) { // 生成二维码的回调
//_this.qrcode_src = (res)
//resolve(res);
},
});
});
},
}
}
</script>
<style scoped lang="scss">
.info_card {
width: 600rpx;
height: 196rpx;
border-radius: 6px;
background: #fff;
margin: 0 auto 0 auto;
padding: 0 36rpx;
color: #0c1c33;
display: flex;
align-items: center;
.id_row {
@include vCenterBox();
display: flex;
//height: 46px;
margin-left: 16rpx;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
flex: 1;
font-size: 28rpx;
&_copy {
@include vCenterBox();
}
.nickname {
@include nomalEllipsis();
max-width: 400rpx;
font-weight: 500;
font-size: 34rpx;
}
.id {
color: #8e9ab0;
}
}
img {
width: 18px;
height: 18px;
}
}
</style>
+125 -138
View File
@@ -1,151 +1,138 @@
<template>
<view class="">
<view class="menu_list">
<view
@click="menuClick(item)"
v-for="item in getMenus"
:key="item.idx"
class="menu_list_item"
>
<image class="menu_icon" :src="item.icon" mode=""></image>
<view class="item_content">
<text class="title">
{{ item.title }}
</text>
<view class="icon">
<u-icon name="arrow-right" color="#999" size="18" />
</view>
</view>
</view>
</view>
<view class="menu_list">
<view
@click="menuClick(item)"
v-for="item in getFriendsMenus"
:key="item.idx"
class="menu_list_item"
>
<image class="menu_icon" :src="item.icon" mode=""></image>
<view class="item_content">
<text class="title">
{{ item.title }}
</text>
<view class="icon">
<u-icon name="arrow-right" color="#999" size="18" />
</view>
</view>
</view>
</view>
</view>
<view class="">
<view class="menu_list">
<view @click="menuClick(item)" v-for="item in getMenus" :key="item.idx" class="menu_list_item">
<image class="menu_icon" :src="item.icon" mode=""></image>
<view class="item_content">
<text class="title">
{{ item.title }}
</text>
<view class="icon">
<u-icon name="arrow-right" color="#999" size="18" />
</view>
</view>
</view>
<view @click="menuClick(item)" v-for="item in getFriendsMenus" :key="item.idx" class="menu_list_item">
<image class="menu_icon" :src="item.icon" mode=""></image>
<view class="item_content">
<text class="title">
{{ item.title }}
</text>
<view class="icon">
<u-icon name="arrow-right" color="#999" size="18" />
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { mapGetters } from "vuex";
import { ContactMenuTypes } from "@/constant";
import {mapGetters} from "vuex";
import {ContactMenuTypes} from "@/constant";
export default {
name: "",
props: {},
data() {
return {};
},
computed: {
getMenus() {
return [
{
idx: 0,
type: ContactMenuTypes.NewFriend,
title: "新的好友",
icon: require("static/images/contact_new_friend.png"),
},
{
idx: 1,
type: ContactMenuTypes.NewGroup,
title: "新的群组",
icon: require("static/images/contact_new_group.png"),
},
];
},
getFriendsMenus() {
return [
{
idx: 2,
type: ContactMenuTypes.MyFriend,
title: "我的好友",
icon: require("static/images/contact_my_friend.png"),
badge: 0,
},
{
idx: 3,
type: ContactMenuTypes.MyGroup,
title: "我的群组",
icon: require("static/images/contact_my_group.png"),
badge: 0,
},
];
},
},
methods: {
menuClick({ type }) {
switch (type) {
case ContactMenuTypes.NewFriend:
case ContactMenuTypes.NewGroup:
uni.navigateTo({
url: `/pages/contact/applicationList/index?applicationType=${type}`,
});
break;
case ContactMenuTypes.MyFriend:
uni.navigateTo({
url: "/pages/contact/friendList/index",
});
break;
case ContactMenuTypes.MyGroup:
uni.navigateTo({
url: "/pages/contact/groupList/index",
});
break;
default:
break;
}
},
},
};
export default {
name: "",
props: {},
data() {
return {};
},
computed: {
getMenus() {
return [{
idx: 0,
type: ContactMenuTypes.NewFriend,
title: "新的好友",
icon: require("static/images/contact_new_friend.png"),
},
// {
// idx: 1,
// type: ContactMenuTypes.NewGroup,
// title: "新的群组",
// icon: require("static/images/contact_new_group.png"),
// },
];
},
getFriendsMenus() {
return [
// {
// idx: 2,
// type: ContactMenuTypes.MyFriend,
// title: "我的好友",
// icon: require("static/images/contact_my_friend.png"),
// badge: 0,
// },
{
idx: 3,
type: ContactMenuTypes.MyGroup,
title: "群聊",
icon: require("static/images/contact_my_group.png"),
badge: 0,
},
];
},
},
methods: {
menuClick({type}) {
switch (type) {
case ContactMenuTypes.NewFriend:
case ContactMenuTypes.NewGroup:
uni.navigateTo({
url: `/pages/contact/applicationList/index?applicationType=${type}`,
});
break;
case ContactMenuTypes.MyFriend:
uni.navigateTo({
url: "/pages/contact/friendList/index",
});
break;
case ContactMenuTypes.MyGroup:
uni.navigateTo({
url: "/pages/contact/groupList/index",
});
break;
default:
break;
}
},
},
};
</script>
<style lang="scss" scoped>
.menu_list {
margin-bottom: 24rpx;
background-color: #fff;
.menu_list {
margin-bottom: 24rpx;
background-color: #fff;
&_item {
@include vCenterBox();
margin: 0 44rpx;
padding: 24rpx 0;
color: #0c1c33;
&_item {
@include vCenterBox();
margin: 0 44rpx;
padding: 24rpx 0;
color: #0c1c33;
.menu_icon {
width: 42px;
min-width: 42px;
height: 42px;
min-height: 42px;
}
.menu_icon {
width: 42px;
min-width: 42px;
height: 42px;
min-height: 42px;
}
.item_content {
@include btwBox();
margin-left: 24rpx;
width: 100%;
position: relative;
.item_content {
@include btwBox();
margin-left: 24rpx;
width: 100%;
position: relative;
.icon {
display: flex;
.icon {
display: flex;
.u-badge {
width: fit-content;
padding: 8rpx 12rpx;
line-height: 18rpx;
}
}
}
}
}
</style>
.u-badge {
width: fit-content;
padding: 8rpx 12rpx;
line-height: 18rpx;
}
}
}
}
}
</style>
+1 -1
View File
@@ -49,7 +49,7 @@
.contact_container {
@include colBox(false);
height: 100vh;
background-color: #f6f6f6;
background-color: #fff;
.contact_title {
padding-left: 44rpx;
+8 -8
View File
@@ -15,9 +15,9 @@
</u-input>
</u-form-item>
<u-form-item prop="phoneNumber" label="手机号码" v-if="userInfo.type == 'mobile'">
<u-input v-model="userInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
<u-input v-model="userInfo.mobile" border="surround" placeholder="请输入手机号码" clearable>
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
<text class="areacode_content">+{{ userInfo.areaCode }}</text>
<text class="areacode_content">+{{ userInfo.region }}</text>
<u-icon class="arrow_down" name="arrow-down"></u-icon>
</view>
</u-input>
@@ -50,15 +50,15 @@
data() {
return {
userInfo: {
phoneNumber: "",
mobile: "",
email: "",
areaCode: "86",
region: "86",
invitationCode: "",
type:'email',
type:'mobile',
},
checked: [true],
rules: {
phoneNumber: [{
mobile: [{
type: "string",
required: true,
message: "请输入手机号码",
@@ -88,7 +88,7 @@
const options = {
mobile: this.userInfo.mobile,
email: this.userInfo.email,
areaCode: `+${this.userInfo.areaCode}`,
region: `+${this.userInfo.region}`,
event: this.isRegister ? 'register' : "reset_pwd",
invitationCode: this.userInfo.invitationCode,
type:this.userInfo.type
@@ -118,7 +118,7 @@
this.$refs.AreaPicker.init();
},
chooseArea(areaCode) {
this.userInfo.areaCode = areaCode;
this.userInfo.region = areaCode;
},
},
};
+5 -5
View File
@@ -39,9 +39,9 @@
isRegister: false,
codeValue: "",
userInfo: {
phoneNumber: "",
mobile: "",
email:"",
areaCode: "",
region: "",
},
formData: {
password: "",
@@ -101,9 +101,9 @@
this.$refs.loginForm.validate().then((valid) => {
if (valid) {
const options = {
mobile: this.userInfo.phoneNumber,
email: this.userInfo.em,
areaCode: `+${this.userInfo.areaCode}`,
mobile: this.userInfo.mobile,
email: this.userInfo.email,
region: `+${this.userInfo.region}`,
code: this.codeValue,
password: this.formData.password,
platform: uni.$u.os(),
+6 -6
View File
@@ -50,9 +50,9 @@
comfirmEying: false,
codeValue: "",
userInfo: {
phoneNumber: "",
mobile: "",
email: "",
areaCode: "",
region: "",
nickname: "",
password: "",
confirmPassword: "",
@@ -135,9 +135,9 @@
platform: uni.$u.os(),
autoLogin: true,
...this.userInfo,
areaCode: `+${this.userInfo.areaCode}`,
region: `+${this.userInfo.region}`,
password: md5(this.userInfo.password),
mobile: this.userInfo.phoneNumber
mobile: this.userInfo.mobile
};
try {
await businessRegister(options);
@@ -162,11 +162,11 @@
saveLoginInfo() {
uni.setStorage({
key: "lastPhoneNumber",
data: this.userInfo.phoneNumber,
data: this.userInfo.mobile,
});
uni.setStorage({
key: "lastAreaCode",
data: this.userInfo.areaCode,
data: this.userInfo.region,
});
},
},
+12 -19
View File
@@ -5,17 +5,17 @@
</view>
<view class="title">验证码已发送至手机</view>
<view class="sub_title">
{{ `+${userInfo.areaCode} ${userInfo.phoneNumber}` }}
{{ `+${userInfo.region} ${userInfo.mobile}` }}
</view>
<view class="code_container">
<!-- <view class="code_title">请输入验证码</view> -->
<u-code-input fontSize="24" color="#000" :focus="true" v-model="codeValue" hairline space="16"
@finish="checkCode" />
<view class="code_des">
<text>
<text v-if="count > 0">
{{ `${count}s` }}
</text>
<text @click="getSmsAgain"> 重发验证码 </text>
</view>
</view>
@@ -23,16 +23,9 @@
</template>
<script>
import user from "../../../store/modules/user";
import {
businessSendSms,
businessVerifyCode
} from "@/api/login";
import {
SmsUserFor
} from "@/constant";
import {
checkLoginError
} from "@/util/common";
import { businessSendSms, businessVerifyCode } from "@/api/login";
import { SmsUserFor } from "@/constant";
import { checkLoginError } from "@/util/common";
let timer;
export default {
data() {
@@ -40,8 +33,8 @@ import {
codeValue: "",
count: 60,
userInfo: {
phoneNumber: "",
areaCode: "",
mobile: "",
region: "",
email: "",
code: "",
type: "email",
@@ -74,10 +67,10 @@ import {
},
checkCode(value) {
const options = {
mobile: this.userInfo.phoneNumber,
mobile: this.userInfo.mobile,
email: this.userInfo.email,
type: this.userInfo.type,
areaCode: `+${this.userInfo.areaCode}`,
region: `+${this.userInfo.region}`,
event: this.isRegister ? 'register' : 'reset_pwd',
code: value,
};
@@ -115,10 +108,10 @@ import {
getSmsAgain() {
if (this.count === 0) {
const options = {
mobile: this.userInfo.phoneNumber,
mobile: this.userInfo.mobile,
email: this.userInfo.email,
type: this.userInfo.type,
areaCode: `+${this.userInfo.areaCode}`,
region: `+${this.userInfo.region}`,
event: this.isRegister ? 'register' : 'reset_pwd',
};
businessSendSms(options)