| | |
| | | data() { |
| | | return { |
| | | icons: '', |
| | | names: '1', |
| | | passwords: '111111', |
| | | names: 'test', |
| | | passwords: '123456', |
| | | msg: '', |
| | | colors: '#123456' |
| | | } |
| | |
| | | if (login == "true" && name != '') { |
| | | //获取用户信息 |
| | | var data = { |
| | | name: name |
| | | userName: name |
| | | } |
| | | this.$store.commit('getUse', data) |
| | | wx.reLaunch({ |
| | | url: '/pages/workbench/workbench?login=' + data.name |
| | | url: '/pages/workbench/workbench?login=' + data.userName |
| | | }) |
| | | } |
| | | }, |
| | |
| | | <img class="img" :src="useimg" alt=""> |
| | | </view> |
| | | <view class="usermsg"> |
| | | <view>{{userMsg.useName}}</view> |
| | | <view>{{userName}}</view> |
| | | <view></view> |
| | | </view> |
| | | </view> |
| | |
| | | <uniPopup :textmsg="textmsg" @cancel='operation(1)' @confirm='operation(2)' v-show="showTextmsg"> |
| | | </uniPopup> |
| | | </view> |
| | | <!-- <view class="m-body"> |
| | | <!-- <card :h="17"> |
| | | <floats :w="17" :h="17" :img="'../../static/img/out.png'" :msg="$store.state.loging == true? '登出': '登入'" |
| | | @onck="outIn"></floats> |
| | | </card> --> |
| | | <!-- <view class="m-b-top"> |
| | | <view class="m-b-t-once" @click="outIn"> |
| | | <image class="img" src="../../static/img/out.png" mode=""></image> |
| | | <span>{{butTitle}}</span> |
| | | </view> |
| | | </view> --> |
| | | |
| | | <!-- </view> --> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | uniPopup |
| | | }, |
| | | computed: { |
| | | userMsg() { |
| | | return this.$store.state.message; |
| | | userName() { |
| | | return this.$store.state.puserName; |
| | | }, |
| | | butTitle(){ |
| | | return this.$store.state.loging == true? '登出': '登入' |
| | |
| | | }, |
| | | ], |
| | | pasw = md5(data.pass), |
| | | url = 'http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name +' &password=' + pasw + '&grant_type=password&scope=all&type=account'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password'; |
| | | // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all'; |
| | | // wx.request({ //uniapp 自带axios |
| | | // url: url, //仅为示例,并非真实接口地址。 |
| | | // // data: d, |
| | | // // data: { |
| | | // // tenantId: '000000', |
| | | // // username: data.name, |
| | | // // password: pasw, |
| | | // // grant_type: 'password', |
| | | // // scope: 'all', |
| | | // // type: "account" |
| | | // // }, |
| | | // header: { |
| | | // // "Content-Type":"", |
| | | // 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0', |
| | | // "Tenant-Id": "000000", |
| | | // "Captcha-Key": "14c53622c5a0d633d10318fcea86acc2", |
| | | // "Captcha-Code": '', |
| | | // // "Cookie": "JSESSIONID=maOJY05vT2jj4nHwsQGSPgWWVFH1mY-TGWOLYCSh" |
| | | // }, |
| | | // method: "post", |
| | | // // dataType: 'JSON', |
| | | // success: (res) => { |
| | | // console.log(res) |
| | | // }, |
| | | // fail: (res) => { |
| | | // console.log('失去连接 请稍等'); |
| | | // console.log(res); |
| | | // } |
| | | // }); |
| | | var time = setTimeout(() => { //模拟请求时间 |
| | | var ud = user, |
| | | isit = false; |
| | | for (var key in ud) { |
| | | if (ud[key].name == data.name && ud[key].password == data.pass) { |
| | | isit = true; |
| | | break; |
| | | } else { |
| | | isit = false; |
| | | } |
| | | url = 'https://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | ' &password=' + pasw + '&grant_type=password&scope=all&type=account'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password'; |
| | | // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all'; |
| | | // console.log(url); |
| | | wx.request({ //uniapp 自带axios |
| | | url: url, //仅为示例,并非真实接口地址。 |
| | | // data: d, |
| | | // data: { |
| | | // tenantId: '000000', |
| | | // username: data.name, |
| | | // password: pasw, |
| | | // grant_type: 'password', |
| | | // scope: 'all', |
| | | // type: "account" |
| | | // }, |
| | | header: { |
| | | // "Content-Type":"", |
| | | "Authorization": "Basic c2FiZXI6c2FiZXJfc2VjcmV0", |
| | | "Tenant-Id": "000000" |
| | | |
| | | // "Cookie": "JSESSIONID=maOJY05vT2jj4nHwsQGSPgWWVFH1mY-TGWOLYCSh" |
| | | }, |
| | | method: "post", |
| | | // // dataType: 'JSON', |
| | | success: (res) => { |
| | | data.isit = true; |
| | | data.userName = res.data.real_name;//警袁姓名 |
| | | data.userID = res.data.user_id;//警袁id |
| | | // data.userPhon = res.user_id; |
| | | store.commit('login', data); |
| | | // console.log(res) |
| | | }, |
| | | fail: (res) => { |
| | | console.log('失去连接 请稍等'); |
| | | // console.log(res); |
| | | } |
| | | data.isit = isit; |
| | | store.commit('login', data); |
| | | }, 2000) |
| | | }); |
| | | // var time = setTimeout(() => { //模拟请求时间 |
| | | // var ud = user, |
| | | // isit = false; |
| | | // for (var key in ud) { |
| | | // if (ud[key].name == data.name && ud[key].password == data.pass) { |
| | | // isit = true; |
| | | // break; |
| | | // } else { |
| | | // isit = false; |
| | | // } |
| | | // } |
| | | // data.isit = isit; |
| | | // store.commit('login', data); |
| | | // }, 2000) |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | const mutations = { |
| | | login(state, data) { |
| | | console.log(data); |
| | | state.loging = data.isit; //登入状态 |
| | | if (data.isit) { //写入用户数据 |
| | | state.message.useName = data.name; |
| | | state.message.useName = data.userName; |
| | | state.puserName = data.userName; |
| | | state.puserID = data.userID; |
| | | } |
| | | //储存用户 |
| | | WxStorage.set("init", "true"); |
| | | WxStorage.set("name", data.name); |
| | | WxStorage.set("name", data.userName); |
| | | }, |
| | | loginReset(state) { //重置 |
| | | state.loging = false; |
| | |
| | | WxStorage.clear(); |
| | | }, |
| | | getUse(state,data){ |
| | | state.message.useName = data.name; |
| | | state.puserName = data.userName; |
| | | // console.log(state.puserName) |
| | | } |
| | | } |
| | | |