提交 ecfce872 作者: wk

微信手机号获取登录 阻止切换

父级 7f64283f
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
}) })
this.check_tpl_id = option.check_tpl_id this.check_tpl_id = option.check_tpl_id
this.checkItemId = option.check_item_id this.checkItemId = option.check_item_id
this.projectId = uni.getStorageSync("project_id") this.projectId = option.project_id
}, },
onPullDownRefresh() { onPullDownRefresh() {
......
<template> <template>
<view class="index-content"> <view class="index-content">
<!-- <navbar :showBack="false" :title="title"></navbar> --> <!-- <navbar :showBack="false" :title="title"></navbar> -->
<picker @change="itemSelect" :range="projectNames"> <picker @change="itemSelect" :range="projectList" range-key="project_name">
<label> <label>
<view class="index-uni-project"> <view class="index-uni-project">
<text>{{projectSelect}}</text> <text>{{projectSelect.project_name||projectName}}</text>
<image src="../../../../static/icon_down_select.png"></image> <image src="../../../../static/icon_down_select.png"></image>
</view> </view>
</label> </label>
...@@ -33,12 +33,10 @@ ...@@ -33,12 +33,10 @@
title: '', title: '',
column: 3, column: 3,
projectList: [], projectList: [],
projectNames: [],
banners: [], banners: [],
tplConfig: [], tplConfig: [],
list: [], list: [],
projectSelect: "示例项目", projectSelect: {},
projectId: "",
pattern: { pattern: {
color: '#7A7E83', color: '#7A7E83',
backgroundColor: '#fff', backgroundColor: '#fff',
...@@ -46,7 +44,8 @@ ...@@ -46,7 +44,8 @@
buttonColor: '#007AFF' buttonColor: '#007AFF'
}, },
menu: [], menu: [],
appId: "" appId: "",
projectName: ""
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -69,20 +68,32 @@ ...@@ -69,20 +68,32 @@
console.log("项目列表:", result); console.log("项目列表:", result);
if (result.code === 0) { if (result.code === 0) {
this.projectList = result.data.list this.projectList = result.data.list
for (var i = 0; i < this.projectList.length; i++) { let curId = uni.getStorageSync("project_id")
this.projectNames[i] = this.projectList[i].project_name if (curId) {
} this.projectName = uni.getStorageSync("org_name")
if (this.projectList.length > 0) { } else {
console.log("项目ID:", ); this.projectSelect = this.projectList[0]
let curId = uni.getStorageSync("project_id")
if (curId.length == 0) {
this.projectSelect = this.projectList[0].project_name
uni.setStorageSync("project_id", this.projectList[0].project_id)
uni.setStorageSync("project_name", this.projectList[0].project_name)
} else {
this.projectSelect = uni.getStorageSync("project_name")
}
} }
// for (var i = 0; i < this.projectList.length; i++) {
// this.projectNames[i] = this.projectList[i].project_name
// }
// if (this.projectList.length > 0) {
// console.log("项目ID:", );
// let curId = uni.getStorageSync("project_id")
// if (curId.length == 0) {
// this.projectSelect = this.projectList[0].project_name
// uni.setStorageSync("project_id", this.projectList[0].project_id)
// uni.setStorageSync("project_name", this.projectList[0].project_name)
// } else {
// let project = this.projectList.find(item => item.project_id == curId)
// if (project) {
// this.projectSelect = uni.getStorageSync("project_name")
// } else {
// this.projectSelect = this.projectList[0].project_name
// }
// }
// }
} else { } else {
if (result.code === -1) { if (result.code === -1) {
uni.showToast({ uni.showToast({
...@@ -140,15 +151,13 @@ ...@@ -140,15 +151,13 @@
} = e.detail } = e.detail
let item = this.list[index] let item = this.list[index]
uni.navigateTo({ uni.navigateTo({
url: `/pages/gallery/app/checkObjList/checkObjList?check_item_name=${item.check_item_name}&check_item_id=${item.check_item_id}&check_tpl_id=${this.appId}`, url: `/pages/gallery/app/checkObjList/checkObjList?check_item_name=${item.check_item_name}&check_item_id=${item.check_item_id}&check_tpl_id=${this.appId}&project_id=${this.projectSelect.project_id}`,
}) })
}, },
itemSelect(e) { itemSelect(e) {
console.log(e); console.log(e);
let index = parseInt(e.detail.value) let index = parseInt(e.detail.value)
this.projectSelect = this.projectList[index].project_name this.projectSelect = this.projectList[index]
uni.setStorageSync("project_id", this.projectList[index].project_id)
uni.setStorageSync("project_name", this.projectList[index].project_name)
}, },
} }
} }
......
...@@ -420,7 +420,9 @@ ...@@ -420,7 +420,9 @@
this.userInfo = result.data this.userInfo = result.data
// this.title = "欢迎" + this.userInfo.user.user_name + "访问一点通" // this.title = "欢迎" + this.userInfo.user.user_name + "访问一点通"
this.role = this.userInfo.identity.code this.role = this.userInfo.identity.code
this.loadProject() if (!uni.getStorageSync("org_no")) {
this.loadProject()
}
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
......
...@@ -283,7 +283,6 @@ ...@@ -283,7 +283,6 @@
uni.setStorageSync("short_token", result.data.short_token) uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("token", result.data.access_token) uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("user_info", result.data) uni.setStorageSync("user_info", result.data)
uni.setStorageSync("org_no", result.data.org_no)
uni.setStorageSync("company_id", result.data.comp_id) uni.setStorageSync("company_id", result.data.comp_id)
uni.showToast({ uni.showToast({
title: "授权登录成功", title: "授权登录成功",
...@@ -312,7 +311,6 @@ ...@@ -312,7 +311,6 @@
uni.setStorageSync("token", result.data.access_token) uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("user_info", result.data) uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id) uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("org_no", result.data.org_no)
uni.showToast({ uni.showToast({
title: "授权登录成功", title: "授权登录成功",
icon: 'none' icon: 'none'
...@@ -349,7 +347,6 @@ ...@@ -349,7 +347,6 @@
uni.setStorageSync("short_token", result.data.short_token) uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data) uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id) uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("org_no", result.data.org_no)
uni.setStorageSync("refresh_token", result.data.refresh_token) uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({ uni.showToast({
title: "登录成功", title: "登录成功",
...@@ -385,7 +382,6 @@ ...@@ -385,7 +382,6 @@
uni.setStorageSync("short_token", result.data.short_token) uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data) uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id) uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("org_no", result.data.org_no)
uni.setStorageSync("refresh_token", result.data.refresh_token) uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({ uni.showToast({
title: "登录成功", title: "登录成功",
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
uni.setStorageSync("short_token", result.data.short_token) uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data) uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id) uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("org_no", result.data.org_no)
uni.setStorageSync("refresh_token", result.data.refresh_token) uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({ uni.showToast({
title: "登录成功", title: "登录成功",
......
...@@ -117,11 +117,14 @@ ...@@ -117,11 +117,14 @@
}) })
}, },
switchOrg: function(item) { switchOrg: function(item) {
console.log("切换组织", item);
uni.setStorageSync("org_no", item.org_no) uni.setStorageSync("org_no", item.org_no)
uni.setStorageSync("org_name", item.name) uni.setStorageSync("org_name", item.name)
uni.setStorageSync("org_id", item.id) uni.setStorageSync("org_id", item.id)
if (item.project_id) { if (item.project_id) {
uni.setStorageSync("project_id", item.project_id) uni.setStorageSync("project_id", item.project_id)
} else {
uni.setStorageSync("project_id", "")
} }
uni.$emit("refreshOrg") uni.$emit("refreshOrg")
uni.navigateBack({ uni.navigateBack({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment