Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luqingwu committed Jun 19, 2023
0 parents commit 0a58385
Show file tree
Hide file tree
Showing 98 changed files with 5,199 additions and 0 deletions.
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# WeApp - wechat
weApp for wechat by liujians [http://liujians.me](http://liujians.me)
<hr/>


###作者声明:
基于微信小程序开发的**仿微信demo**
<br/>
整合了ionic的样式库和weui的样式库
<br/>
**使用请查看使用必读!**
<br/>
更新日志请点击[这里](./update.md)

目前功能

查看消息
网络请求获取数据(download示例server端demo)
微信地图(调用API已换成map组件)
发送图片
查看朋友圈
新的朋友
实时文本搜索框(优化)
IDE更新的下拉(目前跟一些组件会出现冲突,等待官方解决)
2种播放器组件
查看系统信息
picker三种MODE
upload与download接口的调用(示例server端demo一起更新)
加入websocket示例,**需要重新install安装依赖**



等待官方加入新内容

<br/>
欢迎一起学习交流
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=9bcf9f7be59b471456c1feec466dab4d54da7ab35c834b8e821ec17177fb33b3"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="前端群居所" title="前端群居所"></a>

<br/>
为学习微信小程序而开发,转发请附地址
> [https://github.com/liujians/WeApp](https://github.com/liujians/WeApp)

###使用必读:
- 10月08日之后的版本被我分离成了服务端和客户端2个demo
- 如果想要继续留有之前静态demo的请备份
<br/>
- server 部分为单独一个项目,装载着此项目需要的数据,需要下载跑起来才能运行此项目
<br/>
- 项目链接:
> [请点击这里下载示例server的demo](https://github.com/liujians/WeApp-server)
跑起服务器之后,在app.js中设置自己的Ip地址
<br/>
![image](./ipconfig.png)

###关于使用:
> 克隆本项目 -> 在微信开发工具中添加项目 -> 选择项目目录 -> 启动示例服务器 -> 重启项目

###项目展示:
![image](./GIF_3.gif)
![image](./GIF.gif)
![image](./GIF_2.gif)


###相关资源:
- [weapp-ide&weapp-api](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html?t=1476197490095) - 微信小应用官方IDE和官方文档
- [WeApp-server](https://github.com/liujians/WeApp-server) - 项目的server示例服务器

95 changes: 95 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//app.js
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo:function(cb){
var that = this
if(this.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success (res) {
console.log(res)
if (res.code) {
//发起网络请求
wx.request({
url: that.globalData.ip +'/wx/loginWithwxxcx',
method:'get',
data: {
code: res.code
},
success (resChangeSession) {
// 必须是在用户已经授权的情况下调用
console.log(resChangeSession)
that.globalData.userInfo = resChangeSession.data.data.loginUser.user
that.globalData.token = resChangeSession.data.data.token
wx.setStorageSync('user', resChangeSession.data.data.loginUser.user);
wx.setStorageSync('token', resChangeSession.data.data.token)
typeof cb == "function" && cb(resChangeSession.data.data.loginUser.user)
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
}
},


//arraybuffer转字符串
arrayBufferToString:function(arr){
if(typeof arr === 'string') {
return arr;
}
var dataview=new DataView(arr.data);
var ints=new Uint8Array(arr.data.byteLength);
for(var i=0;i<ints.length;i++){
ints[i]=dataview.getUint8(i);
}
arr=ints;
var str = '',
_arr = arr;
for(var i = 0; i < _arr.length; i++) {
var one = _arr[i].toString(2),
v = one.match(/^1+?(?=0)/);
if(v && one.length == 8) {
var bytesLength = v[0].length;
var store = _arr[i].toString(2).slice(7 - bytesLength);
for(var st = 1; st < bytesLength; st++) {
store += _arr[st + i].toString(2).slice(2);
}
str += String.fromCharCode(parseInt(store, 2));
i += bytesLength - 1;
} else {
str += String.fromCharCode(_arr[i]);
}
}
return str;
},

//格式化响应流数据
formatText(text){
text = text.replaceAll("\n","")
text = text.replaceAll("event:message","")
let arr = text.split("data:")
return arr
},



globalData:{
userInfo:null,
token: null,
answeredTime:0,
// ip:"https://"+"inner.luqingwu.top"+":80",
ip:"https://"+"inner.luqingwu.top"+":9099",
// ip:"https://"+"127.0.0.1"+":80",
// wsip:"ws://"+"192.168.1.173"+":80"
}
})
49 changes: 49 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"pages": [
"pages/message/message",
"pages/tabs/tabs",
"pages/mine/mine",
"pages/test/test",
"pages/hy/hy",
"pages/tabXiaoshuo/tabXiaoshuo"
],
"window":{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "",
"backgroundColor": "#eee",
"backgroundTextStyle": "dark"
},
"tabBar": {
"backgroundColor":"#000000",
"selectedColor":"#1aad19",
"color":"#ffffff",
"list": [{
"pagePath": "pages/message/message",
"iconPath":"image/wechat.png",
"selectedIconPath":"image/wechat_2.png",
"text": "AI聊天"
},{
"pagePath": "pages/tabs/tabs",
"iconPath":"image/find.png",
"selectedIconPath":"image/find_2.png",
"text": "创作灵感"
}, {
"pagePath": "pages/mine/mine",
"iconPath":"image/mine.png",
"selectedIconPath":"image/mine_2.png",
"text": "我的"
}]
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
},
"usingComponents": {
"mp-vtabs": "@miniprogram-component-plus/vtabs",
"mp-tabs": "@miniprogram-component-plus/tabs",
"mp-vtabs-content": "@miniprogram-component-plus/vtabs-content"

},
"debug": true
}
117 changes: 117 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**app.wxss**/
@import 'wa-ui.wxss';
page{
height: 100%;
background: #1e2d72;
}


.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
.padding{
padding:20rpx;
}
.padding_half{
padding: 10rpx;
}
.graySpace{
padding-left: 40rpx;
background: #eee;
font-size: 12px;
min-height: 30rpx;
}
.item-avatar .text_box,.item-avatar-lg .text_box{
display: flex;
flex-direction: column
}
.flex-row{
display: flex;
flex-direction: row;
}
.flex-column{
display: flex;
flex-direction: column
}
.flex-center{
display: flex;
justify-content: center;
}
.flex{
display: flex;
}
.title{
font-family: "微软雅黑";
font-size: 32rpx;
}
.message{
font-size: 30rpx;
}

.item-avatar-lg,.item-avatar-md,.item-avatar-sm,.item-avatar-xs{
display: flex;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #eee;
cursor: pointer;
position:relative;
}
.item-avatar-lg image{
float: left;
width: 125rpx;
height: 125rpx;
box-sizing: border-box
}
.item-avatar-md image{
float: left;
width: 85rpx;
height: 85rpx;
box-sizing: border-box
}
.item-avatar-sm image{
float: left;
width: 65rpx;
height: 65rpx;
box-sizing: border-box
}
.item-avatar-xs image{
float: left;
width: 45rpx;
height: 45rpx;
box-sizing: border-box
}

.item-avatar-md .marks{
position: absolute;
top: 0px;
left: 90rpx;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
background: red;
border-radius: 50%;
color: white;
text-align: center;
font-size: 28rpx;
}
.item-avatar-lg .item-text,.item-avatar-md .item-text,.item-avatar-sm .item-text,.item-avatar-xs .item-text{
padding-left: 10px;
}
.item-avatar-md .item-time{
position: absolute;
right: 20rpx;
}
.clearfix{
overflow: hidden;
}
.icon::before{
font-size: 70rpx
}
.floatR{
float: right;
}
Binary file added image/adam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/bq_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/chat/voice/attention.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/chat/voice/keyboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/chat/voice/recall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/chat/voice/speak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/chat/voice/voice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/find.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/find_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/friend_r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/friends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/gouwu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/green_tri.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/mine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/mine_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/money.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/newFriend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/note_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/piaoliuping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/saoyisao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/sc_2.png
Binary file added image/setting.png
Binary file added image/wechat.png
Binary file added image/wechat_2.png
Binary file added image/yaoyiyao.png
Binary file added image/youxi.png
Binary file added image/yy.png
Binary file added image/yy_l.png
Loading

0 comments on commit 0a58385

Please sign in to comment.