Commit 83ff14ec by 胡悦

优化代码

1 parent e28e4aaf
......@@ -14,12 +14,10 @@ App({
wx.$router = router
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx.$appId = wx.getAccountInfoSync().miniProgram.appId
this.globalData.appId = wx.getAccountInfoSync().miniProgram.appId
const systemInfo = wx.getStorageSync('srcm_shopmall_system_info')
const systemInfo = wx.getStorageSync('aicard_system_info')
if (!systemInfo) wx.getSystemInfo({
success(res) {
util.setStorageSync('srcm_shopmall_system_info', res)
util.setStorageSync('aicard_system_info', res)
}
})
if (options.path != 'pages/tab/index/index') {
......@@ -36,7 +34,7 @@ App({
}) {
ssoApi.jsCodeLogin({
code,
appId: _this.globalData.appId
appId: wx.$appId
}).then(res => {
wx.$authStatus = res.code != 0
util.setSessionId(res.data.sessionId)
......@@ -47,12 +45,10 @@ App({
if (returnResponse) {
resolve(result)
} else {
if (result.code != -1) {
if (result.code == 0) {
util.setUserInfo(result.data)
} else {
util.showToast(result.message || '网络异常')
}
if (result.code == 0) {
util.setUserInfo(result.data)
} else {
util.showToast(result.message || '网络异常')
}
resolve(result)
}
......@@ -63,10 +59,9 @@ App({
})
if (wx.$trackData.scene) {
_this.getScene(wx.$trackData.scene).then(res => {
console.log('scene', wx.$trackData.scene)
wx.$trackData.merchant = res.merchantId
wx.$trackData.cardId = res.cardId
const systemInfo = JSON.parse(wx.getStorageSync('srcm_shopmall_system_info'))
const systemInfo = JSON.parse(wx.getStorageSync('aicard_system_info'))
wx.$trackData.type = systemInfo.environment ? 2 : 1
wx.$Track.sendTrack(trackData.COMPANY)
})
......
......@@ -4,7 +4,6 @@
<block wx:if="{{!showWechant}}">
<view class="user-company">
<image class="company-logo" src="{{IMGURL}}home/logo.png"></image>
<!-- <text>汽车流通行业数字化运营服务商</text> -->
</view>
<view class="user-name">
<view class="name">{{cardInfo.staffName || ''}}</view>
......
// pages/addTransform/detail/detail.js
import pageData from '../constant/data'
import util from '../../../utils/util'
Page({
/**
......@@ -10,13 +11,20 @@ Page({
attrName: '',
proName: '',
addDatailObj: pageData.addDatailObj,
detailObj: {}
detailObj: {},
hasShare: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(util.getUserInfo())
if (util.getUserInfo().phone) {
this.setData({
hasShare: true
})
}
wx.$router.getData(({
attrName,
proName
......
......@@ -23,10 +23,10 @@
<video class="video" wx:for="{{detailObj.videoList}}" wx:key="index" title="案例视频:{{proName}}" src="{{IMGURL}}{{item.url}}?v={{img_version}}"></video>
</view>
<view class="fixed-btn">
<view class="btn-share" bindtap="handleShare">
<view class="fixed-btn" wx:if="{{hasShare}}">
<button class="btn-share" open-type="share">
<image class="btn-icon" src="{{IMGURL}}addTransform/detail/share.png?v={{img_version}}"/>
<text>分享此页面</text>
</view>
</button>
</view>
</view>
\ No newline at end of file
......@@ -10,7 +10,7 @@ class Draw {
constructor(_this_, canvasObject) {
let {
pixelRatio
} = JSON.parse(wx.getStorageSync('srcm_shopmall_system_info'))
} = JSON.parse(wx.getStorageSync('aicard_system_info'))
this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || pixelRatio || 2
const height = this.toRpx(canvasObject.height),
......
......@@ -176,7 +176,7 @@ class TRACK {
model,
system,
version
} = JSON.parse(wx.getStorageSync('srcm_shopmall_system_info'))
} = JSON.parse(wx.getStorageSync('aicard_system_info'))
return {
SDK_version: SDKVersion,
brand,
......
......@@ -246,14 +246,14 @@ const isFullSucreen = (isComponents) => {
}
/** */
const getSessionId = () => {
return wx.getStorageSync('scrm_shopmall_sessionId')
return wx.getStorageSync('aicard_sessionId')
}
const setSessionId = sessionId => {
wx.setStorageSync('scrm_shopmall_sessionId', sessionId)
wx.setStorageSync('aicard_sessionId', sessionId)
}
const removeSystemStorage = () => {
wx.removeStorageSync('srcm_shopmall_user_info')
wx.removeStorageSync('scrm_shopmall_sessionId')
wx.removeStorageSync('aicard_user_info')
wx.removeStorageSync('aicard_sessionId')
wx.removeStorageSync('guest_no')
wx.removeStorageSync('equity_info')
wx.removeStorageSync('packageList')
......@@ -303,12 +303,12 @@ const phoneCall = phoneNumber => {
}
/**获取用户信息 */
const getUserInfo = () => {
let user = wx.getStorageSync('srcm_shopmall_user_info') || null
let user = wx.getStorageSync('aicard_user_info') || null
return JSON.parse(user)
}
/**设置用户信息 */
const setUserInfo = userInfo => {
wx.setStorageSync('srcm_shopmall_user_info', JSON.stringify(userInfo))
wx.setStorageSync('aicard_user_info', JSON.stringify(userInfo))
}
/**IOS时间兼容 */
const iosTimeFormat = time => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!