Commit 34092d64 by 胡悦

提交

1 parent 67472b4e
...@@ -115,7 +115,7 @@ class Request { ...@@ -115,7 +115,7 @@ class Request {
params.v = '1.0.0' params.v = '1.0.0'
params.format = 'json' params.format = 'json'
params.locale = 'zh_CN' params.locale = 'zh_CN'
params.source = 'dj-wechat' params.source = 'Aicard-wechat'
params.appKey = appKey params.appKey = appKey
return sign(params, secret, noSignAttr) return sign(params, secret, noSignAttr)
} }
......
...@@ -11,13 +11,14 @@ App({ ...@@ -11,13 +11,14 @@ App({
wx.$util = util wx.$util = util
wx.$router = router wx.$router = router
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/' 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') const systemInfo = wx.getStorageSync('srcm_shopmall_system_info')
if (!systemInfo) wx.getSystemInfo({ if (!systemInfo) wx.getSystemInfo({
success(res) { success(res) {
util.setStorageSync('srcm_shopmall_system_info', res) util.setStorageSync('srcm_shopmall_system_info', res)
} }
}) })
// this.login() this.login()
}, },
login(returnResponse) { login(returnResponse) {
let _this = this let _this = this
...@@ -30,14 +31,16 @@ App({ ...@@ -30,14 +31,16 @@ App({
code, code,
appId: _this.globalData.appId appId: _this.globalData.appId
}).then(res => { }).then(res => {
wx.$authStatus = res.code != 0 wx.$authStatus = res.code != 0
if (returnResponse) { if (returnResponse) {
resolve(res) resolve(res)
} else { } else {
util.setSessionId(res.data.sessionId)
if (res.code != -1) { if (res.code != -1) {
if (res.code == 0) { if (res.code == 0) {
util.setUserInfo(res.data) util.setUserInfo(res.data)
util.setSessionId(res.data.sessionId) // util.setSessionId(res.data.sessionId)
} else { } else {
util.showToast(res.message || '网络异常') util.showToast(res.message || '网络异常')
} }
...@@ -53,6 +56,5 @@ App({ ...@@ -53,6 +56,5 @@ App({
}) })
}, },
globalData: { globalData: {
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// pages/tab/index/index.js // pages/tab/index/index.js
import { menuMixin } from "../../../mixins/index"; import { menuMixin } from "../../../mixins/index";
import Draw from '../../../utils/Draw'; import Draw from '../../../utils/Draw';
import { ssoApi } from '../../../api/api';
Page({ Page({
behaviors: [menuMixin], behaviors: [menuMixin],
/** /**
...@@ -31,15 +32,17 @@ Page({ ...@@ -31,15 +32,17 @@ Page({
icon: "icon-video", icon: "icon-video",
icon1: "icon-video", icon1: "icon-video",
}, },
{ // {
name: "合作申请", // name: "合作申请",
icon: "icon-cooperation", // icon: "icon-cooperation",
icon1: "icon-cooperation", // icon1: "icon-cooperation",
}, // },
], ],
curTabIndex: 0, curTabIndex: 0,
// 0-员工,1-代理商 // 0-员工,1-代理商
customerType: 0, customerType: 0,
// 是否授权昵称
hasUserInfo: false
}, },
introduce(e) { introduce(e) {
const curTabIndex = e.currentTarget.dataset.index; const curTabIndex = e.currentTarget.dataset.index;
...@@ -68,10 +71,7 @@ Page({ ...@@ -68,10 +71,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// setTimeout(() => { console.log(this.data.hasUserInfo);
// wx.$router.go('application')
// }, 2e3)
console.log(this.data.menuMixin);
}, },
/** /**
...@@ -235,4 +235,36 @@ Page({ ...@@ -235,4 +235,36 @@ Page({
}; };
drawCard(); 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 @@ ...@@ -26,8 +26,14 @@
<import src="../../template/menu/menu.wxml" /> <import src="../../template/menu/menu.wxml" />
<block wx:if="{{curTabIndex === 1 }}"> <block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template> <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> </block>
</view> </view>
<button wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></button>
<!-- 服务咨询 --> <!-- 服务咨询 -->
<view bindtap="goConsult"> <view bindtap="goConsult">
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image> <image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
......
/* pages/tab/index/index.wxss */ /* pages/tab/index/index.wxss */
@import '../../template/channel/channel.wxss'; @import '../../template/channel/channel.wxss';
@import '../../template/menu/menu.wxss'; @import '../../template/menu/menu.wxss';
@import '../../template/company/company.wxss';
page { page {
background-color: #F5F5F7; background-color: #F5F5F7;
...@@ -79,3 +80,13 @@ page { ...@@ -79,3 +80,13 @@ page {
padding: 24rpx 0; padding: 24rpx 0;
flex: 1; 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 \ No newline at end of file
<template name="company"> <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> </template>
\ No newline at end of file \ 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 \ 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!