Commit cc98ccb5 by 前端

Merge branch 'zq_dev_3.0' into 'v3.0'

第一轮bug修复

See merge request !53
2 parents a35aa88b b1110cf7
import api from '../utils/request/request'
import ssoApi from './ssoApi'
const common = 'scrm.api.carlife.common.'
const {
appId
} = wx.getAccountInfoSync().miniProgram
module.exports = {
ssoApi,
commonApi: {
......@@ -22,6 +25,20 @@ module.exports = {
noSignAttr: ['file']
})
},
createQrcode(data) {
return api.post({
method: 'scrm.api.wechat.miniprogram.createQrcode',
...data,
appId
},true)
},
getQrcodeParams(data) {
return api.post({
method: 'scrm.api.wechat.get.scene.by.id',
...data
},true)
}
},
/** 线索埋点数据上报
* operationType 操作类型(0:分享 1:浏览 2:申请活动)
......
{
"usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar"
}
},
"navigationBarTitleText": "选择账号"
}
\ No newline at end of file
......@@ -14,6 +14,11 @@ Page({
onLoad(options) {
},
toDial(){
wx.makePhoneCall({
phoneNumber: '18902454229',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
......
......@@ -37,11 +37,16 @@
color: #1B233D;
margin-bottom: 8rpx;
}
.dial{
display: flex;
justify-content: center;
}
.phone{
font-weight: 400;
font-size: 22rpx;
color: #9299AD;
color: #5971F6;
line-height: 32rpx;
margin-right: 8rpx;
}
}
}
......
......@@ -3,11 +3,11 @@
<view class="service-wrap">
<image class="qrcode" src="{{IMGURL}}service.png"></image>
<view class="tip">扫码添加客服企微</view>
<view class="hotline">
<view class="hotline" catchtap='toDial'>
<view class="title">客服热线</view>
<view>
<view class="dial">
<text class="phone">189 0245 4229</text>
<image></image>
<image style="width: 32rpx;height: 32rpx;" src="{{IMGURL}}phone.png"></image>
</view>
</view>
</view>
......
......@@ -101,7 +101,7 @@ Page({
mobile: formData.phone,
code: formData.code
}
if(this.data.showLoading) return;
if(this.data.showLoading || this.data.disabled) return;
this.setShowLoading(true)
USERAPI.phoneSmsLogin(obj).then(({
code,
......@@ -145,6 +145,8 @@ Page({
switchLoginMethod(e){
const {type} = e.target.dataset
this.setData({
count: null,
['formData.code']: '',
loginMethod: type
})
},
......@@ -159,8 +161,8 @@ Page({
},
checkInfo(){
this.setData({
phoneReady: this.validate.methods.tel(this.data.formData.phone),
disabled: !this.validate.methods.tel(this.data.formData.phone) || this.data.formData?.code?.length !=4
phoneReady: this.data.formData.phone && this.validate.methods.tel(this.data.formData.phone),
disabled: !(this.data.formData.phone && this.validate.methods.tel(this.data.formData.phone)) || this.data.formData?.code?.length !=4
})
},
/**获取验证码 */
......@@ -263,7 +265,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload() {
clearTimeout()
},
/**
......
import USERAPI from '~/api/usersApi/index'
const navStyle = "background-color: transparent;";
import {
selectAccountLogin,
setLoginInfo
} from '../lib/index'
Page({
/**
......@@ -51,66 +55,75 @@ Page({
if (confirm) this.init()
})
},
// toRegister(){
// console.log(this.loginToken)
// },
toRegister({
detail
}) {
if (!detail.code) return
wx.showLoading()
let params = {
detail,
...this.data.linkParams
}
if(this.data.linkParams.type==1){
wx.$router.go('/pages/authentication/registerInfo/registerInfo',params)
}else{
let randomName = new Date().getTime()+parseInt(Math.random(1)*10000)
let {merchantFileRequest,merchantId} = this.data.linkParams
let regParmas = {
merchantId,
loginToken:this.loginToken,
encryptedData:detail.encryptedData,
iv:detail.iv,
merchantFileRequest: JSON.stringify(merchantFileRequest),
staffName: merchantFileRequest.fileName || randomName,
weChatNickName: merchantFileRequest.fileName,
weChatAvatarUrl: merchantFileRequest.fileUrl
}
this.register(regParmas,detail)
}
},
register(params,detail){
USERAPI.register(params).then((res) => {
if (res.code == '0'){
this.toLogin(detail)
}else{
wx.$api.showToast(message || '系统异常')
}
})
},
toLogin(detail){
USERAPI.authUserPhone(detail, this.loginToken).then(({
code,
data,
message,
errId
}) => {
wx.hideLoading()
if (code == '0' || errId=='30990103'){
let target = null
if(code == '0' && data.loginUserInfoList?.length){
let {loginUserInfoList} = data
target = loginUserInfoList.find(item => item.merchantId== this.data.linkParams.merchantId)
}
if(target){
wx.$router.go('/pages/authentication/registerSuccess/registerSuccess',{type:0})
return;
}
let params = {...this.data.linkParams}
if(this.data.linkParams.type==1){
wx.$router.go('/pages/authentication/registerInfo/registerInfo',params)
}else{
let randomName = new Date().getTime()+parseInt(Math.random(1)*10000)
let {merchantFileRequest,merchantId} = this.data.linkParams
let regParmas = {
merchantId,
loginToken:this.loginToken,
encryptedData:detail.encryptedData,
iv:detail.iv,
merchantFileRequest: JSON.stringify(merchantFileRequest),
staffName: merchantFileRequest.fileName || randomName,
weChatNickName: merchantFileRequest.fileName,
weChatAvatarUrl: merchantFileRequest.fileUrl
}
this.register(regParmas)
}
if (code == '0'){
this.checkLoginUserInfo(data)
}else{
wx.hideLoading()
wx.$api.showToast(message || '系统异常')
}
}).catch(({
errMsg
}) => {
this.setShowLoading(false)
wx.$api.showToast('系统异常')
})
},
register(params){
USERAPI.register(params).then((res) => {
if (res.code == '0'){
wx.$router.go('/pages/authentication/registerSuccess/registerSuccess',{type:1})
}else{
wx.$api.showToast(message || '系统异常')
}
checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
/**多个账号 */
console.log(loginUserInfoList,'loginUserInfoList')
if (loginUserInfoList.length > 1) wx.$router.go('/pages/authentication/accountItems/accountItems', {
sessionId,
...this.options
})
/**只有一个账号 */
else selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
},
/**
......
// pages/authentication/registerInfo/registerInfo.js
import USERAPI from '~/api/usersApi/index'
import {
selectAccountLogin,
setLoginInfo
} from '../lib/index'
Page({
/**
......@@ -111,13 +115,49 @@ Page({
console.log(params,'ddd')
USERAPI.register(params).then((res) => {
if (res.code == '0'){
wx.$router.go('/pages/authentication/registerSuccess/registerSuccess',{type:1})
this.toLogin()
}else{
wx.$api.showToast(message || '系统异常')
}
})
//
},
toLogin(){
USERAPI.authUserPhone(this.data.dataFromOptions.detail, this.loginToken).then(({
code,
data,
message,
errId
}) => {
if (code == '0'){
this.checkLoginUserInfo(data)
}else{
wx.$api.showToast(message || '系统异常')
}
}).catch(({
errMsg
}) => {
this.setShowLoading(false)
wx.$api.showToast('系统异常')
})
},
checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
/**多个账号 */
console.log(loginUserInfoList,'loginUserInfoList')
if (loginUserInfoList.length > 1) wx.$router.go('/pages/authentication/accountItems/accountItems', {
sessionId,
...this.options
})
/**只有一个账号 */
else selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
},
inputStaffNamme(e){
const {value} = e.detail
this.setData({
......
......@@ -3,6 +3,9 @@ import { senceData } from "~/pages/tab/discovery/constant/data";
import Draw from "~/utils/Draw.js";
import { IMG_URL } from "~/utils/constantData.js";
import ActivityApi from '~/api/activityApi/index'
import {
commonApi
} from '~/api/api.js'
const IMGURL = IMG_URL
Page({
/**
......@@ -28,31 +31,8 @@ Page({
name: "下载为海报",
},
],
imgHeightArr: [
[1110, 1290, 596, 744, 490, 1532],
[2168, 1290, 596, 830, 490, 752],
[1110, 1290, 596, 984, 490],
[678, 1266, 1398, 830, 490, 1666],
],
posterUrl: "", //海报url
},
// observers: {
// actNum: function (actNum) {
// let imgList = [
// `${IMGURL}index/scene${actNum + 1}1.png`,
// `${IMGURL}index/scene${actNum + 1}2.png`,
// `${IMGURL}index/scene${actNum + 1}3.png`,
// `${IMGURL}index/scene${actNum + 1}4.png`,
// `${IMGURL}index/scene${actNum + 1}5.png`,
// ];
// if (actNum != 2) {
// imgList.push(`${IMGURL}index/scene${actNum + 1}6.png`);
// }
// this.setData({
// imgList,
// });
// },
// },
navbarReady(e) {
let {
height
......@@ -76,6 +56,15 @@ Page({
isShow: true,
});
},
setRouteParams(obj){
const {actNum, activeNavIdx, fromLocal} = obj
this.setData({
actNum,
activeNavIdx,
fromLocal
})
this.createImg()
},
createImg(){
if(this.data.isShow && this.data.fromLocal==1){
let { actNum,activeNavIdx } = this.data;
......@@ -91,9 +80,17 @@ Page({
width: imgW,
height: imgH
});
// ActivityApi.getActivityVisitorList({
// actNum, activeNavIdx
// }).then(response => {
// let scene = {
// actNum,
// activeNavIdx
// }
let params = {
scene: `actNum=${actNum}&activeNavIdx=${activeNavIdx}`,
path: 'pages/checkProduct/checkProduct'
}
commonApi.createQrcode(params).then(response => {
console.log(response,'responseresponse')
let qrcode = response?.data
this.setData({
imgH: (imgH/imgW)*450
})
......@@ -106,13 +103,13 @@ Page({
height: imgH,
url: img,
},
// {
// x:imgW-64,
// y: imgH-arr[actNum]-64,
// width: 64,
// height: 64,
// url: response, //二维码
// },
{
x:imgW-64,
y: imgH-arr[actNum]-64,
width: 64,
height: 64,
url: qrcode, //二维码
},
];
drawFun.begin({
imageList: imgList,
......@@ -123,7 +120,7 @@ Page({
});
wx.hideLoading()
})
// })
})
}
})
}
......@@ -172,15 +169,30 @@ Page({
},
onRoute(options) {
wx.nextTick(()=>{
let { actNum,activeNavIdx,fromLocal } = this.options
this.shareQuery = `actNum=${actNum}&activeNavIdx=${activeNavIdx}`
console.log(" this.options: ", this.options);
this.setData({
actNum,
activeNavIdx,
fromLocal
})
this.createImg()
let { actNum, activeNavIdx, scene } = this.options
this.shareTitle = senceData[actNum].productList[activeNavIdx].proName
this.shareQuery = `actNum=${actNum}&activeNavIdx=${activeNavIdx}`
if(scene){
let qrcodeQuery = decodeURIComponent(scene)
let id = qrcodeQuery.split('=').pop()
let paramsObj = {}
if(id){
commonApi.getQrcodeParams({id}).then(res => {
console.log(res?.data?.scene,'responseresponse12233')
if(res.code=='0'){
let paramsArr = res?.data?.scene?.split('&');
paramsArr.forEach(item => {
let keyValArr = item?.split('=');
paramsObj[keyValArr[0]] = keyValArr[1]
})
this.setRouteParams({...paramsObj, fromLocal: 0})
}
})
}
}else{
this.setRouteParams(this.options)
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!