Commit 91e34c7f8c02ff7865c742cdac9684013e89e5bc

Authored by fengtao
1 parent 422092f9

pref:优化mp端登录背景,名称

@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 "appid": "wx99c411dc3c5571ef", 81 "appid": "wx99c411dc3c5571ef",
82 "setting": { 82 "setting": {
83 "urlCheck": false, 83 "urlCheck": false,
84 - "minified": false, 84 + "minified": true,
85 "es6": true, 85 "es6": true,
86 "postcss": true 86 "postcss": true
87 }, 87 },
@@ -91,9 +91,7 @@ @@ -91,9 +91,7 @@
91 "desc": "如果没有位置信息则使用当前定位" 91 "desc": "如果没有位置信息则使用当前定位"
92 } 92 }
93 }, 93 },
94 - "requiredPrivateInfos": [  
95 - "getLocation"  
96 - ], 94 + "requiredPrivateInfos": ["getLocation"],
97 "lazyCodeLoading": "requiredComponents", 95 "lazyCodeLoading": "requiredComponents",
98 //开启分包优化 96 //开启分包优化
99 "optimization": { 97 "optimization": {
@@ -8,12 +8,12 @@ @@ -8,12 +8,12 @@
8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> 8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
9 <block v-if="userInfo.isToken || userInfo.isThirdLogin"> 9 <block v-if="userInfo.isToken || userInfo.isThirdLogin">
10 <view @click.top="openPersonalInfo" class="u-m-r-20"> 10 <view @click.top="openPersonalInfo" class="u-m-r-20">
11 - <image class="avatar" mode="aspectFill" :src="plateInfo.logo || userInfo.avatar || thirdObj.avatarUrl||'../../static/logo.png'"></image> 11 + <image class="avatar" mode="aspectFill" :src="mpOwnConfig.logo || userInfo.avatar || thirdObj.avatarUrl || '../../static/logo.png'"></image>
12 </view> 12 </view>
13 <view class="u-flex-1" @click.top="openPersonalInfo"> 13 <view class="u-flex-1" @click.top="openPersonalInfo">
14 <view class="nickName u-flex"> 14 <view class="nickName u-flex">
15 - <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName">  
16 - <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> 15 + <view class="name u-m-r-10" v-if="mpOwnConfig.name || userInfo.realName || userInfo.nickName">
  16 + <text style="#FFFFFF;font-size: 18px;">{{ mpOwnConfig.name || userInfo.realName || userInfo.nickName }}</text>
17 </view> 17 </view>
18 <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> 18 <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view>
19 </view> 19 </view>
@@ -154,9 +154,13 @@ export default { @@ -154,9 +154,13 @@ export default {
154 appUserSecret: '' 154 appUserSecret: ''
155 }, 155 },
156 thirdObj: {}, 156 thirdObj: {},
157 - getOpenId: '' 157 + getOpenId: '',
  158 + mpOwnConfig: {}
158 }; 159 };
159 }, 160 },
  161 + mounted() {
  162 + this.getPlateForm();
  163 + },
160 onLoad(e) { 164 onLoad(e) {
161 // 隐藏原生的tabbar 165 // 隐藏原生的tabbar
162 uni.hideTabBar(); 166 uni.hideTabBar();
@@ -171,6 +175,18 @@ export default { @@ -171,6 +175,18 @@ export default {
171 ...mapState(['userInfo', 'plateInfo']) 175 ...mapState(['userInfo', 'plateInfo'])
172 }, 176 },
173 methods: { 177 methods: {
  178 + //获取平台定制信息
  179 + getPlateForm() {
  180 + uni.$u.http.get('/yt/app_design/get').then(res => {
  181 + if (res) {
  182 + this.mpOwnConfig = {
  183 + bg: res.background,
  184 + logo: res.logo,
  185 + name: res.name
  186 + };
  187 + }
  188 + });
  189 + },
174 handlePhoneFunc(e) { 190 handlePhoneFunc(e) {
175 //前三后四位显示 191 //前三后四位显示
176 const result = /^(\d{3})\d{4}(\d{4})$/; 192 const result = /^(\d{3})\d{4}(\d{4})$/;
@@ -268,7 +284,11 @@ export default { @@ -268,7 +284,11 @@ export default {
268 } 284 }
269 }) 285 })
270 .catch(e => { 286 .catch(e => {
271 - uni.$u.toast(e.data?.msg); 287 + let msg = e.data?.msg;
  288 + if (msg == undefined) {
  289 + msg = '';
  290 + }
  291 + uni.$u.toast(msg);
272 this.show = true; 292 this.show = true;
273 }); 293 });
274 } else { 294 } else {
@@ -330,7 +350,11 @@ export default { @@ -330,7 +350,11 @@ export default {
330 this.saveUserInfo(); 350 this.saveUserInfo();
331 }) 351 })
332 .catch(e => { 352 .catch(e => {
333 - uni.$u.toast(e.data?.msg); 353 + let msg = e.data?.msg;
  354 + if (msg == undefined) {
  355 + msg = '';
  356 + }
  357 + uni.$u.toast(msg);
334 this.show = true; 358 this.show = true;
335 }); 359 });
336 } 360 }
@@ -153,10 +153,11 @@ export default { @@ -153,10 +153,11 @@ export default {
153 }); 153 });
154 return; 154 return;
155 } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { 155 } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) {
156 - uni.showToast({  
157 - title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~',  
158 - icon: 'none',  
159 - duration: 3000 156 + //uni.showToast,字数过长,会造成手机上显示不完全,官方bug,采用uni.showModal
  157 + uni.showModal({
  158 + title: '提示',
  159 + content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~',
  160 + showCancel: false
160 }); 161 });
161 return; 162 return;
162 } 163 }
1 <template> 1 <template>
2 - <view class="login-page"> 2 + <view
  3 + class="login-page"
  4 + style="background-size: 750rpx 1400rpx; min-height: 100vh;"
  5 + :style="{ backgroundImage: 'url(' + (mpOwnConfig.bg !== undefined ? mpOwnConfig.bg : `${defaultLogo}`) + ')' }"
  6 + >
3 <!-- 公共组件-每个页面必须引入 --> 7 <!-- 公共组件-每个页面必须引入 -->
4 <public-module></public-module> 8 <public-module></public-module>
5 <view class="u-flex login-main"> 9 <view class="u-flex login-main">
6 <view class="content"> 10 <view class="content">
7 <view class="hello login-text-muted">您好,</view> 11 <view class="hello login-text-muted">您好,</view>
8 <!-- <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> --> 12 <!-- <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> -->
9 - <view style="width:587rpx" class="text-clip hello-welcome login-text-muted">欢迎来到{{ plateInfo.name !== undefined ? plateInfo.name : 'ThingsKit' }}!</view> 13 + <view style="width:587rpx" class="text-clip hello-welcome login-text-muted">欢迎来到{{ mpOwnConfig.name !== undefined ? mpOwnConfig.name : 'ThingsKit' }}!</view>
10 </view> 14 </view>
11 </view> 15 </view>
12 16
@@ -60,7 +64,9 @@ export default { @@ -60,7 +64,9 @@ export default {
60 }, 64 },
61 showPassword: true, 65 showPassword: true,
62 code: '', 66 code: '',
63 - openid: '' 67 + openid: '',
  68 + mpOwnConfig: {},
  69 + defaultLogo: '/static/login.png'
64 }; 70 };
65 }, 71 },
66 onLoad() { 72 onLoad() {
@@ -78,7 +84,22 @@ export default { @@ -78,7 +84,22 @@ export default {
78 computed: { 84 computed: {
79 ...mapState(['plateInfo']) 85 ...mapState(['plateInfo'])
80 }, 86 },
  87 + mounted() {
  88 + this.getPlateForm();
  89 + },
81 methods: { 90 methods: {
  91 + //获取平台定制信息
  92 + getPlateForm() {
  93 + uni.$u.http.get('/yt/app_design/get').then(res => {
  94 + if (res) {
  95 + this.mpOwnConfig = {
  96 + bg: res.background,
  97 + logo: res.logo,
  98 + name: res.name
  99 + };
  100 + }
  101 + });
  102 + },
82 ...mapMutations(['setUserInfo', 'setPlateInfo']), 103 ...mapMutations(['setUserInfo', 'setPlateInfo']),
83 ...mapActions(['updateBadgeTotal']), 104 ...mapActions(['updateBadgeTotal']),
84 //微信授权登录 105 //微信授权登录
@@ -4,7 +4,7 @@ export const state = { @@ -4,7 +4,7 @@ export const state = {
4 //存储告警徽标数据 4 //存储告警徽标数据
5 badgeInfo: 0, 5 badgeInfo: 0,
6 //平台信息 6 //平台信息
7 - plateInfo:{} 7 + plateInfo: {}
8 }; 8 };
9 export const mutations = { 9 export const mutations = {
10 //储存用户信息 10 //储存用户信息