Commit f3f1ae77 authored by 李苏's avatar 李苏 💬

调整

parent 6b99c952
......@@ -9,6 +9,8 @@ import {RouterMount} from './plugin/uni-simple-router/index.js'
console.log("main")
// 注册缓存器
Vue.use(MinCache,{timeout: 6})
//判定isCloud
Vue.prototype.isCloud=true;
// store
Vue.prototype.$store=store;
// tip
......
......@@ -9,6 +9,8 @@
"path": "pages/login/login",
"style": {}
},
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
......
......@@ -66,9 +66,9 @@
<!-- <image src="https://static.jeecg.com/upload/test/login4_1595818039175.png" mode="aspectFit" class="round"></image> -->
<view class="gray-text">登录中...</view>
</view>
<view @tap="changErp()" style="position: absolute;bottom: 20px;right: 10px;text-decoration:underline">
<!-- <view @tap="changErp()" style="position: absolute;bottom: 20px;right: 10px;text-decoration:underline">
切换到格物erp登录
</view>
</view> -->
</view>
</template>
......@@ -112,6 +112,7 @@
},
onLoad:function(da){
this.isCloud=true
if(da&&da.query){
let infor=JSON.parse(da.query).infor
this.userName=infor.userName
......@@ -144,65 +145,6 @@
// #endif
},
watch:{
loginBz:function(val){
let _this =this;
http.config.baseUrl = "http://192.168.20.214:9090/erp";
if(val){
this.$http.post(this.loginurl,{}).then((resp) => {
if(resp.data.success){
console.log("success")
uni.setStorage({
key: 'userid',
data: resp.data.data.userid,
success: function () {
console.log(resp.data.data.userid);
}
});
uni.setStorage({
key: 'username',
data: resp.data.data.username,
success: function () {
console.log(resp.data.data.username);
}
});
uni.setStorage({
key: 'ACCESS_TOKEN',
data: resp.data.data.token,
success: function () {
console.log(resp.data.data.token)
}
});
// 本地存储信息
uni.setStorage({
key: 'userName',
data: _this.userName,
success: function () {
console.log("用户名获取成功")
}
});
uni.setStorage({
key: 'password',
data: _this.password,
success: function () {
console.log("用户名获取成功")
}
});
//ACCESS_TOKEN
this.$tip.success('登录成功!')
this.$Router.replaceAll({name:'index'})
// #ifdef APP-PLUS
// this.saveClientId()
// #endif
// #ifndef APP-PLUS
this.$tip.success('登录成功!')
this.$Router.replaceAll({name:'index'})
// #endif
}else{
this.$tip.alert(resp.data.message||"登录失败");
}
})
}
}
},
computed: {
isSendSMSEnable() {
......@@ -224,6 +166,65 @@
},
methods: {
...mapActions([ "mLogin","PhoneLogin","ThirdLogin" ]),
// 二次登录
loginT(){
let _this =this;
http.config.baseUrl = "http://localhost:9090/erp";
this.$http.post(this.loginurl,{}).then((resp) => {
if(resp.data.success){
console.log("success")
uni.setStorage({
key: 'userid',
data: resp.data.data.userid,
success: function () {
console.log(resp.data.data.userid);
}
});
uni.setStorage({
key: 'username',
data: resp.data.data.username,
success: function () {
console.log(resp.data.data.username);
}
});
uni.setStorage({
key: 'ACCESS_TOKEN',
data: resp.data.data.token,
success: function () {
console.log(resp.data.data.token)
}
});
// 本地存储信息
uni.setStorage({
key: 'userName',
data: _this.userName,
success: function () {
console.log("用户名获取成功")
}
});
uni.setStorage({
key: 'password',
data: _this.password,
success: function () {
console.log("用户名获取成功")
}
});
//ACCESS_TOKEN
this.$tip.success('登录成功!')
this.$Router.replaceAll({name:'index'})
// #ifdef APP-PLUS
// this.saveClientId()
// #endif
// #ifndef APP-PLUS
this.$tip.success('登录成功!')
this.$Router.replaceAll({name:'index'})
// #endif
}else{
this.$tip.alert(resp.data.message||"登录失败");
}
})
},
changErp(){
this.$Router.replaceAll({name:'login'})
},
......@@ -240,7 +241,7 @@
onLogin: function (){
// http.config.baseUrl='http://'+this.fwq+'/'+this.dkh
let _this=this;
http.config.baseUrl = "http://192.168.20.214:9080/"
http.config.baseUrl = "http://localhost:9080/"
if(!this.userName || this.userName.length==0){
this.$tip.toast('请填写用户名');
return;
......@@ -268,9 +269,11 @@
},3000)
this.$http.post("/erp/clouderp/cusmer/login",params).then((resp) => {
if(resp.data.success){
this.loginBz=true;
this.loading=false;
this.loginurl =resp.data.data.records+"&&tp='1'";
this.loginT()
}else{
this.loading=false;
this.$tip.alert(resp.data.message||"请求失败");
}
})
......
......@@ -76,9 +76,9 @@
<!-- <image src="https://static.jeecg.com/upload/test/login4_1595818039175.png" mode="aspectFit" class="round"></image> -->
<view class="gray-text">登录中...</view>
</view>
<view @tap="changErp()" style="position: absolute;bottom: 20px;right: 10px;text-decoration:underline">
<!-- <view @tap="changErp()" style="position: absolute;bottom: 20px;right: 10px;text-decoration:underline">
切换到格物云erp登录
</view>
</view> -->
</view>
</template>
......@@ -120,6 +120,7 @@
},
onLoad:function(da){
this.isCloud=false
if(da&&da.query){
let infor=JSON.parse(da.query).infor
this.userName=infor.userName
......
......@@ -41,7 +41,7 @@
<text class="text-grey">设置</text>
</view>
</navigator>
<navigator style="" class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.7s'}]" url="/pages/login/login" hover-class="none">
<navigator style="" class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.7s'}]" :url="isCloud?'/pages/login/login':'/pages/login/cusmerLogin'" hover-class="none">
<view class="content" @click="clearToken()">
<text class="cuIcon-exit text-cyan"></text>
<text class="text-grey">退出</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment