From 6461cb30979d39b5c3208440860137122ad870aa Mon Sep 17 00:00:00 2001 From: ggy <2694732783@qq.com> Date: Mon, 6 May 2024 16:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B5=E9=9D=A2=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/login.js | 7 ++ pages.json | 9 ++- pages/loginInfo/login.vue | 12 ++-- pages/mine/index.vue | 8 ++- pages/mine/info/index.vue | 68 +++++++++--------- pages/mine/info/userInfo.vue | 131 +++++++++++++++++++++++++++++++++++ static/font/iconfont.css | 9 ++- static/font/iconfont.ttf | Bin 5376 -> 5648 bytes store/index.js | 3 +- store/modules/userInfo.js | 111 +++++++++++++++++++++++++++++ 10 files changed, 315 insertions(+), 43 deletions(-) create mode 100644 pages/mine/info/userInfo.vue create mode 100644 store/modules/userInfo.js diff --git a/api/login.js b/api/login.js index 6ce7e7c..d6df800 100644 --- a/api/login.js +++ b/api/login.js @@ -37,7 +37,14 @@ export function getInfo() { 'method': 'get' }) } +//获取最详细的用户数据 +export function getUserInfo() { + return request({ + 'url': '/system/userinfo/getInfo', + 'method': 'get' + }) +} // 退出方法 export function logout() { return request({ diff --git a/pages.json b/pages.json index 00977c4..f898dcc 100644 --- a/pages.json +++ b/pages.json @@ -50,7 +50,14 @@ "style": { "navigationBarTitleText": "编辑资料" } - }, { + }, + { + "path": "pages/mine/info/userInfo", + "style": { + "navigationBarTitleText": "编辑资料" + } + }, + { "path": "pages/mine/pwd/index", "style": { "navigationBarTitleText": "修改密码" diff --git a/pages/loginInfo/login.vue b/pages/loginInfo/login.vue index 3fafc6f..f4301f9 100644 --- a/pages/loginInfo/login.vue +++ b/pages/loginInfo/login.vue @@ -31,9 +31,9 @@ 微信 - @@ -48,7 +48,7 @@ - diff --git a/pages/mine/info/userInfo.vue b/pages/mine/info/userInfo.vue new file mode 100644 index 0000000..2ac0fe4 --- /dev/null +++ b/pages/mine/info/userInfo.vue @@ -0,0 +1,131 @@ + + + + + + \ No newline at end of file diff --git a/static/font/iconfont.css b/static/font/iconfont.css index 6da3667..9d6ddc1 100644 --- a/static/font/iconfont.css +++ b/static/font/iconfont.css @@ -1,17 +1,20 @@ @font-face { - font-family: "iconfont"; - src: url('@/static/font/iconfont.ttf') format('truetype'); + font-family: "iconfont"; /* Project id 4533699 */ + src:url('iconfont.ttf?t=1714975199159') format('truetype'); } .iconfont { font-family: "iconfont" !important; font-size: 16px; - display: inline-block; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } +.icon-zhaoxiangji:before { + content: "\e601"; +} + .icon-lishixinxi:before { content: "\e67d"; } diff --git a/static/font/iconfont.ttf b/static/font/iconfont.ttf index e6cc38b828977280c5fdd5f3ce4f1b91161c5fc6..cd7d21da3116af5d2911a056b0af204fbc746d3d 100644 GIT binary patch delta 740 zcmYLFO>7cT5T1Ga!(UsLvb(5Nge_35K+5u0puvL|6H^jfd%%N~Xe~9RkXYMlqNwrU zp@+6y>XDe#r14PW&GhU+qbC!4^Do&`FCM%Ra28^Glkd$p^X8k$yvO5P;jM|roAsGN z045RG;`065ujZ9K0R9|+(^^?5-x~Y&{2c&%C!{Kru>9gSi60UImFnt7K2vu5_zV384^pn5~&>Od6v#2dDY`3mr@m%ERLc!#AGj{ z$3&E+6QK(j5*1OUvJ~4>19~PFRFq&WqX*QEa3$H+7H2k?jaXPDM+38{-=dVd_bi2sRJ?RI#Ke$hv4?J&u{0qrvLxvpkD4>WI aw4x2|;CN6e*EW{QD~orQnjhsPedAxMMTd6) delta 462 zcmXv~IZFdk5T3WUM`8?71V!TkVn`7X4=`XKR0P4wgT=(8$eMsbVxiGiEmqbdl_04_ zA#Ey4|A1O39AY1!{b|~l?qhi*9gVXGo8L&OME_TMjf8NCoIZ%b%nI=U35_~{(-h&VD x>D=2U2;E>i%9FaNmbD@6M)!lGiuWQ{d)4zm&|nginZi`2F`XH#g`9`3i9cMCSVjN< diff --git a/store/index.js b/store/index.js index f8bb72f..9a79936 100644 --- a/store/index.js +++ b/store/index.js @@ -1,10 +1,11 @@ import { createStore } from "vuex"; import user from '@/store/modules/user' +import userInfo from '@/store/modules/userInfo' import getters from './getters' const store = createStore({ modules: { - user + user,userInfo }, getters }); diff --git a/store/modules/userInfo.js b/store/modules/userInfo.js new file mode 100644 index 0000000..684250d --- /dev/null +++ b/store/modules/userInfo.js @@ -0,0 +1,111 @@ +import config from "@/config"; +import storage from "@/utils/storage"; +import constant from "@/utils/constant"; +import { getUserInfo } from "@/api/login"; +import { getToken, setToken, removeToken } from "@/utils/auth"; +import defaultAvatar from "@/static/images/profile.jpg"; +import { ref } from 'vue'; +const baseUrl = config.baseUrl; + +const user = { + state: { + birthday: storage.get(constant.birthday) /** 生日 */, + doingsStatus: storage.get(constant.doingsStatus) /** 活动发布权限(0没有,1有) */, + infoName: storage.get(constant.infoName) /** 实名信息名字 */, + infoSchool: storage.get(constant.infoSchool) /** 实名信息学校 */, + infoDepartment: storage.get(constant.infoDepartment) /** 实名信息系别 */, + infoGrade: storage.get(constant.infoGrade) /** 实名信息年级 */, + infoCode: storage.get(constant.infoCode) /** 实名信息学号 */, + infoDocument: storage.get(constant.infoDocument) /** 实名信息证件图片 */, + auditInfo: storage.get(constant.auditInfo) /** 审核状态(0已通过学生证,1通过身份证,2都通过,3审核中) */, + infoRank: storage.get(constant.infoRank) /** 用户等级 */, + infoCoin: storage.get(constant.infoCoin) /** 虚拟币数量 */, + infoActive: storage.get(constant.infoActive) /** 活跃度 */, + remark: storage.get(constant.remark) /** 简介 */, + }, + + mutations: { + SET_BIRTHDAY: (state, birthday) => { + state.birthday = birthday; + }, + SET_doingsStatus: (state, doingsStatus) => { + state.doingsStatus = doingsStatus; + }, + SET_infoName: (state, infoName) => { + state.infoName = infoName; + }, + SET_infoSchool: (state, infoSchool) => { + state.infoSchool = infoSchool; + }, + SET_infoDepartment: (state, infoDepartment) => { + state.infoDepartment = infoDepartment; + }, + SET_infoGrade: (state, infoGrade) => { + state.infoGrade = infoGrade; + }, + SET_infoCode: (state, infoCode) => { + state.infoCode = infoCode; + }, + SET_infoDocument: (state, infoDocument) => { + state.infoDocument = infoDocument; + }, + SET_auditInfo: (state, auditInfo) => { + state.auditInfo = auditInfo; + }, + SET_infoRank: (state, infoRank) => { + state.infoRank = infoRank; + }, + SET_infoCoin: (state, infoCoin) => { + state.infoCoin = infoCoin; + }, + SET_infoActive: (state, infoActive) => { + state.infoActive = infoActive; + }, + SET_remark: (state, remark) => { + state.remark = remark; + }, + }, + + actions: { + // 获取用户信息 + GetUserInfo({ commit, state }) { + return new Promise((resolve, reject) => { + getUserInfo() + .then((res) => { + const userInfo = res.data; + console.log("res:", res); + + const infoDocument = ref([]); + infoDocument = + userInfo == null || + userInfo.infoDocument == "" || + userInfo.infoDocument == null + ? defaultAvatar + : userInfo.infoDocument; + if (userInfo) { + commit("SET_BIRTHDAY", userInfo.birthday); + commit("SET_doingsStatus", userInfo.doingsStatus); + commit("SET_infoName", userInfo.infoName); + commit("SET_infoSchool", userInfo.infoSchool); + commit("SET_infoDepartment", userInfo.infoDepartment); + commit("SET_infoGrade", userInfo.infoGrade); + commit("SET_infoCode", userInfo.infoCode); + commit("SET_infoDocument", userInfo.infoDocument); + commit("SET_auditInfo", userInfo.auditInfo); + commit("SET_infoRank", userInfo.infoRank); + commit("SET_infoCoin", userInfo.infoCoin); + commit("SET_infoActive", userInfo.infoActive); + commit("SET_remark", userInfo.remark); + } + + resolve(res); + }) + .catch((error) => { + reject(error); + }); + }); + }, + }, +}; + +export default user;