Browse Source

1111

master
wangjiahai 2 years ago
parent
commit
e48b3bb6da
  1. 5
      App.vue
  2. 2
      common/config.js
  3. 1
      common/request.api.js
  4. 50
      common/wxSilentLogin.js
  5. 22
      pages.json
  6. 40
      pages/index/BindPhone.vue

5
App.vue

@ -2,12 +2,11 @@
import config from "common/config.js";
export default {
globalData: {
wxSilentLoginURL: config.baseUrl+"/v1/app/wxuser/wxSilentLogin",
wxSilentLoginURL: config.baseUrl + "/lpkcustomer/wxSilentLogin",
sid: ""
},
onLaunch: function() {
this.WxSilentLogin()
},
onShow: function() {
console.log('App Show')

2
common/config.js

@ -6,7 +6,7 @@
* loginTimeoutPage = "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面
*/
module.exports = {
baseUrl: 'http://192.168.1.193:7201',
baseUrl: 'http://192.168.0.108:7201',
// baseUrl: 'https://jianguan.yyundong.com',
// baseUrl: 'http://jianguan.yyundong.com/api',
tokenName: "Authorization", // 请求头中token的名字,与服务器端对应

1
common/request.api.js

@ -2,6 +2,7 @@ import request from '@/utils/requester.js'
export default {
login: (params = {}) => request.post("/wxmpapi/sysuser/login", params),
wxBindMobile: (params = {}) => request.post("/lpkcustomer/wxBindMobile", params),
sayhello: (params = {}) => request.get("/sayb", params),
getSalesReport: (params = {}) => request.get("/system/reportCenter/getSalesReport", params),
getGoodsOnWay: (params = {}) => request.get("/system/reportCenter/getGoodsOnWay", params),

50
common/wxSilentLogin.js

@ -1,4 +1,3 @@
const wxSilentLogin = () => {
return new Promise((resolve, reject) => {
wx.login({
@ -30,35 +29,19 @@ const wxSilentLogin = () => {
if (res.statusCode == 200) {
if (!res.data.success) {
// if (res.data.code == 500) {
// uni.showModal({
// title: '温馨提示',
// content: '您的平台应用未被授权,请联系工作人员。',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {
// wx.exitMiniProgram({
// success: function() {},
// fail: function() {}
// })
// } else {
// console.log('点击了取消')
// }
// }
if (res.data.code == "110") {
console.log(res.data.data);
// 未绑定用户
// uni.navigateTo({
// url: '/pages/index/BindPhone?openid=' +
// res.data.data.wxMpOpenid
// })
// return
// }
// if (res.data.code == 100) {
// 未绑定用户
uni.navigateTo({
url: '../index/BindPhone?openid=' +
res.data.data.openid+"&unionid="+
res.data.data.unionid
url: '/pages/index/BindPhone?openid=' +
res.data.data.wxMpOpenid
})
// }
}
} else {
@ -74,11 +57,16 @@ const wxSilentLogin = () => {
getApp().globalData.mobile = res.data.data
.mobile
getApp().globalData.isAdmin = res.data.data.isAdmin
getApp().globalData.orgSidPath = res.data.data.orgSidPath
getApp().globalData.orgNamePath = res.data.data.orgNamePath
getApp().globalData.organizationSid = res.data.data.organizationSid
getApp().globalData.headImage = res.data.data.headImage
getApp().globalData.isAdmin = res.data.data
.isAdmin
getApp().globalData.orgSidPath = res.data.data
.orgSidPath
getApp().globalData.orgNamePath = res.data.data
.orgNamePath
getApp().globalData.organizationSid = res.data
.data.organizationSid
getApp().globalData.headImage = res.data.data
.headImage
getApp().globalData.isLogin = true

22
pages.json

@ -15,7 +15,16 @@
"scrollIndicator": false //,
}
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "绑定账号",
"navigationStyle": "custom",
"app-plus": {
"scrollIndicator": false //,
}
}
}
],
"globalStyle": {
@ -31,19 +40,10 @@
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/card/card",
"iconPath": "static/home_n.png",
"selectedIconPath": "static/home_s.png",
"text": "首页"
}, {
"pagePath": "pages/index/msg",
"iconPath": "static/msg_n.png",
"selectedIconPath": "static/msg_s.png",
"pagePath": "pages/index/index",
"text": "通知"
}, {
"pagePath": "pages/index/me",
"iconPath": "static/me_n.png",
"selectedIconPath": "static/me_s.png",
"text": "我的"
}]
},
"uniIdRouter": {}

40
pages/index/BindPhone.vue

@ -19,10 +19,10 @@
</view>
<view class="inputRow">
<!-- <view class="inputRow">
<image src="../../static/baseIcon/code.png" mode="aspectFill" class="drawableLeft"></image>
<input type="number" @input="codeText" maxlength="6" placeholder="请输入验证码" class="input" />
</view>
</view> -->
<view class="btn" @click="next">
@ -63,16 +63,6 @@
created() {
//
this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
this.$bus.$on('isShow', msg => {
//httpjswholeSpin
console.log("isShows>>>>>", msg)
this.isShow = msg
console.log("isShows>>>>>", this.isShow)
});
},
onShow() {
/* #ifdef MP-WEIXIN */
@ -91,33 +81,33 @@
var mobileLength = this.page.mobile.length;
var codeLength = this.page.code.length;
if (mobileLength == 0) {
this.Toast("请输入手机号")
return;
}
if (codeLength == 0) {
this.Toast("验证码不能为空")
uni.showToast({
icon: 'error',
title: '手机号不能为空'
})
return;
}
let _this = this
console.log('1111', _this.page)
_this.$api.wxBindMobile(_this.page).then((resp) => {
// if (resp.success) {
console.log('1111', resp)
getApp().globalData.username = resp.userName
getApp().globalData.token = resp.token
getApp().globalData.sid = resp.sid
getApp().globalData.mobile = resp.mobile
getApp().globalData.isLogin = true
getApp().globalData.sid = resp
// getApp().globalData.token = resp.token
// getApp().globalData.sid = resp.sid
// getApp().globalData.mobile = resp.mobile
// getApp().globalData.isLogin = true
// _this.WritePreference("sysUserSid", res.data)
// _this.WritePreference("isLogin", true)
// getApp().globalData.isLogin = true
// getApp().globalData.sysUserSid = res.data
uni.navigateBack({
delta: 10,
});
uni.switchTab({
url: '/pages/card/card'
})
// uni.switchTab({
// url: '/pages/home/WorkFragment'

Loading…
Cancel
Save