Commit b4ccc0e3 authored by youjie's avatar youjie

no message

parent 4c868bbc
...@@ -143,6 +143,18 @@ export function GetOrderPage(data) { ...@@ -143,6 +143,18 @@ export function GetOrderPage(data) {
}) })
} }
/**
* 进入亲友团
* @param {JSON参数} data
*/
export function SetFriend(data) {
return request({
url: '/AppletCenter/SetFriend',
method: 'post',
data
})
}
/** /**
* 获取“我的孩子”列表 * 获取“我的孩子”列表
* @param {JSON参数} data * @param {JSON参数} data
......
...@@ -45,18 +45,17 @@ ...@@ -45,18 +45,17 @@
<view class="addChild-header flex"> <view class="addChild-header flex">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1664160541000_21.png" <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1664160541000_21.png"
style="width: 352rpx;height: 218rpx;"></image> style="width: 352rpx;height: 218rpx;"></image>
<text>李欣芮的亲友团</text> <text>{{AccountName?AccountName:'**'}}的亲友团</text>
</view> </view>
<view class="title"> <view class="title">
Ranjunjun邀请您加入亲友团 {{nickName?nickName:'**'}}邀请您加入亲友团
</view> </view>
<view v-if="loading" class="addChild-buttom" @click="addFriend"> <view v-if="loading" class="addChild-buttom" @click="getUserProfile">
立即加入 立即加入
</view> </view>
<view v-else class="addChild-buttom active"> <view v-else class="addChild-buttom active">
立即加入 立即加入
</view> </view>
</view> </view>
</template> </template>
...@@ -75,7 +74,7 @@ ...@@ -75,7 +74,7 @@
import Loadmore from "../../components/loadmore.vue"; import Loadmore from "../../components/loadmore.vue";
import bottom from "../../components/bottom"; import bottom from "../../components/bottom";
import { import {
GetStudentPageList,SetMyChild getWeChatOpenId,loginByUnionId,getLoginAccounts,SetFriend
} from "../../api/erp"; } from "../../api/erp";
export default { export default {
components: { components: {
...@@ -87,43 +86,129 @@ ...@@ -87,43 +86,129 @@
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
let data = reactive({ let data = reactive({
erpUserInfo:null, obj: {
userInfo:null, Name: '',
Photo: '',
},
nickName:'',
AccountName:'',
OldUnionId:'',
loading:true, loading:true,
form:{ form:{
StuId:'', OldUnionId:'',
UnionId:'' NewUnionId:''
},
msg: {
}, },
dataList: [],
}); });
const pages = getCurrentPages() // 获取栈实例
const currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
const methods = { const methods = {
async addFriend(){ getUserProfile() {
data.loading = false //新的获取用户资料
var that = this;
wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (info) => {
uni.setStorageSync('userWxInfo',info)
wx.login({
//成功放回
success:(res)=>{
uni.showLoading({
title:'尝试授权登陆'
})
that.loginByOpenCode(res.code)
}
})
},
fail: () => {
uni.showToast({
title: "微信授权失败",
icon: "none",
});
},
});
},
loginByOpenCode(Code){
getWeChatOpenId({Code}).then(r=>{
uni.setStorageSync('wxUserAuthInfo',r.Data)
data.userAuth=r.Data
if(r.Data.unionid){
that.addFriend(r)
}
}).catch(e=>{})
},
addFriend(r){
data.form = {
OldUnionId: data.OldUnionId,
NewUnionId: uni.getStorageSync('wxUserAuthInfo').unionid
}
data.loading = false
uni.showLoading() uni.showLoading()
let res = await SetMyChild(data.form); let res = SetFriend(data.form);
if (res) { if (res.Code==1) {
uni.hideLoading() uni.hideLoading()
data.loading = true data.loading = true
uni.redirectTo({ that.setUserLoginByUnionId(r.Data.unionid)
url: `/pages/login/login?RealPhone=${this.erpUserInfo.RealPhone}&Account=${this.userInfo.Account}`, }else{
}); uni.hideLoading()
data.loading = true
uni.showToast({
title: res.Message,
icon: "none",
});
} }
}, },
async getData() { setUserLoginByUnionId(uid){
uni.showLoading() loginByUnionId({uid}).then(r=>{
let res = await GetStudentPageList(data.msg); if(r.Data && r.Data.length>0){
if (res) { uni.setStorageSync("ErpStus",r.Data)
let account=[]
r.Data.forEach(x=>{
account.push(x.ClassInAccount)
})
that.setAccountsLogin(`'${account.join("','")}'`)
}
}).catch(x=>{
uni.hideLoading() uni.hideLoading()
data.loading = true
})
},
setAccountsLogin(Accounts){
getLoginAccounts({Accounts}).then(r=>{
let erpStus=uni.getStorageSync('ErpStus')
uni.hideLoading()
data.loading = true
if(r.Data && r.Data.length>0){
if(erpStus){
erpStus.forEach(x=>{
if(x.ClassInAccount==r.Data[0].Account){
uni.setStorageSync('erpUserInfo',x)
}
})
}
uni.setStorageSync("userInfo", r.Data[0]);
uni.setStorageSync("users",r.Data)
console.log(r.Data && r.Data.length>0)
uni.reLaunch({
url:'/pages/index/index'
})
}else if(erpStus){
uni.setStorageSync('erpUserInfo',x[0])
uni.reLaunch({
url:'/pages/index/index'
})
}
} }).catch(e=>{
uni.hideLoading()
data.loading = true
})
}, },
}; };
let that = methods; let that = methods;
onMounted(() => { onMounted(() => {
// that.getData()
}); });
return { return {
...toRefs(data), ...toRefs(data),
...@@ -131,15 +216,12 @@ ...@@ -131,15 +216,12 @@
}; };
}, },
onLoad(options) { onLoad(options) {
this.OldUnionId = options.unionid
this.AccountName = options.AccountName
this.nickName = options.nickName
}, },
onShow(){ onShow(){
this.erpUserInfo = uni.getStorageSync('erpUserInfo')
this.userInfo = uni.getStorageSync('userInfo')
this.form = {
StuId: '',
UnionId: uni.getStorageSync('wxUserAuthInfo').unionid
}
}, },
onReachBottom() { onReachBottom() {
......
...@@ -227,10 +227,11 @@ ...@@ -227,10 +227,11 @@
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
let data = reactive({ let data = reactive({
userWxInfo:null,
wxUserAuthInfo:null,
erpUserInfo:null,
erpUrl:'', erpUrl:'',
QRcodeImg:'', QRcodeImg:'',
erpUserInfo:null,
userInfo:null,
FriendCount: null, FriendCount: null,
loading:true, loading:true,
Account:'', Account:'',
...@@ -241,6 +242,7 @@ ...@@ -241,6 +242,7 @@
}, },
dataList: [], dataList: [],
statusBarHeight: 0, statusBarHeight: 0,
}); });
const methods = { const methods = {
// 删除接口 // 删除接口
...@@ -276,7 +278,8 @@ ...@@ -276,7 +278,8 @@
async QRcode(){ async QRcode(){
uni.showLoading() uni.showLoading()
let msg = { let msg = {
url: `/pages/FriendsAndRelatives/addFriendsAndRelatives?RealPhone=${this.erpUserInfo.RealPhone}&Account=${this.userInfo.Account}`,//"www.baidu.com", url: `/pages/FriendsAndRelatives/addFriendsAndRelatives?unionid=${data.wxUserAuthInfo.unionid}
&AccountName=${data.erpUserInfo.AccountName}&nickName=${data.userWxInfo.nickName}`,//"www.baidu.com",
width: 200 width: 200
} }
let res = await CreateFriendQrCode(msg); let res = await CreateFriendQrCode(msg);
...@@ -306,10 +309,10 @@ ...@@ -306,10 +309,10 @@
} }
}, },
}; };
let that = methods;
onMounted(() => { onMounted(() => {
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight; data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
}) })
let that = methods;
return { return {
...toRefs(data), ...toRefs(data),
...methods ...methods
...@@ -320,20 +323,19 @@ ...@@ -320,20 +323,19 @@
}, },
onShow(){ onShow(){
this.erpUrl = this.$erpImgUrl this.erpUrl = this.$erpImgUrl
this.userWxInfo = uni.getStorageSync('userWxInfo').userInfo
this.wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo')
this.erpUserInfo = uni.getStorageSync('erpUserInfo') this.erpUserInfo = uni.getStorageSync('erpUserInfo')
this.userInfo = uni.getStorageSync('userInfo')
this.getData() this.getData()
}, },
onReachBottom() { onReachBottom() {
}, },
onShareAppMessage() { onShareAppMessage() {
// console.log(uni.getStorageSync('RealPhone'),'==')
// console.log(uni.getStorageSync('Account'))
return { return {
title: "邀请好友", title: "邀请好友",
query: `/pages/FriendsAndRelatives/addFriendsAndRelatives?RealPhone=${this.erpUserInfo.RealPhone}&Account=${this.userInfo.Account}`, query: `/pages/FriendsAndRelatives/addFriendsAndRelatives?unionid=${this.wxUserAuthInfo.unionid}
&AccountName=${this.erpUserInfo.AccountName}&nickName=${this.userWxInfo.nickName}`,
imageUrl: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1664163809000_838.png", imageUrl: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1664163809000_838.png",
}; };
}, },
......
...@@ -68,13 +68,7 @@ ...@@ -68,13 +68,7 @@
}; };
}, },
onLoad(options) { onLoad(options) {
// 微信邀请过来的数据存储
if(options.RealPhone){
uni.setStorageSync('RealPhone',options.RealPhone)
}
if(options.Account){
uni.setStorageSync('Account',options.Account)
}
} }
}; };
</script> </script>
......
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