分享及分包

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) cb(r.data.data)
} else if (r.data.status === 2) { } else if (r.data.status === 2) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/index' url: '/package/pages/login/index'
}) })
return false return false
} else { } else {

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

@ -38,6 +38,7 @@
</template> </template>
<script> <script>
import {weixin} from '../../../utils/weixin.js'
export default { export default {
data() { data() {
const currentDate = this.getDate({ const currentDate = this.getDate({
@ -49,12 +50,17 @@
token: '', token: '',
phone: '', phone: '',
productId: '', productId: '',
} },
token: '',
openid: '',
} }
}, },
onLoad() { onLoad() {
const phone_token = uni.getStorageSync('phone_token') const phone_token = uni.getStorageSync('phone_token')
this.info.phone = phone_token.phone this.info.phone = phone_token.phone
this.token = phone_token.token
let user_info = weixin.getUserInfoCache()
this.openid = user_info.openid
}, },
methods: { methods: {
pay() { pay() {
@ -68,7 +74,28 @@
} }
this.reqByToken('/api/member/order-add', this.info, r => { 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) { bindDateChange: function(e) {

@ -1,14 +1,13 @@
<template> <template>
<view class="content"> <view class="content">
<image class="logo" src="../../static/logo@3x.png"></image> <image class="logo" src="../../static/logo@3x.png"></image>
<!-- <button v-show="!hasProfile" @click="getUserProfile"></button> --> <!-- <button v-show="!hasProfile" @click="getUserProfile"></button> -->
<button v-show="hasProfile" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button> <button v-show="hasProfile" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
</view> </view>
</template> </template>
<script> <script>
import {weixin} from '../../utils/weixin.js'; import {weixin} from '../../../utils/weixin.js';
export default { export default {
data(){ data(){
return{ return{
@ -30,7 +29,7 @@
}, },
getPhoneNumber(e) { getPhoneNumber(e) {
if (e.detail.iv) { if (e.detail.iv) {
weixin.getOpenidInfo(user_info => { weixin.getOpenidInfo(user_info => {
uni.request({ uni.request({
url: this.baseUrl + '/api/member/get-phone-by-openid', url: this.baseUrl + '/api/member/get-phone-by-openid',
method: 'POST', method: 'POST',
@ -64,27 +63,27 @@
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.logo{ .logo{
display: block; display: block;
width:250rpx; width:250rpx;
height:250rpx; height:250rpx;
margin:100rpx auto 0 auto; margin:100rpx auto 0 auto;
} }
.title{ .title{
display: block; display: block;
width:333rpx; width:333rpx;
height:44rpx; height:44rpx;
margin:40rpx auto 110rpx auto; margin:40rpx auto 110rpx auto;
} }
button{ button{
width: 520rpx; width: 520rpx;
height: 90rpx; height: 90rpx;
@ -93,12 +92,12 @@
line-height:90rpx; line-height:90rpx;
font-weight: bold; font-weight: bold;
color: #FFFFFF; color: #FFFFFF;
margin-top:35rpx; margin-top:35rpx;
border-radius:45rpx; border-radius:45rpx;
vertical-align: middle; vertical-align: middle;
} }
button:active{ button:active{
background: #FF578A; background: #FF578A;
color: #FFFFFF; color: #FFFFFF;
} }
</style> </style>

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

@ -1,29 +1,13 @@
{ {
"pages": [ "pages": [
{ {
"path": "pages/member/member", "path": "pages/member/member",
"style": { "style": {
"navigationBarTitleText": "加入会员", "navigationBarTitleText": "加入会员",
"navigationBarBackgroundColor":"#fff", "navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
},
{
"path": "pages/applyReg/applyReg",
"style": {
"navigationBarTitleText": "推广人员注册",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/login/index",
"style": {
"navigationBarTitleText": "登录授权",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
}
}, },
{ {
"path": "pages/active/active", "path": "pages/active/active",
@ -32,15 +16,6 @@
"navigationBarBackgroundColor":"#FF578A", "navigationBarBackgroundColor":"#FF578A",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
}
},
{
"path": "pages/buyMember/buyMember",
"style": {
"navigationBarTitleText": "购买会员",
"navigationBarBackgroundColor":"#fff",
"navigationBarTextStyle": "black"
} }
}, },
@ -237,7 +212,38 @@
} }
} }
], ],
"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": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "优孕课堂", "navigationBarTitleText": "优孕课堂",

@ -1,13 +1,19 @@
<template> <template>
<view class="content"> <view class="content">
<view class="memberBanner"> <view class="memberBanner">
<image mode="widthFix" src="../../static/1_01.jpg"></image> <image mode="widthFix" src="../../static/member_01.jpg"></image>
</view> </view>
<view class="memberBanner"> <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>
<view class="joinBox" @click="open"><button>加入会员</button></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> <image src="../../static/share.png"></image>
</view> </view>
<uni-popup ref="popup" :mask-click="false" type="bottom" class="popBox"> <uni-popup ref="popup" :mask-click="false" type="bottom" class="popBox">
@ -33,35 +39,98 @@
</uni-popup> </uni-popup>
<uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox"> <uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox">
<view class="codeOuter"> <view class="codeOuter">
<view class="shareCon"> <view class="shareCon" @click="shareClose">
<image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image> <canvas style="width:100%;" :style="{ height: (cropperH-50) + 'px' }" canvas-id="firstCanvas" id="firstCanvas"></canvas>
<image class="code" src="../../static/300_qr.png"></image> <!-- <image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image> -->
<!-- <image class="code" src="../../static/300_qr.png"></image> -->
</view> </view>
<view class="shareBott"> <view class="shareBott" :style="{display: shareBtnDisplay}">
<view class="shareCol" @click="shareClose"></view> <button class="shareCol" @click="shareClose" open-type="share" style="border-radius:0;flex:1;">发给朋友</button>
<view class="shareCol" @click="shareClose"></view> <button class="shareCol" @click="save" style="border-radius:0;flex:1;">保存相册</button>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script> <script>
let sysInfo = uni.getSystemInfoSync();
let SCREEN_WIDTH = sysInfo.screenWidth
let SCREEN_HEIGHT = sysInfo.screenHeight
import { import {
weixin weixin
} from '../../utils/weixin.js'; } from '../../utils/weixin.js';
export default { export default {
data() { data() {
return { return {
cardActive: 0 cardActive: 0,
img: '',
user_info: {
promotion: ''
},
shareBtnDisplay: 'none',
//
cropperW: SCREEN_WIDTH,
cropperH: SCREEN_HEIGHT,
} }
}, },
onLoad() { 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: { methods: {
shareOpen() { shareOpen() {
this.$refs.shareCode.open() 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() { shareClose() {
this.$refs.shareCode.close() this.$refs.shareCode.close()
@ -76,10 +145,28 @@
if (this.checkLogin()) { if (this.checkLogin()) {
this.$refs.popup.close() this.$refs.popup.close()
uni.navigateTo({ 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> </script>
@ -234,15 +321,18 @@
width: 100%; width: 100%;
height: 100vh; height: 100vh;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
padding-top: 13vh; // padding-top: 13vh;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
} }
.shareCon { .shareCon {
width: 500rpx; // width: 500rpx;
margin: 0 auto; // margin: 0 auto;
position: relative; //position: absolute;
//top: 45%;
//left: 50%;
// transform: translate(-50%, -50%);
.code { .code {
width: 300rpx; 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 const user_info1 = result.data.data.user_info
user_info1.openid = user_info1.wechat_openid user_info1.openid = user_info1.wechat_openid
uni.setStorageSync(user_info_key, user_info1) uni.setStorageSync(user_info_key, user_info1)
cb(result.data.data.user_info) cb(user_info1)
} }
}); });
} }

Loading…
Cancel
Save