Commit 27c06926 authored by 罗超's avatar 罗超

新增对用户分享的支持

parent 443e3190
<script>
import {setAttatchParameter} from './plugin/utils.js'
export default {
data() {
return {
......@@ -7,18 +8,79 @@ export default {
};
},
onLaunch: function () {
//console.log('App Launch')
console.log('App Launch')
this.$utils.setAttatchParameter()
this.init();
this.formatPlat();
},
onShow: function () {
//console.log('App Show')
onLoad(option) {
// console.log('App OnLoad',option)
// // #ifdef MP-DI
// this.checkBindParentHandle(option.query)
// // #endif
},
onShow: function (option) {
console.log('App Show',option)
this.$utils.VersionUpdate()
// #ifdef MP-DI
this.checkBindParentHandle(option.query)
// #endif
},
onHide: function () {
//console.log('App Hide')
},
methods: {
checkBindParentHandle(query){
if(query && query.direct_user_id){
if(uni.getStorageSync('mall_UserInfo')){
const {OpenId,Unoinid,Name} = uni.getStorageSync('mall_UserInfo')
if(OpenId && Unoinid) {
const pid = parseInt(query.direct_user_id)
if(!isNaN(pid)) this.directUserLoginHandle(OpenId,Unoinid,pid,Name)
return
}
}
uni.setStorageSync('direct_user_id',query.direct_user_id)
}
},
directUserLoginHandle(OpenId,Unoinid,Pid,MallName){
const parameters={
OpenId,
Unoinid,
Pid
}
this.apipost("HePingGuoLvLogin_post", parameters, r =>{
const u = r.data
const user = {
accountId: u.directCustomerId,
customerId: u.directCustomerId,
customerInfoChildrenId: u.directCustomerId,
realNameAuthentication: 0,
account: "",
name:u.name,
customerName: MallName,
photo: u.photo,
secretKey: "",
token: u.token,
groupId: 0,
isMember: 0,
createBy: u.pid,
EmLoginMobile: u.moblie,
contactNumber: u.moblie,
salesBaseInfo: u.salesBaseInfo,
pid:u.pid,
erpBaseInfo: u.erpBaseInfo,
count: 0,
customerType: 1, //直客,2-同行
directCustomerId: u.directCustomerId //直客Id
}
uni.setStorageSync('b2b_user', user)
this.user = user
uni.setStorageSync("lastLogin",new Date().getTime())
this.$utils.setAttatchParameter()
})
},
init() {
if (uni.getStorageSync("basedata")) {
this.basedata = uni.getStorageSync("basedata");
......
......@@ -233,8 +233,8 @@
createBy: u.pid,
EmLoginMobile: u.moblie,
contactNumber: u.moblie,
salesBaseInfo: u.salesBaseInfo,
pid:u.pid,
salesBaseInfo: u.erpBaseInfo?u.erpBaseInfo:u.salesBaseInfo,
pid:u.erpBaseInfo?u.erpBaseInfo.employeeId:u.pid,
erpBaseInfo: u.erpBaseInfo,
count: 0,
customerType: 1, //直客,2-同行
......@@ -243,6 +243,7 @@
uni.setStorageSync('b2b_user', user)
this.$emit("changeuserinfo");
uni.setStorageSync("lastLogin",new Date().getTime())
this.$utils.setAttatchParameter()
},e=>{
uni.showToast({
title:'用户登录失败',
......
......@@ -190,7 +190,7 @@
return {
title: title,
query: "user_id=" + uid,
query: "user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER,
imageUrl: "",
};
},
......@@ -204,7 +204,7 @@
return {
title: title,
path: "/pages/index/index?user_id=" + uid,
path: "/pages/index/index?user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER,
imageUrl: "",
};
},
......
......@@ -2109,7 +2109,7 @@
"&configId=" +
this.delMsg.configId +
"&cityId=" +
this.delMsg.cityId,
this.delMsg.cityId+this.$uiConfig.DIRECT_PARAMETER,
imageUrl: imageUrl,
};
},
......@@ -2140,7 +2140,7 @@
"&configId=" +
this.delMsg.configId +
"&cityId=" +
this.delMsg.cityId,
this.delMsg.cityId+this.$uiConfig.DIRECT_PARAMETER,
imageUrl: "",
// imageUrl:
// this.dataList.tempImgCover && this.dataList.tempImgCover.length > 0
......
......@@ -114,6 +114,7 @@
uni.setStorageSync('b2b_user', user)
this.user = user
uni.setStorageSync("lastLogin",new Date().getTime())
this.$utils.setAttatchParameter()
uni.hideLoading()
})
},
......
......@@ -6,11 +6,13 @@ let topstyle = {
textColor: "#000"
}
let is_bang = false
let DIRECT_PARAMETER = '&direct_user_id=0'
export default {
mainColor,
secondary,
pricecolor,
topstyle,
is_bang
is_bang,
DIRECT_PARAMETER
}
\ No newline at end of file
......@@ -94,7 +94,6 @@ function SubscribeMsgAli(cb) {
//定义更新方法
function VersionUpdate() {
// 判断应用的 getUpdateManager 是否在当前版本可用
console.log('canIUse',uni.canIUse('getUpdateManager'))
if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager()
// 向小程序后台请求完新版本信息
......@@ -171,6 +170,18 @@ function formatDates(date, fmt) {
function padLeftZero(str) {
return ('00' + str).substr(str.length);
}
function setAttatchParameter(){
this.$uiConfig.DIRECT_PARAMETER = ''
if(uni.getStorageSync('b2b_user')){
const {salesBaseInfo, erpBaseInfo} = uni.getStorageSync('b2b_user')
if(erpBaseInfo && erpBaseInfo.employeeId){
this.$uiConfig.DIRECT_PARAMETER = '&direct_user_id='+erpBaseInfo.employeeId
}else if(salesBaseInfo && salesBaseInfo.employeeId){
this.$uiConfig.DIRECT_PARAMETER = '&direct_user_id='+salesBaseInfo.employeeId
}
}
}
function changeMoneyToChinese(Num) { // 数字转中文大写
if (!Num) {
return '零'
......@@ -353,4 +364,5 @@ export default {
VersionUpdate,
formatDates,
changeMoneyToChinese,
setAttatchParameter
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment