Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CooolKey committed Apr 22, 2020
0 parents commit f580dd0
Show file tree
Hide file tree
Showing 79 changed files with 3,758 additions and 0 deletions.
109 changes: 109 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
## 中传小动物图鉴

### 主要需求

1. 显示小动物部分资料(所有人)
2. 支持每只动物的图片上传(所有人)
3. 小动物资料的修改/增添/删除(管理员)
4. 普通用户上传图片的审核(管理员)
5. 领养途径(所有人)

### 前端设计

(暂时参考北大喵咪图鉴)

#### animals

初始页面

列表形式,显示名字和头像和状态(状态包括在校,毕业,喵星/汪星)

底部:「小动物们」「相册」「搜索」

#### gallery

相册

平铺形式,显示小动物名字,作者名字,点赞数,按审核完成时间排序

底部:「小动物们」「相册」「搜索」

#### search

搜索页面

(可以任何信息搜索,包括名字,性格,种类)

底部:「小动物们」「相册」「搜索」

#### searchDetail

搜索结果

列表形式,显示名字和头像和状态,没有结果显示「未找到」

顶部:返回键

#### animalDetail

小动物资料

界面同北大

顶部:返回键

底部:「查看相册」「我想上传」「我想领养」

#### animalGallery

个人(不是)相册

平铺形式,显示小动物名字,作者名字,点赞数

顶部:返回键

#### uploading

上传页面

填写图片和作者名字

顶部:返回键

底部:确定上传

#### adopt

领养页面

领养表单下载地址(百度云链接啥的)和领养联系人

顶部:返回键

### 数据库设计

#### 表1 animals

用于小动物资料和列表

小动物编号(主键),名字name,头像图片地址icon,状态status,出生时间birth,性别sex,物种type
健康状况health,绝育情况及时间opr,第一次目击时间time,外貌look,性格personality,关系relation,领养建议adopt-adv

#### 表2 photos

用于相册

图片编号(主键),作者upper,小动物名字name,点赞数likes,图片地址pic

#### 表3 wait

待审核照片

图片编号(主键),作者upper,小动物名字name,图片地址pic

### 未完成功能

- 图片裁剪

- 点赞

5 changes: 5 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wx.cloud.init({

traceUser: true,

})
43 changes: 43 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"pages": [
"pages/animals/animals",
"pages/gallery/gallery",
"pages/search/search",
"pages/animalDetail/animalDetail",
"pages/animalGallery/animalGallery",
"pages/adopt/adopt",
"pages/uploading/uploading",
"pages/selectPic/selectPic",
"pages/searchDetail/searchDetail"
],
"window": {
"navigationBarBackgroundColor": "#ebebeb",
"backgroundTextStyle": "light",
"navigationBarTitleText": "CUC小动物图鉴",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#686868",
"selectedColor": "#47a86c",
"backgroundColor": "#ffffff",
"borderStyle": "white",
"list": [
{
"pagePath": "pages/animals/animals",
"iconPath": "images/animals_icon.png",
"selectedIconPath": "images/animals_icon_active.png"
},
{
"pagePath": "pages/gallery/gallery",
"iconPath": "images/gallery_icon.png",
"selectedIconPath": "images/gallery_icon_active.png"
},
{
"pagePath": "pages/search/search",
"iconPath": "images/search_icon.png",
"selectedIconPath": "images/search_icon_active.png"
}
]
},
"sitemapLocation": "sitemap.json"
}
4 changes: 4 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.animal-name {
font-size: 40rpx;
color: #333;
}
7 changes: 7 additions & 0 deletions cloudfunctions/callback/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"permissions": {
"openapi": [
"customerServiceMessage.send"
]
}
}
26 changes: 26 additions & 0 deletions cloudfunctions/callback/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const cloud = require('wx-server-sdk')

cloud.init({
// API 调用都保持和云函数当前所在环境一致
env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async (event, context) => {

console.log(event)

const { OPENID } = cloud.getWXContext()

const result = await cloud.openapi.customerServiceMessage.send({
touser: OPENID,
msgtype: 'text',
text: {
content: '收到:' + event.Content,
}
})

console.log(result)

return result
}
14 changes: 14 additions & 0 deletions cloudfunctions/callback/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "callback",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~1.8.3"
}
}
5 changes: 5 additions & 0 deletions cloudfunctions/echo/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"permissions": {
"openapi": []
}
}
8 changes: 8 additions & 0 deletions cloudfunctions/echo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const cloud = require('wx-server-sdk')

exports.main = async (event, context) => {
// event.userInfo 是已废弃的保留字段,在此不做展示
// 获取 OPENID 等微信上下文请使用 cloud.getWXContext()
delete event.userInfo
return event
}
14 changes: 14 additions & 0 deletions cloudfunctions/echo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "echo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~1.8.3"
}
}
5 changes: 5 additions & 0 deletions cloudfunctions/login/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"permissions": {
"openapi": []
}
}
36 changes: 36 additions & 0 deletions cloudfunctions/login/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 云函数模板
// 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”

const cloud = require('wx-server-sdk')

// 初始化 cloud
cloud.init({
// API 调用都保持和云函数当前所在环境一致
env: cloud.DYNAMIC_CURRENT_ENV
})

/**
* 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
*
* event 参数包含小程序端调用传入的 data
*
*/
exports.main = (event, context) => {
console.log(event)
console.log(context)

// 可执行其他自定义逻辑
// console.log 的内容可以在云开发云函数调用日志查看

// 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)等信息
const wxContext = cloud.getWXContext()

return {
event,
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
env: wxContext.ENV,
}
}

14 changes: 14 additions & 0 deletions cloudfunctions/login/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "login",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~1.8.3"
}
}
15 changes: 15 additions & 0 deletions cloudfunctions/openapi/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"permissions": {
"openapi": [
"wxacode.get",
"subscribeMessage.send",
"subscribeMessage.addTemplate",
"templateMessage.send",
"templateMessage.addTemplate",
"templateMessage.deleteTemplate",
"templateMessage.getTemplateList",
"templateMessage.getTemplateLibraryById",
"templateMessage.getTemplateLibraryList"
]
}
}
Loading

0 comments on commit f580dd0

Please sign in to comment.