分享及分包

Signed-off-by: wangxiaoping <809126545@qq.com>
master
wangxiaoping 4 years ago
parent 1ea4d1e7ca
commit 5c7b5f3405

@ -62,7 +62,7 @@ Vue.prototype.reqByToken = (url, params, cb, method) => {
cb(r.data.data)
} else if (r.data.status === 2) {
uni.navigateTo({
url: '/pages/login/index'
url: '/package/pages/login/index'
})
return false
} else {

@ -59,6 +59,9 @@
"scope.userLocation" : {
"desc" : "提供LBS服务"
}
},
"optimization":{
"subPackages":true
}
},
"mp-alipay" : {

@ -38,6 +38,7 @@
</template>
<script>
import {weixin} from '../../../utils/weixin.js'
export default {
data() {
const currentDate = this.getDate({
@ -49,12 +50,17 @@
token: '',
phone: '',
productId: '',
}
},
token: '',
openid: '',
}
},
onLoad() {
const phone_token = uni.getStorageSync('phone_token')
this.info.phone = phone_token.phone
this.token = phone_token.token
let user_info = weixin.getUserInfoCache()
this.openid = user_info.openid
},
methods: {
pay() {
@ -68,7 +74,28 @@
}
this.reqByToken('/api/member/order-add', this.info, r => {
console.log(r)
uni.request({
url: this.baseUrl + '/api/member/order-payment',
method: 'GET',
data: {
token: this.token,
order_id: r.id,
openid: this.openid
},
success: res => {
let payParams = JSON.parse(res.data.jsApiParameters)
payParams.provider = 'wxpay'
payParams.success = result => {
uni.navigateTo({
url: '../../../pages/active/active'
})
}
payParams.fail = result => {
console.log(result);
}
wx.requestPayment(payParams);
}
})
})
},
bindDateChange: function(e) {

@ -6,9 +6,8 @@
<button v-show="hasProfile" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
</view>
</template>
<script>
import {weixin} from '../../utils/weixin.js';
import {weixin} from '../../../utils/weixin.js';
export default {
data(){
return{

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

@ -9,22 +9,6 @@
}
},
{
"path": "pages/applyReg/applyReg",
"style": {
"navigationBarTitleText": "推广人员注册",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/login/index",
"style": {
"navigationBarTitleText": "登录授权",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/active/active",
"style": {
@ -34,15 +18,6 @@
}
},
{
"path": "pages/buyMember/buyMember",
"style": {
"navigationBarTitleText": "购买会员",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/my/my",
@ -238,6 +213,37 @@
}
],
"subPackages": [{
"root" : "package",
"pages":[
{
"path": "pages/applyReg/applyReg",
"style": {
"navigationBarTitleText": "推广人员注册",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/login/index",
"style": {
"navigationBarTitleText": "登录授权",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/buyMember/buyMember",
"style": {
"navigationBarTitleText": "购买会员",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
}
]
}],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "优孕课堂",

@ -1,13 +1,19 @@
<template>
<view class="content">
<view class="memberBanner">
<image mode="widthFix" src="../../static/1_01.jpg"></image>
<image mode="widthFix" src="../../static/member_01.jpg"></image>
</view>
<view class="memberBanner">
<image mode="widthFix" src="../../static/1_02.jpg"></image>
<image mode="widthFix" src="../../static/member_02.jpg"></image>
</view>
<view class="memberBanner">
<image mode="widthFix" src="../../static/member_03.jpg"></image>
</view>
<view class="memberBanner">
<image mode="widthFix" src="../../static/member_04.jpg"></image>
</view>
<view class="joinBox" @click="open"><button>加入会员</button></view>
<view class="shareIcon" @click="shareOpen">
<view class="shareIcon" @click="shareOpen" v-if="user_info.promotion == 1">
<image src="../../static/share.png"></image>
</view>
<uni-popup ref="popup" :mask-click="false" type="bottom" class="popBox">
@ -33,35 +39,98 @@
</uni-popup>
<uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox">
<view class="codeOuter">
<view class="shareCon">
<image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image>
<image class="code" src="../../static/300_qr.png"></image>
<view class="shareCon" @click="shareClose">
<canvas style="width:100%;" :style="{ height: (cropperH-50) + 'px' }" canvas-id="firstCanvas" id="firstCanvas"></canvas>
<!-- <image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image> -->
<!-- <image class="code" src="../../static/300_qr.png"></image> -->
</view>
<view class="shareBott">
<view class="shareCol" @click="shareClose"></view>
<view class="shareCol" @click="shareClose"></view>
<view class="shareBott" :style="{display: shareBtnDisplay}">
<button class="shareCol" @click="shareClose" open-type="share" style="border-radius:0;flex:1;">发给朋友</button>
<button class="shareCol" @click="save" style="border-radius:0;flex:1;">保存相册</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
let sysInfo = uni.getSystemInfoSync();
let SCREEN_WIDTH = sysInfo.screenWidth
let SCREEN_HEIGHT = sysInfo.screenHeight
import {
weixin
} from '../../utils/weixin.js';
export default {
data() {
return {
cardActive: 0
cardActive: 0,
img: '',
user_info: {
promotion: ''
},
shareBtnDisplay: 'none',
//
cropperW: SCREEN_WIDTH,
cropperH: SCREEN_HEIGHT,
}
},
onLoad() {
weixin.getOpenidInfo(info => {
this.user_info = info
})
},
onShareAppMessage() {
return {
title: '加入会员',
path: 'pages/member/member?promotion_id=' + this.user_info.id,
imageUrl: this.img
}
},
methods: {
shareOpen() {
uni.showLoading({
title: '加载中'
});
this.$refs.shareCode.open()
uni.request({
url: this.baseUrl + '/api/member/get-wxa-qrcode',
method: 'GET',
data: {
path: '',
scene: this.user_info.id
},
success: r => {
if (r.data.status === 1) {
uni.getImageInfo({
src: this.baseUrl + r.data.data, //
success: res => {
let ctx = uni.createCanvasContext('firstCanvas')
// ctx.fillStyle = '#fff';
// ctx.fillRect(0, 0, 214, 342);
ctx.drawImage('../../static/shareBg.png', SCREEN_WIDTH*0.1, (SCREEN_HEIGHT-50-SCREEN_WIDTH*0.8*1.65)/2, SCREEN_WIDTH*0.8,SCREEN_WIDTH*0.8*1.5);
ctx.drawImage(res.path, SCREEN_WIDTH*0.62, (SCREEN_HEIGHT-50-SCREEN_WIDTH*0.8*1.5)/2+SCREEN_WIDTH*0.8*1.02, SCREEN_WIDTH*0.2, SCREEN_WIDTH*0.2,);
ctx.draw()
setTimeout(()=>{
uni.canvasToTempFilePath({
canvasId: 'firstCanvas',
fileType: 'jpg',
success: (res) => {
this.shareBtnDisplay = 'flex'
uni.hideLoading()
this.img = res.tempFilePath
},
})
},100)
}
})
} else {
uni.hideLoading()
this.$refs.shareCode.close()
this.alert(r.data.msg)
}
}
})
},
shareClose() {
this.$refs.shareCode.close()
@ -76,10 +145,28 @@
if (this.checkLogin()) {
this.$refs.popup.close()
uni.navigateTo({
url: "../buyMember/buyMember"
url: "../../package/pages/buyMember/buyMember"
});
}
},
//h5
save() {
let _this = this;
// #ifdef H5
uni.previewImage({
urls: [_this.img]
})
// #endif
// #ifdef APP-PLUS||MP-WEIXIN
uni.saveImageToPhotosAlbum({
filePath: _this.img,
success: function() {
_this.$refs.shareCode.close()
_this.alert('保存成功')
}
});
// #endif
},
}
}
</script>
@ -234,15 +321,18 @@
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
padding-top: 13vh;
// padding-top: 13vh;
box-sizing: border-box;
position: relative;
}
.shareCon {
width: 500rpx;
margin: 0 auto;
position: relative;
// width: 500rpx;
// margin: 0 auto;
//position: absolute;
//top: 45%;
//left: 50%;
// transform: translate(-50%, -50%);
.code {
width: 300rpx;

@ -0,0 +1,67 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"bundle": false,
"userConfirmedBundleSwitch": false,
"urlCheck": true,
"scopeDataCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"compileHotReLoad": false,
"preloadBackgroundData": false,
"minified": true,
"autoAudits": false,
"newFeature": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"useIsolateContext": true,
"nodeModules": false,
"enhance": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"enableEngineNative": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false
},
"compileType": "miniprogram",
"libVersion": "2.19.0",
"appid": "wx9b4762770771d98a",
"projectname": "miniprogram-1",
"debugOptions": {
"hidedInDevtools": []
},
"scripts": {},
"staticServerOptions": {
"baseURL": "",
"servePath": ""
},
"isGameTourist": false,
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"game": {
"list": []
},
"plugin": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

@ -26,7 +26,7 @@ export const weixin = {
const user_info1 = result.data.data.user_info
user_info1.openid = user_info1.wechat_openid
uni.setStorageSync(user_info_key, user_info1)
cb(result.data.data.user_info)
cb(user_info1)
}
});
}

Loading…
Cancel
Save