Commit 8db741ca by 张立顺

第一轮bug修复

1 parent 59d89c7f
...@@ -33,6 +33,15 @@ class Request { ...@@ -33,6 +33,15 @@ class Request {
data: { code, message }, data: { code, message },
data data
} = response } = response
// let thisPage = wx.$router.getPageInstance()
// // console.log(thisPage, 'thisPage')
// let { route, data: pageData } = thisPage
// if (pageData.shareQuery) {
// wx.$util.setStorageSync('shareQuery', {
// route,
// shareQuery: pageData.shareQuery
// })
// }
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
wx.hideLoading() wx.hideLoading()
......
...@@ -74,11 +74,27 @@ App({ ...@@ -74,11 +74,27 @@ App({
onShow(options) { onShow(options) {
let that = this let that = this
this.autoUpdate() this.autoUpdate()
console.log(options)
// console.log(options) // console.log(options)
wx.onMemoryWarning(function () { wx.onMemoryWarning(function () {
console.log('onMemoryWarningReceive') console.log('onMemoryWarningReceive')
}) })
if (options.query.scene) wx.$SCENE = options let { query } = options
// 判断对象是否满足任意一个key
console.log(query, ' query')
if (query && (query.scene || query.supplement || query.type)) {
if (query.supplement) {
options.patch = 'pages/index/index'
}
if (query.type) {
options.patch = 'tabWorkOrder/pages/createOrder/createOrder'
}
// tabIndex/pages/index/index?supplement=true
wx.$SCENE = options
}
console.log(wx.$SCENE, ' wx.$SCENE')
// if (options.query.scene)
let systemInfo = util.getStorageSync('dj_boutique_system_info') let systemInfo = util.getStorageSync('dj_boutique_system_info')
wx.getSystemInfo({ wx.getSystemInfo({
success(res) { success(res) {
...@@ -204,6 +220,7 @@ App({ ...@@ -204,6 +220,7 @@ App({
return resolve(this.globalData.YQorderSetting) return resolve(this.globalData.YQorderSetting)
} else { } else {
let userInfo = util.getUserInfo() let userInfo = util.getUserInfo()
if (!userInfo) this.login(true)
let { merchantId, merchantName } = userInfo.subLoginUser let { merchantId, merchantName } = userInfo.subLoginUser
// console.log(this.globalData) // console.log(this.globalData)
......
...@@ -43,7 +43,8 @@ Component({ ...@@ -43,7 +43,8 @@ Component({
let params = { let params = {
pageSize: 999999, pageSize: 999999,
pageNum: 1, pageNum: 1,
upgradeFinishFlag: 'R', // upgradeFinishFlag: 'R',
statusList: [1],
// ...data // ...data
keyword keyword
} }
......
...@@ -69,15 +69,17 @@ Page({ ...@@ -69,15 +69,17 @@ Page({
// console.log(data.loginUserInfoList[0]) // console.log(data.loginUserInfoList[0])
app.checkYqdSuper(data.loginUserInfoList[0]) app.checkYqdSuper(data.loginUserInfoList[0])
const SCENE = wx.$SCENE const SCENE = wx.$SCENE
console.log(SCENE)
// debugger
if (SCENE) { if (SCENE) {
let { let {
path, path,
query: { scene } query
// : { scene }
} = SCENE } = SCENE
let { target, name } = wx.$util.getSceneId(path) let { target, name } = wx.$util.getSceneId(path)
wx.$router.reLaunch(`${target}.${name}`, { console.log(query)
scene wx.$router.reLaunch(`${target}.${name}`, query)
})
wx.$SCENE = null wx.$SCENE = null
} else { } else {
wx.$router.reLaunch('tabIndex.index') wx.$router.reLaunch('tabIndex.index')
......
import { checkLoginUserInfo, setRouteData, setLoginInfo, loginModal } from '../lib/index'
import { getSessionId } from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
import { IMG_URL } from '~/utils/constantData'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const appEnter = wx.getEnterOptionsSync()
if (appEnter.scene == 1037) {
if (Object.keys(appEnter.referrerInfo).length) {
const { extraData } = appEnter.referrerInfo
if (extraData && Object.keys(extraData).length) this.phoneSmsLogin(extraData)
else this.init()
} else this.init()
} else this.init()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
init() {
wx.nextTick(() => {
const sessionId = getSessionId(),
{ url, targetPath = url ? decodeURIComponent(url) : '' } = this.options
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
if (sessionId) {
USERAPI.checkSession().then(({ code }) => {
if (code == '0') {
if (targetPath) {
path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(path, obj)
} else this.autoLogin(obj)
})
} else this.autoLogin(obj)
})
},
autoLogin(obj) {
const autoLoginObject = wx.$storage.get('auto_login_object')
if (autoLoginObject) {
const { failureTime, userName, password } = autoLoginObject
if (Date.now() < failureTime) {
USERAPI.accountLogin({
userName,
password
}).then(async ({ data, code, message }) => {
if (code == '0' && data.loginUserInfoList.length) {
const { sessionId, loginUserInfoList } = data
setLoginInfo(loginUserInfoList[0], sessionId)
} else {
try {
const reload = await loginModal({
message: data.loginUserInfoList.length ? message : '登录失败请重试',
cancelText: '返回'
})
if (reload) this.onShow()
} catch (error) {
wx.$storage.rm('auto_login_object')
wx.$router.reLaunch('login.index', obj)
}
}
})
} else wx.$router.reLaunch('login.index', obj)
} else wx.$router.reLaunch('login.index', obj)
},
phoneSmsLogin(extraData) {
console.log(extraData)
USERAPI.phoneSmsLogin({
mobile: extraData.phone,
code: extraData.smscode
})
.then(({ code, data, message }) => {
if (code == '0') checkLoginUserInfo(data)
else {
wx.$api.showToast(message || '系统异常')
setTimeout(() => {
wx.$router.reLaunch('login.index')
}, 1e3)
}
})
.catch(err => {
wx.$api.showToast('系统异常')
setTimeout(() => {
wx.$router.reLaunch('login.index')
}, 1e3)
})
}
})
{ {
"usingComponents": {} "usingComponents": {},
"navigationStyle": "custom",
"disableScroll": true
} }
\ No newline at end of file \ No newline at end of file
.layout {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: #fff;
.loading {
height: 48rpx;
view {
width: 16rpx;
height: 100%;
display: inline-block;
background-color: #0052d9;
animation: stretchdelay 1.2s infinite ease-in-out;
margin: 0 4rpx;
&:nth-child(2) {
animation-delay: -1.1s;
}
&:nth-child(3) {
animation-delay: -1s;
}
&:nth-child(4) {
animation-delay: -.9s;
}
}
}
}
@keyframes stretchdelay {
0%,
100%,
40% {
transform: scaley(.33);
}
20% {
transform: scaley(1);
}
}
\ No newline at end of file \ No newline at end of file
<view class="layout">
<image webp src="{{IMG_URL}}login/index-loading.webp" mode="widthFix" ></image>
<!-- <view class="loading">
<block wx:for="{{4}}" wx:key="index">
<view></view>
</block>
</view> -->
</view>
\ No newline at end of file \ No newline at end of file
// pages/wxLogin/wxLogin.js
import api from '../../api/api.js'
Page({
/**
* 页面的初始数据
*/
data: {
password: '',
userName: '',
count: 60,
verificationCount: '',
loginType: true
},
onRoute(loginToken) {
this.setData({
loginToken
})
},
changeLoginType() {
this.setData({
loginType: !this.data.loginType
})
},
input(e) {
let { value } = e.detail
let { name } = e.currentTarget.dataset
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
this.setData({
[name]: value
})
this.check()
},
check() {
let arr = [this.data.mobile, this.data.code]
this.setData({
flag: arr.findIndex(e => !e) == -1
})
},
clear(e) {
let target = e.currentTarget.dataset.name
this.setData({
[target]: ''
})
this.check()
},
getSms() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/
let { mobile } = this.data
if (!mobile) {
wx.$util.showToast('请输入手机号')
return
}
if (!phoneRex.test(mobile)) {
wx.$util.showToast('请输入正确的手机号')
return
}
api
.getSMS({
mobile
})
.then(({ code, message }) => {
if (code == '0') {
wx.$util.showToast('验证码发送成功')
this.setData({
verificationFlag: true,
verificationCount: Math.round(new Date() / 1000) + 60,
countDown: true
})
this.playCountDown()
} else {
wx.$util.showToast(message)
}
})
},
smsLogin() {
let { flag, code, mobile } = this.data
if (!flag) return
wx.$util.showLoading()
api
.smsLogin({
code,
mobile
})
.then(result => {
wx.$util.showLoading()
if (result.code == 0) {
let { loginUserInfoList, sessionId } = result.data
if (loginUserInfoList.length > 0) {
wx.$util.setSessionId(sessionId)
wx.$router.reLaunch('pages.accountItems')
} else {
wx.$router.reLaunch('pages.nothing')
}
} else {
wx.hideLoading()
wx.showModal({
title: '温馨提示',
content: result.message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#3582EE'
})
}
})
},
playCountDown() {
let { count, verificationCount } = this.data
this.countDownTime = setInterval(() => {
let nowTime = Math.round(new Date() / 1000)
if (nowTime == verificationCount) {
clearInterval(this.countDownTime)
this.setData({
count: 60,
countDown: false,
verificationFlag: false
})
return
}
this.setData({
count: --count
})
}, 1 * 1000)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 获取授权手机号
*/
getPhoneNumber(e) {
console.log(e)
let { loginToken } = this.data
let { encryptedData, iv } = e.detail
if (!encryptedData) return
wx.$util.showLoading('加载中...')
api
.authPhone({
encryptedData,
loginToken,
iv
})
.then(({ code, data, message }) => {
wx.hideLoading()
if (code == 0) {
let { loginUserInfoList, sessionId } = data
if (loginUserInfoList.length) {
wx.$util.setSessionId(sessionId)
wx.$router.reLaunch('pages.accountItems')
} else {
wx.$router.reLaunch('pages.nothing')
}
} else {
wx.hideLoading()
wx.showModal({
title: '温馨提示',
content: message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#3582EE'
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
wx.hideHomeButton()
this.login()
},
login() {
wx.$util.showLoading()
let _this = this
wx.login({
success({ code }) {
if (code) {
api
.wxLogin({
code,
appId: wx.getAccountInfoSync().miniProgram.appId
})
.then(res => {
console.log(res)
wx.$util.hideLoading()
if (res.code == '0') {
_this.setData({
loginToken: res.data
})
}
})
} else {
wx.$util.showToast('登录失败')
}
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
<view class='layout'>
<block wx:if="{{!loginType}}">
<view class='login-form'>
<view class='input'>
<input placeholder="请输入手机号" type="number" placeholder-style="color:#999;" style="width:calc(100% - 50rpx);" bindinput="input" data-name='mobile' value="{{mobile}}" maxlength="11"></input>
<view class='clear y-center' hidden="{{!mobile}}" bindtap="clear" data-name='mobile'>
<image src="/images/clear.png"></image>
</view>
</view>
<view class="sms-box">
<view class='input'>
<input placeholder="请输入验证码" type="number" placeholder-style="color:#999;" style="width:calc(100% - 100rpx);" bindinput="input" data-name='code' value='{{code}}' maxlength="4"></input>
<view class='clear y-center' style="right:50rpx;" hidden="{{!code}}" bindtap="clear" data-name='code'>
<image src="/images/clear.png"></image>
</view>
</view>
<view class="sms {{countDown?'code-disabled':''}}" bindtap="getSms">
<block wx:if="{{countDown}}">
{{count}}秒后获取
</block>
<block wx:else>
获取验证码
</block>
</view>
</view>
</view>
</block>
<view class='box' >
<!-- <view class='box' style="top:{{loginType?'-264rpx':'0'}}"> -->
<view class="login-btn {{loginType?'mini':''}}">
<button size="default" hidden="{{!loginType}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
<view hidden="{{!loginType}}">微信登录</view>
<view hidden="{{loginType}}" bindtap="smsLogin">登录</view>
</view>
<view class='tips' bindtap="changeLoginType">{{loginType?"手机号登录":"切换为微信登录"}}</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* pages/login/login/login.wxss */
page{
background: #fff;
}
.layout{
padding-top: 160rpx;
}
.box {
height: 264rpx;
position: relative;
z-index: 9;
/* top: -264rpx; */
background: #fff;
transition: all 0.5s;
}
.login-form {
padding: 0 40rpx;
}
.login-form .input {
height: 40rpx;
line-height: 40rpx;
width: 100%;
position: relative;
margin-bottom: 92rpx;
font-size: 28rpx;
box-sizing: border-box;
padding-left: 66rpx;
color: #333;
}
.login-form .sms-box{
display: flex;
align-items: center;
margin-bottom: 92rpx;
}
.login-form .sms-box .input{
width: 70%;
margin-bottom: 0;
}
.login-form .sms-box .sms{
width: 30%;
font-size: 24rpx;
color: #3582EE;
}
.login-form .input::after {
content: '';
position: absolute;
left: 0;
bottom: -26rpx;
width: 100%;
height: 2rpx;
background: #eee;
}
.login-form .input .icon {
width: 36rpx;
height: 36rpx;
position: absolute;
left: 0;
}
.clear {
position: absolute;
right: 0;
width: 36rpx;
height: 36rpx;
}
.login-form .input .icon-eye {
width: 36rpx;
height: 36rpx;
position: absolute;
right: 0;
}
.input .clear {
position: absolute;
right: 0;
}
.login-btn {
background-color: #3582EE;
border-radius: 40rpx;
text-align: center;
font-size: 32rpx;
color: #fff;
letter-spacing: 13.72rpx;
height: 80rpx;
line-height: 80rpx;
width: 670rpx;
margin: 0 auto;
font-weight: normal;
transition: all .5s;
position: relative;
}
.box button{
opacity: 0;
position: absolute;
top: 0;
left: 0;
padding: 0;
width: 100% !important;
height: 100%;
box-sizing: border-box;
}
.mini{
width: 368rpx;
}
.tips {
font-size: 24rpx;
color: #3582EE;
letter-spacing: 1.72rpx;
margin-top: 76rpx;
text-align: center;
}
.tip {
position: fixed;
left: 0;
bottom: 40rpx;
width: 100%;
font-size: 24rpx;
color: #999;
letter-spacing: 2rpx;
text-align: center;
}
.code-disabled {
color: #999 !important;
}
\ No newline at end of file \ No newline at end of file
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
{ {
"name": "新增工单", "name": "新增工单",
"pathName": "tabWorkOrder/pages/createOrder/createOrder", "pathName": "tabWorkOrder/pages/createOrder/createOrder",
"query": "", "query": "type=supplement",
"launchMode": "default",
"scene": null "scene": null
}, },
{ {
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,7 @@
{ {
"name": "首页", "name": "首页",
"pathName": "/tabIndex/pages/index/index", "pathName": "/tabIndex/pages/index/index",
"query": "", "query": "supplement=true",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
......
...@@ -285,11 +285,6 @@ Page({ ...@@ -285,11 +285,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
// console.log(decodeURIComponent(options))
// let id = decodeURIComponent(options.supplement).split('=')[1]
// if (options) {
// }
// console.log(options) // console.log(options)
if (options.supplement) { if (options.supplement) {
this.setData({ this.setData({
...@@ -425,6 +420,13 @@ Page({ ...@@ -425,6 +420,13 @@ Page({
} }
}) })
}, },
onRoute(options) {
if (options.supplement) {
this.setData({
showOrderpop: true
})
}
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -433,7 +435,8 @@ Page({ ...@@ -433,7 +435,8 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function (options) {
console.log(options, 'options')
let userInfo = wx.$util.getUserInfo() let userInfo = wx.$util.getUserInfo()
// console.log(userInfo) // console.log(userInfo)
// 如果是员工 开启订单补录轮询 // 如果是员工 开启订单补录轮询
...@@ -446,7 +449,7 @@ Page({ ...@@ -446,7 +449,7 @@ Page({
isChangeLogin && this.init(userInfo) isChangeLogin && this.init(userInfo)
} }
} else { } else {
console.log('首页登录') // console.log('首页登录')
getApp().login(true) getApp().login(true)
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!