Keep sharing images in the users subpackage
This commit is contained in:
parent
190db7446d
commit
77cb04964a
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@ -42,11 +42,11 @@ import {service} from '../../config'
|
|||||||
import {sharingPath, renderSharingPoster, renderSharingCover, saveSharingPoster, storeSharingCode} from '../../utils/sharing'
|
import {sharingPath, renderSharingPoster, renderSharingCover, saveSharingPoster, storeSharingCode} from '../../utils/sharing'
|
||||||
wepy.page({
|
wepy.page({
|
||||||
mixins:[https],
|
mixins:[https],
|
||||||
data:{loading:true,error:'',total:0,verified:0,remaining:7,invitees:[],page:0,hasMore:false,listLoading:false,listError:false,profile:{id:0,nickname:'',qrcode:''},poster:'',cover:'',posterError:'',generating:false,saving:false,canApply:false,checkingEligibility:false,eligibilityError:false,showApplication:false,savingContact:false,contactImage:'/images/ambassador-contact.jpg'},
|
data:{loading:true,error:'',total:0,verified:0,remaining:7,invitees:[],page:0,hasMore:false,listLoading:false,listError:false,profile:{id:0,nickname:'',qrcode:''},poster:'',cover:'',posterError:'',generating:false,saving:false,canApply:false,checkingEligibility:false,eligibilityError:false,showApplication:false,savingContact:false,contactImage:'/pages/users/assets/ambassador-contact.jpg'},
|
||||||
onLoad() { this.load() },
|
onLoad() { this.load() },
|
||||||
onShow() { if (!this.loading && !this.error) this.refreshEligibility() },
|
onShow() { if (!this.loading && !this.error) this.refreshEligibility() },
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
return {title:'邀请你加入福恋,上福恋认真找对象',path:this.profile.id ? sharingPath(this.profile.id,false) : '/pages/tabBar/welcome',imageUrl:this.cover || '/images/fulian-logo.png'}
|
return {title:'邀请你加入福恋,上福恋认真找对象',path:this.profile.id ? sharingPath(this.profile.id,false) : '/pages/tabBar/welcome',imageUrl:this.cover || '/pages/users/assets/fulian-logo.png'}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
setOverview(data) {
|
setOverview(data) {
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<block v-else>
|
<block v-else>
|
||||||
<image v-if="poster" class="sharing-poster" src="{{poster}}" mode="widthFix" @tap="preview"></image>
|
<image v-if="poster" class="sharing-poster" src="{{poster}}" mode="widthFix" @tap="preview"></image>
|
||||||
<view v-else class="sharing-preview">
|
<view v-else class="sharing-preview">
|
||||||
<image class="sharing-logo" src="/images/fulian-logo.png" mode="aspectFit"></image>
|
<image class="sharing-logo" src="/pages/users/assets/fulian-logo.png" mode="aspectFit"></image>
|
||||||
<image v-if="profile.photo" class="sharing-photo" src="{{profile.photo}}" mode="aspectFill"></image>
|
<image v-if="profile.photo" class="sharing-photo" src="{{profile.photo}}" mode="aspectFill"></image>
|
||||||
<view class="sharing-title">{{profile.nickname}}</view><view>{{profile.details}}</view>
|
<view class="sharing-title">{{profile.nickname}}</view><view>{{profile.details}}</view>
|
||||||
<view class="sharing-intro">{{profile.introduction}}</view>
|
<view class="sharing-intro">{{profile.introduction}}</view>
|
||||||
@ -31,7 +31,7 @@ wepy.page({
|
|||||||
onLoad() { this.load() },
|
onLoad() { this.load() },
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
if (!this.profile.id) return {title:'上福恋认真找对象',path:'/pages/tabBar/welcome'}
|
if (!this.profile.id) return {title:'上福恋认真找对象',path:'/pages/tabBar/welcome'}
|
||||||
return {title:`我是${this.profile.nickname},期待与你相识`,path:sharingPath(this.profile.id,true),imageUrl:this.cover || this.profile.photo || '/images/fulian-logo.png'}
|
return {title:`我是${this.profile.nickname},期待与你相识`,path:sharingPath(this.profile.id,true),imageUrl:this.cover || this.profile.photo || '/pages/users/assets/fulian-logo.png'}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
async load() {
|
async load() {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ function textLines(ctx, text, x, y, width, lineHeight, maxLines) {
|
|||||||
|
|
||||||
export async function renderSharingPoster(page, profile, personal) {
|
export async function renderSharingPoster(page, profile, personal) {
|
||||||
if (!profile.qrcode) throw new Error('分享码暂未准备好,请稍后重试')
|
if (!profile.qrcode) throw new Error('分享码暂未准备好,请稍后重试')
|
||||||
const sources = ['/images/fulian-logo.png', profile.qrcode]
|
const sources = ['/pages/users/assets/fulian-logo.png', profile.qrcode]
|
||||||
if (personal && profile.photo) sources.push(profile.photo)
|
if (personal && profile.photo) sources.push(profile.photo)
|
||||||
const images = await Promise.all(sources.map(imageInfo))
|
const images = await Promise.all(sources.map(imageInfo))
|
||||||
const ctx = wx.createCanvasContext('fulianPoster', page.$wx)
|
const ctx = wx.createCanvasContext('fulianPoster', page.$wx)
|
||||||
@ -95,7 +95,7 @@ export function saveSharingPoster(filePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function renderSharingCover(page, profile, personal) {
|
export async function renderSharingCover(page, profile, personal) {
|
||||||
const logo=await imageInfo('/images/fulian-logo.png')
|
const logo=await imageInfo('/pages/users/assets/fulian-logo.png')
|
||||||
const photo=personal && profile.photo ? await imageInfo(profile.photo) : null
|
const photo=personal && profile.photo ? await imageInfo(profile.photo) : null
|
||||||
const ctx=wx.createCanvasContext('fulianPoster',page.$wx)
|
const ctx=wx.createCanvasContext('fulianPoster',page.$wx)
|
||||||
ctx.setFillStyle('#FFF9F5'); ctx.fillRect(0,0,750,600)
|
ctx.setFillStyle('#FFF9F5'); ctx.fillRect(0,0,750,600)
|
||||||
|
|||||||
@ -6,7 +6,7 @@ module.exports = {
|
|||||||
wpyExt: '.wpy',
|
wpyExt: '.wpy',
|
||||||
// eslint: true,
|
// eslint: true,
|
||||||
cliLogs: !prod,
|
cliLogs: !prod,
|
||||||
static: ['./src/images'],
|
static: ['./src/images', './src/pages/users/assets'],
|
||||||
build: {},
|
build: {},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user