Commit 69abac62a5fdc09dd021b2c2beb9b330e42c9092

Authored by 史婷婷
1 parent f327d285

feat: 我的页面(我的、设置、修改密码、关于我们)+全局的一些数据处理、顶部样式、主题色相关、底部、用户信息存储

... ... @@ -6,6 +6,7 @@
6 6 export default {
7 7 onLaunch: function() {
8 8 this.initApp()
  9 + this.applyTheme()
9 10 },
10 11 methods: {
11 12 // 初始化应用
... ... @@ -20,8 +21,20 @@
20 21 initConfig() {
21 22 this.globalData.config = config
22 23 },
  24 + applyTheme() {
  25 + const color = config.themeColor
  26 + try {
  27 + uni.setTabBarStyle({
  28 + color: 'rgba(0,0,0,0.9)',
  29 + selectedColor: color,
  30 + backgroundColor: '#ffffff',
  31 + borderStyle: 'white'
  32 + })
  33 + } catch (e) {
  34 + }
  35 + },
23 36 checkLogin() {
24   -
  37 +
25 38 if (!getToken()) {
26 39 this.$tab.reLaunch('/pages/login')
27 40 }
... ...
... ... @@ -36,7 +36,7 @@ export function register(data) {
36 36 // 获取用户详细信息
37 37 export function getInfo() {
38 38 return request({
39   - 'url': '/getInfo',
  39 + 'url': '/center/info',
40 40 'method': 'get'
41 41 })
42 42 }
... ...
... ... @@ -27,8 +27,10 @@ export function updateUserPwd(oldPsw,newPsw,confirmPsw){
27 27 }
28 28 return request({
29 29 url: baseUrl + '/password',
30   - method: 'put',
31   - params: data
  30 + method: 'patch',
  31 + data: {
  32 + ...data
  33 + }
32 34 })
33 35 }
34 36
... ...
1 1 // 应用全局配置
2 2 module.exports = {
  3 + // 主题主色(运行时用于注入 pages.json 中的颜色配置)
  4 + themeColor: '#3d48a3',
3 5
4 6 // baseUrl: 'http://ft.wecando21cn.com/api',
5 7 baseUrl: 'http://erp.qgutech.com/api',
... ...
... ... @@ -35,7 +35,13 @@
35 35 }, {
36 36 "path": "pages/mine/index",
37 37 "style": {
38   - "navigationBarTitleText": "我的"
  38 + "navigationBarTitleText": "我的",
  39 + "navigationBarTextStyle": "white"
  40 + }
  41 + }, {
  42 + "path": "pages/mine/index2",
  43 + "style": {
  44 + "navigationBarTitleText": "我的2"
39 45 }
40 46 }, {
41 47 "path": "pages/mine/avatar/index",
... ... @@ -55,12 +61,12 @@
55 61 }, {
56 62 "path": "pages/mine/pwd/index",
57 63 "style": {
58   - "navigationBarTitleText": "修改密码"
  64 + "navigationBarTitleText": "修改密码"
59 65 }
60 66 }, {
61 67 "path": "pages/mine/setting/index",
62 68 "style": {
63   - "navigationBarTitleText": "应用设置"
  69 + "navigationBarTitleText": "应用设置"
64 70 }
65 71 }, {
66 72 "path": "pages/mine/help/index",
... ... @@ -70,7 +76,7 @@
70 76 }, {
71 77 "path": "pages/mine/about/index",
72 78 "style": {
73   - "navigationBarTitleText": "关于我们"
  79 + "navigationBarTitleText": "关于我们"
74 80 }
75 81 }, {
76 82 "path": "pages/common/webview/index",
... ... @@ -204,11 +210,10 @@
204 210 ]
205 211 }
206 212 ],
207   - "tabBar": {
208   - "color": "rgba(0,0,0,0.9)",
209   - "selectedColor": "#3D48A3",
210   - "backgroundColor": "#ffffff",
211   - "borderStyle": "white",
  213 + "tabBar": {
  214 + "color": "rgba(0,0,0,0.9)",
  215 + "backgroundColor": "#ffffff",
  216 + "borderStyle": "white",
212 217 "list": [{
213 218 "pagePath": "pages/index",
214 219 "iconPath": "static/images/tabbar/home.png",
... ... @@ -223,7 +228,7 @@
223 228 },
224 229 "globalStyle": {
225 230 "navigationBarTitleText": "ERP",
226   - "navigationBarBackgroundColor": "#3c96f3",
  231 + "navigationBarBackgroundColor": "$theme-primary",
227 232 "navigationBarTextStyle": "white"
228 233 }
229 234 }
\ No newline at end of file
... ...
... ... @@ -23,16 +23,16 @@
23 23 </view>
24 24
25 25 <view class="agree-row">
26   - <uni-data-checkbox v-model="agreeVal" :localdata="agreeOptions" :multiple="true" />
  26 + <uni-data-checkbox v-model="agreeVal" :localdata="agreeOptions" :multiple="true" />
27 27 <text @click="handleUserAgrement" class="link">《用户协议》</text>
28 28 <text @click="handlePrivacy" class="link">《隐私协议》</text>
29 29 </view>
30 30
31   - <button @click="handleLogin" :disabled="Array.isArray(agreeVal) ? agreeVal.length===0 : !agreeVal" class="login-btn">立即登录</button>
  31 + <button @click="handleLogin" :disabled="!canSubmit" class="login-btn">立即登录</button>
32 32
33 33 <view class="reg text-center" v-if="register">
34 34 <text class="text-grey1">没有账号?</text>
35   - <text @click="handleUserRegister" class="text-blue">立即注册</text>
  35 + <text @click="handleUserRegister" >立即注册</text>
36 36 </view>
37 37 </view>
38 38 </view>
... ... @@ -41,8 +41,8 @@
41 41 <script>
42 42 import { getCodeImg } from '@/api/login'
43 43 import config from '@/config'
44   - export default {
45   - data() {
  44 +export default {
  45 + data() {
46 46 return {
47 47 //获取配置文件对象
48 48 globalConfig: getApp().globalData.config,
... ... @@ -60,8 +60,18 @@
60 60 sn: ''
61 61 }
62 62 }
63   - },
64   - created() {
  63 + },
  64 + computed: {
  65 + canSubmit() {
  66 + const agreeChecked = Array.isArray(this.agreeVal)
  67 + ? (this.agreeVal.includes('1') || this.agreeVal.length > 0)
  68 + : !!this.agreeVal
  69 + const username = (this.loginForm.username || '').trim()
  70 + const password = (this.loginForm.password || '').trim()
  71 + return agreeChecked && username && password
  72 + }
  73 + },
  74 + created() {
65 75 this.getCode()
66 76 },
67 77 methods: {
... ... @@ -188,11 +198,11 @@
188 198 color: rgba(0,0,0,0.9);
189 199 margin-top: 8rpx;
190 200 font-size: 28rpx;
191   -
192   - .link {
193   - color: #3D48A3;
194   - }
195   - }
  201 +
  202 + .link {
  203 + color: $theme-primary;
  204 + }
  205 + }
196 206
197 207 .login-btn {
198 208 width: 100%;
... ... @@ -200,14 +210,14 @@
200 210 line-height: 88rpx;
201 211 border-radius: 8rpx;
202 212 margin-top: 64rpx;
203   - background-color: #3D48A3;
  213 + background-color: $theme-primary;
204 214 color: #fff;
205 215 font-size: 32rpx;
206 216 text-align: center;
207 217 }
208 218 .login-btn[disabled] {
209   - background-color: rgba(61,72,163,0.5);
210   - color: #fff;
  219 + background-color: $theme-primary-alpha-50;
  220 + color: #fff;
211 221 }
212 222
213 223 .reg { margin-top: 20rpx; text-align: center; }
... ...
... ... @@ -50,6 +50,13 @@
50 50 url: getApp().globalData.config.appInfo.site_url,
51 51 version: getApp().globalData.config.appInfo.version
52 52 }
  53 + },
  54 + onShow() {
  55 + const color = getApp().globalData.config.themeColor
  56 + uni.setNavigationBarColor({
  57 + frontColor: '#ffffff',
  58 + backgroundColor: color
  59 + })
53 60 }
54 61 }
55 62 </script>
... ...
1 1 <template>
2 2 <view class="mine-container" :style="{height: `${windowHeight}px`}">
3   - <!--顶部个人信息栏-->
4   - <view class="header-section">
5   - <view class="flex padding justify-between">
  3 + <!-- 个人信息卡片 -->
  4 + <view class="profile-card">
  5 + <view class="profile-bg" />
  6 + <view class="profile-header">
6 7 <view class="flex align-center">
7   - <view v-if="!avatar" class="cu-avatar xl round bg-white">
8   - <view class="iconfont icon-people text-gray icon"></view>
  8 + <view class="cu-avatar xl round avatar-initial">
  9 + <text class="avatar-text">{{ initialNameChar }}</text>
9 10 </view>
10   - <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
11   - </image>
12   - <view v-if="!name" @click="handleToLogin" class="login-tip">
13   - 点击登录
14   - </view>
15   - <view v-if="name" @click="handleToInfo" class="user-info">
16   - <view class="u_title">
17   - {{ name }}
18   - </view>
19   - <view @click="handleToInfo" class="flex align-center">
20   - <text>个人信息</text>
21   - <view class="iconfont icon-right"></view>
22   - </view>
  11 + <view class="profile-text" @click="name ? handleToInfo() : handleToLogin()">
  12 + <view class="name">{{ name || '点击登录' }}</view>
  13 + <view class="muted omit1">{{ deptPathsText }}</view>
  14 + <view class="muted omit1">{{ telephone }}</view>
23 15 </view>
24 16 </view>
25   -
26 17 </view>
27 18 </view>
28 19
29   - <view class="content-section">
30   - <view class="mine-actions grid col-4 text-center">
31   - <view class="action-item" @click="handleJiaoLiuQun">
32   - <view class="iconfont icon-friendfill text-pink icon"></view>
33   - <text class="text">交流群</text>
34   - </view>
35   - <view class="action-item" @click="handleBuilding">
36   - <view class="iconfont icon-service text-blue icon"></view>
37   - <text class="text">在线客服</text>
38   - </view>
39   - <view class="action-item" @click="handleJiaoLiuQun">
40   - <view class="iconfont icon-community text-mauve icon"></view>
41   - <text class="text">反馈社区</text>
42   - </view>
43   - <view class="action-item" @click="handleLink">
44   - <view class="iconfont icon-dianzan text-green icon"></view>
45   - <text class="text">点赞我们</text>
  20 + <!-- 菜单列表 -->
  21 + <view class="menu-list">
  22 + <view class="list-cell list-cell-arrow" @click="handleToPwd">
  23 + <view class="menu-item-box">
  24 + <view class="iconfont icon-password menu-icon"></view>
  25 + <view>修改密码</view>
46 26 </view>
47 27 </view>
48   -
49   - <view class="menu-list">
50   - <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
51   - <view class="menu-item-box">
52   - <view class="iconfont icon-user menu-icon"></view>
53   - <view>编辑资料</view>
54   - </view>
55   - </view>
56   - <view class="list-cell list-cell-arrow" @click="handleHelp">
57   - <view class="menu-item-box">
58   - <view class="iconfont icon-help menu-icon"></view>
59   - <view>常见问题</view>
60   - </view>
  28 + <!-- <view class="list-cell list-cell-arrow" @click="handleClearCache">
  29 + <view class="menu-item-box">
  30 + <view class="iconfont icon-clean menu-icon"></view>
  31 + <view>清除缓存</view>
61 32 </view>
62   - <view class="list-cell list-cell-arrow" @click="handleAbout">
63   - <view class="menu-item-box">
64   - <view class="iconfont icon-aixin menu-icon"></view>
65   - <view>关于我们</view>
66   - </view>
  33 + </view> -->
  34 + <view class="list-cell list-cell-arrow" @click="handleToSetting">
  35 + <view class="menu-item-box">
  36 + <view class="iconfont icon-setting menu-icon"></view>
  37 + <view>设置</view>
67 38 </view>
68   - <view class="list-cell list-cell-arrow" @click="handleToSetting">
69   - <view class="menu-item-box">
70   - <view class="iconfont icon-setting menu-icon"></view>
71   - <view>应用设置</view>
72   - </view>
  39 + </view>
  40 + <view class="list-cell list-cell-arrow" @click="handleAbout">
  41 + <view class="menu-item-box">
  42 + <view class="iconfont icon-aixin menu-icon"></view>
  43 + <view>关于我们</view>
73 44 </view>
74 45 </view>
75   -
76 46 </view>
77 47 <view>
78 48 <uni-popup ref="alertDialog" type="dialog">
... ... @@ -91,23 +61,56 @@
91 61 data() {
92 62 return {
93 63 globalConfig: getApp().globalData.config,
94   - name: this.$store.state.user.name,
95   - version: getApp().globalData.config.appInfo.version
  64 + name: '',
  65 + username: '',
  66 + version: getApp().globalData.config.appInfo.version,
  67 + deptPathsText: '',
  68 + telephone: '',
  69 + initialNameChar: ''
96 70 }
97 71 },
98   -
  72 + onShow() {
  73 + // this.$store.dispatch('GetInfo');
  74 + const color = getApp().globalData.config.themeColor
  75 + uni.setNavigationBarColor({
  76 + frontColor: '#ffffff',
  77 + backgroundColor: color
  78 + })
  79 + },
  80 +
99 81 computed: {
100   -
101   - avatar() {
102   - return this.$store.state.user.avatar
  82 +
  83 + initialNameChar() {
  84 + const n = (this.username || '').trim()
  85 + return n ? n.charAt(0) : '登'
103 86 },
104 87 windowHeight() {
105 88 return uni.getSystemInfoSync().windowHeight - 50
106 89 }
107 90 },
  91 + created() {
  92 + console.log('this.$store.state.user', this.$store.state.user)
  93 + this.name = this.$store.state.user.name || '';
  94 + this.username = this.$store.state.user.username || '',
  95 + this.deptPathsText =this.$store.state.user.deptPaths.length ? this.$store.state.user.deptPaths.join(',') : '',
  96 + this.telephone = this.$store.state.user.telephone
  97 + const _username = (this.username || '').trim()
  98 + this.initialNameChar = _username ? _username.charAt(0) : '登'
  99 + },
108 100 methods: {
109   -
110   -
  101 + handleToPwd() {
  102 + this.$tab.navigateTo('/pages/mine/pwd/index')
  103 + },
  104 + handleClearCache() {
  105 + try {
  106 + storage.clean()
  107 + uni.clearStorage()
  108 + this.$modal.showToast('缓存已清除')
  109 + } catch (e) {
  110 + this.$modal.showToast('清除失败')
  111 + }
  112 + },
  113 +
111 114 handleToInfo() {
112 115 this.$tab.navigateTo('/pages/mine/info/index')
113 116 },
... ... @@ -132,7 +135,7 @@
132 135 },
133 136 handleHelp() {
134 137 this.$tab.navigateTo('/pages/mine/help/index')
135   -
  138 +
136 139 },
137 140 handleAbout() {
138 141 this.$tab.navigateTo('/pages/mine/about/index')
... ... @@ -153,65 +156,71 @@
153 156 }
154 157 </script>
155 158
156   -<style lang="scss">
  159 +<style scoped lang="scss">
157 160 page {
158   - background-color: #f5f6f7;
  161 + background: #F2F3FF;
159 162 }
160 163
161 164 .mine-container {
162 165 width: 100%;
163 166 height: 100%;
164   -
165   -
166   - .header-section {
167   - padding: 15px 15px 45px 15px;
168   - background-color: #3c96f3;
169   - color: white;
170   -
171   - .login-tip {
172   - font-size: 18px;
173   - margin-left: 10px;
  167 + .profile-card {
  168 + position: relative;
  169 + height: 284rpx;
  170 + .profile-bg {
  171 + position: absolute;
  172 + top: 0;
  173 + left: 0;
  174 + right: 0;
  175 + z-index: 1;
  176 + background: $theme-primary;
  177 + height: 134rpx;
  178 + }
  179 + .profile-header {
  180 + position: absolute;
  181 + top: 50rpx;
  182 + left: 50%;
  183 + transform: translateX(-50%);
  184 + z-index: 2;
  185 + width: 686rpx;
  186 + padding: 36rpx 36rpx 46rpx;
  187 + border-radius: 16rpx;
  188 + background: linear-gradient( 358deg, #FFFFFF 0%, #CBE2FD 100%);
174 189 }
175 190
176 191 .cu-avatar {
177   - border: 2px solid #eaeaea;
178   -
179   - .icon {
180   - font-size: 40px;
  192 + margin-right: 26rpx;
  193 + &.avatar-initial {
  194 + background-color: #fbecc0;
  195 + display: flex;
  196 + align-items: center;
  197 + justify-content: center;
  198 + }
  199 + .avatar-text {
  200 + color: #666;
  201 + font-weight: 600;
  202 + font-size: 36rpx;
181 203 }
182 204 }
183 205
184   - .user-info {
185   - margin-left: 15px;
186   -
187   - .u_title {
188   - font-size: 14px;
189   - line-height: 30px;
190   - }
  206 + .profile-text {
  207 + display: flex;
  208 + flex-direction: column;
  209 + gap: 4rpx;
  210 + .name { font-size: 18px; font-weight: 600; color: rgba(0,0,0,0.9); }
  211 + .muted { font-size: 12px; color: rgba(0,0,0,0.5); }
191 212 }
192 213 }
193   -
194   - .content-section {
195   - position: relative;
196   - top: -50px;
197   -
198   - .mine-actions {
199   - margin: 15px 15px;
200   - padding: 20px 0px;
201   - border-radius: 8px;
202   - background-color: white;
203   -
204   - .action-item {
205   - .icon {
206   - font-size: 28px;
207   - }
208   -
209   - .text {
210   - display: block;
211   - font-size: 13px;
212   - margin: 8px 0px;
213   - }
214   - }
  214 + .menu-list {
  215 + margin: 0 32rpx;
  216 + .list-cell {
  217 + padding: 32rpx 40rpx;
  218 + color: rgba(0,0,0,0.9);
  219 + font-size: 32rpx;
  220 + }
  221 + .menu-icon {
  222 + color: rgba(0,0,0,0.9);
  223 + font-size: 40rpx;
215 224 }
216 225 }
217 226 }
... ...
  1 +<template>
  2 + <view class="mine-container" :style="{height: `${windowHeight}px`}">
  3 + <!--顶部个人信息栏-->
  4 + <view class="header-section">
  5 + <view class="flex padding justify-between">
  6 + <view class="flex align-center">
  7 + <view v-if="!avatar" class="cu-avatar xl round bg-white">
  8 + <view class="iconfont icon-people text-gray icon"></view>
  9 + </view>
  10 + <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  11 + </image>
  12 + <view v-if="!name" @click="handleToLogin" class="login-tip">
  13 + 点击登录
  14 + </view>
  15 + <view v-if="name" @click="handleToInfo" class="user-info">
  16 + <view class="u_title">
  17 + {{ name }}
  18 + </view>
  19 + <view @click="handleToInfo" class="flex align-center">
  20 + <text>个人信息</text>
  21 + <view class="iconfont icon-right"></view>
  22 + </view>
  23 + </view>
  24 + </view>
  25 +
  26 + </view>
  27 + </view>
  28 +
  29 + <view class="content-section">
  30 + <view class="mine-actions grid col-4 text-center">
  31 + <view class="action-item" @click="handleJiaoLiuQun">
  32 + <view class="iconfont icon-friendfill text-pink icon"></view>
  33 + <text class="text">交流群</text>
  34 + </view>
  35 + <view class="action-item" @click="handleBuilding">
  36 + <view class="iconfont icon-service text-blue icon"></view>
  37 + <text class="text">在线客服</text>
  38 + </view>
  39 + <view class="action-item" @click="handleJiaoLiuQun">
  40 + <view class="iconfont icon-community text-mauve icon"></view>
  41 + <text class="text">反馈社区</text>
  42 + </view>
  43 + <view class="action-item" @click="handleLink">
  44 + <view class="iconfont icon-dianzan text-green icon"></view>
  45 + <text class="text">点赞我们</text>
  46 + </view>
  47 + </view>
  48 +
  49 + <view class="menu-list">
  50 + <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
  51 + <view class="menu-item-box">
  52 + <view class="iconfont icon-user menu-icon"></view>
  53 + <view>编辑资料</view>
  54 + </view>
  55 + </view>
  56 + <view class="list-cell list-cell-arrow" @click="handleHelp">
  57 + <view class="menu-item-box">
  58 + <view class="iconfont icon-help menu-icon"></view>
  59 + <view>常见问题</view>
  60 + </view>
  61 + </view>
  62 + <view class="list-cell list-cell-arrow" @click="handleAbout">
  63 + <view class="menu-item-box">
  64 + <view class="iconfont icon-aixin menu-icon"></view>
  65 + <view>关于我们</view>
  66 + </view>
  67 + </view>
  68 + <view class="list-cell list-cell-arrow" @click="handleToSetting">
  69 + <view class="menu-item-box">
  70 + <view class="iconfont icon-setting menu-icon"></view>
  71 + <view>应用设置</view>
  72 + </view>
  73 + </view>
  74 + </view>
  75 +
  76 + </view>
  77 + <view>
  78 + <uni-popup ref="alertDialog" type="dialog">
  79 + <uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="公众号" content="公众号">
  80 + <view><image src="../../static/images/gzh.jpg" style="width: 250px;height: 250px;"></image></view>
  81 + </uni-popup-dialog>
  82 + </uni-popup>
  83 + </view>
  84 + </view>
  85 +</template>
  86 +
  87 +<script>
  88 + import storage from '@/utils/storage'
  89 +
  90 + export default {
  91 + data() {
  92 + return {
  93 + globalConfig: getApp().globalData.config,
  94 + name: this.$store.state.user.name,
  95 + version: getApp().globalData.config.appInfo.version
  96 + }
  97 + },
  98 +
  99 + computed: {
  100 +
  101 + avatar() {
  102 + return this.$store.state.user.avatar
  103 + },
  104 + windowHeight() {
  105 + return uni.getSystemInfoSync().windowHeight - 50
  106 + }
  107 + },
  108 + methods: {
  109 +
  110 +
  111 + handleToInfo() {
  112 + this.$tab.navigateTo('/pages/mine/info/index')
  113 + },
  114 + handleToEditInfo() {
  115 + this.$tab.navigateTo('/pages/mine/info/edit')
  116 + },
  117 + handleToSetting() {
  118 + this.$tab.navigateTo('/pages/mine/setting/index')
  119 + },
  120 + handleToLogin() {
  121 + this.$tab.reLaunch('/pages/login')
  122 + },
  123 + handleToAvatar() {
  124 + this.$tab.navigateTo('/pages/mine/avatar/index')
  125 + },
  126 + handleLogout() {
  127 + this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  128 + this.$store.dispatch('LogOut').then(() => {
  129 + this.$tab.reLaunch('/pages/index')
  130 + })
  131 + })
  132 + },
  133 + handleHelp() {
  134 + this.$tab.navigateTo('/pages/mine/help/index')
  135 +
  136 + },
  137 + handleAbout() {
  138 + this.$tab.navigateTo('/pages/mine/about/index')
  139 + },
  140 + handleJiaoLiuQun() {
  141 + this.$refs.alertDialog.open('center');
  142 + },
  143 + handleBuilding() {
  144 + this.$modal.showToast('添加CDERP客服 QQ:3783722918')
  145 + },
  146 + handleLink() {
  147 + // let site = this.globalConfig.appInfo.agreements[2]
  148 + // this.$tab.navigateTo('/pages/common/webview/index?title='+site.title+'&url='+site.url)
  149 + this.$refs.alertDialog.open('center');
  150 + }
  151 +
  152 + }
  153 + }
  154 +</script>
  155 +
  156 +<style lang="scss">
  157 + page {
  158 + background-color: #f5f6f7;
  159 + }
  160 +
  161 + .mine-container {
  162 + width: 100%;
  163 + height: 100%;
  164 +
  165 +
  166 + .header-section {
  167 + padding: 15px 15px 45px 15px;
  168 + background-color: #3c96f3;
  169 + color: white;
  170 +
  171 + .login-tip {
  172 + font-size: 18px;
  173 + margin-left: 10px;
  174 + }
  175 +
  176 + .cu-avatar {
  177 + border: 2px solid #eaeaea;
  178 +
  179 + .icon {
  180 + font-size: 40px;
  181 + }
  182 + }
  183 +
  184 + .user-info {
  185 + margin-left: 15px;
  186 +
  187 + .u_title {
  188 + font-size: 14px;
  189 + line-height: 30px;
  190 + }
  191 + }
  192 + }
  193 +
  194 + .content-section {
  195 + position: relative;
  196 + top: -50px;
  197 +
  198 + .mine-actions {
  199 + margin: 15px 15px;
  200 + padding: 20px 0px;
  201 + border-radius: 8px;
  202 + background-color: white;
  203 +
  204 + .action-item {
  205 + .icon {
  206 + font-size: 28px;
  207 + }
  208 +
  209 + .text {
  210 + display: block;
  211 + font-size: 13px;
  212 + margin: 8px 0px;
  213 + }
  214 + }
  215 + }
  216 + }
  217 + }
  218 +</style>
... ...
... ... @@ -4,8 +4,8 @@
4 4 <uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称" :rightText="user.username" />
5 5 <uni-list-item showExtraIcon="true" :extraIcon="{type: 'phone-filled'}" title="手机号码" :rightText="user.telephone" />
6 6 <uni-list-item showExtraIcon="true" :extraIcon="{type: 'email-filled'}" title="邮箱" :rightText="user.email" />
7   - <!-- <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="岗位" :rightText="postGroup" />
8   - <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="角色" :rightText="roleGroup" />-->
  7 + <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="岗位" :rightText="postGroup" />
  8 + <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="角色" :rightText="roleGroup" />
9 9 <!-- <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="创建日期" :rightText="user.createTime" /> -->
10 10 </uni-list>
11 11 </view>
... ... @@ -22,6 +22,13 @@
22 22 // postGroup: ""
23 23 }
24 24 },
  25 + onShow() {
  26 + const color = getApp().globalData.config.themeColor
  27 + uni.setNavigationBarColor({
  28 + frontColor: '#ffffff',
  29 + backgroundColor: color
  30 + })
  31 + },
25 32 onLoad() {
26 33 this.getUser()
27 34 },
... ...
... ... @@ -58,16 +58,37 @@
58 58 }
59 59 }
60 60 },
  61 + onShow() {
  62 + const color = getApp().globalData.config.themeColor
  63 + uni.setNavigationBarColor({
  64 + frontColor: '#ffffff',
  65 + backgroundColor: color
  66 + })
  67 + },
61 68 onReady() {
62 69 this.$refs.form.setRules(this.rules)
63 70 },
64 71 methods: {
65 72 submit() {
66   - this.$refs.form.validate().then(res => {
67   - updateUserPwd(this.user.oldPassword, this.user.newPassword,this.user.confirmPassword).then(response => {
68   - this.$modal.msgSuccess("修改成功")
  73 + this.$modal
  74 + .confirm('是否确认修改密码?修改密码后需要重新登录。')
  75 + .then(() => {
  76 + this.$refs.form.validate().then(() => {
  77 + updateUserPwd(
  78 + this.user.oldPassword,
  79 + this.user.newPassword,
  80 + this.user.confirmPassword
  81 + ).then(() => {
  82 + this.$modal.msgSuccess('修改成功')
  83 + // 修改密码成功后,退出登录并跳转登录页
  84 + this.$store
  85 + .dispatch('LogOut')
  86 + .finally(() => {
  87 + try { this.$tab.reLaunch('/pages/login') } catch(e) { uni.reLaunch({ url: '/pages/login' }) }
  88 + })
  89 + })
  90 + })
69 91 })
70   - })
71 92 }
72 93 }
73 94 }
... ...
1 1 <template>
2 2 <view class="setting-container" :style="{height: `${windowHeight}px`}">
3   - <view class="menu-list">
  3 + <!-- <view class="menu-list">
4 4 <view class="list-cell list-cell-arrow" @click="handleToPwd">
5 5 <view class="menu-item-box">
6 6 <view class="iconfont icon-password menu-icon"></view>
... ... @@ -19,7 +19,7 @@
19 19 <view>清理缓存</view>
20 20 </view>
21 21 </view>
22   - </view>
  22 + </view> -->
23 23 <view class="cu-list menu">
24 24 <view class="cu-item item-box">
25 25 <view class="content text-center" @click="handleLogout">
... ... @@ -37,6 +37,13 @@
37 37 windowHeight: uni.getSystemInfoSync().windowHeight
38 38 }
39 39 },
  40 + onShow() {
  41 + const color = getApp().globalData.config.themeColor
  42 + uni.setNavigationBarColor({
  43 + frontColor: '#ffffff',
  44 + backgroundColor: color
  45 + })
  46 + },
40 47 methods: {
41 48 handleToPwd() {
42 49 this.$tab.navigateTo('/pages/mine/pwd/index')
... ...
... ... @@ -11,4 +11,141 @@
11 11 box-shadow: inset 0px 1px 0px 0px #E7E7E7;
12 12 border-top: none;
13 13 }
14   -/* #endif */
\ No newline at end of file
  14 +/* #endif */
  15 +
  16 +/* 页面原生导航标题字号:H5 覆盖为 18px */
  17 +/* #ifdef H5 */
  18 +.uni-page-head .uni-page-head-title {
  19 + font-size: 18px !important;
  20 +}
  21 +/* #endif */
  22 +
  23 +/* 组件 uni-nav-bar 标题字号统一为 18px */
  24 +.uni-nav-bar-text {
  25 + font-size: 18px !important;
  26 +}
  27 +
  28 +/* 全端覆盖 primary 按钮主色(内置 <button type="primary">) */
  29 +button[type="primary"],
  30 +.uni-button[type="primary"],
  31 +button.uni-button--primary,
  32 +.uni-btn-primary {
  33 + background-color: $theme-primary !important;
  34 + border-color: $theme-primary !important;
  35 + color: #ffffff !important;
  36 +}
  37 +
  38 +/* plain 模式(仅描边) */
  39 +button[type="primary"][plain],
  40 +.uni-button[type="primary"][plain] {
  41 + background-color: transparent !important;
  42 + color: $theme-primary !important;
  43 + border-color: $theme-primary !important;
  44 +}
  45 +
  46 +/* 点击态 */
  47 +button[type="primary"]:active {
  48 + background-color: $theme-primary-active !important;
  49 +}
  50 +
  51 +/* uni-badge 主色 */
  52 +.uni-badge--primary,
  53 +.uni-badge-primary {
  54 + background-color: $theme-primary !important;
  55 + border-color: $theme-primary !important;
  56 +}
  57 +
  58 +/* uni-tag 主色(默认填充与描边两种) */
  59 +.uni-tag--primary,
  60 +.uni-tag-primary {
  61 + background-color: $theme-primary !important;
  62 + border-color: $theme-primary !important;
  63 + color: #fff !important;
  64 +}
  65 +.uni-tag--primary.is-plain,
  66 +.uni-tag-primary.is-plain {
  67 + background-color: $theme-primary-plain-bg !important;
  68 + border-color: $theme-primary-plain-border !important;
  69 + color: $theme-primary !important;
  70 +}
  71 +
  72 +/* uni-link 主色 */
  73 +.uni-link--primary,
  74 +.uni-link-primary,
  75 +.uni-link[type="primary"] {
  76 + color: $theme-primary !important;
  77 +}
  78 +
  79 +/* uni-notice-bar 主色(如支持)*/
  80 +.uni-noticebar--primary,
  81 +.uni-noticebar-primary {
  82 + background-color: $theme-primary-plain-bg !important;
  83 + color: $theme-primary !important;
  84 +}
  85 +
  86 +/* uni-data-checkbox 主色覆盖:default/button/tag/list 模式 */
  87 +.uni-data-checklist {
  88 + .checklist-group {
  89 + .checklist-box.is-checked {
  90 + /* default & list 多选框 */
  91 + .checkbox__inner {
  92 + border-color: $theme-primary !important;
  93 + background-color: $theme-primary !important;
  94 + }
  95 + .checkbox__inner .checkbox__inner-icon {
  96 + opacity: 1 !important;
  97 + transform: rotate(45deg) !important;
  98 + }
  99 + /* default & list 单选 */
  100 + .radio__inner {
  101 + border-color: $theme-primary !important;
  102 + }
  103 + .radio__inner .radio__inner-icon {
  104 + opacity: 1 !important;
  105 + background-color: $theme-primary !important;
  106 + }
  107 + .checklist-text {
  108 + color: $theme-primary !important;
  109 + }
  110 + /* list 模式右侧勾 */
  111 + .checklist-content .checkobx__list {
  112 + opacity: 1 !important;
  113 + border-color: $theme-primary !important;
  114 + }
  115 + }
  116 + /* button 模式选中边框与文本 */
  117 + .checklist-box.is--button.is-checked {
  118 + border-color: $theme-primary !important;
  119 + .checklist-text { color: $theme-primary !important; }
  120 + }
  121 + /* tag 模式选中填充与文本色 */
  122 + .checklist-box.is--tag.is-checked {
  123 + background-color: $theme-primary !important;
  124 + border-color: $theme-primary !important;
  125 + .checklist-text { color: #fff !important; }
  126 + }
  127 + }
  128 +}
  129 +
  130 +/* uni-easyinput 图标颜色全局主题化(prefix/suffix/clear/eye 等) */
  131 +.uni-easyinput .content-clear-icon {
  132 + color: $theme-primary !important;
  133 +}
  134 +/* 表单错误态优先保持红色 */
  135 +.uni-easyinput.uni-easyinput-error .content-clear-icon {
  136 + color: #dd524d !important;
  137 +}
  138 +/* 禁用态灰色 */
  139 +.uni-easyinput .is-disabled .content-clear-icon {
  140 + color: #d5d5d5 !important;
  141 +}
  142 +
  143 +/* 全局覆盖:uni-easyinput 聚焦高亮使用主题色(所有表单输入统一) */
  144 +.uni-easyinput .uni-easyinput__content.is-focused {
  145 + border-color: $theme-primary !important;
  146 +}
  147 +.uni-easyinput .uni-easyinput__content.is-focused .uni-easyinput__content-input,
  148 +.uni-easyinput .uni-easyinput__content.is-focused .uni-easyinput__content-textarea {
  149 + /* H5 支持光标颜色;小程序端不影响 */
  150 + caret-color: $theme-primary;
  151 +}
\ No newline at end of file
... ...
1 1 const getters = {
2 2 token: state => state.user.token,
3   - avatar: state => state.user.avatar,
4 3 name: state => state.user.name,
5 4 roles: state => state.user.roles,
6   - permissions: state => state.user.permissions
  5 + permissions: state => state.user.permissions,
  6 + code: state => state.user.code,
  7 + deptPaths: state => state.user.deptPaths,
  8 + id: state => state.user.id,
  9 + username: state => state.user.username,
  10 + roleCodes: state => state.user.roleCodes,
  11 + telephone: state => state.user.telephone
7 12 }
8 13 export default getters
... ...
... ... @@ -10,9 +10,14 @@ const user = {
10 10 state: {
11 11 token: getToken(),
12 12 name: storage.get(constant.name),
13   - avatar: storage.get(constant.avatar),
14 13 roles: storage.get(constant.roles),
15   - permissions: storage.get(constant.permissions)
  14 + permissions: storage.get(constant.permissions),
  15 + code: storage.get(constant.code),
  16 + deptPaths: storage.get(constant.deptPaths),
  17 + id: storage.get(constant.id),
  18 + username: storage.get(constant.username),
  19 + roleCodes: storage.get(constant.roleCodes),
  20 + telephone: storage.get(constant.telephone),
16 21 },
17 22
18 23 mutations: {
... ... @@ -23,10 +28,6 @@ const user = {
23 28 state.name = name
24 29 storage.set(constant.name, name)
25 30 },
26   - SET_AVATAR: (state, avatar) => {
27   - state.avatar = avatar
28   - storage.set(constant.avatar, avatar)
29   - },
30 31 SET_ROLES: (state, roles) => {
31 32 state.roles = roles
32 33 storage.set(constant.roles, roles)
... ... @@ -34,12 +35,36 @@ const user = {
34 35 SET_PERMISSIONS: (state, permissions) => {
35 36 state.permissions = permissions
36 37 storage.set(constant.permissions, permissions)
  38 + },
  39 + SET_CODE: (state, code) => {
  40 + state.code = code
  41 + storage.set(constant.code, code)
  42 + },
  43 + SET_DEPT_PATHS: (state, deptPaths) => {
  44 + state.deptPaths = deptPaths
  45 + storage.set(constant.deptPaths, deptPaths)
  46 + },
  47 + SET_ID: (state, id) => {
  48 + state.id = id
  49 + storage.set(constant.id, id)
  50 + },
  51 + SET_USERNAME: (state, username) => {
  52 + state.username = username
  53 + storage.set(constant.username, username)
  54 + },
  55 + SET_ROLE_CODES: (state, roleCodes) => {
  56 + state.roleCodes = roleCodes
  57 + storage.set(constant.roleCodes, roleCodes)
  58 + },
  59 + SET_TELEPHONE: (state, telephone) => {
  60 + state.telephone = telephone
  61 + storage.set(constant.telephone, telephone)
37 62 }
38 63 },
39 64
40 65 actions: {
41 66 // 登录
42   - Login({ commit }, userInfo) {
  67 + Login({ commit, dispatch }, userInfo) {
43 68 const username = userInfo.username.trim()
44 69 const password = userInfo.password.trim()
45 70 const captcha = userInfo.captcha.trim()
... ... @@ -48,24 +73,30 @@ const user = {
48 73 return new Promise((resolve, reject) => {
49 74
50 75 login(username, password, captcha, sn).then(res => {
51   - console.log("结果:"+res.data.token)
  76 + console.log('login_res', res)
52 77 setToken(res.data.token)
53 78 commit('SET_TOKEN', res.data.token)
54 79
55   - const user = res.data.user
56   - const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
57   - const username = (user == null || user.name == "" || user.name == null) ? "" : user.name
58   - if (res.data.roles && res.data.roles.length > 0) {
59   - commit('SET_ROLES', res.data.roles)
60   - // commit('SET_PERMISSIONS', res.permissions)
61   - } else {
62   - commit('SET_ROLES', ['ROLE_DEFAULT'])
63   - }
64   - commit('SET_NAME', username)
65   - commit('SET_AVATAR', avatar)
66   -
67   -
68   - resolve()
  80 + const name = res.data.user.name || '';
  81 + commit('SET_NAME', name)
  82 +
  83 + if (res.data.roles && res.data.roles.length > 0) {
  84 + commit('SET_ROLES', res.data.roles)
  85 + } else {
  86 + commit('SET_ROLES', ['ROLE_DEFAULT'])
  87 + }
  88 +
  89 + // 登录后拉取最新的用户信息,统一存入 store
  90 + dispatch('GetInfo')
  91 + .then(() => resolve())
  92 + .catch(() => {
  93 + // GetInfo 失败(token 异常或过期),执行登出并回到登录页
  94 + dispatch('LogOut')
  95 + .finally(() => {
  96 + try { uni.reLaunch({ url: '/pages/login' }) } catch(e) {}
  97 + resolve()
  98 + })
  99 + })
69 100 }).catch(error => {
70 101 reject(error)
71 102 })
... ... @@ -76,17 +107,16 @@ const user = {
76 107 GetInfo({ commit, state }) {
77 108 return new Promise((resolve, reject) => {
78 109 getInfo().then(res => {
79   - const user = res.user
80   - const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
81   - const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
82   - if (res.roles && res.roles.length > 0) {
83   - commit('SET_ROLES', res.roles)
84   - commit('SET_PERMISSIONS', res.permissions)
85   - } else {
86   - commit('SET_ROLES', ['ROLE_DEFAULT'])
87   - }
88   - commit('SET_NAME', username)
89   - commit('SET_AVATAR', avatar)
  110 + const _data = res.data || {};
  111 + console.log('center/info__data', _data)
  112 + // 写入基础信息
  113 + commit('SET_NAME', _data.name)
  114 + commit('SET_ID', _data.id || '')
  115 + commit('SET_USERNAME', _data.username || '')
  116 + commit('SET_CODE', _data.code || '')
  117 + commit('SET_TELEPHONE', _data.telephone || '')
  118 + commit('SET_ROLE_CODES', _data.roleCodes || [])
  119 + commit('SET_DEPT_PATHS', _data.deptPaths || [])
90 120 resolve(res)
91 121 }).catch(error => {
92 122 reject(error)
... ... @@ -101,6 +131,13 @@ const user = {
101 131 commit('SET_TOKEN', '')
102 132 commit('SET_ROLES', [])
103 133 commit('SET_PERMISSIONS', [])
  134 + commit('SET_NAME', '')
  135 + commit('SET_ID', '')
  136 + commit('SET_USERNAME', '')
  137 + commit('SET_CODE', '')
  138 + commit('SET_TELEPHONE', '')
  139 + commit('SET_ROLE_CODES', [])
  140 + commit('SET_DEPT_PATHS', [])
104 141 removeToken()
105 142 storage.clean()
106 143 resolve()
... ...
... ... @@ -2,8 +2,21 @@
2 2 * uni-app内置的常用样式变量
3 3 */
4 4
5   -/* 行为相关颜色 */
6   -$uni-color-primary: #007aff;
  5 +/* 行为相关颜色(主题色集中定义,方便统一替换) */
  6 +// 主主题色,可一处修改全局生效
  7 +$theme-primary: #3d48a3;
  8 +// 派生色:悬停/按下/禁用/浅色背景等
  9 +$theme-primary-hover: darken($theme-primary, 6%);
  10 +$theme-primary-active: darken($theme-primary, 10%);
  11 +$theme-primary-disabled: mix(#ffffff, $theme-primary, 60%);
  12 +$theme-primary-plain-bg: mix(#ffffff, $theme-primary, 92%);
  13 +$theme-primary-plain-border: mix(#ffffff, $theme-primary, 30%);
  14 +// 半透明主题色(0.5 不透明度,用于禁用态或蒙层)
  15 +$theme-primary-alpha-50: rgba($theme-primary, 0.5);
  16 +
  17 +/* 行为相关颜色(uni-ui 使用)*/
  18 +$uni-color-primary: $theme-primary;
  19 +$uni-primary: $theme-primary;
7 20 $uni-color-success: #4cd964;
8 21 $uni-color-warning: #f0ad4e;
9 22 $uni-color-error: #dd524d;
... ... @@ -57,8 +70,15 @@ $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
57 70
58 71 /* 文章场景相关 */
59 72 $uni-color-title: #2C405A; // 文章标题颜色
60   -$uni-font-size-title:20px;
  73 +$uni-font-size-title:18px;
61 74 $uni-color-subtitle: #555555; // 二级标题颜色
62 75 $uni-font-size-subtitle:26px;
63 76 $uni-color-paragraph: #3F536E; // 文章段落颜色
64   -$uni-font-size-paragraph:15px;
\ No newline at end of file
  77 +$uni-font-size-paragraph:15px;
  78 +
  79 +/* 全局标题默认字号覆盖:让 uni-title 的 h2 默认为 18px */
  80 +$uni-headings: (
  81 + 'h2': (
  82 + size: 18px
  83 + )
  84 +);
\ No newline at end of file
... ...
1 1 const constant = {
2   - avatar: 'vuex_avatar',
3 2 name: 'vuex_name',
4 3 roles: 'vuex_roles',
5   - permissions: 'vuex_permissions'
  4 + permissions: 'vuex_permissions',
  5 + code: 'vuex_code',
  6 + deptPaths: 'vuex_deptPaths',
  7 + id: 'vuex_id',
  8 + username: 'vuex_username',
  9 + roleCodes: 'vuex_roleCodes',
  10 + telephone: 'vuex_telephone'
6 11 }
7 12
8 13 export default constant
... ...
... ... @@ -4,7 +4,19 @@ import constant from './constant'
4 4 let storageKey = 'storage_data'
5 5
6 6 // 存储节点变量名
7   -let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions]
  7 +let storageNodeKeys = [
  8 + constant.avatar,
  9 + constant.name,
  10 + constant.roles,
  11 + constant.permissions,
  12 + // user profile fields persisted by GetInfo
  13 + constant.code,
  14 + constant.deptPaths,
  15 + constant.id,
  16 + constant.username,
  17 + constant.roleCodes,
  18 + constant.telephone
  19 +]
8 20
9 21 const storage = {
10 22 set: function(key, value) {
... ... @@ -17,7 +29,17 @@ const storage = {
17 29 },
18 30 get: function(key) {
19 31 let storageData = uni.getStorageSync(storageKey) || {}
20   - return storageData[key] || ""
  32 + // Provide sensible defaults for array-type keys
  33 + const arrayDefaults = [
  34 + constant.roles,
  35 + constant.permissions,
  36 + constant.roleCodes,
  37 + constant.deptPaths
  38 + ]
  39 + if (storageData[key] === undefined || storageData[key] === null) {
  40 + return arrayDefaults.includes(key) ? [] : ""
  41 + }
  42 + return storageData[key]
21 43 },
22 44 remove: function(key) {
23 45 let storageData = uni.getStorageSync(storageKey) || {}
... ...