init
This commit is contained in:
parent
df989164cf
commit
3fec0df724
6
app.js
6
app.js
@ -10,7 +10,7 @@ App({
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
api("/user/code2session?js_code=" + res.code).then(res => {
|
||||
api("/auth/miniLogin?code=" + res.code).then(res => {
|
||||
if (res.code === 200) {
|
||||
wx.setStorageSync('openid', res.data.openid)
|
||||
wx.setStorageSync('sessionKey', res.data.sessionKey)
|
||||
@ -34,6 +34,10 @@ App({
|
||||
wx.removeStorageSync('user')
|
||||
}
|
||||
publisher.emit("login");
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: '../login/index',
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
9
app.json
9
app.json
@ -1,10 +1,13 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
"pages/index/index",
|
||||
"pages/add/index",
|
||||
"pages/add/edit",
|
||||
"pages/login/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "Weixin",
|
||||
"navigationBarTitleText": "植趣",
|
||||
"navigationBarBackgroundColor": "#ffffff"
|
||||
},
|
||||
"darkmode": false,
|
||||
@ -23,4 +26,4 @@
|
||||
"t-fab": "tdesign-miniprogram/fab/fab",
|
||||
"t-search": "tdesign-miniprogram/search/search"
|
||||
}
|
||||
}
|
||||
}
|
||||
10
app.wxss
10
app.wxss
@ -1,9 +1,9 @@
|
||||
/**app.wxss**/
|
||||
page {
|
||||
--td-brand-color: #1755EC;
|
||||
--td-brand-color-active: #0d4ef3;
|
||||
--td-brand-color: #4FAB5F;
|
||||
--td-brand-color-active: #4FAB5F;
|
||||
color: #373737;
|
||||
background: #F7F7F7;
|
||||
background: white
|
||||
}
|
||||
|
||||
.container {
|
||||
@ -24,11 +24,11 @@ page {
|
||||
color
|
||||
*/
|
||||
.primary {
|
||||
color: #1755EC;
|
||||
color: #4FAB5F;
|
||||
}
|
||||
|
||||
.primary-bg {
|
||||
background-color: #1755EC;
|
||||
background-color: #4FAB5F;
|
||||
}
|
||||
|
||||
.white {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const config = {
|
||||
baseUrl: 'https://prod.wutongshucloud.com/api',
|
||||
baseUrl: 'https://prod.sundynix.cn/api',
|
||||
// baseUrl: "http://127.0.0.1:3000",
|
||||
minio: 'https://res.wutongshucloud.com',
|
||||
baseHeader: {
|
||||
|
||||
66
pages/add/edit.js
Normal file
66
pages/add/edit.js
Normal file
@ -0,0 +1,66 @@
|
||||
// pages/add/edit.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
7
pages/add/edit.json
Normal file
7
pages/add/edit.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
|
||||
"usingComponents": {
|
||||
"t-textarea": "tdesign-miniprogram/textarea/textarea",
|
||||
"t-upload": "tdesign-miniprogram/upload/upload"
|
||||
}
|
||||
}
|
||||
15
pages/add/edit.wxml
Normal file
15
pages/add/edit.wxml
Normal file
@ -0,0 +1,15 @@
|
||||
<!--pages/add/edit.wxml-->
|
||||
<view>
|
||||
<view>
|
||||
<t-input placeholder="请输入花盆名称" borderless t-class="t-input" />
|
||||
<t-textarea t-class="external-class" placeholder="请输入备注" disableDefaultPadding="{{true}}" />
|
||||
<view class="mt-16 ml-32 ">
|
||||
<view class="font-12 grey">上传一张花盆的照片(可选)</view>
|
||||
<view class="mt-16">
|
||||
<t-upload disabled mediaType="{{['image']}}" max="{{1}}" files="{{fileList}}" bind:add="handleAdd" bind:remove="handleRemove">
|
||||
</t-upload>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
17
pages/add/edit.wxss
Normal file
17
pages/add/edit.wxss
Normal file
@ -0,0 +1,17 @@
|
||||
/* pages/add/edit.wxss */
|
||||
.t-input {
|
||||
--td-input-bg-color: #F2F2F7;
|
||||
margin: 32rpx;
|
||||
border-radius: 48rpx; /* 关键:加圆角 */
|
||||
overflow: hidden; /* 防止子元素溢出圆角 */
|
||||
}
|
||||
|
||||
.external-class {
|
||||
--td-textarea-background-color: #F2F2F7;
|
||||
margin: 32rpx;
|
||||
border-radius: 48rpx; /* 关键:加圆角 */
|
||||
overflow: hidden;
|
||||
height: 256rpx;
|
||||
background-color: wheat;
|
||||
|
||||
}
|
||||
23
pages/add/index.js
Normal file
23
pages/add/index.js
Normal file
@ -0,0 +1,23 @@
|
||||
// pages/add/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
goEdit(){
|
||||
wx.navigateTo({
|
||||
url: '../add/edit',
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/add/index.json
Normal file
4
pages/add/index.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "添加",
|
||||
"usingComponents": {}
|
||||
}
|
||||
22
pages/add/index.wxml
Normal file
22
pages/add/index.wxml
Normal file
@ -0,0 +1,22 @@
|
||||
<!--pages/add/index.wxml-->
|
||||
<view class="flex flex-center flex-col">
|
||||
<view class="card mt-32 flex flex-center flex-col" bind:tap="goEdit">
|
||||
<view class="flex flex-center flex-col">
|
||||
<view class="bg flex flex-center">
|
||||
<t-icon name="add"></t-icon>
|
||||
</view>
|
||||
<view class="font-16 bold mt-16">花盆</view>
|
||||
<view class="font-12 grey mt-16">添加新的花盆</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card mt-32 flex flex-center flex-col" style="background-color: #FCFAFF; border: #E9D0FC 1rpx solid;" bind:tap="goEdit">
|
||||
<view class="flex flex-center flex-col">
|
||||
<view class="bg flex flex-center" style="background-color: #E0BCFB;">
|
||||
<t-icon name="add"></t-icon>
|
||||
</view>
|
||||
<view class="font-16 bold mt-16">植物</view>
|
||||
<view class="font-12 grey mt-16">添加新植物,科学的进行种植!</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
16
pages/add/index.wxss
Normal file
16
pages/add/index.wxss
Normal file
@ -0,0 +1,16 @@
|
||||
/* pages/add/index.wxss */
|
||||
.card {
|
||||
width: 95vw;
|
||||
height: 50vw;
|
||||
margin: 16rpx;
|
||||
border: #DAE2FD 1rpx solid;
|
||||
border-radius: 16rpx;
|
||||
background-color: #F6F8FE;
|
||||
}
|
||||
|
||||
.bg {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background-color:#A4B7FA ;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
@ -1,49 +1,11 @@
|
||||
// index.js
|
||||
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||
|
||||
Page({
|
||||
data: {
|
||||
motto: 'Hello World',
|
||||
userInfo: {
|
||||
avatarUrl: defaultAvatarUrl,
|
||||
nickName: '',
|
||||
},
|
||||
hasUserInfo: false,
|
||||
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
|
||||
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
|
||||
list:[]
|
||||
},
|
||||
bindViewTap() {
|
||||
goAdd(){
|
||||
wx.navigateTo({
|
||||
url: '../logs/logs'
|
||||
url: '../add/index',
|
||||
})
|
||||
},
|
||||
onChooseAvatar(e) {
|
||||
const { avatarUrl } = e.detail
|
||||
const { nickName } = this.data.userInfo
|
||||
this.setData({
|
||||
"userInfo.avatarUrl": avatarUrl,
|
||||
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
|
||||
})
|
||||
},
|
||||
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
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,4 +1,12 @@
|
||||
<!--index.wxml-->
|
||||
<view>
|
||||
<t-button theme="primary">333</t-button>
|
||||
<view class="flex flex-center">
|
||||
<view wx-if="{{list.length === 0}}" class="flex flex-center flex-col " style="margin-top: 128rpx;" bind:tap="goAdd">
|
||||
<view class="empty flex flex-center flex-col">
|
||||
<t-icon name="extension-off" size="42rpx"></t-icon>
|
||||
</view>
|
||||
<view class="mt-16 flex flex-center flex-col">
|
||||
<view class="font-16 bold" >添加花盆</view>
|
||||
<view class="font-12 grey mt-16">您还没有添加任何花盆</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -1,62 +1,8 @@
|
||||
/**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;
|
||||
}
|
||||
.empty {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
background-color:#F6F6F6 ;
|
||||
border-radius: 140rpx;
|
||||
}
|
||||
38
pages/login/index.js
Normal file
38
pages/login/index.js
Normal file
@ -0,0 +1,38 @@
|
||||
// pages/login/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
checked:false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
read(){
|
||||
if (this.data.checked === false){
|
||||
wx.showModal({
|
||||
content: '请先勾选我已经阅读并同意《植趣用户协议》和《植趣隐私政策》',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getPhoneNumber(e){
|
||||
|
||||
if (e.detail.errMsg != 'getPhoneNumber:ok') {
|
||||
return
|
||||
}
|
||||
console.log(e);
|
||||
},
|
||||
change(e){
|
||||
const tmp = this.data.checked === false
|
||||
console.log(tmp);
|
||||
this.setData({checked:tmp})
|
||||
}
|
||||
})
|
||||
6
pages/login/index.json
Normal file
6
pages/login/index.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "账号登录",
|
||||
"usingComponents": {
|
||||
"t-radio": "tdesign-miniprogram/radio/radio"
|
||||
}
|
||||
}
|
||||
19
pages/login/index.wxml
Normal file
19
pages/login/index.wxml
Normal file
@ -0,0 +1,19 @@
|
||||
<!--pages/login/index.wxml-->
|
||||
<view>
|
||||
<view class="flex flex-center flex-col">
|
||||
<view class="bg"></view>
|
||||
<view style="width: 80%;" >
|
||||
<t-button theme="primary" wx:if="{{checked === false}}" bind:tap="read" block shape="round">一键登录</t-button>
|
||||
<t-button theme="primary" wx:else open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" block shape="round">一键登录</t-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex flex-center bottom" >
|
||||
<t-radio bind:change="change" borderless checked="{{checked}}">
|
||||
<view slot="label" class="font-12 grey">
|
||||
我已经阅读并同意 <p class="primary">《植趣用户协议》</p> 和<p class="primary">《植趣隐私政策》</p>
|
||||
</view>
|
||||
</t-radio>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
17
pages/login/index.wxss
Normal file
17
pages/login/index.wxss
Normal file
@ -0,0 +1,17 @@
|
||||
/* pages/login/index.wxss */
|
||||
.bg {
|
||||
height: 60vh;
|
||||
width: 90vw;
|
||||
border-radius: 16rpx;
|
||||
background-image: url("https://res.catter.cn/pub/2025/09/25/202509251104161.svg");
|
||||
background-position: center center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
position: fixed;
|
||||
bottom: 100rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
@ -17,12 +17,25 @@
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileWorklet": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"packNpmManually": false,
|
||||
"minifyWXSS": true,
|
||||
"minifyWXML": true,
|
||||
"localPlugins": false,
|
||||
"disableUseStrict": false,
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "auto",
|
||||
"tabSize": 2
|
||||
},
|
||||
"appid": "wx0f8c13371584dda4"
|
||||
"appid": "wxb463820bf36dd5d6",
|
||||
"simulatorPluginLibVersion": {}
|
||||
}
|
||||
@ -1,7 +1,36 @@
|
||||
{
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "plane-mp",
|
||||
"projectname": "flow-mp",
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
"compileHotReLoad": true,
|
||||
"urlCheck": true,
|
||||
"coverView": true,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"skylineRenderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"autoAudits": false,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"useStaticServer": false,
|
||||
"useLanDebug": false,
|
||||
"showES6CompileOption": false,
|
||||
"checkInvalidKey": true,
|
||||
"ignoreDevUnusedFiles": true,
|
||||
"bigPackageSizeSupport": false
|
||||
},
|
||||
"libVersion": "3.10.1",
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/add/edit",
|
||||
"pathName": "pages/add/edit",
|
||||
"query": "",
|
||||
"scene": null,
|
||||
"launchMode": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user