123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <view style="display: flex;align-items: center;justify-content: center;height: 100vh;">
- <!-- <image src="../../static/logo.png" style="width: 90px;height:80px"></image> -->
- <tn-loading mode="circle" size="60"></tn-loading>
- </view>
-
- </template>
- <script>
- import request from '../../utils/request'
-
- export default {
- data() {
- return {
-
- }
- },
- onLoad(options) {
-
- let that = this;
- uni.login({
- success(res) {
- console.error(res);
- that.loginByCode(res.code);
- },
- fail(res) {
- console.error(res);
- uni.hideLoading();
- }
- });
-
- },
- methods: {
- loginByCode(frontId) {
- const that = this;
- uni.setStorageSync('loginStatus', 'false');
- wx.getUserInfo({
- success: function(res) {
- console.error(res);
- request.post("/slbMpAutoLogin", {
- code:frontId,
- appType:'ma',
- encryptedData:res.encryptedData,
- iv: res.iv
- }, {
- login: false,
- warn:false,
- loading:false
- }).then(res2=>{
- console.error(res2);
- if(res2.success){
- //登录成功
- uni.setStorageSync('loginStatus', 'true');
- uni.setStorageSync('userMap', JSON.stringify(res2.resultMap));
- uni.setStorageSync('userNo', res2.resultMap.accountName);
- that.getUserInfo();
- }else{
- console.error(12345);
- uni.setStorageSync('loginStatus', 'false');
- uni.removeStorageSync('userMap');
- uni.removeStorageSync('userNo');
- uni.removeStorageSync('userInfo');
- uni.redirectTo({
- url:'/pages/index/index'
- })
- //登录失败,
- // uni.login({
- // success(res) {
- // console.error(res);
- // that.getOpenId(res.code);
- // },
- // fail(res) {
- // console.error(res);
- // uni.hideLoading();
- // }
- // });
-
- }
- console.error(res2);
- });
-
-
- }
- })
-
-
- },
- getUserInfo() {
- let that = this;
- request.post('/slbWxma/getPersonlInfo', {
-
- }).then(res => {
- console.warn(res);
- if(res.success){
- that.personInfo = res.resultMap.userInfo||{};
- uni.setStorageSync('userInfo', JSON.stringify(res.resultMap.userInfo));
- uni.redirectTo({
- url:'/pages/index/index'
- })
- }
- console.warn(res);
- })
-
- },
- }
- }
- </script>
- <style>
- </style>
|