Commit d8adb7b6 authored by 俞嘉婷's avatar 俞嘉婷

feat: 整理结构路径

parent 5bad5d25
{
"pages": [
"pages/dbindex/dbindex",
"pages/index/index",
"pages/webview/webview"
],
"window": {
......
const app = getApp();
/**
* 樱花节
*/
Page({
data: {
},
options: {},
async onLoad(options) {
console.log('页面参数', options)
this.options = options;
this.goAct();
},
onShow() {
},
goAct() {
// wx.showToast({
// title: "活动暂未开始,敬请期待~",
// icon: 'none',
// duration: 1000
// });
const { env, redirect, isNeedLogin } = this.options
let url = `/pages/webview/webview?isNeedLogin=${isNeedLogin || 1}`;;
if (env) url += `&env=${env}`;
if (redirect) url += `&redirect=${redirect}`;
console.log('跳转链接', url);
wx.redirectTo({ url });
},
})
\ No newline at end of file
{
"navigationBarTitleText": "",
"usingComponents": {
}
}
\ No newline at end of file
<view class="container">
<!-- <image class="bg" src="https://yun.duiba.com.cn/polaris/mid_bg0402.8066da5ae610adaa8bf3aacfb0c99b5aa39d7bde.png" bindtap="goAct" /> -->
</view>
\ No newline at end of file
.container {
min-height: 1448rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
}
.bg {
width: 750rpx;
height: 1624rpx;
position: absolute;
top: 0rpx;
left: 0rpx;
}
// index.js
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
const app = getApp();
Page({
data: {
motto: 'Hello World',
userInfo: {
avatarUrl: defaultAvatarUrl,
nickName: '',
},
hasUserInfo: false,
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
options: {},
async onLoad(options) {
console.log('页面参数', options)
this.options = options;
// this.goAct();
},
onChooseAvatar(e) {
const { avatarUrl } = e.detail
const { nickName } = this.data.userInfo
this.setData({
"userInfo.avatarUrl": avatarUrl,
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
})
onShow() {
},
onInputChange(e) {
const nickName = e.detail.value
const { avatarUrl } = this.data.userInfo
this.setData({
"userInfo.nickName": nickName,
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
})
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
goAct() {
// wx.showToast({
// title: "活动暂未开始,敬请期待~",
// icon: 'none',
// duration: 1000
// });
const { env, redirect, isNeedLogin } = this.options
let url = `/pages/webview/webview?isNeedLogin=${isNeedLogin || 1}`;;
if (env) url += `&env=${env}`;
if (redirect) url += `&redirect=${redirect}`;
console.log('跳转链接', url);
wx.redirectTo({ url });
},
})
})
\ No newline at end of file
{
"navigationBarTitleText": "",
"usingComponents": {
}
}
\ No newline at end of file
<!--index.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseNicknameComp && !hasUserInfo}}">
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="avatar" src="{{userInfo.avatarUrl}}"></image>
</button>
<view class="nickname-wrapper">
<text class="nickname-label">昵称</text>
<input type="nickname" class="nickname-input" placeholder="请输入昵称" bind:change="onInputChange" />
</view>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<view wx:else> 请使用2.10.4及以上版本基础库 </view>
</block>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>
</scroll-view>
<view class="container">
<image class="bg" src="https://yun.duiba.com.cn/polaris/bg.6699da2a8d66c0ba1087dc2d2b02c413d984d29a.jpg" bindtap="goAct" />
<image class="btn" src="https://yun.duiba.com.cn/polaris/btn.45304462debe02bf26d2a1292ab39957f66de914.png" bindtap="goAct" />
</view>
\ No newline at end of file
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
color: #aaa;
width: 80%;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.usermotto {
margin-top: 200px;
}
.avatar-wrapper {
padding: 0;
width: 56px !important;
border-radius: 8px;
margin-top: 40px;
margin-bottom: 40px;
}
.avatar {
display: block;
width: 56px;
height: 56px;
}
.nickname-wrapper {
display: flex;
width: 100%;
padding: 16px;
box-sizing: border-box;
border-top: .5px solid rgba(0, 0, 0, 0.1);
border-bottom: .5px solid rgba(0, 0, 0, 0.1);
color: black;
}
.nickname-label {
width: 105px;
}
.nickname-input {
flex: 1;
.container {
min-height: 1448rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
}
.bg {
width: 750rpx;
height: 1624rpx;
position: absolute;
top: 0rpx;
left: 0rpx;
}
.btn {
width: 498rpx;
height: 101rpx;
position: absolute;
left: 125rpx;
top: 1200rpx;
}
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})
{
"usingComponents": {
}
}
\ No newline at end of file
<!--logs.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<view class="log-item">{{index + 1}}. {{log.date}}</view>
</block>
</scroll-view>
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.log-item {
margin-top: 20rpx;
text-align: center;
}
.log-item:last-child {
padding-bottom: env(safe-area-inset-bottom);
}
......@@ -6,12 +6,12 @@ const DEFAULT_PROJECT = {
loginDomain: "https://activity.m.duibatest.com.cn"
},
'pre': {
redirectUrl: 'https://98655-activity.m.dexfu.cn/projectx/p86defdb9/index.html?appID=98655',
loginDomain: "TODO正式域名"
redirectUrl: 'https://99183-activity.dexfu.cn/projectx/pe08eb0d1/index.html?appID=99183',
loginDomain: "https://99183-activity.dexfu.cn"
},
'prod': {
redirectUrl: 'https://98655-activity.m.dexfu.cn/projectx/pad0649b4/index.html?appID=98655',
loginDomain: "TODO正式域名"
redirectUrl: 'https://99183-activity.dexfu.cn/projectx/TODO/index.html?appID=99183',
loginDomain: "https://99183-activity.dexfu.cn"
},
}
......@@ -24,7 +24,7 @@ Page({
link: ''
},
},
env: 'test', // TODO 'test', 'pre', 'prod'
env: 'pre', // TODO 'test', 'pre', 'prod'
redirectUrl: '',
options: {},
onLoad(options) {
......@@ -104,7 +104,7 @@ Page({
onShareAppMessage: function (options) { //分享
const { h5ShareInfo } = this.data;
console.log("onShareAppMessage--------", JSON.stringify(options))
const shareUrl = `pages/dbindex/dbindex?env=${this.env}isNeedLogin=1&redirect=${encodeURIComponent(
const shareUrl = `pages/dbindex/dbindex?env=${this.env}&isNeedLogin=1&redirect=${encodeURIComponent(
h5ShareInfo.link || this.redirectUrl
)}`;
......
{
"compileType": "miniprogram",
"libVersion": "trial",
"libVersion": "3.8.12",
"packOptions": {
"ignore": [],
"include": []
......
......@@ -19,5 +19,6 @@
"checkInvalidKey": true,
"ignoreDevUnusedFiles": true
},
"libVersion": "3.8.12"
"libVersion": "3.8.12",
"condition": {}
}
\ 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