新增分享二维码

This commit is contained in:
zdx
2020-12-31 13:15:31 +08:00
parent cff94e05f6
commit aa94413f67
12 changed files with 422 additions and 145 deletions

View File

@@ -14,8 +14,13 @@ const companySubscribesList = ( page) => req({
page: page
}
})
// 获取分享二维码
const getShareCode = ( companyId) => req({
url: "user/share/"+companyId,
})
export default({
userInfo,//用户基本信息
companySubscribesList,//关注企业列表
getShareCode,//获取分享二维码
})

View File

@@ -18,6 +18,7 @@
"pages/user/user_coupon/user_coupon",
"pages/user/user_coupon_data/user_coupon_data",
"pages/user/setting/setting",
"pages/user/code/code",
"pages/user/setting/aboutUs/aboutUs",
"pages/user/setting/aboutMine/aboutMine",
"pages/user/setting/aboutAdvice/aboutAdvice",

View File

@@ -2,7 +2,7 @@
<view class="scroll_menu">
<scroll-view class="scroll-view_H" scroll-x="true" bindscroll="scroll" style="width: 100%">
<view id="menu1" wx:for='{{categoryList}}' catchtap="menuSelect" data-id='{{item.id}}'
<view id="menu1" wx:for='{{categoryList}}' catchtap="menuSelect" data-id='{{item.id}}'
class="scroll-view-item_H {{category_id==item.id?'scroll_view_select':''}}">{{item.title}}</view>
</scroll-view>
</view>
@@ -37,5 +37,4 @@
<span>已结束</span>
</view>
</view>
<view class="has_more">{{has_more?'~ 上拉加载更多 ~':'~ 暂无更多数据 ~'}}</view>

View File

@@ -46,7 +46,7 @@ Page({
// 获取企业风采列表
graces() {
wx.$api.companyModule.graces(this.data.company_id, this.data.page).then(res => {
wx.$api.companyModule.graces(wx.getStorageSync('company_id'), this.data.page).then(res => {
console.log(res);
var lists = this.data.lists.concat(res.data)
if (res.page.has_more) {
@@ -65,7 +65,7 @@ Page({
},
// 获取企业宣传视频列表
videos() {
wx.$api.companyModule.videos(this.data.company_id, this.data.page).then(res => {
wx.$api.companyModule.videos(wx.getStorageSync('company_id'), this.data.page).then(res => {
console.log(res);
var lists = this.data.lists.concat(res.data)
if (res.page.has_more) {
@@ -84,7 +84,7 @@ Page({
},
// 获取企业员工页面
users() {
wx.$api.companyModule.users(this.data.company_id, this.data.page).then(res => {
wx.$api.companyModule.users(wx.getStorageSync('company_id'), this.data.page).then(res => {
console.log(res);
var lists = this.data.lists.concat(res.data)
if (res.page.has_more) {

View File

@@ -78,7 +78,7 @@ page{
}
.couponLabel text.active {
background-color: #2151f5;
background-color: #378fff;
color: #fff;
}
@@ -128,7 +128,7 @@ page{
top: 0;
left: 0;
background-color: #c0d3fc;
color: #2151f5;
color: #378fff;
z-index: 102;
font-size: 26rpx;
border-radius: 10rpx 0 10rpx 0;
@@ -215,7 +215,7 @@ page{
.couponEject-list-btn {
width: 140rpx;
color: #2d6bf6;
color: #378fff;
background-color: #fff;
border-radius: 50rpx;
text-align: center;

172
pages/user/code/code.js Normal file
View File

@@ -0,0 +1,172 @@
const style = {
codeContent: {
backgroundColor: 'white',
width: '375',
height: '525'
},
codeNickname: {
width: '355',
height: '46',
textAlign: 'center',
fontSize: '25',
verticalAlign: 'middle',
marginTop: '40',
marginLeft: '10'
},
codeJob: {
width: '355',
height: '30',
textAlign: 'center',
verticalAlign: 'middle',
fontSize: '15',
marginLeft: '10'
},
codeImg: {
width: '151',
height: '151',
marginTop: '30',
marginBottom: '40',
marginLeft: '112'
},
codeLogo: {
width: '51',
height: '51',
marginLeft: '162',
marginBottom: '5',
},
codeCompany: {
width: '355',
height: '30',
textAlign: 'center',
verticalAlign: 'middle',
fontSize: '15',
marginLeft: '10',
marginBottom: '20',
},
codeText: {
width: '355',
height: '30',
textAlign: 'center',
verticalAlign: 'middle',
fontSize: '13',
marginLeft: '10',
color: 'gray'
}
}
Page({
/**
* 页面的初始数据
*/
data: {
code: "", //二维码
company: {}, //公司信息
user: {}, //用户信息,
name:'',//用户名
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.getStorage({
key: 'compayId',
success: res => {
console.log(res);
wx.$api.user.getShareCode(res.data).then(res => {
this.setData({
user: {
job: res.job,
cover: res.cover,
name:options.name
},
company: {
name: res.company,
logo: res.logo,
id: res.company_id
},
code: res.code
})
})
}
})
},
/**
* 绘制分享海报
*/
canvasDowImg() {
wx.showLoading({
title: "绘制海报中"
})
const wxml = `
<view class="code-content">
<text class="code-nickname">` + this.data.user.name + `</text>
<image class="code-img" src="` + this.data.code + `" mode="widthFix"></image>
<image class="code-logo" src="` + this.data.company.logo + `" mode="aspectFit"></image>
<text class="code-company">` + this.data.company.name + `</text>
<text class="code-text">扫一扫,快速了解我们的企业</text>
</view>
`
this.codeimg = this.selectComponent('.codeImg')
this.codeimg.renderToCanvas({
wxml,
style
}).then(() => {
this.codeimg.canvasToTempFilePath().then(res => {
console.log(res);
if (res.tempFilePath) {
wx.hideLoading()
this.dowQrCodeImg(res.tempFilePath)
} else {
wx.showToast({
title: "绘制失败,请稍后重试",
icon: "none"
})
}
})
})
},
/**
* 保存canvas图片到本地
*/
dowQrCodeImg(path) {
wx.saveImageToPhotosAlbum({
filePath: path,
success: () => {
wx.showToast({
title: "保存成功,分享图已存储至您的手机相册",
icon: "none"
})
},
fail: () => {
wx.showModal({
title: "提示",
content: "由于您的设置,系统暂无权限访问您的相册,保存海报失败",
cancelText: "以后再说",
cancelColor: "#4f4f4f",
confirmText: "去设置",
confirmColor: "#0b0041",
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: this.data.user.name + "邀请您快速了解" + this.data.company.name,
imageUrl: this.data.user.cover,
path: "/pages/employees/join/join?companyId=" + this.data.company.id
}
}
})

View File

@@ -0,0 +1,8 @@
{
"usingComponents": {
"wxml-to-canvas": "wxml-to-canvas"
},
"navigationBarTitleText" : "分享海报",
"navigationBarBackgroundColor" : "#378fff",
"navigationBarTextStyle" : "white"
}

19
pages/user/code/code.wxml Normal file
View File

@@ -0,0 +1,19 @@
<wxml-to-canvas class="codeImg" width="375" height="525"></wxml-to-canvas>
<view class="code-content">
<view class="code-nickname">{{user.name || "-"}}</view>
<view class="code-img">
<image class="code-img-src" src="{{code}}" mode="widthFix"></image>
</view>
<view class="code-logo">
<image class="code-logo-src" src="{{company.logo || '/static/images/logo_null.png'}}" mode="aspectFit"></image>
</view>
<view class="code-company">{{company.name}}</view>
<view class="code-text">扫一扫,快速了解我们的企业</view>
</view>
<view class="code-btns">
<button class="code-btn" size="default" open-type="share">转发邀请</button>
<button class="code-btn" size="default" bindtap="canvasDowImg">保存分享海报</button>
</view>

73
pages/user/code/code.wxss Normal file
View File

@@ -0,0 +1,73 @@
.codeImg{
position: fixed;
left: -100%;
top: -100%;
}
/* 展示图片 */
.code-content{
margin: 30rpx;
padding: 60rpx 30rpx;
background: white;
border-radius: 10rpx;
box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .02);
text-align: center;
}
.code-nickname{
font-size: 50rpx;
padding-bottom: 20rpx;
}
.code-text{
border-top: dashed 1rpx #ddd;
padding-top: 30rpx;
color: gray;
margin-top: 60rpx;
font-size: 26rpx;
}
.code-img{
padding: 70rpx 0;
}
.code-img-src{
width: 300rpx;
height: 300rpx;
background: #eee;
vertical-align: top;
}
.code-logo-src{
background: #eee;
width: 98rpx;
height: 98rpx;
}
.code-company{
padding-top: 20rpx;
}
/* 操作按钮 */
.code-btns{
padding: 0 15rpx 50rpx 15rpx;
display: flex;
}
.code-btn[size="default"]{
background: #ddd;
width: 100%;
line-height: 90rpx;
height: 90rpx;
padding: 0;
border-radius: 10rpx;
margin: 0 15rpx;
font-size: 32rpx;
color: white;
background: #ff8c37;
}
.code-btn[size="default"]:last-child{
background: #378fff;
}

View File

@@ -36,12 +36,13 @@
</view>
<text>我的订单</text>
</navigator>
<view class="userNav-label" catchtap="showtoast">
<navigator hover-class="none" url="/pages/user/code/code?name={{info.user.nickname}}" class="userNav-label">
<!-- <view class="userNav-label" catchtap="showtoast"> -->
<view class="userNav-label-img">
<image src="/static/user_iocn/userNav_02.png"></image>
</view>
<text>分享海报</text>
</view>
</navigator>
</view>
<view class="userTool">

View File

@@ -2,6 +2,5 @@
<!-- <rich-text nodes="{{nodes}}"></rich-text> -->
<view>
电子科技有限公司是一家集产品研发生产及销售的大型高科技电子企业是全球专业的液晶广告机液晶电视及液晶拼接墙制造商从创立伊始历经多年的稳健发展以推动国内液晶广告机的普及化为己任以提升人类视听享受为目标公司旗下品牌博视TBOSV已经成为全球普遍赞誉的知名品牌。上海域展电子科技有限公司成立于2006年。我们凭借着"以品质为根本、以创新求发展"的理念;力争以优质的全方位服务为客户提供具有竞争力价...
电子科技有限公司是一家集产品研发生产及销售的大型高科技电子企业是全球专业的液晶广告机液晶电视及液晶拼接墙制造商从创立伊始历经多年的稳健发展以推动国内液晶广告机的普及化为己任以提升人类视听享受为目标公司旗下品牌博视TBOSV已经成为全球普遍赞誉的知名品牌。上海域展电子科技有限公司成立于2006年。我们凭借着"以品质为根本、以创新求发展"的理念;力争以优质的全方位服务为客户提供具有竞争力价...
电子科技有限公司是一家集产品研发生产及销售的大型高科技电子企业是全球专业的液晶广告机液晶电视及液晶拼接墙制造商从创立伊始历经多年的稳健发展以推动国内液晶广告机的普及化为己任以提升人类视听享受为目标公司旗下品牌博视TBOSV已经成为全球普遍赞誉的知名品牌。上海域展电子科技有限公司成立于2006年。我们凭借着"以品质为根本、以创新求发展"的理念;力争以优质的全方位服务为客户提供具有竞争力价...
</view>

View File

@@ -1,143 +1,143 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.13.2",
"appid": "wxd931d03dfe955254",
"projectname": "%E8%A1%8C%E4%B8%9A%E7%89%88Saas",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"plugin": {
"list": []
},
"compileType": "miniprogram",
"libVersion": "2.13.2",
"appid": "wxd931d03dfe955254",
"projectname": "%E8%A1%8C%E4%B8%9A%E7%89%88Saas",
"debugOptions": {
"hidedInDevtools": []
"game": {
"list": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"plugin": {
"list": []
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"name": "登录",
"pathName": "pages/login/login",
"query": "",
"scene": null
},
"game": {
"list": []
{
"name": "搜索",
"pathName": "pages/company/search/search",
"query": "",
"scene": null
},
"gamePlugin": {
"list": []
{
"name": "商城",
"pathName": "pages/mall/index",
"query": "",
"scene": null
},
"miniprogram": {
"list": [
{
"name": "登录",
"pathName": "pages/login/login",
"query": "",
"scene": null
},
{
"name": "搜索",
"pathName": "pages/company/search/search",
"query": "",
"scene": null
},
{
"name": "商城",
"pathName": "pages/mall/index",
"query": "",
"scene": null
},
{
"name": "pages/user/index",
"pathName": "pages/user/index",
"query": "",
"scene": null
},
{
"name": "pages/user/companyMine/companyOrder",
"pathName": "pages/user/companyMine/companyOrder",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/companyOrder",
"pathName": "pages/user/companyMine/companyOrder",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/projectDetail/projectDetail",
"pathName": "pages/user/companyMine/projectDetail/projectDetail",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/refundInfo/refundInfo",
"pathName": "pages/user/companyMine/refundInfo/refundInfo",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/home/index",
"pathName": "pages/home/index",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/setting/setting",
"pathName": "pages/user/setting/setting",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutMine/aboutMine",
"pathName": "pages/user/setting/aboutMine/aboutMine",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutAdvice/aboutAdvice",
"pathName": "pages/user/setting/aboutAdvice/aboutAdvice",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutUs/aboutUs",
"pathName": "pages/user/setting/aboutUs/aboutUs",
"scene": null
}
]
{
"name": "pages/user/index",
"pathName": "pages/user/index",
"query": "",
"scene": null
},
{
"name": "pages/user/companyMine/companyOrder",
"pathName": "pages/user/companyMine/companyOrder",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/companyOrder",
"pathName": "pages/user/companyMine/companyOrder",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/projectDetail/projectDetail",
"pathName": "pages/user/companyMine/projectDetail/projectDetail",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/companyMine/refundInfo/refundInfo",
"pathName": "pages/user/companyMine/refundInfo/refundInfo",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/home/index",
"pathName": "pages/home/index",
"query": "orderid=20201229132338964625",
"scene": null
},
{
"name": "pages/user/setting/setting",
"pathName": "pages/user/setting/setting",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutMine/aboutMine",
"pathName": "pages/user/setting/aboutMine/aboutMine",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutAdvice/aboutAdvice",
"pathName": "pages/user/setting/aboutAdvice/aboutAdvice",
"query": "",
"scene": null
},
{
"name": "pages/user/setting/aboutUs/aboutUs",
"pathName": "pages/user/setting/aboutUs/aboutUs",
"scene": null
}
]
}
}
}