@@ -105,8 +105,8 @@
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </div>-->
|
||||
<u-picker v-model="showApiUrlPicker" mode="selector" :range="apiUrlList" range-key="label"
|
||||
@confirm="onApiUrlConfirm" @cancel="showApiUrlPicker = false"></u-picker>
|
||||
<u-select v-model="showApiUrlPicker" :list="apiUrlList" title="选择服务器"
|
||||
@confirm="onApiUrlConfirm" @cancel="showApiUrlPicker = false"></u-select>
|
||||
<!-- 版本信息显示 -->
|
||||
<view class="version-info">
|
||||
<text class="version-text">版本: {{ appVersion }}</text>
|
||||
@@ -125,6 +125,7 @@ import md5 from '@/common/md5.js';
|
||||
import manifest from '@/manifest.json';
|
||||
import { mapState } from 'vuex'
|
||||
import app_upgrade from '@/uni_modules/app-upgrade/js_sdk/index.js'
|
||||
import { applyLoginData, applyUserInformation } from '@/common/userSession.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -218,9 +219,8 @@ export default {
|
||||
},
|
||||
|
||||
onApiUrlConfirm(e) {
|
||||
console.log('e', JSON.stringify(e));
|
||||
const selectedValue = this.apiUrlList[e[0]].value;
|
||||
console.log('selectedValue', selectedValue)
|
||||
const selectedValue = e && e[0] && e[0].value;
|
||||
if (selectedValue == null) return;
|
||||
this.selectedApiUrl = selectedValue;
|
||||
this.showApiUrlPicker = false;
|
||||
|
||||
@@ -334,11 +334,10 @@ export default {
|
||||
this.$u.api.pdaLogin({
|
||||
'phone': this.login.username,
|
||||
'password': this.login.password,
|
||||
}).then((res) => {
|
||||
}).then(async (res) => {
|
||||
console.log('login res', res)
|
||||
var aLoginUserData = res;
|
||||
|
||||
//console.log('--aLoginUserData->>' + JSON.stringify(aLoginUserData));
|
||||
// 只在开发环境保存 apiurl 到本地存储
|
||||
if (config.isDevelopment) {
|
||||
uni.setStorage({
|
||||
@@ -347,27 +346,17 @@ export default {
|
||||
});
|
||||
util.updateApiUrl(currentApiUrl);
|
||||
}
|
||||
// 保存 token 到本地存储
|
||||
uni.setStorageSync('RemoteTokenData', aLoginUserData);
|
||||
|
||||
uni.setStorage({
|
||||
key: 'userToken',
|
||||
data: {
|
||||
Token: aLoginUserData.token,
|
||||
}
|
||||
});
|
||||
applyLoginData(aLoginUserData);
|
||||
|
||||
try {
|
||||
const userInfo = await this.$u.api.pdaGetInformation();
|
||||
console.log('information res', userInfo);
|
||||
applyUserInformation(userInfo);
|
||||
} catch (infoError) {
|
||||
console.log('information error', infoError);
|
||||
}
|
||||
|
||||
getApp().globalData.Token = aLoginUserData.token;
|
||||
getApp().globalData.EmployeeID = aLoginUserData.user_id;
|
||||
getApp().globalData.IsSaleUserStatus = 0;
|
||||
getApp().globalData.LoginID = aLoginUserData.user_id;
|
||||
getApp().globalData.LoginName = aLoginUserData.user_name;
|
||||
getApp().globalData.PlanDepartmentID = aLoginUserData.default_sale_system_id;
|
||||
getApp().globalData.PlanDepartmentName = aLoginUserData.default_sale_system_name;
|
||||
getApp().globalData.UserGroup = '';
|
||||
getApp().globalData.StoreNameID = aLoginUserData.default_physical_warehouse_id;
|
||||
getApp().globalData.StoreName = aLoginUserData.default_physical_warehouse_name;
|
||||
getApp().globalData.StoreTypeNo = '';
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/workbench/index'
|
||||
|
||||
Reference in New Issue
Block a user