Commit 6f93ab89 authored by wangxuelai's avatar wangxuelai

''

parent 07c17fe4
......@@ -25,6 +25,7 @@ const apis = {
clockSs: `${api}common/login`,
newUpdateUserInfo: `${api}consumer/clock/userinfo/new_update_user_info`,
studentTasks: `${api}student/tasks`,
baseUserShow: `${api}student/has_school`
},
userIndex: {
circleList: `${api}consumer/clock/circle/index`,
......@@ -121,6 +122,7 @@ const apis = {
},
myAchievement: {
certificates: `${api}student/certificates`,
certificate: `${api}student/certificate`,
honors: `${api}student/honors`,
}
},
......
......@@ -41,7 +41,7 @@
"list": []
},
"miniprogram": {
"current": 149,
"current": 151,
"list": [
{
"id": 0,
......@@ -1069,7 +1069,7 @@
"id": 146,
"name": "消费者日历打卡主页",
"pathName": "src/pages/calendarthemeindex/index",
"query": "tid=14&id=4",
"query": "tid=24&id=4",
"scene": null
},
{
......@@ -1087,10 +1087,24 @@
"scene": null
},
{
"id": -1,
"id": 149,
"name": "消费者邀请卡片页面",
"pathName": "src/pages/invitationcard/index",
"query": "tid=14&id=4",
"query": "tid=5&id=3",
"scene": null
},
{
"id": -1,
"name": "消费者邀请卡片页面",
"pathName": "src/pages/invitation/index",
"query": "tid=5&consumerId=111",
"scene": null
},
{
"id": -1,
"name": "我的成就页面",
"pathName": "src/pages/myachievement/index",
"query": "sid=5",
"scene": null
}
]
......
......@@ -215,7 +215,14 @@ function calendarClockRank (data) {
errorresolve: 1,
})
}
function baseUserShow (data) {
return wxRequest({
url: apis.customer.common.baseUserShow,
data,
method: 'GET',
errorresolve: 1,
})
}
export {
cOssAccess,
getCircleUserShow,
......@@ -236,5 +243,6 @@ export {
exampleGet,
rankrecord,
ranklike,
calendarClockRank
calendarClockRank,
baseUserShow
}
\ No newline at end of file
......@@ -19,7 +19,16 @@ function honors (data) {
errorresolve: 1,
})
}
function certificate (data) {
return wxRequest({
url: apis.customer.myAchievement.certificate,
data,
method: 'GET',
errorresolve: 2,
})
}
export {
certificates,
honors
honors,
certificate
}
\ No newline at end of file
......@@ -52,6 +52,9 @@ import initCalendar, {
jump
} from '../../../components/calendar/main.js';
import regexp from '../../../constants/regexp.js';
import {
certificate
} from '../../../service/customer/myachievement.js';
const innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
var app = getApp();
Page({
......@@ -2196,5 +2199,164 @@ Page({
},
numberDate(date){
return date.split('-')[0]+'-'+Number(date.split('-')[1])+'-'+Number(date.split('-')[2])
},
graduatePoster () { //生成结课证书
const posterMateria = getDailyMateria();
const visitor = LocalStorage.getItem('visitor');
const userInfo = visitor && visitor.userInfo;
const circleInfo = this.data.circleInfo;
const date = dateDetail(this.data.datetime)
wx.showLoading({
title: '日签生成中...'
})
let qrcode = '';
generateCustomerQrcode({
scene: `i=${this.data.id}&t=${this.data.tid}&p=7`,
page: `src/pages/themeindex/index`
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
qrcode = imagify(data.url);
} else {
qrcode = '';
}
}).then(() => {
if (qrcode == '') {
wx.showToast({
title: '生成失败',
icon: 'none'
})
return;
}
return certificate({
subject_id: this.data.tid
})
}).then ((res) => {
const {code, data} = res;
if (code != 200) {
wx.showToast({
title: '生成失败',
icon: 'none'
})
return;
}
let certificateInfo = data;
this.setData({
painting: {
width: 750,
height: 1334,
views: [
{ // 背景
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav3/2c/graduateposter/bg.png',
top: 0,
left: 0,
width: 750,
height: 1334
},
{ // 头像
type: 'image',
url: certificateInfo.avatar,
top: 274,
left: 313,
width: 124,
height: 124
},
{ // 头像
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav3/2c/graduateposter/avatarcircle.png',
top: 274,
left: 313,
width: 124,
height: 124
},
{ // 二维码
type: 'image',
url: qrcode,
top: 1208,
left: 132,
width: 118,
height: 118
},
{ // 昵称
type: 'text',
content: certificateInfo.nickname,
fontSize: 30,
color: '#000000',
textAlign: 'center',
top: 420,
left: 375,
bolder: true
},
{ // 主题名称
type: 'text',
content: certificateInfo.subject.title,
fontSize: 40,
color: '#000000',
textAlign: 'center',
top: 570,
left: 375,
width: 410,
MaxLineNumber: 1,
breakWord: true,
bolder: true
},
{ // 打卡天数
type: 'text',
content: certificateInfo.clock_day,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 130,
bolder: true
},
{ // 连续打卡
type: 'text',
content: certificateInfo.clock_continuous,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 375,
bolder: true
},
{ // 收到点赞
type: 'text',
content: certificateInfo.like,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 610,
bolder: true
},
{ // 机构名称
type: 'text',
content: certificateInfo.school.title,
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1070,
left: 730,
// bolder: true
},
{ // 结课日期
type: 'text',
content: date.chineseDate,
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1112,
left: 730,
// bolder: true
},
]
}
})
})
}
})
\ No newline at end of file
......@@ -6,6 +6,9 @@ import {
import {
subjectClassStudent
} from '../../../service/customer/circleindex.js';
import {
baseUserShow
} from '../../../service/common.js';
var app = getApp();
Page({
......@@ -124,7 +127,7 @@ Page({
})
},
userShow (school_id) {
userShow({
baseUserShow({
school_id,
consumer_id: this.data.consumerId
}).then((res) => {
......
......@@ -3,6 +3,9 @@ import {
userShow,
themeDetail,
} from '../../../service/customer/themeindex.js';
import {
baseUserShow
} from '../../../service/common.js';
import {
LocalStorage,
imagify
......@@ -134,7 +137,7 @@ Page({
},
userShow (school_id) {
const visitor = LocalStorage.getItem('visitor')
userShow({
baseUserShow({
school_id,
consumer_id: visitor && visitor.id
}).then((res) => {
......
......@@ -6,6 +6,13 @@ import {
certificates,
honors
} from '../../../service/customer/myachievement.js';
import {
generateCustomerQrcode
} from '../../../service/common.js';
import {
dateDetail,
imagify
} from '../../../utilities/index.js';
var app = getApp();
Page({
data: {
......@@ -18,53 +25,61 @@ Page({
medalCount: 0,
clockday: 0,
clockCount: 0,
medalImgMap: [{
lingt: `${app.globalData.imageRoot}2c/usermedal/light1.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark1.png`,
day: 1
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light7.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark7.png`,
day: 7
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light14.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark14.png`,
day: 14
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light100.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark100.png`,
day: 100
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light120.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark120.png`,
day: 120
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light180.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark180.png`,
day: 180
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light200.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark200.png`,
day: 200
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light270.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark270.png`,
day: 270
medalImgMap: [
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light1.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark1.png`,
day: 1
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light7.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark7.png`,
day: 7
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light14.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark14.png`,
day: 14
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light100.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark100.png`,
day: 100
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light120.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark120.png`,
day: 120
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light180.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark180.png`,
day: 180
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light200.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark200.png`,
day: 200
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light270.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark270.png`,
day: 270
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light300.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark300.png`,
day: 300
},
],
canvasShow: false,
canvasImagePath: '',
posterBoxShow: false,
posterBox: {
},
{
lingt: `${app.globalData.imageRoot}2c/usermedal/light300.png`,
dark: `${app.globalData.imageRoot}2c/usermedal/dark300.png`,
day: 300
},
]
currentSubjectId: 0
},
onLoad: function(options) { // Do some initialize when page load.
const {sid} = options;
......@@ -109,6 +124,9 @@ Page({
if (code != 200) {
return
}
data.list.forEach((ele) => {
ele.createTimeobj = dateDetail(ele.created_at)
})
this.setData({
cerCount: data.total,
cerBooks: data.list,
......@@ -140,5 +158,190 @@ Page({
this.setData({
medalCount: count
})
}
},
graduatePoster (e) { //生成结课证书
const {dataset} = e.currentTarget;
const certificateInfo = dataset.posterdata;
this.data.currentSubjectId = certificateInfo.subject.id;
const date = certificateInfo.createTimeobj.chineseDate;
if (this.data.posterBox[certificateInfo.subject.id]) {
this.setData({
canvasShow: false,
canvasImagePath: this.data.posterBox[certificateInfo.subject.id],
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: '',
})
return;
}
wx.showLoading({
title: '日签生成中...'
})
generateCustomerQrcode({
scene: `i=${certificateInfo.subject.class_id}&t=${certificateInfo.subject.id}`,
page: `src/pages/themeindex/index`
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
return imagify(data.url);
} else {
return '';
}
}).then ((qrcode) => {
if (qrcode == '') {
wx.showToast({
title: '生成失败',
icon: 'none'
})
return;
}
this.setData({
painting: {
width: 750,
height: 1334,
views: [
{ // 背景
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav3/2c/graduateposter/bg.png',
top: 0,
left: 0,
width: 750,
height: 1334
},
{ // 头像
type: 'image',
url: certificateInfo.avatar,
top: 274,
left: 313,
width: 124,
height: 124
},
{ // 头像
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav3/2c/graduateposter/avatarcircle.png',
top: 274,
left: 313,
width: 124,
height: 124
},
{ // 二维码
type: 'image',
url: qrcode,
top: 1208,
left: 132,
width: 118,
height: 118
},
{ // 昵称
type: 'text',
content: certificateInfo.nickname,
fontSize: 30,
color: '#000000',
textAlign: 'center',
top: 420,
left: 375,
bolder: true
},
{ // 主题名称
type: 'text',
content: certificateInfo.subject.title,
fontSize: 40,
color: '#000000',
textAlign: 'center',
top: 570,
left: 375,
width: 410,
MaxLineNumber: 1,
breakWord: true,
bolder: true
},
{ // 打卡天数
type: 'text',
content: certificateInfo.clock_day,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 130,
bolder: true
},
{ // 连续打卡
type: 'text',
content: certificateInfo.clock_continuous,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 375,
bolder: true
},
{ // 收到点赞
type: 'text',
content: certificateInfo.like,
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 610,
bolder: true
},
{ // 机构名称
type: 'text',
content: certificateInfo.school.title,
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1070,
left: 730,
// bolder: true
},
{ // 结课日期
type: 'text',
content: date,
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1112,
left: 730,
// bolder: true
},
]
}
})
})
},
eventGetImage (e) {
const {detail} = e;
wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') {
this.setData({
canvasShow: false,
canvasImagePath: e.detail.tempFilePath,
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: '',
[`posterBox[${this.data.currentSubjectId}]`]: e.detail.tempFilePath
}, () => {
})
this.setData({
painting:{}
})
} else {
this.setData({
painting:{}
})
wx.showToast({
title: '生成失败',
icon: 'none'
})
}
},
closeposter() {
this.setData({
posterBoxShow: false
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFD85C"
"navigationBarBackgroundColor": "#FFD85C",
"usingComponents": {
"poster-box": "../../../components/posterbox",
"canvasdrawer": "/components/canvasdrawer/canvasdrawer"
}
}
\ No newline at end of file
......@@ -17,13 +17,23 @@
scroll-x="{{true}}"
style="width: auto;overflow:hidden;"
>
<view class="certificatebox" hover-class="none" hover-stop-propagation="false" wx:for="{{cerBooks}}" wx:key="{{index}}" data-posterdata="{{item}}" bindtap="graduatePoster">
<image class="bg" src="{{imageRoot}}2c/graduateposter/bg.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="avatar" src="{{item.avatar}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<view class="nickname" hover-class="none" hover-stop-propagation="false">{{item.nickname}}</view>
<view class="static staticleft" hover-class="none" hover-stop-propagation="false">{{item.clock_day}}</view>
<view class="static staticcenter" hover-class="none" hover-stop-propagation="false">{{item.clock_continuous}}</view>
<view class="static staticright" hover-class="none" hover-stop-propagation="false">{{item.like}}</view>
<view class="schoolname" hover-class="none" hover-stop-propagation="false">{{item.school.title}}</view>
<view class="time" hover-class="none" hover-stop-propagation="false">{{item.createTimeobj.chineseDate}}</view>
</view>
<!-- <image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="cer-card" src="http://wxloss.oss-cn-hangzhou.aliyuncs.com/dailyposter/bga.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image> -->
</scroll-view>
</view>
</view>
......@@ -35,4 +45,7 @@
</view>
</view>
</view>
<canvasdrawer painting="{{painting}}" bind:getImage="eventGetImage"/>
<poster-box wx:if="{{posterBoxShow}}" canvasimagepath="{{canvasImagePath}}" bind:closeposter="closeposter">
</poster-box>
</view>
\ No newline at end of file
......@@ -103,4 +103,75 @@
font-size: 24rpx;
font-weight: bold;
color: rgba(163, 163, 163, 1);
}
.certificatebox {
position: relative;
width: 146rpx;
height: 260rpx;
}
.certificatebox .bg {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
}
.certificatebox .avatar {
position: absolute;
width: 24rpx;
height: 24rpx;
border-radius: 50%;
left: 61rpx;
top: 53rpx;
z-index: 2;
}
.certificatebox .nickname {
position: absolute;
width: 100%;
text-align: center;
font-size: 6rpx;
color: #000;
top: 84rpx;
line-height: 1;
z-index: 2;
}
.certificatebox .static {
position: absolute;
width: 22rpx;
text-align: center;
font-size: 8rpx;
color: #FFB400;
top: 168rpx;
line-height: 1;
z-index: 2;
}
.certificatebox .static.staticleft {
left: 16rpx;
}
.certificatebox .static.staticcenter {
left: 60rpx;
}
.certificatebox .static.staticright {
left: 110rpx;
}
.certificatebox .schoolname {
position: absolute;
width: 100%;
text-align: right;
font-size: 6rpx;
color: #000000;
top: 209rpx;
line-height: 1;
z-index: 2;
}
.certificatebox .time {
position: absolute;
width: 100%;
text-align: right;
font-size: 6rpx;
color: #000000;
top: 216rpx;
line-height: 1;
z-index: 2;
}
\ No newline at end of file
......@@ -2037,144 +2037,5 @@ Page({
})
}
})
},
graduatePoster () { //生成结课证书
const posterMateria = getDailyMateria();
const visitor = LocalStorage.getItem('visitor');
const userInfo = visitor && visitor.userInfo;
const circleInfo = this.data.circleInfo;
const date = dateDetail(this.data.datetime)
wx.showLoading({
title: '日签生成中...'
})
generateCustomerQrcode({
scene: `i=${this.data.id}&t=${this.data.tid}&p=7`,
page: `src/pages/themeindex/index`
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
const qrcode = imagify(data.url);
console.log(qrcode)
return qrcode
} else {
return ''
}
}).then ((qrcode) => {
if (qrcode == '') {
wx.showToast({
title: '生成失败',
icon: 'none'
})
return;
}
this.setData({
painting: {
width: 750,
height: 1334,
views: [
{ // 头像
type: 'image',
url: userInfo.avatarUrl,
top: 274,
left: 313,
width: 124,
height: 124
},
{ // 背景
type: 'image',
url: 'https://wxloss.oss-cn-hangzhou.aliyuncs.com/graduateposter/bg.png',
top: 0,
left: 0,
width: 750,
height: 1334
},
{ // 二维码
type: 'image',
url: qrcode,
top: 1208,
left: 132,
width: 118,
height: 118
},
{ // 昵称
type: 'text',
content: userInfo.nickName,
fontSize: 30,
color: '#000000',
textAlign: 'center',
top: 420,
left: 375,
bolder: true
},
{ // 主题名称
type: 'text',
content: circleInfo.title,
fontSize: 40,
color: '#000000',
textAlign: 'center',
top: 570,
left: 375,
width: 410,
MaxLineNumber: 1,
breakWord: true,
bolder: true
},
{ // 打卡天数
type: 'text',
content: '909',
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 130,
bolder: true
},
{ // 连续打卡
type: 'text',
content: '909',
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 375,
bolder: true
},
{ // 收到点赞
type: 'text',
content: '909',
fontSize: 40,
color: '#FFB400',
textAlign: 'center',
top: 844,
left: 610,
bolder: true
},
{ // 机构名称
type: 'text',
content: '小星星英语培训机构小星星英语培训机构',
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1070,
left: 730,
// bolder: true
},
{ // 结课日期
type: 'text',
content: date.chineseDate,
fontSize: 24,
color: '#000000',
textAlign: 'right',
top: 1112,
left: 730,
// bolder: true
},
]
}
})
})
}
})
\ No newline at end of file
<wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="" hover-class="none" hover-stop-propagation="false" bindtap="graduatePoster">
生成结课证书
</view>
<view class="theme-index-container clearfix">
<!-- <view class="user-guide-box" hover-class="none" bindtap="hideUserGuide" wx:if="{{userguide == true}}" hover-stop-propagation="false" catchtouchmove="preventTouchMove">
<view class="guide-mask" hover-class="none" hover-stop-propagation="false" catchtouchmove="preventTouchMove"></view>
......
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