feat: move project

This commit is contained in:
ckaaaa 2025-09-16 13:41:49 +08:00
commit 4a940f28ba
97 changed files with 5047 additions and 0 deletions

View file

@ -0,0 +1,109 @@
import C from '../../utils/constant';
import * as F from '../../utils/func';
import R from '../../utils/request';
import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';
Page({
data: {
price: '',
expireDate: F.parseDate(new Date()),
dateVisible: false,
start: F.parseDate(new Date()),
end: F.parseDate(new Date(new Date() * 1 + 24 * 3600 * 366 * 1000 + 1)),
filter(type, options) {
if (type === 'year') {
return options.sort((a, b) => b.value - a.value);
}
return options;
},
popupProps: {
usingCustomNavbar: true,
},
buy_type: '',
buy_types: [],
},
onLoad() {
R.get('/index.php/api/v1/config_one', { k: 'buy_types' }).then(({ model }) => {
this.setData({
buy_types: model || [],
buy_type: model[0],
});
});
},
handleSelected(e) {
console.log(e.detail);
this.setData({
buy_type: e.detail.selected.label,
});
},
handleAction() {
ActionSheet.show({
theme: ActionSheetTheme.List,
selector: '#t-action-sheet',
context: this,
items: this.data.buy_types.map((item) => ({
label: item,
})),
});
},
onConfirm(e) {
const { value } = e.detail;
this.setData({
expireDate: value,
dateVisible: false,
});
},
showPicker() {
this.setData({ dateVisible: true });
},
onClose() {
this.setData({ dateVisible: false });
},
validate() {
const { price, expireDate } = this.data;
if (!price) {
wx.showToast({ title: '请输入分销金额', icon: 'none' });
return false;
}
if (!/^\d+(\.\d+)?$/.test(price)) {
wx.showToast({ title: '请输入正确的金额', icon: 'none' });
return false;
}
if (!expireDate) {
wx.showToast({ title: '请选择付款有效期', icon: 'none' });
return false;
}
return true;
},
share() {
if (!this.validate()) return;
// TODO: 调用分享接口
// console.log('share1', this.data);
// wx.showShareMenu({
// withShareTicket: true,
// menus: ['shareAppMessage']
// });
},
onShareAppMessage(e) {
if (!this.validate()) {
return {
title: '',
path: '',
imageUrl: '',
promise: Promise.reject(),
}
}
const { price, expireDate, buy_type } = this.data;
return R.get('/index.php/api/v1/create_share', {
price, expireDate, buy_type,
}).then(({ model }) => {
return {
title: model.title,
path: model.path || '/pages/sharebuy/sharebuy?id=' + model.id,
imageUrl: model.img,
promise: Promise.resolve(),
};
});
},
});

View file

@ -0,0 +1,11 @@
{
"navigationBarTitleText": "分销",
"backgroundTextStyle": "light",
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-button": "tdesign-miniprogram/button/button",
"t-input": "tdesign-miniprogram/input/input",
"t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker",
"t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet"
}
}

View file

View file

@ -0,0 +1,14 @@
<view class="container">
<view class="form">
<t-input label="分销金额" placeholder="请输入分销金额" suffix="元" type="digit" align="right" model:value="{{price}}" />
<t-cell title="分销类型" hover note="{{buy_type || '请选择分销类型'}}" arrow bindtap="handleAction" />
<t-cell title="付款有效期" hover note="{{expireDate || '请选择付款有效期'}}" arrow bindtap="showPicker" />
<!-- <t-input label="分销类型" placeholder="请选择分销类型" align="right" value="{{buy_type}}" bindtap="handleAction" readonly /> -->
<!-- <t-input label="付款有效期" placeholder="请选择付款有效期" align="right" value="{{expireDate}}" bindtap="showPicker" readonly /> -->
</view>
<view class="footer">
<t-button theme="primary" open-type="share" block catchtap="share">分享</t-button>
</view>
<t-action-sheet id="t-action-sheet" usingCustomNavbar bind:selected="handleSelected" />
<t-date-time-picker auto-close title="选择日期" visible="{{dateVisible}}" mode="date" default-value="{{expireDate}}" format="YYYY-MM-DD" start="{{start}}" end="{{end}}" filter="{{filter}}" popup-props="{{popupProps}}" bind:confirm="onConfirm" bind:close="onClose" />
</view>

View file

@ -0,0 +1,14 @@
.container {
padding: 20rpx;
}
.form {
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.footer {
margin-top: 40rpx;
padding: 0 20rpx;
}

33
pages/detail/detail.js Normal file
View file

@ -0,0 +1,33 @@
import R from '../../utils/request';
import C from '../../utils/constant';
Page({
data: {
cdnHost: C.cdnHost,
detail: {},
user: {},
},
onLoad(options) {
const { id } = options;
R.get('/index.php/api/v1/news_detail', { id }).then(({ model }) => {
this.setData({
detail: {
...model.detail,
content: (model.detail.content||'').replace(/src\="\/uploads/g, 'src="'+C.cdnHost + '/uploads'),
imgs: (model.detail.imgs || '').split(',').filter(o=>!!o),
video: model.detail.video ? model.detail.video : '',
},
user: {
...model.user,
}
});
});
},
videoErrorCallback(e) {
console.log('视频错误信息:')
console.log(e.detail.errMsg)
},
onShareAppMessage() {
}
})

8
pages/detail/detail.json Normal file
View file

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "详情",
"backgroundTextStyle": "light",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image"
}
}

14
pages/detail/detail.wxml Normal file
View file

@ -0,0 +1,14 @@
<view>
<view class="title">{{detail.title}}</view>
<view class="info">
<view class="time">{{detail.create_time}}</view>
<view class="viewcnt">
<t-icon name="browse" size="28rpx" color="#b3b5b9"></t-icon>
{{detail.view_cnt}}
</view>
</view>
<rich-text class="desc" nodes="{{detail.content}}"></rich-text>
<t-image mode="aspectFill" wx:for="{{detail.imgs}}" src="{{cdnHost + item}}" wx:key="item" class="img" shape="round" />
<video class="video" wx:if="{{detail.video}}" id="myVideo" src="{{cdnHost + detail.video}}" binderror="videoErrorCallback" show-center-play-btn='{{false}}' show-play-btn="{{true}}" controls></video>
<view class="source">来源: {{user.real_name || '三鲤'}}</view>
</view>

57
pages/detail/detail.wxss Normal file
View file

@ -0,0 +1,57 @@
page {
box-sizing: border-box;
background-color: #fff;
padding: 0 20rpx;
padding-top: 20rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title {
font-size: 34rpx;
list-style: square;
margin-bottom: 20rpx;
color: #363a44;
}
.info {
display: flex;
font-size: 28rpx;
justify-content: space-between;
margin-bottom: 60rpx;
color: #b3b5b9;
}
.info .viewcnt {
display: flex;
align-items: center;
}
.info .viewcnt .t-icon {
margin-right: 12rpx;
}
.content {
word-break: break-all;
line-height: 46rpx;
font-size: 26rpx;
color: #363a44;
}
.img {
width: 100%;
margin: 20rpx auto;
}
.video {
width: 100%;
margin: 20rpx auto;
}
.source {
font-size: 24rpx;
color: #b3b5b9;
text-align: left;
margin-top: 40rpx;
}

View file

@ -0,0 +1,66 @@
// pages/detail_admin/detail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View file

@ -0,0 +1,2 @@
<!--pages/detail_admin/detail.wxml-->
<text>pages/detail_admin/detail.wxml</text>

View file

@ -0,0 +1,107 @@
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
cdnHost: C.cdnHost,
list: [],
page: 1,
status: '',
// money_flag: 'send',
listEndText: '',
},
onShow() {
this.getTabBar().init();
this.fetchList(1);
},
onLoad(options) {
},
goCreate(e) {
wx.navigateTo({
url: `/pages/createpay/createpay`
});
},
fetchList(page) {
const { status } = this.data;
// money_flag
R.get('/index.php/api/v1/share_list', { page, status }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
price: F.formatePrice(item.price),
});
});
if (list.length == 0) {
this.setData({ listEndText: '没有更多了' });
} else {
this.setData({ listEndText: '点击加载更多。。。' });
}
if (page == 1) {
this.setData({ list,page });
} else {
const list2 = this.data.list.concat(list);
this.setData({ list: list2,page });
}
});
// for (let i = 0; i < 20; i++) {
// list.push({
// id: i,
// title: '自动热重载] 已开启代码文件保存后自动热重载自动热重载] 已开启代码文件保存后自动热重载',
// image: `${imageCdn}/swiper2.png`,
// createTime: '09-12 12:21',
// viewCnt: 1922 + i,
// });
// }
// this.setData({
// list
// })
},
loadMore() {
const { page, listEndText } = this.data;
if (listEndText == '点击加载更多。。。') {
this.fetchList(page + 1);
}
},
onTabsChange(event) {
const v = event.detail.value;
this.data.status = v;
this.fetchList(1);
},
// handleSwitchChange(e) {
// const { value } = e.detail;
// if (value) {
// this.data.money_flag = 'send';
// } else {
// this.data.money_flag = '';
// }
// this.fetchList(1);
// },
onReachBottom() {
this.loadMore();
},
onPullDownRefresh() {
this.fetchList(1);
wx.stopPullDownRefresh();
},
editRemark(e) {
const { id, remark } = e.currentTarget.dataset.detail;
const that = this;
wx.showModal({
title: '备注',
content: remark || '',
editable: true,
success(re) {
const remark2 = re.content || '';
R.post('/index.php/api/v1/mark', { id, remark: remark2 }).then(() => {
that.data.list.find(o => o.id == id).remark = remark2;
that.setData({
list: [...that.data.list],
})
})
}
})
}
})

View file

@ -0,0 +1,13 @@
{
"navigationBarTitleText": "我的分销",
"backgroundTextStyle": "light",
"usingComponents": {
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
"t-image": "tdesign-miniprogram/image/image",
"t-sticky": "tdesign-miniprogram/sticky/sticky",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-footer": "tdesign-miniprogram/footer/footer"
}
}

View file

@ -0,0 +1,44 @@
<view>
<!-- <t-sticky offset-top="{{0}}"> -->
<!-- <view class="tabs"> -->
<!-- <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" t-class="custom-tabs">
<t-tab-panel label="全部" value="" />
<t-tab-panel label="已支付" value="payed" />
<t-tab-panel label="待支付" value="wait_pay" />
</t-tabs>
<view class="sw"> -->
<!-- <t-switch defaultValue="{{false}}" bindchange="handleSwitchChange" size="small" />
<view class="txt">已提现</view> -->
<!-- </view> -->
<!-- </view> -->
<!-- </t-sticky> -->
<view class="list">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-id="{{item.id}}" bind:tap="goDetail">
<view class="right">
<view class="text">
<view>订单号: {{item.order_no || '-'}} 金额: {{item.price}} 元</view>
<view wx:if="{{item.name}}">购买信息: {{item.name}} {{item.phone}}</view>
<view data-detail="{{item}}" class="remark" bind:tap="editRemark">
<t-icon prefix="wr" name="edit" size="40rpx" />
备注: {{item.remark || '无'}}
</view>
</view>
<view class="info">
<view wx:if="{{item.pay_time}}">支付时间: {{item.pay_time}}</view>
<view wx:else>订单时间: {{item.create_time}}</view>
<view class="viewcnt init">{{item.buy_type}}</view>
<!-- <view class="viewcnt init" wx:if="{{item.status == 'init'}}">待审核</view> -->
<!-- <view class="viewcnt resolve" wx:if="{{item.status == 'payed'}}">已支付</view> -->
<!-- <view class="viewcnt reject" wx:if="{{item.status == 'wait_pay'}}">待支付</view> -->
</view>
</view>
</view>
</view>
<t-footer wx:if="{{listEndText}}" text="{{listEndText}}" bind:tap="loadMore"></t-footer>
</view>
<view class="btn_cre" bind:tap="goCreate">
<view>创建</view>
<view>分销</view>
</view>
</view>

View file

@ -0,0 +1,113 @@
page {
padding: 0 20rpx;
background-color: rgb(245, 246, 247);
}
.tabs {
display: flex;
justify-content: space-between;
background-color: rgb(245, 246, 247);
}
.tabs .t-tabs {
width: 60%;
background: none !important;
}
.tabs .t-tabs .t-tabs__wrapper {
background: none !important;
}
.sw {
width: 240rpx;
display: flex;
align-items: center;
font-size: 32rpx;
}
.sw .txt {
padding-left: 16rpx;
}
.list {
margin-top: 20rpx;
padding-bottom: 60rpx;
}
.list .item {
border-radius: 16rpx;
background-color: #fff;
margin-bottom: 20rpx;
width: 710rpx;
padding-top: 20rpx;
}
.list .item .item-main {
display: flex;
padding-left: 20rpx;
}
.list .item .item-main .right {
flex: 1;
padding: 0 32rpx;
padding-bottom: 20rpx;
}
.list .item .item-main .right .text {
padding-top: 16rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 20rpx;
color: #333;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #8f9197;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
padding: 0 20rpx;
}
.list .item .item-main .right .info .viewcnt.init {
color: blue;
}
.list .item .item-main .right .info .viewcnt.resolve {
color: green;
}
.list .item .item-main .right .info .viewcnt.reject {
color: gray;
}
.remark{
display: flex;
}
.btn_cre {
position: fixed;
bottom: 220rpx;
right: 20rpx;
height: 120rpx;
width: 120rpx;
border-radius: 50%;
background-color: rgb(111, 172, 207);
color: #fff;
font-size: 26rpx;
z-index: 2;
padding-top: 26rpx;
box-sizing: border-box;
}
.btn_cre view {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
text-align: center;
}

106
pages/home/home.js Normal file
View file

@ -0,0 +1,106 @@
import R from '../../utils/request';
import C from '../../utils/constant';
Page({
data: {
cdnHost: C.cdnHost,
loadFlag: false,
swiperList: [],
list: [],
},
onShow() {
this.getTabBar().init();
// this.init();
this.fetchBanner();
},
onLoad() {
R.login().then(() => {
this.init();
})
},
fetchBanner() {
R.get('/index.php/api/v1/banner_list', {}).then(({ model }) => {
const swiperList = [];
model.forEach(item => {
swiperList.push({
...item,
value: C.cdnHost + item.img,
ariaLabel: item.title,
id: item.id,
});
});
if (JSON.stringify(swiperList) != JSON.stringify(this.data.swiperList)) {
this.setData({ swiperList });
}
});
},
init() {
if (this.data.loadFlag) return;
this.data.loadFlag = false;
this.fetchList(1);
this.fetchBanner();
},
fetchList(page) {
R.get('/index.php/api/v1/news_list', { page, pageSize: 5 }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
});
});
this.setData({ list });
});
},
goDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/detail/detail?id=${id}`
});
},
onSwiperTap(e) {
const { index } = e.detail;
this.data.swiperList.forEach((o, i) => {
if (i == index) {
console.log(o)
if(o.action_type == 'newsId'){
wx.navigateTo({
url: '/pages/detail/detail?id=' + o.action_item,
});
}
if(o.action_type == 'url'){
wx.navigateTo({
url: '/pages/webview/webview?url=' + encodeURIComponent(o.action_item),
});
}
if(o.action_type == 'path'){
wx.navigateTo({
url: o.action_item,
});
}
}
})
},
goUrl(e) {
const { url } = e.currentTarget.dataset;
wx.navigateTo({
url
});
},
goMore() {
wx.navigateTo({
url: '/pages/news_list/home'
});
},
refresh() {
this.fetchList(1);
this.fetchBanner();
wx.showToast({ icon: 'none', title: '刷新成功' });
},
onPullDownRefresh() {
this.init();
wx.stopPullDownRefresh();
},
onShareAppMessage() { },
onShareTimeline() { },
});

12
pages/home/home.json Normal file
View file

@ -0,0 +1,12 @@
{
"navigationBarTitleText": "首页",
"backgroundTextStyle": "light",
"usingComponents": {
"t-swiper": "tdesign-miniprogram/swiper/swiper",
"t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image",
"t-divider": "tdesign-miniprogram/divider/divider"
},
"enablePullDownRefresh": true
}

101
pages/home/home.less Normal file
View file

@ -0,0 +1,101 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
color: rgb(53, 58, 71);
height: 34rpx;
display: flex;
align-items: center;
font-weight: bold;
.t-icon {
margin-left: 10rpx;
}
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-left: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
.t-image {
width: 100%;
}
}

31
pages/home/home.wxml Normal file
View file

@ -0,0 +1,31 @@
<view>
<t-swiper wx:if="{{swiperList.length > 0}}" current="{{current}}" autoplay="{{true}}" duration="{{500}}" height="{{180}}" interval="{{3000}}" list="{{swiperList}}" navigation="{{ { type: 'dots-bar' } }}" bind:click="onSwiperTap" />
<view class="title_bar" wx:if="{{list.length}}">
<view class="title" bind:tap="refresh">
公司动态
<t-icon name="refresh" size="28rpx" color="71737b"></t-icon>
</view>
<view class="btn" bind:tap="goMore">
查看全部
<t-icon name="chevron-right" size="28rpx" color="71737b"></t-icon>
</view>
</view>
<view class="list" wx:if="{{list.length}}">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-id="{{item.id}}" bind:tap="goDetail">
<t-image mode="aspectFill" src="{{cdnHost+item.poster}}" width="108" height="72" shape="round" />
<view class="right">
<view class="text">{{item.title}}</view>
<view class="info">
<view>{{item.create_time}}</view>
<view class="viewcnt">
<t-icon name="browse" size="28rpx" color="71737b"></t-icon>
{{item.view_cnt}}
</view>
</view>
</view>
</view>
<t-divider />
</view>
</view>
</view>

84
pages/home/home.wxss Normal file
View file

@ -0,0 +1,84 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
color: #353a47;
height: 34rpx;
display: flex;
align-items: center;
font-weight: bold;
}
.title_bar .title .t-icon {
margin-left: 10rpx;
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-left: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
}
.activity .t-image {
width: 100%;
}

8
pages/home/readme Normal file
View file

@ -0,0 +1,8 @@
首页功能设定
1. loading入场
2. 下拉刷新
3. 搜索栏
4. 分类切换
5. 商品列表
6. 规格弹层
7. 加载更多

View file

@ -0,0 +1,66 @@
// pages/news_admin_list/home.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View file

@ -0,0 +1,2 @@
<!--pages/news_admin_list/home.wxml-->
<text>pages/news_admin_list/home.wxml</text>

63
pages/news_list/home.js Normal file
View file

@ -0,0 +1,63 @@
import R from '../../utils/request';
import C from '../../utils/constant';
Page({
data: {
cdnHost: C.cdnHost,
list: [],
page: 1,
listEndText: '',
},
onShow() {
this.getTabBar().init();
},
onLoad() {
this.init();
},
init() {
this.fetchList(1);
},
fetchList(page) {
R.get('/index.php/api/v1/news_list', { page }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
});
});
if (list.length == 0) {
this.setData({ listEndText: '没有更多了' });
} else {
this.setData({ listEndText: '点击加载更多。。。' });
}
if (page == 1) {
this.setData({ list ,page});
} else {
const list2 = this.data.list.concat(list);
this.setData({ list: list2,page });
}
});
},
loadMore() {
const { page, listEndText } = this.data;
if (listEndText == '点击加载更多。。。') {
this.fetchList(page + 1);
}
},
goDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/detail/detail?id=${id}`
});
},
refresh() {
this.fetchList(1);
wx.showToast({ icon: 'none', title: '刷新成功' });
},
// 下拉刷新
onPullDownRefresh() {
this.init();
wx.stopPullDownRefresh();
},
});

10
pages/news_list/home.json Normal file
View file

@ -0,0 +1,10 @@
{
"navigationBarTitleText": "发现",
"backgroundTextStyle": "light",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-footer": "tdesign-miniprogram/footer/footer"
}
}

95
pages/news_list/home.less Normal file
View file

@ -0,0 +1,95 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
// background: url('http://cdn.zhonganonline.top/newslist/static/title.png') no-repeat;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-right: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
.t-image {
width: 100%;
}
}

28
pages/news_list/home.wxml Normal file
View file

@ -0,0 +1,28 @@
<view>
<view class="title_bar">
<view class="title">最新动态</view>
<view class="btn" bind:tap="refresh">
<t-icon name="refresh" size="28rpx" color="71737b"></t-icon>
刷新
</view>
</view>
<view class="list">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-id="{{item.id}}" bind:tap="goDetail">
<t-image mode="aspectFill" src="{{cdnHost+item.poster}}" width="108" height="72" shape="round" />
<view class="right">
<view class="text">{{item.title}}</view>
<view class="info">
<view>{{item.create_time}}</view>
<view class="viewcnt">
<t-icon name="browse" size="28rpx" color="71737b"></t-icon>
{{item.view_cnt}}
</view>
</view>
</view>
</view>
<t-divider />
</view>
<t-footer wx:if="{{listEndText}}" text="{{listEndText}}" bind:tap="loadMore"></t-footer>
</view>
</view>

78
pages/news_list/home.wxss Normal file
View file

@ -0,0 +1,78 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #71737b;
font-size: 28rpx;
display: flex;
align-items: center;
}
.title_bar .btn .t-icon {
margin-right: 10rpx;
}
.list {
margin-top: 20rpx;
}
.list .item .item-main {
display: flex;
}
.list .item .item-main .right {
flex: 1;
padding-left: 32rpx;
}
.list .item .item-main .right .text {
padding-top: 0rpx;
font-size: 28rpx;
line-height: 46rpx;
margin-bottom: 10rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
color: #363a44;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #71737b;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
}
.list .item .viewcnt .t-icon {
margin-right: 10rpx;
}
.t-tab-bar {
border-top: 1px solid #eee;
position: relative;
}
.activity {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
}
.activity .t-image {
width: 100%;
}

8
pages/news_list/readme Normal file
View file

@ -0,0 +1,8 @@
首页功能设定
1. loading入场
2. 下拉刷新
3. 搜索栏
4. 分类切换
5. 商品列表
6. 规格弹层
7. 加载更多

39
pages/pay/pay.js Normal file
View file

@ -0,0 +1,39 @@
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
},
onLoad(options) {
const { order_no, redirect_url } = options;
R.post('/index.php/api/v1/pay_order_shop', { order_no }).then(({ model }) => {
wx.requestPayment({
...model,
success(res) {
wx.showToast({
title: '支付成功',
icon: 'success',
duration: 2000,
success() {
wx.redirectTo({
url: '/pages/shop/shop?path=user',
});
}
})
},
fail(res) {
wx.showToast({
title: '支付失败',
icon: 'none',
duration: 2000
})
wx.redirectTo({
url: '/pages/shop/shop?path=user',
});
}
})
})
},
})

5
pages/pay/pay.json Normal file
View file

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "支付",
"backgroundTextStyle": "light",
"usingComponents": {}
}

1
pages/pay/pay.wxml Normal file
View file

@ -0,0 +1 @@
<view class="tip">支付中...</view>

4
pages/pay/pay.wxss Normal file
View file

@ -0,0 +1,4 @@
.tip {
text-align: center;
margin-top: 20px;
}

105
pages/paylist/paylist.js Normal file
View file

@ -0,0 +1,105 @@
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
cdnHost: C.cdnHost,
list: [],
page: 1,
status: '',
// money_flag: 'send',
listEndText: '',
},
onLoad(options) {
const {from} = options;
if(from == 'sharebuy') {
R.post('/index.php/api/v1/configs',{ks:['payed_tip','payed_vip_link']}).then(({model})=>{
if(model.payed_tip && model.payed_vip_link) {
wx.showModal({
title: '提示',
content: model.payed_tip,
complete: (res) => {
if (res.confirm) {
wx.navigateTo({
url: '/pages/webview/webview?url=' + encodeURIComponent(model.payed_vip_link),
})
}
}
})
}
})
}
this.fetchList(1);
},
goDetail(e) {
const { detail } = e.currentTarget.dataset;
if (!detail.phone && detail.status == 'payed') {
wx.navigateTo({
url: `/pages/sharebuy/sharebuy?id=${detail.share_id}&orderNo=${detail.order_no}`,
});
}
},
fetchList(page) {
const { status } = this.data;
// money_flag
R.get('/index.php/api/v1/order_list', { page }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
price: F.formatePrice(item.price),
});
});
if (list.length == 0) {
this.setData({ listEndText: '没有更多了' });
} else {
this.setData({ listEndText: '点击加载更多。。。' });
}
if (page == 1) {
this.setData({ list,page });
} else {
const list2 = this.data.list.concat(list);
this.setData({ list: list2,page });
}
});
// for (let i = 0; i < 20; i++) {
// list.push({
// id: i,
// title: '自动热重载] 已开启代码文件保存后自动热重载自动热重载] 已开启代码文件保存后自动热重载',
// image: `${imageCdn}/swiper2.png`,
// createTime: '09-12 12:21',
// viewCnt: 1922 + i,
// });
// }
// this.setData({
// list
// })
},
loadMore() {
const { page, listEndText } = this.data;
if (listEndText == '点击加载更多。。。') {
this.fetchList(page + 1);
}
},
onTabsChange(event) {
const v = event.detail.value;
this.data.status = v;
this.fetchList(1);
},
// handleSwitchChange(e) {
// const { value } = e.detail;
// if (value) {
// this.data.money_flag = 'send';
// } else {
// this.data.money_flag = '';
// }
// this.fetchList(1);
// },
onReachBottom() {
this.loadMore();
},
onShareAppMessage() {
}
})

View file

@ -0,0 +1,12 @@
{
"navigationBarTitleText": "我的订单",
"backgroundTextStyle": "light",
"usingComponents": {
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
"t-image": "tdesign-miniprogram/image/image",
"t-sticky": "tdesign-miniprogram/sticky/sticky",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-footer": "tdesign-miniprogram/footer/footer"
}
}

View file

@ -0,0 +1,31 @@
<view>
<view class="list">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-detail="{{item}}" bind:tap="goDetail">
<view class="right">
<view class="text">
<view>订单号: {{item.order_no || '-'}}</view>
<view>{{item.price}}元</view>
</view>
<view class="info" wx:if="{{!item.phone}}">
<view>{{item.buy_type}}</view>
<view style="text-align: right;color:coral">补充信息{{' >'}}</view>
</view>
<view class="info" wx:if="{{item.phone}}">
<view>信息: {{item.name || '暂无'}} {{item.phone}}</view>
<view style="text-align: right;">{{item.buy_type}}</view>
</view>
<view class="info">
<view wx:if="{{item.pay_time}}">支付时间: {{item.pay_time}}</view>
<view wx:else>订单时间: {{item.create_time}}</view>
<!-- <view class="viewcnt init">{{item.buy_type}}</view> -->
<!-- <view class="viewcnt init" wx:if="{{item.status == 'init'}}">待审核</view> -->
<view class="viewcnt resolve" wx:if="{{item.status == 'payed'}}">已支付</view>
<view class="viewcnt reject" wx:if="{{item.status == 'wait_pay'}}">待支付</view>
</view>
</view>
</view>
</view>
<t-footer wx:if="{{listEndText}}" text="{{listEndText}}" bind:tap="loadMore"></t-footer>
</view>
</view>

View file

@ -0,0 +1,76 @@
page {
padding: 0 20rpx;
background-color: rgb(245, 246, 247);
}
.sw {
width: 240rpx;
display: flex;
align-items: center;
font-size: 32rpx;
}
.sw .txt {
padding-left: 16rpx;
}
.list {
margin-top: 20rpx;
padding-bottom: 60rpx;
}
.list .item {
border-radius: 16rpx;
background-color: #fff;
margin-bottom: 20rpx;
width: 710rpx;
padding-top: 20rpx;
}
.list .item .item-main {
display: flex;
padding-left: 20rpx;
}
.list .item .item-main .right {
flex: 1;
padding: 0 32rpx;
padding-bottom: 20rpx;
}
.list .item .item-main .right .text {
display: flex;
font-size: 28rpx;
justify-content: space-between;
color: #333;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #8f9197;
line-height: 36rpx;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
padding: 0 20rpx;
}
.list .item .item-main .right .info .viewcnt.init {
color: blue;
}
.list .item .item-main .right .info .viewcnt.resolve {
color: green;
}
.list .item .item-main .right .info .viewcnt.reject {
color: gray;
}
.list .item .h20 {
height: 20rpx;
}

141
pages/sharebuy/sharebuy.js Normal file
View file

@ -0,0 +1,141 @@
import C from '../../utils/constant';
import * as F from '../../utils/func';
import R from '../../utils/request';
Page({
data: {
expireDate: '',
price: '',
shareId: '',
isPay: false,
orderNo: '',
phone: '',
username: '',
tip_before_pay: '',
tip_after_pay: '',
buy_type: '',
},
onLoad(options) {
const { id, orderNo } = options;
if (orderNo) {
this.setData({
isPay: true,
orderNo,
})
this.fetchOrder(orderNo);
} else {
R.get('/index.php/api/v1/get_share', { id }).then(({ model }) => {
this.setData({
shareId: id,
price: F.formatePrice(model.price),
expireDate: model.expire_time,
tip_before_pay: model.tip_before_pay || '',
tip_after_pay: model.tip_after_pay || '',
buy_type: model.buy_type,
});
}).catch((e)=>{
console.log('xxx',e);
})
R.get('/index.php/api/v1/view_share', { id });
}
},
refresh() {
if (this.data.orderNo) {
this.fetchOrder(this.data.orderNo);
}
},
fetchOrder(orderNo) {
const that = this;
return R.get('/index.php/api/v1/fetch_order_pay', { order_no: orderNo }).then(({ model }) => {
console.log('payed', model);
if (model.status === 'payed') {
clearInterval(that.data.timer);
wx.hideLoading();
this.setData({
isPay: true,
orderNo,
price: F.formatePrice(model.price),
buy_type: model.buy_type,
});
}
});
},
checkOrderStatus(orderNo) {
wx.showLoading({
title: '确认支付中...',
})
this.data.timer = setInterval(() => {
this.fetchOrder(orderNo).catch(() => {
clearInterval(this.data.timer);
});
}, 1000);
},
goPay() {
const that = this;
if (this.data.shareId) {
R.post('/index.php/api/v1/make_order', { share_id: this.data.shareId }).then(({ model: { order_no } }) => {
that.data.orderNo = order_no;
R.post('/index.php/api/v1/pay_order', { order_no }).then(({ model }) => {
wx.requestPayment({
...model,
success(res) {
wx.showToast({
title: '支付成功',
icon: 'success',
duration: 2000,
success() {
that.checkOrderStatus(order_no);
// this.setData({
// isPay: true,
// })
}
})
},
fail(res) {
wx.showToast({
title: '您已取消支付',
icon: 'none',
duration: 2000
})
// wx.redirectTo({
// url: '/pages/shop/shop?path=user',
// });
}
})
})
})
}
},
onShareAppMessage() {
},
validate() {
const { username, phone, orderNo, } = this.data;
if (!username) {
wx.showToast({ title: '请输入姓名', icon: 'none' });
return false;
}
if (!/^1\d{10}$/.test(phone)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return false;
}
return true;
},
submit() {
if (!this.validate()) return;
const {
username, phone, orderNo,
} = this.data
R.post('/index.php/api/v1/mark_order_info', { name: username, phone, order_no: orderNo, }).then(({ model }) => {
wx.showToast({
title: '提交成功',
icon: 'success',
duration: 2000,
success() {
wx.redirectTo({
url: '/pages/paylist/paylist?from=sharebuy',
})
}
});
});
},
})

View file

@ -0,0 +1,9 @@
{
"navigationBarTitleText": "支付",
"backgroundTextStyle": "light",
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-button": "tdesign-miniprogram/button/button",
"t-input": "tdesign-miniprogram/input/input"
}
}

View file

@ -0,0 +1,57 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.logo {
height: 180rpx;
width: 180rpx;
margin: 0 auto;
background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.form {
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.footer {
margin-top: 40rpx;
padding: 0 20rpx;
}
.card {
margin: 20rpx 0;
padding: 0 20rpx;
.line {
font-size: 36rpx;
line-height: 60rpx;
}
}
.ma {
height: 20rpx;
}
.desc {
color: #666;
font-size: 28rpx;
margin-top: 20rpx;
line-height: 34rpx;
}
.refresh{
text-align: center;
margin-top: 20rpx;
color: #999;
}

View file

@ -0,0 +1,37 @@
<view class="logo"></view>
<view class="card" wx:if="{{!isPay}}">
<!-- <view class="line">付款: {{price}}元</view>
<view class="line">付款有效期: {{expireDate}}</view> -->
<t-cell title="付款" hover note="{{price}}元" />
<t-cell title="有效期" hover note="{{expireDate}}" />
<t-cell title="类型" hover note="{{buy_type}}" />
<view class="ma"></view>
<t-button theme="primary" size="large" block bind:tap="goPay">立即付款</t-button>
<view class="refresh" bind:tap="refresh">已支付? 手动刷新</view>
<view class="ma"></view>
<view class="ma"></view>
<view wx:if="{{tip_before_pay}}">
<!-- <view>支付提示:</view> -->
<rich-text class="desc" nodes="{{tip_before_pay}}"></rich-text>
</view>
</view>
<view wx:else>
<!-- <view>付款订单号: {{orderNo}}</view> -->
<!-- <view>付款成功: {{price}}元</view> -->
<t-cell title="付款订单号" hover note="{{orderNo}}" />
<t-cell title="类型" hover note="{{buy_type}}" />
<t-cell title="付款成功" hover note="{{price}}元" />
<view class="ma"></view>
<view class="form">
<t-input label="姓名" placeholder="请输入姓名" model:value="{{username}}" />
<t-input label="电话" placeholder="请输入电话" type="digit" model:value="{{phone}}" />
</view>
<view class="footer">
<t-button theme="primary" block catchtap="submit">提交</t-button>
</view>
<view class="ma"></view>
<view class="ma"></view>
<view wx:if="{{tip_after_pay}}">
<rich-text class="desc" nodes="{{tip_after_pay}}"></rich-text>
</view>
</view>

View file

@ -0,0 +1,48 @@
page {
box-sizing: border-box;
background-color: linear-gradient(180deg, #f0f4fc, #fff);
padding: 0 20rpx;
padding-top: 10rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx);
}
.logo {
height: 180rpx;
width: 180rpx;
margin: 0 auto;
background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.form {
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.footer {
margin-top: 40rpx;
padding: 0 20rpx;
}
.card {
margin: 20rpx 0;
padding: 0 20rpx;
}
.card .line {
font-size: 36rpx;
line-height: 60rpx;
}
.ma {
height: 20rpx;
}
.desc {
color: #666;
font-size: 28rpx;
margin-top: 20rpx;
line-height: 34rpx;
}
.refresh{
text-align: center;
margin-top: 20rpx;
color: #999;
}

View file

@ -0,0 +1,77 @@
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
cdnHost: C.cdnHost,
list: [],
page: 1,
status: '',
// money_flag: 'send',
listEndText: '',
},
onLoad(options) {
this.fetchList(1);
},
goDel(e) {
const {detail,index} =e.currentTarget.dataset;
if(detail.deleted == 1) return;
const {id}=detail;
wx.showModal({
title: '提示',
content: '置为失效后无法恢复,确认继续吗?',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
R.post('/index.php/api/v1/del_share',{id}).then(()=>{
const {list} = this.data;
this.setData({
[`list[${index}]`] : {
...list[index],
deleted:1,
},
});
})
}
}
})
},
fetchList(page) {
const { status } = this.data;
// money_flag
R.get('/index.php/api/v1/share_link_list', { page }).then(({ model }) => {
const list = [];
model.forEach(item => {
list.push({
...item,
price: F.formatePrice(item.price),
expire_time: item.expire_time.split(' ')[0],
});
});
if (list.length == 0) {
this.setData({ listEndText: '没有更多了' });
} else {
this.setData({ listEndText: '点击加载更多。。。' });
}
if (page == 1) {
this.setData({ list,page });
} else {
const list2 = this.data.list.concat(list);
this.setData({ list: list2 ,page});
}
});
},
loadMore() {
const { page, listEndText } = this.data;
if (listEndText == '点击加载更多。。。') {
this.fetchList(page + 1);
}
},
onReachBottom() {
this.loadMore();
},
})

View file

@ -0,0 +1,12 @@
{
"navigationBarTitleText": "进行中的分销",
"backgroundTextStyle": "light",
"usingComponents": {
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
"t-image": "tdesign-miniprogram/image/image",
"t-sticky": "tdesign-miniprogram/sticky/sticky",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-footer": "tdesign-miniprogram/footer/footer"
}
}

View file

@ -0,0 +1,23 @@
<view>
<view class="list">
<view class="item" wx:for="{{list}}" wx:key="id">
<view class="item-main" data-detail="{{item}}" data-index="{{index}}" bind:tap="goDel">
<view class="right">
<view class="text">
<view>{{item.buy_type || '-'}}</view>
<view>{{item.price}}元</view>
</view>
<view class="info">
<view></view>
<view wx:if="{{item.deleted == 0}}" style="text-align: right;color:coral">置为失效</view>
</view>
<view class="info">
<view>创建: {{item.create_time}}</view>
<view>截止: {{item.expire_time}}</view>
</view>
</view>
</view>
</view>
<t-footer wx:if="{{listEndText}}" text="{{listEndText}}" bind:tap="loadMore"></t-footer>
</view>
</view>

View file

@ -0,0 +1,76 @@
page {
padding: 0 20rpx;
background-color: rgb(245, 246, 247);
}
.sw {
width: 240rpx;
display: flex;
align-items: center;
font-size: 32rpx;
}
.sw .txt {
padding-left: 16rpx;
}
.list {
margin-top: 20rpx;
padding-bottom: 60rpx;
}
.list .item {
border-radius: 16rpx;
background-color: #fff;
margin-bottom: 20rpx;
width: 710rpx;
padding-top: 20rpx;
}
.list .item .item-main {
display: flex;
padding-left: 20rpx;
}
.list .item .item-main .right {
flex: 1;
padding: 0 32rpx;
padding-bottom: 20rpx;
}
.list .item .item-main .right .text {
display: flex;
font-size: 28rpx;
justify-content: space-between;
color: #333;
}
.list .item .item-main .right .info {
display: flex;
font-size: 24rpx;
justify-content: space-between;
color: #8f9197;
line-height: 36rpx;
}
.list .item .item-main .right .info .viewcnt {
display: flex;
align-items: center;
padding: 0 20rpx;
}
.list .item .item-main .right .info .viewcnt.init {
color: blue;
}
.list .item .item-main .right .info .viewcnt.resolve {
color: green;
}
.list .item .item-main .right .info .viewcnt.reject {
color: gray;
}
.list .item .h20 {
height: 20rpx;
}

66
pages/shop/shop.js Normal file
View file

@ -0,0 +1,66 @@
// pages/shop/shop.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

2
pages/shop/shop.wxml Normal file
View file

@ -0,0 +1,2 @@
<!--pages/shop/shop.wxml-->
<text>pages/shop/shop.wxml</text>

View file

@ -0,0 +1,405 @@
import R from '../../utils/request';
import C from '../../utils/constant';
Page({
data: {
cdnHost: C.cdnHost,
cdnHost: C.cdnHost,
title: '',
tel: '',
content: '',
shortAddress: '',
address: '',
video: '',
position: {
longitude: 0,
latitude: 0,
},
ds: {
list: [],
refStatusNum: { finished: 0, failed: 0, process: 0 },
},
ts: {
refImgDescs: {},
refImgKeywords: {},
fileUploadList: [],
fileUploadList2: [],
isUploading: false,
timer: [],
},
stop: false,
gridConfig: {
column: 4,
width: 160,
height: 160,
},
config: {
count: 1,
},
phoneError: false,
//
videoFileList: [],
},
onLoad(options) {
const that = this;
R.get('/index.php/api/v1/my', {}).then(({ model }) => {
this.setData({ tel: model.phone });
});
wx.getFuzzyLocation({
type: 'wgs84',
success(res) {
const longitude = res.longitude
const latitude = res.latitude
that.setData({
position: {
longitude,
latitude,
},
});
R.get('/index.php/api/v1/gps', { lat: latitude, lon: longitude }).then(({ model }) => {
that.setData({ shortAddress: model.short_ad, address: model.full_ad });
});
}
})
},
onUnload() {
this.data.stop = true;
},
onShareAppMessage() {
},
choosePoi() {
const that = this;
wx.chooseLocation({
success({ latitude, longitude, name, address }) {
that.setData({
position: {
latitude,
longitude,
},
shortAddress: name,
address,
});
}
})
},
//
onPhoneInput(e) {
const { phoneError } = this.data;
const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(e.detail.value);
if (phoneError === isPhoneNumber) {
this.setData({
phoneError: !isPhoneNumber,
});
}
},
onSubmit() {
console.log('this.stat', this.data);
const { title, tel, shortAddress, address, position, ds, content, videoFileList } = this.data;
if (ds.refStatusNum.failed > 0) {
wx.showToast({
title: '请处理上传失败的图片',
icon: 'none',
});
return;
}
if (ds.refStatusNum.process > 0) {
wx.showToast({
title: '请等待图片上传完成',
icon: 'none',
});
return;
}
// 每个属性都判空,并且给出toast提示
if (!tel) {
wx.showToast({
title: '请输入手机号',
icon: 'none',
});
return;
}
if (!title) {
wx.showToast({
title: '请输入标题',
icon: 'none',
});
return;
}
if (!content) {
wx.showToast({
title: '请输入您的发件信息',
icon: 'none',
});
return;
}
if (!shortAddress) {
wx.showToast({
title: '请选择位置',
icon: 'none',
});
return;
}
if (ds.list.length === 0) {
wx.showToast({
title: '请上传图片',
icon: 'none',
});
return;
}
// 提交数据
R.post('/index.php/api/v1/submit', {
title,
tel,
shortAddress,
address,
content,
longitude: position.longitude,
latitude: position.latitude,
imgs: ds.list.map((o) => o.path),
video: videoFileList && videoFileList.length > 0 ? videoFileList[0].path : undefined,
}).then(({ model }) => {
wx.showToast({
title: '提交成功,感谢您的反馈',
icon: 'success',
});
setTimeout(() => {
wx.navigateBack();
}, 1000);
});
},
goBack() {
wx.navigateBack();
},
//
callStatusNum() {
const { ds } = this.data;
const s = { finished: 0, failed: 0, process: 0 };
ds.list.forEach((o) => {
if (o.failed) s.failed++;
else if (o.finished) s.finished++;
else s.process++;
});
this.setData({
'ds.refStatusNum': s,
});
},
imgHandleSuccess(e) {
console.log('imgHandleSuccess', e.detail);
// const { files } = e.detail;
// this.setData({
// originFiles: files,
// });
this.httpRequest();
},
imgHandleRemove(e) {
const { index } = e.detail;
console.log('imgHandleRemove', e.detail);
const { ds } = this.data;
ds.list.splice(index, 1);
this.setData({
'ds.list': ds.list,
});
},
imgHandleClick(e) {
console.log(e.detail.file);
},
beforUpload(e) {
const { files } = e.detail;
console.log('beforUpload', files);
const { ts } = this.data;
const { fileUploadList, fileUploadList2 } = ts;
files.map((file) => {
fileUploadList.push(file);
fileUploadList2.push(file);
})
this.setData({
'ts.fileUploadList': fileUploadList,
'ts.fileUploadList2': fileUploadList2,
});
},
startPreview() {
console.log('startPreview');
if (this.data.stop) return;
const { ts, ds } = this.data;
const { fileUploadList2 } = ts;
if (fileUploadList2.length > 0) {
const file = fileUploadList2.shift();
ds.list.push({
src: file.url,
url: file.url,
uid: file.name,
name: file.name,
percent: 0,
failed: false,
status: 'loading',
})
this.setData({
'ts.fileUploadList2': fileUploadList2,
'ds.list': ds.list,
});
setTimeout(() => {
this.startPreview();
}, 0);
} else {
setTimeout(() => {
this.startPreview();
}, 2000);
}
},
httpRequest(e) {
if (this.data.stop) return;
const { ts } = this.data;
if (ts.isUploading) return;
ts.isUploading = true;
console.log('httpRequest');
// 循环检测 是否有文件可以上传
setTimeout(() => {
this.uploadHandle();
this.startPreview();
}, 0);
},
uploadHandle() {
console.log('uploadHandle');
if (this.data.stop) return;
this.callStatusNum();
const { ts, ds } = this.data;
const { fileUploadList } = ts;
if (fileUploadList.length > 0) {
console.log('fileUploadList', fileUploadList);
const file = fileUploadList.shift();
// formData.append('imageData', file);
R.upload({ a: 1 }, 'img_file', file.url).catch((e) => e).then((response) => {
// console.log('response-response333', response);
ts.isUploading = false;
try {
response.data = JSON.parse(response.data);
} catch (error) {
response.data = null;
}
// console.log('asdfasd-response', response.data);
if (response.data && response.data.code == -1000) {
wx.showToast({
title: '登录超时,请重新登录',
icon: 'none',
});
setTimeout(() => {
wx.navigateTo({ url: '/pages/home/home' });
}, 500)
return;
}
else if (response.data && response.data.success) {
console.log('asdfasd-response2222', response.data);
const { data: { model: { path } } } = response;
this.setData({
'ds.list': ds.list.map((o) => {
if (file.name == o.uid) {
return { ...o, path, finished: true, percent: 100, status: 'done' };
}
return { ...o };
})
});
// this.setData({
// [`ds.list[${idx}].url`]: C.cdnHost + path,
// });
// R.getImg(4, imageId).then((path) => {
// const tlist = this.data.ds.list;
// let idx = 0;
// // console.log('path', path);
// tlist.forEach((c, i) => {
// if (c.imageId == imageId) {
// idx = i;
// }
// });
// if (idx) {
// this.setData({
// [`ds.list[${idx}].url`]: path,
// });
// }
// })
// wx.showToast({
// title: '图片:' + file.name + '已暂存',
// icon: 'success',
// });
// this.saveTmpData();
} else {
console.log(response, file.name);
let errorMsg = '上传失败,请移除后重试';
// if (response.data && response.data.status == 529) {
// errorMsg = '其他图集中已存在,请移除';
// }
this.setData({
'ds.list': ds.list.map((o) => {
if (file.name == o.uid) {
return { ...o, failed: errorMsg, status: 'failed' };
}
return { ...o };
}),
});
wx.showToast({
title: file.name + ',' + errorMsg,
icon: 'error',
});
// this.saveTmpData();
}
setTimeout(() => {
this.uploadHandle();
}, 0);
});
} else {
// setTimeout(() => {
// this.uploadHandle();
// }, 2000);
}
},
//video
handleVideoAdd(e) {
const { files } = e.detail;
files.forEach(file => this.uploadVideoFile(file))
},
uploadVideoFile(file) {
wx.getVideoInfo({ src: file.url }).then((res) => {
if (res.duration > 180) {
wx.showToast({
title: '视频时长不能超过3分钟',
icon: 'none',
});
return;
}
//
const { videoFileList } = this.data;
this.setData({
videoFileList: [...videoFileList, { ...file, path: '', status: 'loading' }],
});
const { length } = videoFileList;
R.upload({ a: 2 }, 'video_file', file.url, (res) => {
this.setData({
[`videoFileList[${length}].percent`]: res.progress,
});
}).catch((e) => e).then((response) => {
try {
response.data = JSON.parse(response.data);
} catch (error) {
response.data = null;
}
if (response.data && response.data.success) {
const { data: { model: { path } } } = response;
console.log('asdfasd-response2222', response.data, this.data.videoFileList, length);
this.setData({
[`videoFileList[${length}].status`]: 'done',
[`videoFileList[${length}].path`]: path,
});
}
});
});
},
handleVideoRemove(e) {
const { index } = e.detail;
const { videoFileList } = this.data;
videoFileList.splice(index, 1);
this.setData({
videoFileList,
});
},
})

View file

@ -0,0 +1,14 @@
{
"navigationBarTitleText": "有发现",
"backgroundTextStyle": "light",
"usingComponents": {
"t-image": "tdesign-miniprogram/image/image",
"t-input": "tdesign-miniprogram/input/input",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar",
"t-upload": "tdesign-miniprogram/upload/upload",
"t-button": "tdesign-miniprogram/button/button",
"t-textarea": "tdesign-miniprogram/textarea/textarea"
}
}

View file

@ -0,0 +1,35 @@
<view>
<image class="img" src="{{cdnHost + '/static/bg_take.jpeg?v=5'}}" />
<!-- <view class="img"> -->
<!-- <view>发布信息审核通过后获10元红包</view> -->
<!-- </view> -->
<view class="form">
<t-input label="标题" placeholder="请输入您的发现标题" model:value="{{title}}" align="right" />
<t-input label="手机" type="number" tips="{{phoneError ? '手机号输入不正确' : ''}}" bindchange="onPhoneInput" placeholder="请输入您的手机号码" model:value="{{tel}}" align="right" />
<t-cell title="现场图片" description="最多6张图片" hover></t-cell>
<t-cell class="photos">
<view class="wrapper" slot="description">
<t-upload max="{{6}}" size-limit="{{102400}}" media-type="{{['image']}}" files="{{ds.list}}" gridConfig="{{gridConfig}}" bind:success="imgHandleSuccess" bind:remove="imgHandleRemove" bind:click="imgHandleClick" request-method="{{httpRequest}}" bind:add="beforUpload" />
</view>
</t-cell>
<t-cell title="现场视频(可选)" description="最多一个视频(3分钟内)" hover>
<t-upload slot="note" mediaType="{{['video']}}" max="{{1}}" files="{{videoFileList}}" bind:add="handleVideoAdd" bind:remove="handleVideoRemove"></t-upload>
</t-cell>
<t-textarea t-class="external-class" label="" placeholder="请输入具体内容" value="" maxcharacter="5000" disableDefaultPadding="{{true}}" model:value="{{content}}" />
<view class="local_bar">
<view class="local">
<t-icon name="location-1" size="30rpx" color="green"></t-icon>
{{shortAddress}}
</view>
<view class="btn" bind:tap="choosePoi">
修正位置
<t-icon name="chevron-right" size="28rpx"></t-icon>
</view>
</view>
</view>
<t-notice-bar visible="{{true}}" theme="warning" content="请确保您发布的信息真实有效"></t-notice-bar>
<view class="btns">
<t-button theme="primary" size="large" block bind:tap="onSubmit">确认发布</t-button>
<t-button theme="primary" size="large" block variant="outline" bind:tap="goBack">取消</t-button>
</view>
</view>

View file

@ -0,0 +1,93 @@
page {
background-color: rgb(245, 246, 247);
}
.img {
font-size: 12rpx;
width: 750rpx;
margin: 0 auto;
height: 530rpx;
display: block;
}
.form {
margin: 0 20rpx;
border-radius: 4px;
background-color: #fff;
margin-top: -100rpx;
border-radius: 4px;
}
.form .t-input__label {
position: relative;
}
.form .t-input__label::after {
display: block;
content: '*';
color: #f00;
position: absolute;
font-size: 40rpx;
right: -30rpx;
top: 0;
}
.form .photos .t-image {
margin-left: 20rpx;
margin-bottom: 20rpx;
}
.t-textarea__wrapper {
background-color: rgb(245, 246, 247);
border: 16rpx;
}
.t-textarea__wrapper .t-textarea__wrapper-inner {
padding: 16rpx;
border: 16rpx;
}
.local_bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
border-bottom: 10px solid #fff;
}
.local_bar .t-icon {
margin-right: 10rpx;
}
.local_bar .local {
display: flex;
font-size: 24rpx;
align-items: center;
color: #333;
}
.local_bar .btn {
display: flex;
font-size: 24rpx;
align-items: center;
color: blue;
}
.t-notice-bar {
background: none !important;
}
.btns {
padding: 0 40rpx;
padding-bottom: 90rpx;
}
.btns .t-button {
margin-bottom: 20rpx;
}
.t-upload .t-grid__content .t-grid-item {
width: auto !important;
}

66
pages/test/test.js Normal file
View file

@ -0,0 +1,66 @@
// pages/test/test.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

2
pages/test/test.wxml Normal file
View file

@ -0,0 +1,2 @@
<!--pages/test/test.wxml-->
<text>pages/test/test.wxml</text>

View file

@ -0,0 +1,35 @@
const AuthStepType = {
ONE: 1,
TWO: 2,
THREE: 3,
};
Component({
options: {
multipleSlots: true,
},
properties: {
currAuthStep: {
type: Number,
value: AuthStepType.ONE,
},
userInfo: {
type: Object,
value: {},
},
isNeedGetUserInfo: {
type: Boolean,
value: false,
},
},
data: {
defaultAvatarUrl:
'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png',
AuthStepType,
},
methods: {
gotoUserEditPage() {
this.triggerEvent('gotoUserEditPage');
},
},
});

View file

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-avatar": "tdesign-miniprogram/avatar/avatar"
}
}

View file

@ -0,0 +1,36 @@
<view class="user-center-card">
<!-- 未登录的情况 -->
<block wx:if="{{currAuthStep === AuthStepType.ONE}}">
<view class="user-center-card__header" bind:tap="gotoUserEditPage">
<t-avatar image="{{userInfo.avatarUrl || defaultAvatarUrl}}" class="user-center-card__header__avatar" />
<view class="user-center-card__header__name">{{'请登录'}}</view>
</view>
</block>
<!-- 已登录但未授权用户信息情况 -->
<block wx:if="{{currAuthStep === AuthStepType.TWO}}">
<view class="user-center-card__header">
<t-avatar image="{{userInfo.avatarUrl || defaultAvatarUrl}}" class="user-center-card__header__avatar" />
<view class="user-center-card__header__name">
<view class="name">{{userInfo.nickName || '微信用户'}}</view>
</view>
<!-- 需要授权用户信息通过slot添加弹窗 -->
<view class="user-center-card__header__transparent" wx:if="{{isNeedGetUserInfo}}">
<slot name="getUserInfo" />
</view>
<!-- 不需要授权用户信息仍然触发gotoUserEditPage事件 -->
<view class="user-center-card__header__transparent" bind:tap="gotoUserEditPage" wx:else></view>
</view>
</block>
<!-- 已登录且已经授权用户信息的情况 -->
<block wx:if="{{currAuthStep === AuthStepType.THREE}}">
<view class="user-center-card__header" bind:tap="gotoUserEditPage">
<t-avatar
t-class="avatar"
mode="aspectFill"
class="user-center-card__header__avatar"
image="{{userInfo.avatarUrl || defaultAvatarUrl}}"
/>
<view class="user-center-card__header__name">{{userInfo.nickName || '微信用户'}}</view>
</view>
</block>
</view>

View file

@ -0,0 +1,57 @@
.user-center-card {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 480rpx;
background-image: url('https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png');
background-size: cover;
background-repeat: no-repeat;
padding: 0 24rpx;
}
.user-center-card__header {
margin-top: 192rpx;
margin-bottom: 48rpx;
height: 96rpx;
line-height: 48rpx;
display: flex;
justify-content: flex-start;
align-items: center;
color: #333;
position: relative;
}
.user-center-card__header__avatar {
width: 96rpx;
height: 96rpx;
border-radius: 48rpx;
overflow: hidden;
}
.user-center-card__header__name .name{
font-size: 36rpx;
line-height: 48rpx;
color: #333;
font-weight: bold;
margin-left: 24rpx;
margin-right: 16rpx;
}
.user-center-card__header__name .score{
font-size: 22rpx;
line-height: 38rpx;
color: #333;
margin-left: 24rpx;
margin-right: 16rpx;
display: flex;
align-items: center;
}
.user-center-card__header__transparent {
position: absolute;
right: 0;
top: 0;
background-color: transparent;
height: 100%;
width: 30%;
}
.user-center-card__icon {
line-height: 96rpx;
}

79
pages/usercenter/index.js Normal file
View file

@ -0,0 +1,79 @@
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
cdnHost: C.cdnHost,
phone: '',
name: '',
price_sum: '',
share_cnt: '',
share_view_cnt: '',
is_share: false,
show_vip_link: false,
payed_vip_link: '',
},
onLoad() {
},
onShow() {
this.getTabBar().init();
this.init();
},
onPullDownRefresh() {
this.init();
},
init() {
this.fetUserInfoHandle();
},
fetUserInfoHandle() {
R.get('/index.php/api/v1/my').then(({ model }) => {
this.setData({
name: model.real_name || model.nick_name || '微信用户',
phone: model.phone || '-',
share_cnt: model.share_cnt,
share_view_cnt: model.share_view_cnt,
price_sum: F.formatePrice(model.price_sum || 0),
is_share: !!model.is_share,
show_vip_link: model.show_vip_link || false,
payed_vip_link: model.payed_vip_link || '',
});
})
},
getPhoneNumber(e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
if (!e.detail.errno) {
R.post('/index.php/api/v1/bind_auth_phone', { code: e.detail.code }).then(() => {
this.setData({ hasPhone: true })
this.goH5Shop();
})
} else {
// e.detail.errMsg
}
},
goShared() {
wx.switchTab({
url: '/pages/faxianlist/faxianlist',
})
},
goOrder() {
wx.navigateTo({ url: '/pages/paylist/paylist' })
},
toVipLink() {
wx.navigateTo({ url: '/pages/webview/webview?url='+encodeURIComponent(this.data.payed_vip_link) })
},
goSharelist() {
wx.navigateTo({ url: '/pages/sharelist/sharelist' })
},
goInfo() {
wx.navigateTo({
url: '/pages/usercenter/info',
})
},
});

View file

@ -0,0 +1,9 @@
{
"navigationBarTitleText": "个人中心",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-link": "tdesign-miniprogram/link/link",
"t-cell": "tdesign-miniprogram/cell/cell"
},
"enablePullDownRefresh": true
}

173
pages/usercenter/index.less Normal file
View file

@ -0,0 +1,173 @@
page {
background-color: #f5f5f5;
}
.header {
background-color: linear-gradient(180deg, #f0f4fc, #fff);
position: relative;
background-color: rgba(255, 255, 255, 0.8);
box-sizing: border-box;
width: 90%;
margin: 0 auto;
margin-top: -300rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.header .info {
background-color: transparent;
}
.header .info::after {
display: none;
}
.header .avatar {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
overflow: hidden;
}
.cb {
top: 10rpx;
right: 100rpx;
height: 530rpx;
width: 750rpx;
background: url('http://cdn.zhonganonline.top/newslist/static/bg_take.jpeg?v=5') no-repeat;
background-position: center center;
background-size: 100% 100%;
z-index: 1;
}
.vip {
background: linear-gradient(90deg, #f9e9bc, #f2d786);
border-radius: 20rpx;
height: 154rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
width: 94%;
margin: 0 auto;
box-sizing: border-box;
}
.vip .dest .a {
color: #775d2f;
font-size: 30rpx;
}
.vip .dest .b {
color: #775d2f;
opacity: 0.8;
font-size: 22rpx;
}
.vip .btn {
background-color: #fff;
color: #775d2f;
font-size: 24rpx;
height: 68rpx;
width: 164rpx;
border-radius: 34rpx;
display: flex;
align-items: center;
justify-content: center;
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
width: 92%;
margin: 0 auto;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
color: rgb(53, 58, 71);
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #f09759;
font-size: 28rpx;
display: flex;
align-items: center;
background-color: #fff8e9;
padding: 10rpx 20rpx;
border-radius: 6rpx;
}
.title_bar .btn .t-icon {
margin-right: 4rpx;
}
.ma20 {
height: 20rpx;
background-color: #f5f5f5;
width: 100%;
}
.cards_w {
background-color: #fff;
width: 94%;
border-radius: 6rpx;
margin: 0 auto;
}
.cards_w .cards {
display: flex;
justify-content: space-between;
padding: 30rpx 0;
}
.cards_w .cards .card {
width: 28%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: none;
font-size: 0;
line-height: 24rpx;
&::after {
display: none;
}
}
.cards_w .cards .card .txt {
padding-top: 12rpx;
font-size: 24rpx;
color: #333;
}
.cards_w .cards .card .txt2 {
padding-top: 12rpx;
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.cards_w .cards .card.hide {
opacity: 0;
pointer-events: none;
}
.link {
display: flex;
justify-content: space-between;
padding: 30rpx 0;
width: 50%;
margin: 0 auto;
background-color: #fff;
border-radius: 6rpx;
}

View file

@ -0,0 +1,49 @@
<view class="cb"></view>
<view class="header">
<t-cell class="info" title="{{name}}" image="{{cdnHost + '/static/header.png?v=5'}}" description="{{phone}}" hover arrow bind:tap="goInfo"></t-cell>
</view>
<!-- <view class="vip">
<view class="dest">
<view class="a">美丽桐庐监督行动</view>
<view class="b" wx:if="{{price * 1}}">经审核后可获得{{price}}元现金奖励</view>
</view>
<view class="btn" bind:tap="goTakePhoto">参与试试</view>
</view> -->
<!-- <view class="ma20"></view> -->
<!-- <view class="title_bar"> -->
<!-- <view class="title">服务数据</view> -->
<!-- <view class="btn" bind:tap="goTakePhoto">
<t-icon name="camera" size="28rpx" color="f09759"></t-icon>
有发现
</view> -->
<!-- </view> -->
<!-- <view class="ma20"></view> -->
<view class="cards_w">
<view class="cards" wx:if="{{is_share}}">
<view class="card" bind:tap="goShared">
<view class="txt2">{{price_sum}}元</view>
<view class="txt">总收入</view>
</view>
<!-- aa -->
<view class="card" bind:tap="goSharelist">
<view class="txt2">{{share_cnt}}次</view>
<view class="txt">总分享</view>
</view>
<view class="card">
<view class="txt2">{{share_view_cnt}}</view>
<view class="txt">分享浏览</view>
</view>
<!-- /aa -->
<!-- <view class="card hide">
<t-icon name="location" size="30" color="#aaa" />
<view class="txt">---</view>
</view> -->
</view>
<view class="ma20"></view>
<t-cell class="info" title="我的订单" hover arrow bind:tap="goOrder"></t-cell>
<view class="ma20"></view>
<view class="ma20"></view>
<view class="link" wx:if="{{show_vip_link}}">
<t-link size="small" theme="primary" content="专属服务企业、微信群" suffixIcon="jump" hover bind:tap="toVipLink" />
</view>
</view>

150
pages/usercenter/index.wxss Normal file
View file

@ -0,0 +1,150 @@
page {
background-color: #f5f5f5;
}
.header {
background-color: linear-gradient(180deg, #f0f4fc, #fff);
position: relative;
background-color: rgba(255, 255, 255, 0.8);
box-sizing: border-box;
width: 90%;
margin: 0 auto;
margin-top: -300rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.header .info {
background-color: transparent;
}
.header .info::after {
display: none;
}
.header .avatar {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
overflow: hidden;
}
.cb {
top: 10rpx;
right: 100rpx;
height: 530rpx;
width: 750rpx;
background: url('http://cdn.zhonganonline.top/newslist/static/bg_take.jpeg?v=5') no-repeat;
background-position: center center;
background-size: 100% 100%;
z-index: 1;
}
.vip {
background: linear-gradient(90deg, #f9e9bc, #f2d786);
border-radius: 20rpx;
height: 154rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
width: 94%;
margin: 0 auto;
box-sizing: border-box;
}
.vip .dest .a {
color: #775d2f;
font-size: 30rpx;
}
.vip .dest .b {
color: #775d2f;
opacity: 0.8;
font-size: 22rpx;
}
.vip .btn {
background-color: #fff;
color: #775d2f;
font-size: 24rpx;
height: 68rpx;
width: 164rpx;
border-radius: 34rpx;
display: flex;
align-items: center;
justify-content: center;
}
.title_bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
width: 92%;
margin: 0 auto;
}
.title_bar .title {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-position: left center;
background-size: 100% 100%;
font-size: 32rpx;
color: #353a47;
height: 34rpx;
width: 132rpx;
}
.title_bar .btn {
color: #f09759;
font-size: 28rpx;
display: flex;
align-items: center;
background-color: #fff8e9;
padding: 10rpx 20rpx;
border-radius: 6rpx;
}
.title_bar .btn .t-icon {
margin-right: 4rpx;
}
.ma20 {
height: 20rpx;
background-color: #f5f5f5;
width: 100%;
}
.cards_w {
background-color: #fff;
width: 94%;
border-radius: 6rpx;
margin: 0 auto;
}
.cards_w .cards {
display: flex;
justify-content: space-between;
padding: 30rpx 0;
}
.cards_w .cards .card {
width: 28%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: none;
font-size: 0;
line-height: 24rpx;
}
.cards_w .cards .card::after {
display: none;
}
.cards_w .cards .card .txt {
padding-top: 12rpx;
font-size: 24rpx;
color: #333;
}
.cards_w .cards .card .txt2 {
padding-top: 12rpx;
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.cards_w .cards .card.hide {
opacity: 0;
pointer-events: none;
}
.link {
display: flex;
justify-content: space-between;
padding: 30rpx 0;
width: 50%;
margin: 0 auto;
background-color: #fff;
border-radius: 6rpx;
}

31
pages/usercenter/info.js Normal file
View file

@ -0,0 +1,31 @@
import R from '../../utils/request';
Page({
data: {
name: '',
},
onLoad() {
},
onShow() {
R.get('/index.php/api/v1/my').then(({ model }) => {
this.setData({
name: model.real_name || model.nick_name || '微信用户',
});
})
},
onSubmit(){
if(!this.data.name.trim()){
wx.showToast({
title: '请填写姓名',
icon: 'none',
});
return;
}
R.post('/index.php/api/v1/set_name',{name:this.data.name.trim()}).then(({ model }) => {
wx.navigateBack();
})
}
});

View file

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "个人信息",
"backgroundTextStyle": "light",
"usingComponents": {
"t-input": "tdesign-miniprogram/input/input",
"t-button": "tdesign-miniprogram/button/button"
}
}

View file

@ -0,0 +1,8 @@
<view>
<view class="form">
<t-input label="姓名" placeholder="请输入您的姓名" model:value="{{name}}" align="right" />
</view>
<view class="btns">
<t-button theme="primary" size="large" block bind:tap="onSubmit">确认</t-button>
</view>
</view>

View file

@ -0,0 +1,7 @@
page {
background-color: #f5f5f5;
}
.btns{
padding: 20rpx 40rpx;
box-sizing: border-box;
}

13
pages/webview/webview.js Normal file
View file

@ -0,0 +1,13 @@
Page({
data: {
url: '',
},
onLoad(options) {
let { url } = options;
console.log('url',url);
const user_id = wx.getStorageSync('user_id');
url = url.replace('${user_id}', user_id);
this.setData({ url: decodeURIComponent(url) });
},
})

View file

@ -0,0 +1,5 @@
{
"navigationBarTitleText": " ",
"backgroundTextStyle": "light",
"usingComponents": {}
}

View file

@ -0,0 +1 @@
<web-view wx:if="{{url}}" src="{{url}}"></web-view>

View file

@ -0,0 +1 @@
/* pages/webview/webview.wxss */