Commit 91e34c7f8c02ff7865c742cdac9684013e89e5bc

Authored by fengtao
1 parent 422092f9

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

... ... @@ -81,7 +81,7 @@
81 81 "appid": "wx99c411dc3c5571ef",
82 82 "setting": {
83 83 "urlCheck": false,
84   - "minified": false,
  84 + "minified": true,
85 85 "es6": true,
86 86 "postcss": true
87 87 },
... ... @@ -91,9 +91,7 @@
91 91 "desc": "如果没有位置信息则使用当前定位"
92 92 }
93 93 },
94   - "requiredPrivateInfos": [
95   - "getLocation"
96   - ],
  94 + "requiredPrivateInfos": ["getLocation"],
97 95 "lazyCodeLoading": "requiredComponents",
98 96 //开启分包优化
99 97 "optimization": {
... ...
... ... @@ -8,12 +8,12 @@
8 8 <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
9 9 <block v-if="userInfo.isToken || userInfo.isThirdLogin">
10 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 12 </view>
13 13 <view class="u-flex-1" @click.top="openPersonalInfo">
14 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 17 </view>
18 18 <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view>
19 19 </view>
... ... @@ -154,9 +154,13 @@ export default {
154 154 appUserSecret: ''
155 155 },
156 156 thirdObj: {},
157   - getOpenId: ''
  157 + getOpenId: '',
  158 + mpOwnConfig: {}
158 159 };
159 160 },
  161 + mounted() {
  162 + this.getPlateForm();
  163 + },
160 164 onLoad(e) {
161 165 // 隐藏原生的tabbar
162 166 uni.hideTabBar();
... ... @@ -171,6 +175,18 @@ export default {
171 175 ...mapState(['userInfo', 'plateInfo'])
172 176 },
173 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 190 handlePhoneFunc(e) {
175 191 //前三后四位显示
176 192 const result = /^(\d{3})\d{4}(\d{4})$/;
... ... @@ -268,7 +284,11 @@ export default {
268 284 }
269 285 })
270 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 292 this.show = true;
273 293 });
274 294 } else {
... ... @@ -330,7 +350,11 @@ export default {
330 350 this.saveUserInfo();
331 351 })
332 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 358 this.show = true;
335 359 });
336 360 }
... ...
... ... @@ -153,10 +153,11 @@ export default {
153 153 });
154 154 return;
155 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 162 return;
162 163 }
... ...
1 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 8 <public-module></public-module>
5 9 <view class="u-flex login-main">
6 10 <view class="content">
7 11 <view class="hello login-text-muted">您好,</view>
8 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 14 </view>
11 15 </view>
12 16
... ... @@ -60,7 +64,9 @@ export default {
60 64 },
61 65 showPassword: true,
62 66 code: '',
63   - openid: ''
  67 + openid: '',
  68 + mpOwnConfig: {},
  69 + defaultLogo: '/static/login.png'
64 70 };
65 71 },
66 72 onLoad() {
... ... @@ -78,7 +84,22 @@ export default {
78 84 computed: {
79 85 ...mapState(['plateInfo'])
80 86 },
  87 + mounted() {
  88 + this.getPlateForm();
  89 + },
81 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 103 ...mapMutations(['setUserInfo', 'setPlateInfo']),
83 104 ...mapActions(['updateBadgeTotal']),
84 105 //微信授权登录
... ...
... ... @@ -4,7 +4,7 @@ export const state = {
4 4 //存储告警徽标数据
5 5 badgeInfo: 0,
6 6 //平台信息
7   - plateInfo:{}
  7 + plateInfo: {}
8 8 };
9 9 export const mutations = {
10 10 //储存用户信息
... ...