提交 2979bea1 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 a35a72cf
...@@ -25,3 +25,8 @@ export function getShare(data) { ...@@ -25,3 +25,8 @@ export function getShare(data) {
export function getQrcode(data) { export function getQrcode(data) {
return httpRequest.get('/api/lms/util/pcode', data) return httpRequest.get('/api/lms/util/pcode', data)
} }
// 获取二维码
export function imageTransfer(data) {
return httpRequest.get('/api/usercenter/tool/transfer-image', data)
}
import { getShare, getQrcode } from '../../api/base.js' import { getShare, getQrcode, imageTransfer } from '../../api/base.js'
import { wxml, style } from './share.js' import { wxml, style } from './share.js'
const app = getApp() const app = getApp()
...@@ -43,7 +43,8 @@ Component({ ...@@ -43,7 +43,8 @@ Component({
text: '本质上,我们都生活在我们与内部体验或者外部事件的主观互动中。', text: '本质上,我们都生活在我们与内部体验或者外部事件的主观互动中。',
avatar: '' avatar: ''
}, },
wxUserProfile: {} wxUserProfile: {},
numLength: 1
}, },
lifetimes: { lifetimes: {
attached() { attached() {
...@@ -90,6 +91,8 @@ Component({ ...@@ -90,6 +91,8 @@ Component({
data.course_name = data.course_name ? data.course_name.replace(/(\(|()(.+)(\)|))/, '') : '' data.course_name = data.course_name ? data.course_name.replace(/(\(|()(.+)(\)|))/, '') : ''
data.course_name = `《${data.course_name}》课程` data.course_name = `《${data.course_name}》课程`
data.chapter_name = data.chapter_name ? data.chapter_name.replace(/(\(|()(.+)(\)|))/, '') : '' data.chapter_name = data.chapter_name ? data.chapter_name.replace(/(\(|()(.+)(\)|))/, '') : ''
data.used_day = 123
const numLength = data.used_day.toString().length
// 两门课单独判断 // 两门课单独判断
if (data.course_name.includes('整合心理学与批判性思考')) { if (data.course_name.includes('整合心理学与批判性思考')) {
...@@ -107,7 +110,7 @@ Component({ ...@@ -107,7 +110,7 @@ Component({
this.setData({ textList, 'controls.text': textList[0] }) this.setData({ textList, 'controls.text': textList[0] })
} }
this.setData({ share: Object.assign(data, { lecturer }) }) this.setData({ share: Object.assign(data, { lecturer }), numLength })
return res return res
}) })
}, },
...@@ -126,9 +129,12 @@ Component({ ...@@ -126,9 +129,12 @@ Component({
wx.getUserProfile({ desc: '使用头像生成海报' }) wx.getUserProfile({ desc: '使用头像生成海报' })
.then(res => { .then(res => {
const userInfo = res.userInfo const userInfo = res.userInfo
this.data.avatarList.push(userInfo.avatarUrl) imageTransfer({ source: userInfo.avatarUrl }).then(res => {
this.setData({ wxUserProfile: userInfo, avatarList: this.data.avatarList }) userInfo.avatarUrl = res
wx.setStorageSync('userInfo', JSON.stringify(userInfo)) this.data.avatarList.push(userInfo.avatarUrl)
this.setData({ wxUserProfile: userInfo, avatarList: this.data.avatarList })
wx.setStorageSync('userInfo', JSON.stringify(userInfo))
})
}) })
.catch(() => { .catch(() => {
wx.showToast({ title: '获取微信头像失败', icon: 'none' }) wx.showToast({ title: '获取微信头像失败', icon: 'none' })
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
<view class="footer"> <view class="footer">
<view class="footer-left"> <view class="footer-left">
<view class="tips"> <view class="tips">
我已坚持学习<text class="num"> {{ share.used_day }} </text>天</view <text>我已坚持学习</text>
> <text class="num" style="width:{{ numLength * 11 }}px;"> {{ share.used_day }} </text><text>天</text>
</view>
<view>我离学位殿堂又近了一步</view> <view>我离学位殿堂又近了一步</view>
</view> </view>
<image src="{{ qrcode }}" class="footer-right"></image> <image src="{{ qrcode }}" class="footer-right"></image>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
.text { .text {
margin-top: 56px; margin-top: 56px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; width: 200px;
height: 36px; height: 36px;
font-size: 13px; font-size: 13px;
font-weight: bold; font-weight: bold;
...@@ -109,16 +109,19 @@ ...@@ -109,16 +109,19 @@
flex: 1; flex: 1;
font-size: 12px; font-size: 12px;
color: #1a1a1a; color: #1a1a1a;
line-height: 18px; line-height: 1;
} }
.footer-left .tips { .footer-left .tips {
display: flex; display: flex;
align-items: center; align-items: flex-end;
height: 18px;
margin-bottom: 6px;
} }
.num { .num {
font-size: 17px; font-size: 17px;
color: #d78c4a; color: #d78c4a;
font-weight: bold; font-weight: bold;
text-align: center;
} }
.footer-right { .footer-right {
width: 50px; width: 50px;
...@@ -228,7 +231,7 @@ button::after { ...@@ -228,7 +231,7 @@ button::after {
border: 3px solid #ccc; border: 3px solid #ccc;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
padding: 12px; padding: 10px;
font-size: 13px; font-size: 13px;
color: #1a1a1a; color: #1a1a1a;
line-height: 18px; line-height: 18px;
......
...@@ -120,31 +120,35 @@ const style = function (data) { ...@@ -120,31 +120,35 @@ const style = function (data) {
justifyContent: 'center' justifyContent: 'center'
}, },
box: { box: {
marginBottom: 6,
width: 140, width: 140,
height: 20, height: 20,
flexDirection: 'row' flexDirection: 'row',
alignItems: 'flex-end'
}, },
t1: { t1: {
marginiTop: 8,
width: 72, width: 72,
height: 20, height: 12,
fontSize: 12, fontSize: 12,
lineHeight: 20, lineHeight: 12,
color: '#1A1A1A' color: '#1A1A1A'
}, },
t2: { t2: {
width: numLength * 12, width: numLength * 11,
height: 20, height: 17,
fontSize: 17, fontSize: 17,
fontWeight: 'bold', fontWeight: 'bold',
lineHeight: 20, lineHeight: 17,
color: '#D78C4A', color: '#D78C4A',
textAlign: 'center' textAlign: 'center'
}, },
t3: { t3: {
marginiTop: 8,
width: 12, width: 12,
height: 20, height: 12,
fontSize: 12, fontSize: 12,
lineHeight: 20, lineHeight: 12,
color: '#1A1A1A' color: '#1A1A1A'
}, },
tips: { tips: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论