Commit 34092d64 by 胡悦

提交

1 parent 67472b4e
......@@ -115,7 +115,7 @@ class Request {
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
params.source = 'dj-wechat'
params.source = 'Aicard-wechat'
params.appKey = appKey
return sign(params, secret, noSignAttr)
}
......
......@@ -11,13 +11,14 @@ App({
wx.$util = util
wx.$router = router
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
this.globalData.appId = wx.getAccountInfoSync().miniProgram.appId
const systemInfo = wx.getStorageSync('srcm_shopmall_system_info')
if (!systemInfo) wx.getSystemInfo({
success(res) {
util.setStorageSync('srcm_shopmall_system_info', res)
}
})
// this.login()
this.login()
},
login(returnResponse) {
let _this = this
......@@ -30,14 +31,16 @@ App({
code,
appId: _this.globalData.appId
}).then(res => {
wx.$authStatus = res.code != 0
if (returnResponse) {
resolve(res)
} else {
util.setSessionId(res.data.sessionId)
if (res.code != -1) {
if (res.code == 0) {
util.setUserInfo(res.data)
util.setSessionId(res.data.sessionId)
// util.setSessionId(res.data.sessionId)
} else {
util.showToast(res.message || '网络异常')
}
......@@ -53,6 +56,5 @@ App({
})
},
globalData: {
}
})
\ No newline at end of file
})
\ No newline at end of file
......@@ -8,6 +8,7 @@
// pages/tab/index/index.js
import { menuMixin } from "../../../mixins/index";
import Draw from '../../../utils/Draw';
import { ssoApi } from '../../../api/api';
Page({
behaviors: [menuMixin],
/**
......@@ -31,15 +32,17 @@ Page({
icon: "icon-video",
icon1: "icon-video",
},
{
name: "合作申请",
icon: "icon-cooperation",
icon1: "icon-cooperation",
},
// {
// name: "合作申请",
// icon: "icon-cooperation",
// icon1: "icon-cooperation",
// },
],
curTabIndex: 0,
// 0-员工,1-代理商
customerType: 0,
// 是否授权昵称
hasUserInfo: false
},
introduce(e) {
const curTabIndex = e.currentTarget.dataset.index;
......@@ -68,10 +71,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// setTimeout(() => {
// wx.$router.go('application')
// }, 2e3)
console.log(this.data.menuMixin);
console.log(this.data.hasUserInfo);
},
/**
......@@ -235,4 +235,36 @@ Page({
};
drawCard();
},
// 获取用户昵称
getUserProfile(e) {
console.log(e)
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '用于完善资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
console.log(this.data.hasUserInfo)
this.setData({
hasUserInfo: true
})
ssoApi.authUserInfo({
...res
}).then(({
code
}) => {
if (code == '0') {
getApp().login().then(({
data
}) => {
this.setData({
userInfo: data,
// hasUserInfo: true
})
})
}
})
}
})
},
});
......@@ -26,8 +26,14 @@
<import src="../../template/menu/menu.wxml" />
<block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template>
<block wx:if="{{curIntroduceIndex === 0}}">企微魔方</block>
<block wx:elif="{{curIntroduceIndex === 1}}">数字化权益</block>
<block wx:elif="{{curIntroduceIndex == 2}}">智能线索</block>
</block>
</view>
<button wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></button>
<!-- 服务咨询 -->
<view bindtap="goConsult">
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
......
/* pages/tab/index/index.wxss */
@import '../../template/channel/channel.wxss';
@import '../../template/menu/menu.wxss';
@import '../../template/company/company.wxss';
page {
background-color: #F5F5F7;
......@@ -78,4 +79,14 @@ page {
background: #FFFFFF;
padding: 24rpx 0;
flex: 1;
}
/* 用户授权 */
.user-profile {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
background-color: transparent;
}
\ No newline at end of file
<template name="company">
<text>公司介绍的页面</text>
<view class="company-wrapper">
<view>广联数科</view>
<image class="m-t-md" src="https://img.zcool.cn/community/01a8ea580b48c1a84a0e282b41f540.jpg@1280w_1l_2o_100sh.jpg"></image>
</view>
</template>
\ No newline at end of file
.company-wrapper {
text-align: center;
padding: 48rpx 24rpx;
}
.m-t-md {
margin-top: 20rpx;
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!