Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
feat: 完成个人信息修改
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin3go committed Apr 4, 2023
1 parent ea6bcbc commit d894369
Show file tree
Hide file tree
Showing 18 changed files with 737 additions and 42 deletions.
6 changes: 5 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ onHide(() => {
console.log("App Hide");
});
</script>
<style></style>
<style lang="scss">
page{
background-color: $theme-color-background;
}
</style>
23 changes: 23 additions & 0 deletions src/apis/uni.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,32 @@ export function uniLogin(
resolve(res);
},
fail: (err) => {
uni.showToast({
title: `获取微信登录凭证code失败: ${err}`,
icon: "error",
duration: 2000,
});
reject(err);
},
});
});
}

export function uniUploadFile(data: UniNamespace.UploadFileOption): Promise<UniApp.UploadFileSuccessCallbackResult> {
return new Promise((resolve, reject) => {
uni.uploadFile({
...data,
success: (res) => {
resolve(res);
},
fail: (err) => {
uni.showToast({
title: `上传文件至oss失败: ${err}`,
icon: "error",
duration: 2000,
});
reject(err);
},
});
});
}
59 changes: 59 additions & 0 deletions src/components/oneRowCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<view class="one-row-container">
<view class="left">
<slot name="left"> 这是一则推广消息... </slot>
</view>
<view class="right">
<view class="right-text">
<slot name="rightText"> 更多 </slot>
</view>
<view v-if="props.showIcon" class="right-icon" @click="props.clickIconEvent">
<slot name="rightIcon">
<uni-icons type="forward" size="30" color="#D3D3D3"></uni-icons>
</slot>
</view>
</view>
</view>
</template>
<script setup lang="ts">
interface propsI {
showIcon: boolean;
clickIconEvent: Function;
rightTextWidth: string;
}
const props = withDefaults(defineProps<propsI>(), {
showIcon: true,
clickIconEvent: () => {},
rightTextWidth: "50px",
});
const width = props.rightTextWidth;
</script>
<style lang="scss" scoped>
.one-row-container {
height: 68px;
width: 100vw;
background-color: #ffffff;
border-top: 0.5px solid #ececec;
display: flex;
justify-content: space-between;
align-items: center;
.left {
flex: 1;
padding: 0 20px;
}
.right {
display: flex;
justify-content: space-around;
align-items: center;
.right-text {
width: v-bind(width);
}
.right-icon {
width: 30px;
margin-right: 10px;
}
}
}
</style>
52 changes: 52 additions & 0 deletions src/components/quickEntryCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<view class="quick-entry-container">
<view class="title-container">
<slot name="title"> 快捷入口 </slot>
</view>
<view class="icon-container">
<slot name="icon">
<uni-icons type="color" size="40" color="#FFFFFF"></uni-icons>
</slot>
</view>
</view>
</template>
<script setup lang="ts">
interface propsI {
// 可传入其他长度单位如80%,将直接运用于该组件顶部容器的height
containerHeight: string;
containerWidth: string;
}
const props = withDefaults(defineProps<propsI>(), {
containerHeight: "80px",
containerWidth: "190px",
});
const height = props.containerHeight;
const width = props.containerWidth;
</script>

<style lang="scss" scoped>
.quick-entry-container {
height: v-bind(height);
width: v-bind(width);
background-color: white;
border-radius: 15px;
display: flex;
align-items: center;
justify-content: space-around;
.title-container{
flex: 1;
padding: 0 20px;
font-size: 18px;
}
.icon-container {
width: 40px;
height: 40px;
padding: 10px;
border-radius: 15px;
background-color: $theme-color-lighter-3;
margin-right: 15px;
}
}
</style>
51 changes: 51 additions & 0 deletions src/const/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export const userDefaultData = {
avatarUrl: "/static/image/avatar/avatar_0.png",
nickName: "新用户",
gender: "未知",
province: "未知",
birthday: "未知",
id: "--",
};

export const provincesInChina = [
"北京市",
"上海市",
"天津市",
"重庆市",
"河北省",
"山西省",
"内蒙古自治区",
"辽宁省",
"吉林省",
"黑龙江省",
"江苏省",
"浙江省",
"安徽省",
"福建省",
"江西省",
"山东省",
"河南省",
"湖北省",
"湖南省",
"广东省",
"广西壮族自治区",
"海南省",
"四川省",
"贵省",
"云南省",
"西藏自治区",
"陕西省",
"甘肃省",
"宁夏回族自治区",
"青海省",
"新疆维吾尔族自治区",
"香港特别行政区",
"澳门特别行政区",
"台湾省",
"其它",
];

export const logoUrl = "/static/logo.jpg";


export const ossHost = "https://oss.justin3go.com";
32 changes: 24 additions & 8 deletions src/graphql/me.graphql.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import gql from "graphql-tag";

/**
* $data
*
* LoginAndAutoSignUpInput:
* {
* code: string;
* }
*/
export const loginAndAutoSignUpGQL = gql`
mutation loginAndAutoSignUp($data: LoginAndAutoSignUpInput!) {
loginAndAutoSignUp(data: $data) {
Expand All @@ -17,6 +9,11 @@ export const loginAndAutoSignUpGQL = gql`
id
openId
createdAt
avatarUrl
nickName
gender
province
birthday
}
}
}
Expand Down Expand Up @@ -44,3 +41,22 @@ export const meGQL = gql`
}
}
`;

export const updateUserGQL = gql`
mutation updateUser($data: UpdateUserInput!) {
updateUser(data: $data) {
avatarUrl
nickName
}
}
`;

export const getPostObjectParamsGQL = gql`
query getPostObjectParams {
getPostObjectParams {
OSSAccessKeyId
policy
signature
}
}
`;
10 changes: 8 additions & 2 deletions src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页"
"navigationStyle": "custom"
}
},
{
Expand All @@ -59,7 +59,13 @@
{
"path": "pages/me/index",
"style": {
"navigationBarTitleText": "我的"
"navigationStyle": "custom"
}
},
{
"path": "pages/me/updateUser",
"style": {
"navigationBarTitleText": "修改资料"
}
}
],
Expand Down
Loading

0 comments on commit d894369

Please sign in to comment.