添加组件及页面

This commit is contained in:
zhengw
2026-01-21 17:05:30 +08:00
parent a89e69c381
commit 7ff1a911dd
54 changed files with 1078 additions and 1009 deletions

View File

@@ -1,9 +1,8 @@
{
"usingComponents": {
"t-button": "tdesign-miniprogram/button/button",
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"t-input": "tdesign-miniprogram/input/input",
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin"
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
"t-image": "tdesign-miniprogram/image/image"
}
}

View File

@@ -1,43 +1,80 @@
import { Subscribe } from "@/utils/subscribe";
import { setStorage } from "@/utils/util";
import { base } from '@/utils/config';
import { checkSesskey, loginStatus, post } from '@/utils/https';
import { getStorage, toObject } from '@/utils/util';
Page({
data: {
columns: [
{ title: "我的收藏", width: "100px", dataIndex: "name" },
{ title: "我的点赞", width: "200px", dataIndex: "count" },
{ title: "我的评论", width: "300px", dataIndex: "desc" },
],
data: [
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
],
version: wx.getAccountInfoSync().miniProgram.version || '开发1.0',
isLogin: false,
host: base.apiHost,
user_info: {},
company_info: {},
loading: true,
// staffType: StaffType,
company_list: [],
show: false,
hideTabKeys: [],
},
change() {
setStorage("isLogin", 1);
Subscribe.set("isLogin", "zzzuz");
// wx.navigateTo({ url: "/pages/my/my" });
init() {
const companyInfo = toObject(getStorage('company_info'));
this.setData({
user_info: toObject(getStorage('user_info')),
company_info: companyInfo,
});
},
searchChange(e: any) {
console.log(e);
},
ok() {
console.log("ok");
// 腾讯文档
txDoc() {
return;
wx.navigateToMiniProgram({
appId: 'wxd45c635d754dbf59',
path:
`pages/detail/detail?url=` +
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
});
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
onLoad() {
this.setData({ loading: true });
loginStatus()
.then(() => {
console.log('ssss');
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
loginOut() {
wx.showModal({
title: '确认退出?',
// content: '',
complete: (res: any) => {
if (res.confirm) {
post('Applet/loginOut').then((res: any) => {
this.setData({ isLogin: false });
checkSesskey({ showLoading: false, showError: false })
.then((res) => {})
.catch((err) => {
console.log('checkSesskey', err);
});
});
}
},
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@@ -1,20 +1,37 @@
<page-plugin>
<text>pages/my/my.wxml</text>
<t-button bind:tap="change">change</t-button>
<view style="padding: 12px;">
<search-popup bind:ok="ok" bind:change="searchChange">
<view slot="content">11111</view>
</search-popup>
<card-plugin>
<view slot="header">11111</view>
<view slot="content">
<view style="height: 70px">11111</view>
<page-plugin hasTabBar="1" isAuth="{{true}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<t-cell-group title="企业信息">
<t-cell title="{{company_info.company_name}}" use-label-slot>
<view slot="image" style="margin-right: 12rpx;">
<t-image width="200rpx" height="200rpx" fit="cover"
src="{{host}}{{company_info.company_logo}}" />
</view>
</card-plugin>
</view>
<view slot="description">{{company_info.company_desc}}</view>
</t-cell>
</t-cell-group>
<!-- <block wx:if="{{company_list.length> 1}}">
<t-cell-group>
<t-cell title="切换企业" bind:tap="showPopup" is-link />
</t-cell-group>
</block> -->
<t-cell-group title="账号信息">
<t-cell>
<view slot="image" style="margin-right: 12rpx;">
<t-image width="200rpx" height="200rpx" fit="cover" src="{{host}}{{user_info.logo}}" />
</view>
<view slot="title" style="display: flex;align-items: center;flex-wrap: wrap;">
<view style="margin-right: 16rpx;">{{user_info.login_name}}</view>
</view>
<view slot="description">
<view>{{user_info.nick_name}}</view>
<view>{{user_info.user_phone}}</view>
</view>
</t-cell>
</t-cell-group>
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
<t-cell title="版本" note="{{version}}" hover bind:tap="txDoc" bordered arrow />
</page-plugin>
<tab-bar-plugin active="my" />
<tab-bar-plugin active="my" />