Commit 35c9e19b authored by wildfirecode13's avatar wildfirecode13

1

parent de84c242
No preview for this file type
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
const g = typeof global !== 'undefined' ? global : self; const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = { g.appXAppJson = {
"app": { "app": {
"$homepage": "pages/pageshou_ye/pageshou_ye" "$homepage": "pages/index/index"
} }
}; };
require('@alipay/appx-compiler/lib/sjsEnvInit'); require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$'); require('./config$');
require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pageshou_ye/pageshou_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pageshou_ye/pageshou_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
......
...@@ -5,19 +5,22 @@ self.__appxInited = 1; ...@@ -5,19 +5,22 @@ self.__appxInited = 1;
require('./config$'); require('./config$');
var AFAppX = self.AFAppX.getAppContext if( navigator.userAgent && (navigator.userAgent.indexOf('LyraVM') > 0 || navigator.userAgent.indexOf('AlipayIDE') > 0) ) {
? self.AFAppX.getAppContext().AFAppX var AFAppX = self.AFAppX.getAppContext ? self.AFAppX.getAppContext().AFAppX : self.AFAppX;
: self.AFAppX; } else {
self.getCurrentPages = AFAppX.getCurrentPages; importScripts('https://appx/af-appx.worker.min.js');
self.getApp = AFAppX.getApp; var AFAppX = self.AFAppX;
self.Page = AFAppX.Page; }
self.App = AFAppX.App; self.getCurrentPages = AFAppX.getCurrentPages;
self.my = AFAppX.bridge || AFAppX.abridge; self.getApp = AFAppX.getApp;
self.abridge = self.my; self.Page = AFAppX.Page;
self.Component = AFAppX.WorkerComponent || function(){}; self.App = AFAppX.App;
self.$global = AFAppX.$global; self.my = AFAppX.bridge || AFAppX.abridge;
self.requirePlugin = AFAppX.requirePlugin; self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global;
self.requirePlugin = AFAppX.requirePlugin;
if(AFAppX.registerApp) { if(AFAppX.registerApp) {
AFAppX.registerApp({ AFAppX.registerApp({
...@@ -29,6 +32,7 @@ if(AFAppX.registerApp) { ...@@ -29,6 +32,7 @@ if(AFAppX.registerApp) {
function success() { function success() {
require('../../app'); require('../../app');
require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pageshou_ye/pageshou_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pageshou_ye/pageshou_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68'); require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
......
...@@ -2,12 +2,12 @@ import cloud from '@tbmp/mp-cloud-sdk'; ...@@ -2,12 +2,12 @@ import cloud from '@tbmp/mp-cloud-sdk';
import tbcc from './tbcc-sdk'; import tbcc from './tbcc-sdk';
cloud.init({ cloud.init({
env: 'test' // 云函数环境 test 测试环境 online 线上环境 env: 'online' // 云函数环境 test 测试环境 online 线上环境
}); });
App({ App({
requestType: 'cloud', // ams:ams接口,cloud: 云函数 requestType: 'cloud', // ams:ams接口,cloud: 云函数
cloudName: 'skechRun', // 主云函数项目名 base clientTemplate2C cloudName: 'bubbleSurviva', // 主云函数项目名 base clientTemplate2C
cloud, cloud,
tbcc, tbcc,
onLaunch(options) { onLaunch(options) {
...@@ -23,6 +23,6 @@ App({ ...@@ -23,6 +23,6 @@ App({
*/ */
handleQuery(query) { handleQuery(query) {
const { activityId } = query; const { activityId } = query;
this.activityId = activityId || '5f4605629897b44ce119d8f1'; this.activityId = activityId || '5f34e1c4964f9706aa7d803c';
} }
}); });
{ {
"pages": [ "pages": [
"pages/index/index",
"pages/pageshou_ye/pageshou_ye", "pages/pageshou_ye/pageshou_ye",
"pages/pagehuo_dong_ye/pagehuo_dong_ye", "pages/pagehuo_dong_ye/pagehuo_dong_ye",
"pages/pagejie_shu_ye/pagejie_shu_ye", "pages/pagejie_shu_ye/pagejie_shu_ye",
......
.index-page {
min-height: 100vh;
}
.index-rule-btn, .index-myprize-btn {
position: absolute;
top: 30rpx;
width: 126rpx;
height: 48rpx;
line-height: 48rpx;
font-size: 22rpx;
background: rgba(0, 0, 0, 0.8);
color: #FFF;
text-align: center;
z-index: 5;
}
.index-rule-btn {
left: 0;
border-radius: 0 48rpx 48rpx 0;
}
.index-myprize-btn {
right: 0;
border-radius: 48rpx 0 0 48rpx;
}
.index-page__title {
font-size: 50rpx;
text-align: center;
padding: 100rpx 0 50rpx 0;
}
.index-page__content {
text-align: center;
font-size: 30rpx;
}
.index-page__tips {
padding-top: 40rpx;
text-align: center;
font-size: 22rpx;
}
.index-start-btn {
background: #0077a9;
color: #FFF;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
margin: 100rpx auto 50rpx auto;
font-size: 30rpx;
}
.index-tbcc-btn {
background: #0077a9;
color: #FFF;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
margin: 0 auto;
font-size: 30rpx;
}
.index-link-btn {
text-align: center;
color: #333;
font-size: 26rpx;
}
\ No newline at end of file
<view class="index-page">
<view class="index-rule-btn" onTap="showRuleModal">活动规则</view>
<navigator open-type="navigate" url="/pages/myprize/myprize" class="index-myprize-btn">我的奖品</navigator>
<view class="index-page__title">{{title}}</view>
<view class="index-page__content">{{content}}</view>
<view class="index-page__tips">AM接口只支持PC端预览,手机淘宝预览需要使用云函数模式</view>
<view class="index-start-btn" onTap="doStart">开始</view>
<navigator open-type="navigate" url="/pages/tbccDemo/tbccDemo" class="index-tbcc-btn">tbcc demo</navigator>
</view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal"><text>{{rule}}</text></rule-modal>
<common-modal a:if="{{commonModalVisible}}" data="{{commonModalData}}" onModalClose="closeCommonModal" onModalConfirm="confirmCommonModal" />
<end-modal a:if="{{false}}" />
\ No newline at end of file
const app = getApp();
const { tbcc } = app;
const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
import API from '../../api';
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Page({
data: {
title: '',
content: '',
rule: '',
commonModalData: {
content: '',
btnText: ''
},
commonModalConfirm: null,
commonModalVisible: false,
ruleModalVisible: false
},
onLoad(query) {
// 页面加载
this.getAuth();
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
init() {
this.getIndex();
},
onReady() {
// 页面加载完成
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() {
// 页面被拉到底部
},
/**
* 获取用户授权信息
*/
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
});
if (userInfo) {
console.log('授权成功,userInfo=>', userInfo);
const { nickName, avatar } = userInfo;
app.nickName = nickName;
app.avatar = avatar;
this.login();
}
},
/**
* 获取主接口
*/
async getIndex() {
const { success, data } = await API.getIndex().catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { title, content, rule } = data;
this.setData({ title, content, rule });
}
},
/**
* 登录接口
*/
async login() {
const { nickName, avatar } = app;
const { success } = await API.login({ userNick:nickName, avatar }).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
this.init();
}
},
/**
* 显示规则弹层
*/
showRuleModal() {
this.setData({
ruleModalVisible: true
});
},
/**
* 通用弹出确认按钮回调
*/
confirmCommonModal() {
const { commonModalConfirm } = this.data;
commonModalConfirm && commonModalConfirm();
},
/**
* 执行开始
*/
doStart() {
this.showCommonModal({
content: '活动还未开始\n请稍后',
btnText: '我知道了',
commonModalVisible: true,
confirmCallback: () => {
this.closeCommonModal();
}
});
},
/**
* 显示通用弹层
* @param {object} options content: 通用弹层内容 btnText:按钮文案 confirmCallback: 按钮确认回调
*/
showCommonModal({ content, btnText, confirmCallback }) {
this.setData({
commonModalConfirm: confirmCallback || null,
commonModalVisible: true,
commonModalData: { content, btnText }
});
},
/**
* 跳转到天猫页面
*/
goTmallPage() {
navigateToOutside(REDIRECT_URL['tmall']);
},
/**
* 关闭通用弹层
*/
closeCommonModal() {
this.setData({
commonModalVisible: false
});
},
/**
* 关闭活动规则弹层
*/
closeRuleModal() {
this.setData({
ruleModalVisible: false
});
},
onShareAppMessage() {
// 返回自定义分享信息
return SHARE_CONFIG;
},
});
{
"usingComponents": {
}
}
\ No newline at end of file
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