├── .gitignore ├── miniprogram ├── pages │ ├── index │ │ ├── 奶牛 │ │ │ ├── 奶牛.wxss │ │ │ ├── 奶牛.json │ │ │ ├── 奶牛.wxml │ │ │ └── 奶牛.js │ │ ├── 所有 │ │ │ ├── 所有.wxss │ │ │ ├── 所有.json │ │ │ ├── 所有.wxml │ │ │ └── 所有.js │ │ ├── 狸花 │ │ │ ├── 狸花.wxss │ │ │ ├── 狸花.json │ │ │ ├── 狸花.wxml │ │ │ └── 狸花.js │ │ ├── 纯色 │ │ │ ├── 纯色.wxss │ │ │ ├── 纯色.json │ │ │ ├── 纯色.wxml │ │ │ └── 纯色.js │ │ ├── index.json │ │ ├── 橘猫及橘白 │ │ │ ├── 橘猫及橘白.json │ │ │ ├── 橘猫及橘白.wxss │ │ │ ├── 橘猫及橘白.wxml │ │ │ └── 橘猫及橘白.js │ │ ├── 玳瑁及三花 │ │ │ ├── 玳瑁及三花.wxss │ │ │ ├── 玳瑁及三花.json │ │ │ ├── 玳瑁及三花.wxml │ │ │ └── 玳瑁及三花.js │ │ ├── index.wxss │ │ ├── index.js │ │ └── index.wxml │ ├── json.txt │ ├── cats │ │ ├── 一帆 │ │ │ ├── 一帆.json │ │ │ ├── 一帆.wxml │ │ │ └── 一帆.js │ │ ├── 土谦 │ │ │ ├── 土谦.json │ │ │ ├── 土谦.wxml │ │ │ └── 土谦.js │ │ ├── 杰希 │ │ │ ├── 杰希.json │ │ │ ├── 杰希.wxml │ │ │ └── 杰希.js │ │ ├── 英杰 │ │ │ ├── 英杰.json │ │ │ ├── 英杰.wxml │ │ │ └── 英杰.js │ │ ├── 薏米 │ │ │ ├── 薏米.json │ │ │ ├── 薏米.wxml │ │ │ └── 薏米.js │ │ └── 小黄鸭 │ │ │ ├── 小黄鸭.json │ │ │ ├── 小黄鸭.wxml │ │ │ └── 小黄鸭.js │ ├── about │ │ ├── about.json │ │ ├── about.wxml │ │ └── about.js │ ├── science │ │ ├── science.json │ │ ├── science.wxss │ │ ├── science.wxml │ │ └── science.js │ ├── logs │ │ ├── logs.json │ │ ├── logs.wxss │ │ ├── logs.wxml │ │ └── logs.js │ ├── 猫咪档案.xlsx │ ├── images │ │ ├── play.png │ │ ├── circle.png │ │ ├── huihui.jpg │ │ ├── huihui.png │ │ └── pause.png │ ├── 文案 │ │ ├── WechatIMG12.jpeg │ │ └── 小黄鸭.txt │ ├── appjson.txt │ ├── js2.txt │ ├── js_index.txt │ ├── wxml.txt │ ├── js.txt │ └── circle.py ├── sitemap.json ├── utils │ └── util.js ├── app.json ├── LICENSE ├── app.js ├── project.config.json └── app.wxss ├── 公众号.jpeg ├── 小程序.jpg ├── other-version ├── 小程序.zip └── 有狗狗分类.zip ├── project.private.config.json ├── README.md ├── LICENSE ├── project.config.json ├── wiki.md └── compress.py /.gitignore: -------------------------------------------------------------------------------- 1 | #忽略cat文件夹下的文件 2 | .DS_Store -------------------------------------------------------------------------------- /miniprogram/pages/index/奶牛/奶牛.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/奶牛/奶牛.wxss */ -------------------------------------------------------------------------------- /miniprogram/pages/index/所有/所有.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/所有/所有.wxss */ -------------------------------------------------------------------------------- /miniprogram/pages/index/狸花/狸花.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/狸花/狸花.wxss */ -------------------------------------------------------------------------------- /miniprogram/pages/index/纯色/纯色.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/纯色/纯色.wxss */ -------------------------------------------------------------------------------- /miniprogram/pages/json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/一帆/一帆.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/土谦/土谦.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/杰希/杰希.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/英杰/英杰.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/薏米/薏米.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/about/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/cats/小黄鸭/小黄鸭.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/奶牛/奶牛.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/所有/所有.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/狸花/狸花.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/纯色/纯色.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/science/science.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/橘猫及橘白/橘猫及橘白.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/橘猫及橘白/橘猫及橘白.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/橘猫及橘白/橘猫及橘白.wxss */ -------------------------------------------------------------------------------- /miniprogram/pages/index/玳瑁及三花/玳瑁及三花.wxss: -------------------------------------------------------------------------------- 1 | /* pages/index/玳瑁及三花/玳瑁及三花.wxss */ -------------------------------------------------------------------------------- /公众号.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/公众号.jpeg -------------------------------------------------------------------------------- /小程序.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/小程序.jpg -------------------------------------------------------------------------------- /miniprogram/pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志", 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /other-version/小程序.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/other-version/小程序.zip -------------------------------------------------------------------------------- /other-version/有狗狗分类.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/other-version/有狗狗分类.zip -------------------------------------------------------------------------------- /miniprogram/pages/猫咪档案.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/猫咪档案.xlsx -------------------------------------------------------------------------------- /miniprogram/pages/images/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/images/play.png -------------------------------------------------------------------------------- /miniprogram/pages/images/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/images/circle.png -------------------------------------------------------------------------------- /miniprogram/pages/images/huihui.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/images/huihui.jpg -------------------------------------------------------------------------------- /miniprogram/pages/images/huihui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/images/huihui.png -------------------------------------------------------------------------------- /miniprogram/pages/images/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/images/pause.png -------------------------------------------------------------------------------- /miniprogram/pages/文案/WechatIMG12.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/circlelq/yan-yuan-mao-su-cha-shou-ce-old/HEAD/miniprogram/pages/文案/WechatIMG12.jpeg -------------------------------------------------------------------------------- /miniprogram/pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | .log-list { 2 | display: flex; 3 | flex-direction: column; 4 | padding: 40rpx; 5 | } 6 | .log-item { 7 | margin: 10rpx; 8 | } 9 | -------------------------------------------------------------------------------- /miniprogram/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{index + 1}}. {{log}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /miniprogram/pages/index/玳瑁及三花/玳瑁及三花.json: -------------------------------------------------------------------------------- 1 | { 2 | "window": { 3 | "backgroundTextStyle": "light", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTitleText": "a", 6 | "navigationBarTextStyle": "black", 7 | "enablePullDownRefresh": true 8 | } 9 | } -------------------------------------------------------------------------------- /project.private.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectname": "yan-yuan-mao-su-cha-shou-ce", 3 | "setting": { 4 | "compileHotReLoad": true 5 | }, 6 | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html" 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | //logs.js 2 | const util = require('../../utils/util.js') 3 | 4 | Page({ 5 | data: { 6 | logs: [] 7 | }, 8 | onLoad: function () { 9 | this.setData({ 10 | logs: (wx.getStorageSync('logs') || []).map(log => { 11 | return util.formatTime(new Date(log)) 12 | }) 13 | }) 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /miniprogram/pages/index/奶牛/奶牛.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/pages/index/所有/所有.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/pages/index/狸花/狸花.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/pages/index/纯色/纯色.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/pages/index/橘猫及橘白/橘猫及橘白.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/pages/index/玳瑁及三花/玳瑁及三花.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /miniprogram/utils/util.js: -------------------------------------------------------------------------------- 1 | const formatTime = date => { 2 | const year = date.getFullYear() 3 | const month = date.getMonth() + 1 4 | const day = date.getDate() 5 | const hour = date.getHours() 6 | const minute = date.getMinutes() 7 | const second = date.getSeconds() 8 | 9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') 10 | } 11 | 12 | const formatNumber = n => { 13 | n = n.toString() 14 | return n[1] ? n : '0' + n 15 | } 16 | 17 | module.exports = { 18 | formatTime: formatTime 19 | } 20 | -------------------------------------------------------------------------------- /miniprogram/pages/science/science.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | display: flex; 3 | flex-direction: column; 4 | height: 100%; 5 | } 6 | .navbar{ 7 | flex: none; 8 | display: flex; 9 | background: #fff; 10 | } 11 | .navbar .item{ 12 | position: relative; 13 | flex: auto; 14 | text-align: center; 15 | line-height: 80rpx; 16 | color: #888888; 17 | } 18 | .navbar .item.active{ 19 | color: #94070a; 20 | } 21 | .navbar .item.active:after{ 22 | content: ""; 23 | display: block; 24 | position: absolute; 25 | bottom: 0; 26 | left: 20px; 27 | right: 20px; 28 | height: 4rpx; 29 | background: #94070a; 30 | } 31 | -------------------------------------------------------------------------------- /miniprogram/pages/science/science.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{item}} 3 | 4 | 5 | 13 | 14 | 17 | 18 | 20 | 21 | 23 | 24 | 25 | 29 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | display: flex; 3 | flex-direction: column; 4 | height: 100%; 5 | } 6 | .navbar{ 7 | flex: none; 8 | display: flex; 9 | background: #fff; 10 | } 11 | .navbar .item{ 12 | position: relative; 13 | flex: auto; 14 | text-align: center; 15 | line-height: 80rpx; 16 | color: #888888; 17 | } 18 | .navbar .item.active{ 19 | color: #94070a; 20 | } 21 | .navbar .item.active:after{ 22 | content: ""; 23 | display: block; 24 | position: absolute; 25 | bottom: 0; 26 | left: 40rpx; 27 | right: 40rpx; 28 | height: 4rpx; 29 | background: #94070a; 30 | } 31 | 32 | .placeholder { 33 | color: #888888; 34 | caret-color: #94070a; 35 | } -------------------------------------------------------------------------------- /miniprogram/pages/appjson.txt: -------------------------------------------------------------------------------- 1 | 2 | "pages/about/about", 3 | "pages/logs/logs", 4 | "pages/science/science", 5 | "pages/index/玳瑁及三花/玳瑁及三花", 6 | "pages/index/橘猫及橘白/橘猫及橘白", 7 | "pages/index/纯色/纯色", 8 | "pages/index/奶牛/奶牛", 9 | "pages/index/狸花/狸花", 10 | "pages/index/所有/所有" 11 | ], 12 | "window": { 13 | "backgroundTextStyle": "light", 14 | "navigationBarBackgroundColor": "#fff", 15 | "navigationBarTitleText": "北大猫咪图鉴", 16 | "navigationBarTextStyle": "black", 17 | "enablePullDownRefresh": true 18 | }, 19 | "sitemapLocation": "sitemap.json", 20 | "tabBar": { 21 | "selectedColor":"#94070a", 22 | "color": "#888888", 23 | "list": [ 24 | { 25 | "text": "查猫", 26 | "pagePath": "pages/index/index" 27 | }, 28 | { 29 | "text": "关于", 30 | "pagePath": "pages/about/about" 31 | } 32 | ] 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /miniprogram/pages/about/about.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 北京大学学生流浪猫关爱协会 4 | 5 | 6 | 7 | 8 | 9 | \n 10 | 11 | 12 | 此小程序所有代码开源,可在 GitHub 上搜索「北大猫协」,配有教学视频,简单易用。 13 | 14 | 15 | \n 16 | 17 | 2022-07-23 18 | 19 | 20 | 小程序开发:circle 21 | 22 | 23 | 24 | 25 | 26 | \n 高校动保索引 27 | 28 | 29 | 30 | 31 | \n 32 | 33 | -------------------------------------------------------------------------------- /miniprogram/pages/文案/小黄鸭.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 某位小黄鸭铁粉的介绍: 4 | 5 | 6 | 7 | 8 | 9 | 小黄鸭幼年时是个野孩子。他虽然和微草一家生活在一起,但经常被当作外来的弟弟欺负,摸爬滚打中也练就了一手猫猫拳。尽管脾气凶悍,因为他天真无邪的盛世童颜(有协会流传的歪头杀美照作证),前来撸他的两脚兽络绎不绝,刚喂完食就被他送去打疫苗的也络绎不绝。 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 小黄鸭的转变在土谦突然亲人之后。可能是他胖了,在无数的美食贿赂(和两脚兽的血泪)中想通了亲人的妙处,可能是难兄难弟你亲我也亲的家族情,也可能是被盘得太多了,终于小黄鸭这个熊孩子也想开了。解锁了亲人属性又凭着(胖了也有的)美貌,小黄鸭一时成了畅蠢之后的燕南园明星猫。 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 不过,小黄鸭的送养最终因为熊孩子属性爆发而凉掉。可能鸭鸭还是喜欢在燕南园自由地翻墙、和兄弟姐妹们追逐打闹,也享受着对两脚兽的呼来喝去。你好看就听你的吧,本小黄鸭铁粉绝不认输! 34 | 35 | 36 | 37 | \n 38 | -------------------------------------------------------------------------------- /miniprogram/pages/about/about.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | 3 | Page({ 4 | data: { 5 | screenWidth: 0, 6 | screenHeight: 0, 7 | imgwidth: 0, 8 | imgheight: 0 9 | }, 10 | //转发功能 11 | onShareAppMessage: function () { 12 | let users = wx.getStorageSync('user'); 13 | if (res.from === 'button') { } 14 | return { 15 | path: 'pages/about/about', // 路径,传递参数到指定页面。 16 | success: function (res) { } 17 | } 18 | }, 19 | onPullDownRefresh: function () { 20 | wx.stopPullDownRefresh() 21 | }, 22 | copyTBL: function (e) { 23 | var self = this; 24 | wx.setClipboardData({ 25 | data: '北大猫协',//需要复制的内容 26 | success: function (res) { 27 | // self.setData({copyTip:true}), 28 | 29 | } 30 | }) 31 | }, 32 | 33 | 34 | // 跳转小程序 35 | naviToMini:function(e){ 36 | wx.navigateToMiniProgram({ 37 | appId: 'wx0fb7b06a5065be09', 38 | // path: 'pages/index/index', 39 | envVersion: 'release', 40 | success(res) { 41 | // 打开成功 42 | } 43 | }) 44 | } 45 | 46 | }) 47 | 48 | 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # miniprogram 2 | 3 | 此代码使用 MIT License ,大家可以随意使用(但不包括小程序里的猫咪照片,如要使用,请联系北大猫协)。如果想使用燕园猫速查手册小程序中的科普内容,请在“北大猫协”公众号内留言。打算使用或已经使用的话,最好能告诉我们一声 yuanlq@pku.edu.cn 我们期待收到各位的好消息~ 4 | 5 | 2019 年 9 月,北京大学学生流浪猫关爱协会日常部部长 circle 自主开发出“燕园猫速查手册“小程序。小程序以猫咪证件照及其档案为主要内容,涵盖名称、外貌、绝育、送养及亲人情况等信息,力图简要展现校内猫咪形象,增进爱猫群众对校内猫咪的认识,从而建立起更好的人猫互动关系。为了让其它的小动物保护组织也能使用这个小程序,circle 在此公开所有源代码。如有疑问可以联系 circle yuanlq@pku.edu.cn 。 6 | 7 | 这个版本是一个方便使用的版本,之后会更新。另外大家可以参考北大猫协自己使用的代码 https://gitee.com/circlelq/SCCAPKU-miniprogram 。 8 | 9 | 另外,建议大家使用新框架的版本 https://gitee.com/circlelq/WanliuMeow 。 10 | 11 | ## 如何使用 12 | 13 | 其实整体来说使用非常简单,主要是填写 Excel 表格并保存,然后运行一下 python 代码就行,不需要写任何小程序的代码。使用说明见 https://gitee.com/circlelq/yan-yuan-mao-su-cha-shou-ce/wikis/Home 14 | 15 | 小程序视频教程: https://www.bilibili.com/video/BV16b4y1S7PN 16 | 17 | ## 版本 18 | 19 | 一般情况下点击上方的下载代码即可。下面是其它的版本。 20 | 21 | - 添加了狗狗分类的版本 https://gitee.com/circlelq/miniprogram/tree/dog 22 | 23 | ## 关于我们 24 | 25 | ### 小程序 26 | 27 | 燕园猫速查手册 28 | 29 | ![image](小程序.jpg) 30 | 31 | ### 公众号 32 | 33 | 北大猫协 34 | 35 | ![公众号](公众号.jpeg) 36 | 37 | 关注公众号后提供捐赠途径。 38 | -------------------------------------------------------------------------------- /miniprogram/pages/science/science.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | navbar: ['喂食', '疾病', '领养', '绝育', '撸猫'], 4 | currentTab: 0, 5 | }, 6 | navbarTap: function (e) { 7 | this.setData({ 8 | currentTab: e.currentTarget.dataset.idx 9 | }) 10 | }, 11 | 12 | 13 | onPullDownRefresh:function(){ 14 | wx.stopPullDownRefresh() 15 | }, 16 | 17 | //转发跳转页面设置 18 | onLoad: function (options) { 19 | if (options.pageId) { 20 | wx.navigateTo({ 21 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 22 | }) 23 | } 24 | }, 25 | 26 | //转发此页面的设置 27 | onShareAppMessage: function (ops) { 28 | if (ops.from === 'button') { 29 | // 来自页面内转发按钮 30 | console.log(ops.target) 31 | } 32 | return { 33 | path: 'pages/science/science', // 路径,传递参数到指定页面。 34 | success: function (res) { 35 | // 转发成功 36 | console.log("转发成功:" + JSON.stringify(res)); 37 | }, 38 | fail: function (res) { 39 | // 转发失败 40 | console.log("转发失败:" + JSON.stringify(res)); 41 | } 42 | } 43 | }, 44 | 45 | 46 | }) 47 | 48 | -------------------------------------------------------------------------------- /miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/cats/杰希/杰希", 5 | "pages/cats/英杰/英杰", 6 | "pages/cats/一帆/一帆", 7 | "pages/cats/土谦/土谦", 8 | "pages/cats/小黄鸭/小黄鸭", 9 | "pages/cats/薏米/薏米", 10 | 11 | "pages/about/about", 12 | "pages/logs/logs", 13 | "pages/science/science", 14 | "pages/index/玳瑁及三花/玳瑁及三花", 15 | "pages/index/橘猫及橘白/橘猫及橘白", 16 | "pages/index/纯色/纯色", 17 | "pages/index/奶牛/奶牛", 18 | "pages/index/狸花/狸花", 19 | "pages/index/所有/所有" 20 | ], 21 | "window": { 22 | "backgroundTextStyle": "light", 23 | "navigationBarBackgroundColor": "#fff", 24 | "navigationBarTitleText": "北大猫咪图鉴", 25 | "navigationBarTextStyle": "black", 26 | "enablePullDownRefresh": true 27 | }, 28 | "sitemapLocation": "sitemap.json", 29 | "tabBar": { 30 | "selectedColor":"#94070a", 31 | "color": "#888888", 32 | "list": [ 33 | { 34 | "text": "查猫", 35 | "pagePath": "pages/index/index" 36 | }, 37 | { 38 | "text": "关于", 39 | "pagePath": "pages/about/about" 40 | } 41 | ] 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /miniprogram/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 circle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Stray Cats Caring Association, Peking University 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /miniprogram/pages/js2.txt: -------------------------------------------------------------------------------- 1 | 2 | ], 3 | screenWidth: 0, 4 | screenHeight: 0, 5 | imgwidth: 0, 6 | imgheight: 0, 7 | url: app.globalData.url, 8 | }, 9 | 10 | onPullDownRefresh:function(){ 11 | wx.stopPullDownRefresh() 12 | }, 13 | 14 | //转发跳转页面设置 15 | onLoad: function (options) { 16 | if (options.pageId) { 17 | 18 | wx.navigateTo({ 19 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 20 | }) 21 | } 22 | }, 23 | 24 | //转发此页面的设置 25 | onShareAppMessage: function (ops) { 26 | if (ops.from === 'button') { 27 | // 来自页面内转发按钮 28 | console.log(ops.target) 29 | } 30 | return { 31 | path: 'pages/index/index', // 路径,传递参数到指定页面。 32 | success: function (res) { 33 | // 转发成功 34 | console.log("转发成功:" + JSON.stringify(res)); 35 | }, 36 | fail: function (res) { 37 | // 转发失败 38 | console.log("转发失败:" + JSON.stringify(res)); 39 | } 40 | } 41 | }, 42 | 43 | // 搜索栏输入名字后页面跳转 44 | bindconfirmT: function (e) { 45 | console.log("e.detail.value"); 46 | if(e.detail.value) { 47 | 48 | wx.navigateTo({ 49 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 50 | }) 51 | } 52 | } 53 | 54 | 55 | }) 56 | 57 | -------------------------------------------------------------------------------- /miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | if (wx.canIUse('getUpdateManager')) { 5 | const updateManager = wx.getUpdateManager() 6 | updateManager.onCheckForUpdate(function (res) { 7 | if (res.hasUpdate) { 8 | updateManager.onUpdateReady(function () { 9 | wx.showModal({ 10 | title: '更新提示', 11 | content: '新版本已经准备好,是否重启应用?', 12 | success: function (res) { 13 | if (res.confirm) { 14 | updateManager.applyUpdate() 15 | } 16 | } 17 | }) 18 | }) 19 | updateManager.onUpdateFailed(function () { 20 | wx.showModal({ 21 | title: '已经有新版本了哟~', 22 | content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~' 23 | }) 24 | }) 25 | } 26 | }) 27 | } else { 28 | wx.showModal({ 29 | title: '提示', 30 | content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' 31 | }) 32 | } 33 | 34 | }, 35 | 36 | globalData: { 37 | userInfo: null, 38 | url: "https://pku-lostangel.oss-cn-beijing.aliyuncs.com/", 39 | }, 40 | }) 41 | 42 | wx.showShareMenu({ 43 | withShareTicket: true 44 | }) 45 | 46 | wx.setInnerAudioOption({ 47 | obeyMuteSwitch: false 48 | }); -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "miniprogram/", 3 | "appid": "wx176cdf19e4cadaaf", 4 | "compileType": "miniprogram", 5 | "libVersion": "2.25.0", 6 | "packOptions": { 7 | "ignore": [], 8 | "include": [] 9 | }, 10 | "setting": { 11 | "urlCheck": true, 12 | "coverView": true, 13 | "es6": true, 14 | "postcss": true, 15 | "lazyloadPlaceholderEnable": false, 16 | "preloadBackgroundData": false, 17 | "minified": true, 18 | "autoAudits": false, 19 | "uglifyFileName": false, 20 | "uploadWithSourceMap": true, 21 | "enhance": true, 22 | "showShadowRootInWxmlPanel": true, 23 | "packNpmManually": false, 24 | "packNpmRelationList": [], 25 | "minifyWXSS": true, 26 | "useStaticServer": true, 27 | "showES6CompileOption": false, 28 | "checkInvalidKey": true, 29 | "babelSetting": { 30 | "ignore": [], 31 | "disablePlugins": [], 32 | "outputPath": "" 33 | }, 34 | "disableUseStrict": false, 35 | "useCompilerPlugins": false, 36 | "minifyWXML": true 37 | }, 38 | "condition": {}, 39 | "editorSetting": { 40 | "tabIndent": "insertSpaces", 41 | "tabSize": 2 42 | }, 43 | "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", 44 | "srcMiniprogramRoot": "miniprogram/" 45 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/狸花/狸花.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/pages/index/玳瑁及三花/玳瑁及三花.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/pages/index/纯色/纯色.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | { name:"薏米"}, 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/pages/index/橘猫及橘白/橘猫及橘白.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | { name:"小黄鸭"}, 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/pages/index/奶牛/奶牛.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | { name:"英杰"},{ name:"一帆"}, 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/pages/index/所有/所有.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catlist: [ 5 | { name:"小黄鸭"},{ name:"英杰"},{ name:"一帆"},{ name:"薏米"}, 6 | ], 7 | screenWidth: 0, 8 | screenHeight: 0, 9 | imgwidth: 0, 10 | imgheight: 0, 11 | url: app.globalData.url, 12 | }, 13 | 14 | onPullDownRefresh:function(){ 15 | wx.stopPullDownRefresh() 16 | }, 17 | 18 | //转发跳转页面设置 19 | onLoad: function (options) { 20 | if (options.pageId) { 21 | 22 | wx.navigateTo({ 23 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 24 | }) 25 | } 26 | }, 27 | 28 | //转发此页面的设置 29 | onShareAppMessage: function (ops) { 30 | if (ops.from === 'button') { 31 | // 来自页面内转发按钮 32 | console.log(ops.target) 33 | } 34 | return { 35 | path: 'pages/index/index', // 路径,传递参数到指定页面。 36 | success: function (res) { 37 | // 转发成功 38 | console.log("转发成功:" + JSON.stringify(res)); 39 | }, 40 | fail: function (res) { 41 | // 转发失败 42 | console.log("转发失败:" + JSON.stringify(res)); 43 | } 44 | } 45 | }, 46 | 47 | // 搜索栏输入名字后页面跳转 48 | bindconfirmT: function (e) { 49 | console.log("e.detail.value"); 50 | if(e.detail.value) { 51 | 52 | wx.navigateTo({ 53 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 54 | }) 55 | } 56 | } 57 | 58 | 59 | }) 60 | 61 | -------------------------------------------------------------------------------- /miniprogram/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Project configuration file", 3 | "packOptions": { 4 | "ignore": [] 5 | }, 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": false, 9 | "enhance": true, 10 | "postcss": true, 11 | "preloadBackgroundData": false, 12 | "minified": true, 13 | "newFeature": false, 14 | "coverView": true, 15 | "nodeModules": false, 16 | "autoAudits": false, 17 | "showShadowRootInWxmlPanel": true, 18 | "scopeDataCheck": false, 19 | "uglifyFileName": false, 20 | "checkInvalidKey": true, 21 | "checkSiteMap": true, 22 | "uploadWithSourceMap": true, 23 | "compileHotReLoad": false, 24 | "lazyloadPlaceholderEnable": false, 25 | "useMultiFrameRuntime": true, 26 | "useApiHook": true, 27 | "useApiHostProcess": true, 28 | "babelSetting": { 29 | "ignore": [], 30 | "disablePlugins": [], 31 | "outputPath": "" 32 | }, 33 | "useIsolateContext": true, 34 | "userConfirmedBundleSwitch": false, 35 | "packNpmManually": false, 36 | "packNpmRelationList": [], 37 | "minifyWXSS": true, 38 | "disableUseStrict": false, 39 | "minifyWXML": true, 40 | "showES6CompileOption": false, 41 | "useCompilerPlugins": false, 42 | "ignoreUploadUnusedFiles": true 43 | }, 44 | "compileType": "miniprogram", 45 | "libVersion": "2.8.1", 46 | "appid": "wx176cdf19e4cadaaf", 47 | "projectname": "miniprogram", 48 | "debugOptions": { 49 | "hidedInDevtools": [] 50 | }, 51 | "isGameTourist": false, 52 | "simulatorType": "wechat", 53 | "simulatorPluginLibVersion": {}, 54 | "condition": { 55 | "search": { 56 | "list": [] 57 | }, 58 | "conversation": { 59 | "list": [] 60 | }, 61 | "plugin": { 62 | "list": [] 63 | }, 64 | "game": { 65 | "currentL": -1, 66 | "list": [] 67 | }, 68 | "gamePlugin": { 69 | "list": [] 70 | }, 71 | "miniprogram": { 72 | "list": [ 73 | { 74 | "id": 0, 75 | "name": "pages/index/index", 76 | "pathName": "pages/index/index", 77 | "query": "", 78 | "scene": null 79 | } 80 | ] 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /miniprogram/pages/js_index.txt: -------------------------------------------------------------------------------- 1 | screenWidth: 0, 2 | screenHeight: 0, 3 | imgwidth: 0, 4 | imgheight: 0, 5 | navbar: ['在校', '毕业', '休学', '喵星'], 6 | currentTab: 0, 7 | url: app.globalData.url, 8 | }, 9 | navbarTap: function (e) { 10 | this.setData({ 11 | currentTab: e.currentTarget.dataset.idx 12 | }) 13 | }, 14 | 15 | iconType: [ 16 | 'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear' 17 | ], 18 | 19 | onPullDownRefresh: function () { 20 | wx.stopPullDownRefresh() 21 | }, 22 | 23 | //转发跳转页面设置 24 | onLoad: function (options) { 25 | if (options.pageId) { 26 | wx.navigateTo({ 27 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 28 | }) 29 | } 30 | }, 31 | 32 | //转发此页面的设置 33 | onShareAppMessage: function (ops) { 34 | if (ops.from === 'button') { 35 | // 来自页面内转发按钮 36 | console.log(ops.target) 37 | } 38 | return { 39 | path: 'pages/index/index', // 路径,传递参数到指定页面。 40 | success: function (res) { 41 | // 转发成功 42 | console.log("转发成功:" + JSON.stringify(res)); 43 | }, 44 | fail: function (res) { 45 | // 转发失败 46 | console.log("转发失败:" + JSON.stringify(res)); 47 | } 48 | } 49 | }, 50 | 51 | // 转发到朋友圈 52 | onShareTimeline: function (res) { 53 | if (ops.from === 'button') { 54 | // 来自页面内转发按钮 55 | console.log(ops.target) 56 | } 57 | return { 58 | path: 'pages/index/index', // 路径,传递参数到指定页面。 59 | success: function (res) { 60 | // 转发成功 61 | console.log("转发成功:" + JSON.stringify(res)); 62 | }, 63 | fail: function (res) { 64 | // 转发失败 65 | console.log("转发失败:" + JSON.stringify(res)); 66 | } 67 | } 68 | }, 69 | 70 | // 搜索栏输入名字后页面跳转 71 | bindconfirmT: function (e) { 72 | console.log("e.detail.value"); 73 | if (e.detail.value) { 74 | wx.navigateTo({ 75 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 76 | }) 77 | } 78 | }, 79 | copyTBL: function (e) { 80 | var self = this; 81 | wx.setClipboardData({ 82 | data: '北大猫协',//需要复制的内容 83 | success: function (res) { 84 | // self.setData({copyTip:true}), 85 | 86 | } 87 | }) 88 | }, 89 | 90 | }) 91 | 92 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | fostered_catlist: [ 5 | { name:"杰希"}, 6 | { name:"土谦"}, 7 | ], 8 | unknown_catlist: [ 9 | ], 10 | dead_catlist: [ 11 | ], 12 | screenWidth: 0, 13 | screenHeight: 0, 14 | imgwidth: 0, 15 | imgheight: 0, 16 | navbar: ['在校', '毕业', '休学', '喵星'], 17 | currentTab: 0, 18 | url: app.globalData.url, 19 | }, 20 | navbarTap: function (e) { 21 | this.setData({ 22 | currentTab: e.currentTarget.dataset.idx 23 | }) 24 | }, 25 | 26 | iconType: [ 27 | 'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear' 28 | ], 29 | 30 | onPullDownRefresh: function () { 31 | wx.stopPullDownRefresh() 32 | }, 33 | 34 | //转发跳转页面设置 35 | onLoad: function (options) { 36 | if (options.pageId) { 37 | wx.navigateTo({ 38 | url: '/pages/cats/' + options.pageId + '/' + options.pageId, 39 | }) 40 | } 41 | }, 42 | 43 | //转发此页面的设置 44 | onShareAppMessage: function (ops) { 45 | if (ops.from === 'button') { 46 | // 来自页面内转发按钮 47 | console.log(ops.target) 48 | } 49 | return { 50 | path: 'pages/index/index', // 路径,传递参数到指定页面。 51 | success: function (res) { 52 | // 转发成功 53 | console.log("转发成功:" + JSON.stringify(res)); 54 | }, 55 | fail: function (res) { 56 | // 转发失败 57 | console.log("转发失败:" + JSON.stringify(res)); 58 | } 59 | } 60 | }, 61 | 62 | // 转发到朋友圈 63 | onShareTimeline: function (res) { 64 | if (ops.from === 'button') { 65 | // 来自页面内转发按钮 66 | console.log(ops.target) 67 | } 68 | return { 69 | path: 'pages/index/index', // 路径,传递参数到指定页面。 70 | success: function (res) { 71 | // 转发成功 72 | console.log("转发成功:" + JSON.stringify(res)); 73 | }, 74 | fail: function (res) { 75 | // 转发失败 76 | console.log("转发失败:" + JSON.stringify(res)); 77 | } 78 | } 79 | }, 80 | 81 | // 搜索栏输入名字后页面跳转 82 | bindconfirmT: function (e) { 83 | console.log("e.detail.value"); 84 | if (e.detail.value) { 85 | wx.navigateTo({ 86 | url: '/pages/cats/' + e.detail.value + '/' + e.detail.value, 87 | }) 88 | } 89 | }, 90 | copyTBL: function (e) { 91 | var self = this; 92 | wx.setClipboardData({ 93 | data: '北大猫协',//需要复制的内容 94 | success: function (res) { 95 | // self.setData({copyTip:true}), 96 | 97 | } 98 | }) 99 | }, 100 | 101 | }) 102 | 103 | -------------------------------------------------------------------------------- /miniprogram/pages/wxml.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/一帆/一帆.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/土谦/土谦.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/杰希/杰希.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/英杰/英杰.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/薏米/薏米.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | -------------------------------------------------------------------------------- /miniprogram/pages/js.txt: -------------------------------------------------------------------------------- 1 | 2 | //音频播放 3 | audioPlay(e) { 4 | var that = this, 5 | id = e.currentTarget.dataset.id, 6 | key = e.currentTarget.dataset.key, 7 | audioArr = that.data.audioArr; 8 | 9 | //设置状态 10 | audioArr.forEach((v, i, array) => { 11 | v.bl = false; 12 | if (i == key) { 13 | v.bl = true; 14 | } 15 | }) 16 | that.setData({ 17 | audioArr: audioArr, 18 | audKey: key, 19 | }) 20 | 21 | myaudio.autoplay = true; 22 | var audKey = that.data.audKey, 23 | vidSrc = audioArr[audKey].src; 24 | myaudio.src = vidSrc; 25 | 26 | myaudio.play(); 27 | 28 | //开始监听 29 | myaudio.onPlay(() => { 30 | console.log('开始播放'); 31 | }) 32 | 33 | //结束监听 34 | myaudio.onEnded(() => { 35 | console.log('自动播放完毕'); 36 | audioArr[key].bl = false; 37 | that.setData({ 38 | audioArr: audioArr, 39 | }) 40 | }) 41 | 42 | //错误回调 43 | myaudio.onError((err) => { 44 | console.log(err); 45 | audioArr[key].bl = false; 46 | that.setData({ 47 | audioArr: audioArr, 48 | }) 49 | return 50 | }) 51 | 52 | }, 53 | 54 | // 音频停止 55 | audioStop(e) { 56 | var that = this, 57 | key = e.currentTarget.dataset.key, 58 | audioArr = that.data.audioArr; 59 | //设置状态 60 | audioArr.forEach((v, i, array) => { 61 | v.bl = false; 62 | }) 63 | that.setData({ 64 | audioArr: audioArr 65 | }) 66 | 67 | myaudio.stop(); 68 | 69 | //停止监听 70 | myaudio.onStop(() => { 71 | console.log('停止播放'); 72 | }) 73 | }, 74 | 75 | onPullDownRefresh:function(){ 76 | wx.stopPullDownRefresh() 77 | }, 78 | 79 | onShareAppMessage: function (res) { 80 | if (res.from === 'button') { 81 | // 来自页面内转发按钮 82 | console.log(res.target) 83 | } 84 | return { 85 | title: this.data.catname, 86 | path: '/pages/index/index?pageId='+this.data.catname, 87 | success: function (res) { 88 | // 转发成功 89 | }, 90 | fail: function (res) { 91 | // 转发失败 92 | } 93 | } 94 | }, 95 | 96 | previewImage: function (e) { 97 | let that = this; 98 | let src = e.currentTarget.dataset.src; 99 | wx.previewImage({ 100 | current: src, 101 | urls: [src] 102 | }) 103 | }, 104 | 105 | onShareTimeline: function (res) { 106 | if (res.from === 'button') { 107 | // 来自页面内转发按钮 108 | console.log(res.target) 109 | } 110 | return { 111 | title: this.data.catname, 112 | path: '/pages/index/index?pageId='+this.data.catname, 113 | success: function (res) { 114 | // 转发成功 115 | }, 116 | fail: function (res) { 117 | // 转发失败 118 | } 119 | } 120 | }, 121 | 122 | }) 123 | //创建audio控件 124 | const myaudio = wx.createInnerAudioContext(); 125 | 126 | -------------------------------------------------------------------------------- /wiki.md: -------------------------------------------------------------------------------- 1 | 小程序使用教程,希望每一个人看了以后都能做出自己的猫咪图鉴。 2 | 3 | # 准备工作 4 | 5 | 小程序视频教程: https://www.bilibili.com/video/BV1jk4y1B7sX 6 | 7 | 若需要北大猫协的科普内容,请在北大猫协公众号留言,之后把聊天记录截图发给circle yuanlq@pku.edu.cn。 8 | 9 | ## 注册小程序账号 10 | 11 | 主页: https://mp.weixin.qq.com/cgi-bin/wx?token=&lang=zh_CN 12 | 13 | 注册页: https://mp.weixin.qq.com/wxopen/waregister?action=step1 14 | 15 | 需要身份信息,每人可以注册 5 个小程序。 16 | 17 | ## 下载小程序开发工具 18 | 19 | 下载后安装: https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html 20 | 21 | ## 安装 python3 22 | 23 | 之后需要运行 python 代码。 24 | 25 | 下载后安装: https://www.python.org/downloads/ 26 | 27 | Windows 用户注意要把 python 加入环境变量 https://baijiahao.baidu.com/s?id=1606573927720991570&wfr=spider&for=pc 28 | 29 | ## 安装 python 的一个包 30 | 31 | 终端(命令行)输入下面一行 32 | 33 | `pip install openpyxl` 34 | 35 | ## 下载模版 36 | 37 | clone 或下载: https://gitee.com/circlelq/yan-yuan-mao-su-cha-shou-ce 38 | 39 | ## 购买腾讯云或阿里云或云开发或使用 gitee 40 | 41 | 需要把猫咪的图片存储到云端,然后用小程序调用,因为小程序允许上传的文件大小很小。 42 | 43 | 小程序云服务: https://cloud.tencent.com/edu/learning/course-1481-8464 44 | 45 | 腾讯云: https://cloud.tencent.com/product/cos 46 | 47 | 阿里云: https://www.aliyun.com/product/oss?spm=5176.10695662.1112155.2.188e5ad3nmYcYt 48 | 49 | # 运行小程序 50 | 51 | ## 用开发者工具打开 52 | 53 | 导入 miniprogram 记得输入自己的 AppID 。 54 | 55 | ## 修改信息 56 | 57 | 一些信息需要修改,才能符合不同的社团。例如北大猫协的简介,在 pages/about/about.wxml 文件里,会徽图片在 pages/images 里,pages/ 文案 给出了一个在图鉴后面添加其它文字的例子。 58 | 59 | 另外还有一个比较重要的事情就是改猫的图片,我们目前是在阿里云上传图片,然后让小程序调用图片,因为小程序允许上传的文件大小很小,建议大家直接使用小程序的云开发功能。需要修改 app.js 文件中的调用地址(把 "https://pku-lostangel.oss-cn-beijing.aliyuncs.com/" 改成你的地址),以及 pages/circle.py 文件中的地址。 60 | 61 | 科普内容请联系北大猫协公众号。 62 | 63 | ## 图片命名方法 64 | 65 | - 头像:名字.png 66 | 67 | - 图片:名字.jpg 68 | 69 | - 更多图片:名字+数字.jpg 70 | 71 | ## 视频命名方法 72 | 73 | - 名字+数字.mp4 74 | 75 | ## 压缩 76 | 77 | - 建议把图片和视频压缩小一点,否则会比较烧流量,最低可以把头像压缩到 10k,照片压缩到 90k。可以限制大图的长边像素为 900 像素,头像宽 200 像素。 78 | 79 | - 视频压缩可以使用微信,即把视频发给某人,微信会自动压缩,然后再下载下来。 80 | 81 | 推荐图片压缩网址 https://docsmall.com 。 82 | 83 | ## 编辑表格 84 | 85 | 填写 page 文件夹里的 Excel 表格并保存。 86 | 87 | ## 运行 python 88 | 89 | 根据教学视频里的方法运行即可,或者上网查看如何运行 python 代码。 90 | 91 | ## 提交 92 | 93 | 在小程序开发者工具中点击提交。 94 | 95 | # 问题解答 96 | 97 | 可以发邮件 yuanlq@pku.edu.cn 98 | 99 | ## 修改 100 | 101 | 小程序最上方的名称修改:修改 app.json 文件里的信息 102 | 增加地点信息:去掉 circle.py 代码第 56 行的 '#' 和后面的一个空格。(考虑到猫咪的安全,不建议增加地点信息) 103 | 104 | ## 增加广告 105 | 106 | 可以查看[官方文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/ad/banner-ad.html)。 107 | 108 | 1. 累计用户要达到 1000,然后在微信公众平台登陆小程序,点击 流量主 开通广告,点击 banner 形式,获得广告 id。 109 | 110 | 2. 将以下代码加到文件 miniprogram/miniprogram/pages/index/index.wxml 的第 76 行,或者其它你喜欢的位置,注意修改 id 号。 111 | 112 | ``` 113 | 114 | 115 | 116 | 117 | 118 | ``` 119 | 120 | 3. 将以下代码加到文件 miniprogram/miniprogram/app.wxss 的最后 121 | 122 | ```css 123 | .adContainer { 124 | width:100%; 125 | display: flex; 126 | justify-content: center; 127 | } 128 | 129 | .adContainer ad { 130 | width:100%; 131 | } 132 | ``` 133 | 134 | ## 遇到的问题 135 | 136 | 如果在开发者工具里打开猫咪名片显示找不到 wxml 文件,点击开发者工具上方的预览,在手机中即可查看,这是开发者工具的 bug,不影响手机上的体验。 137 | python 要正确安装,并且要安装一个包。 138 | -------------------------------------------------------------------------------- /miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } 11 | 12 | .itemname1 { 13 | font-size: 27rpx; 14 | margin-left: 40rpx; 15 | margin-bottom: 30rpx; 16 | margin-top: 30rpx; 17 | display:flex; 18 | color:#888888; 19 | flex-direction: row; 20 | flex-wrap: wrap; 21 | justify-content: flex-start; 22 | } 23 | 24 | .itemname2 { 25 | font-size: 30rpx; 26 | color:#353535; 27 | font-weight:normal; 28 | margin-right: 40rpx; 29 | margin-bottom: 30rpx; 30 | } 31 | 32 | 33 | .content { 34 | display: flex; 35 | flex-direction: column; 36 | align-items: center; 37 | } 38 | 39 | .title { 40 | font-size: 45rpx; 41 | text-align: center; 42 | margin-top: 14rpx; 43 | margin-bottom: 14rpx; 44 | font-weight:bold; 45 | } 46 | 47 | .head1 { 48 | font-size: 35rpx; 49 | margin-left: 40rpx; 50 | margin-right: 40rpx; 51 | line-height:25rpx; 52 | margin-bottom: 20rpx; 53 | margin-top: 40rpx; 54 | font-weight:bold; 55 | color:black; 56 | text-align: left; 57 | } 58 | 59 | .body { 60 | font-size: 30rpx; 61 | margin-left: 40rpx; 62 | margin-right: 40rpx; 63 | margin-bottom: 30rpx; 64 | margin-top: 14rpx; 65 | color:#353535; 66 | letter-spacing: 5rpx; 67 | line-height: 55rpx; 68 | text-align: justify; 69 | } 70 | 71 | 72 | 73 | .bodybold { 74 | font-weight:bold; 75 | } 76 | 77 | /* 会徽 */ 78 | .board image{ 79 | width: 100%; 80 | height: 300rpx; 81 | border-bottom: 1rpx solid #eee; 82 | } 83 | 84 | 85 | /*每一只猫*/ 86 | .catitem{ 87 | height: 3.7rem; 88 | display: flex; 89 | align-items: center; 90 | width: 100%; 91 | } 92 | 93 | /*分割线样式*/ 94 | .divLine{ 95 | background: #eee; 96 | height: 3rpx; 97 | margin-left: 5rem; 98 | } 99 | 100 | 101 | /*猫名称*/ 102 | .cat-name{ 103 | font-size: 30rpx; 104 | flex-direction:row; 105 | margin-left: 5rem; 106 | color:#353535; 107 | text-align: center; 108 | } 109 | 110 | /*搜索框*/ 111 | .search{ 112 | font-size: 30rpx; 113 | position: absolute; 114 | margin-left: 5rem; 115 | margin-top: 0.7rem; 116 | } 117 | 118 | .avator { 119 | width: 3rem; 120 | height: 3rem; 121 | margin-left: 40rpx; 122 | position: absolute; 123 | align-items: center; 124 | display:flex; 125 | } 126 | 127 | .copy{ 128 | color: #576b95; 129 | } 130 | 131 | .play{ 132 | width:45rpx; 133 | height: 45rpx; 134 | margin-right: 20rpx; 135 | } 136 | 137 | .staff { 138 | font-size: 20rpx; 139 | margin-left: 40rpx; 140 | margin-right: 40rpx; 141 | line-height:45rpx; 142 | margin-bottom: 0rpx; 143 | margin-top: -10rpx; 144 | color:#888888; 145 | text-align: right; 146 | } 147 | 148 | .cat_image { 149 | border-radius: 10rpx; 150 | overflow: hidden; 151 | } 152 | 153 | .cat-card { 154 | font-size: 45rpx; 155 | color:black; 156 | font-weight:bold; 157 | justify-content: flex-start; 158 | } 159 | 160 | .sound { 161 | margin-top: 9rpx; 162 | display:flex; 163 | flex-direction: row; 164 | flex-wrap: wrap; 165 | } 166 | 167 | .adContainer { 168 | width:100%; 169 | display: flex; 170 | justify-content: center; 171 | } 172 | 173 | .adContainer ad { 174 | width:100%; 175 | } -------------------------------------------------------------------------------- /compress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | # 压缩图片脚本 4 | from PIL import Image, ExifTags 5 | from pathlib import Path 6 | import os 7 | from pathlib import Path 8 | import sys 9 | 10 | 11 | def get_file_size(fileName): 12 | size = os.path.getsize(fileName) 13 | return size / 1024 14 | 15 | 16 | def compress_file_jpg(fileName): 17 | sizeMax = 700 # 大图长边的像素数 18 | inputPath = Path('input/') 19 | outPath = Path('out_put_files/') 20 | im = Image.open(inputPath / fileName) 21 | 22 | try: 23 | for orientation in ExifTags.TAGS.keys(): 24 | if ExifTags.TAGS[orientation] == 'Orientation': 25 | break 26 | exif = dict(im._getexif().items()) 27 | if exif[orientation] == 3: 28 | im = im.rotate(180, expand=True) 29 | elif exif[orientation] == 6: 30 | im = im.rotate(270, expand=True) 31 | elif exif[orientation] == 8: 32 | im = im.rotate(90, expand=True) 33 | except: 34 | pass 35 | 36 | im = im.convert('RGB') 37 | im.save(outPath / fileName) 38 | 39 | x, y = im.size 40 | if x < sizeMax and y < sizeMax: 41 | # 原图尺寸足够小 42 | im.save(outPath / fileName) 43 | else: 44 | if x > y: 45 | x_resize = sizeMax 46 | y_resize = int(y/x*sizeMax) 47 | out = im.resize((x_resize, y_resize)) 48 | else: 49 | y_resize = sizeMax 50 | x_resize = int(x/y*sizeMax) 51 | out = im.resize((x_resize, y_resize)) 52 | out.save(outPath / fileName) 53 | iterateNum = 3 54 | while(get_file_size(outPath / fileName) > 100): 55 | # print(get_file_size(outPath / fileName)) 56 | if(iterateNum == 0): 57 | break 58 | im = Image.open(outPath / fileName) 59 | im.save(outPath / fileName, quality=70) 60 | iterateNum = iterateNum - 1 61 | 62 | 63 | def compress_file_png(fileName): 64 | sizeMax = 150 # 头像长边的像素数 65 | inputPath = Path('input/') 66 | outPath = Path('out_put_files/') 67 | im = Image.open(inputPath / fileName) 68 | x, y = im.size 69 | if x < sizeMax and y < sizeMax: 70 | # 原图尺寸足够小 71 | im.save(outPath / fileName) 72 | else: 73 | if x > y: 74 | x_resize = sizeMax 75 | y_resize = int(y/x*sizeMax) 76 | out = im.resize((x_resize, y_resize)) 77 | else: 78 | y_resize = sizeMax 79 | x_resize = int(x/y*sizeMax) 80 | out = im.resize((x_resize, y_resize)) 81 | out.save(outPath / fileName) 82 | iterateNum = 3 83 | while(get_file_size(outPath / fileName) > 40): 84 | # print(get_file_size(outPath / fileName)) 85 | if(iterateNum == 0): 86 | break 87 | im = Image.open(outPath / fileName) 88 | im.save(outPath / fileName, quality=60) 89 | iterateNum = iterateNum - 1 90 | 91 | 92 | if __name__ == '__main__': 93 | if not os.path.exists('out_put_files'): 94 | os.makedirs('out_put_files') 95 | inputPath = Path('input/') 96 | for fileName in os.listdir(inputPath): 97 | # 排除隐藏文件 98 | if fileName[0] == '.': 99 | continue 100 | fileType = fileName.split('.') 101 | if fileType[1] == 'jpg': 102 | compress_file_jpg(fileName) 103 | if fileType[1] == 'png': 104 | compress_file_png(fileName) 105 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/薏米/薏米.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"薏米", 5 | catitems:[ 6 | {category:"毛色", 7 | content:" 长毛白",}, 8 | {category:"性别", 9 | content:" 母",}, 10 | {category:"状况", 11 | content:" 健康",}, 12 | {category:"绝育情况", 13 | content:" 已绝育",}, 14 | {category:"绝育时间", 15 | content:" 2019年03月13号",}, 16 | {category:"性格", 17 | content:" 怕人 安全距离 1m 以内",}, 18 | {category:"第一次目击", 19 | content:" 2019寒假",}, 20 | {category:"外貌", 21 | content:" 异瞳小白猫 蓝黄异瞳 右耳耳缺 ",}, 22 | {category:"关系", 23 | content:" 跟夜色关系好",}, 24 | 25 | ], 26 | url: app.globalData.url, 27 | relationship:[], 28 | nums:[ 29 | ], 30 | }, 31 | //音频播放 32 | audioPlay(e) { 33 | var that = this, 34 | id = e.currentTarget.dataset.id, 35 | key = e.currentTarget.dataset.key, 36 | audioArr = that.data.audioArr; 37 | 38 | //设置状态 39 | audioArr.forEach((v, i, array) => { 40 | v.bl = false; 41 | if (i == key) { 42 | v.bl = true; 43 | } 44 | }) 45 | that.setData({ 46 | audioArr: audioArr, 47 | audKey: key, 48 | }) 49 | 50 | myaudio.autoplay = true; 51 | var audKey = that.data.audKey, 52 | vidSrc = audioArr[audKey].src; 53 | myaudio.src = vidSrc; 54 | 55 | myaudio.play(); 56 | 57 | //开始监听 58 | myaudio.onPlay(() => { 59 | console.log('开始播放'); 60 | }) 61 | 62 | //结束监听 63 | myaudio.onEnded(() => { 64 | console.log('自动播放完毕'); 65 | audioArr[key].bl = false; 66 | that.setData({ 67 | audioArr: audioArr, 68 | }) 69 | }) 70 | 71 | //错误回调 72 | myaudio.onError((err) => { 73 | console.log(err); 74 | audioArr[key].bl = false; 75 | that.setData({ 76 | audioArr: audioArr, 77 | }) 78 | return 79 | }) 80 | 81 | }, 82 | 83 | // 音频停止 84 | audioStop(e) { 85 | var that = this, 86 | key = e.currentTarget.dataset.key, 87 | audioArr = that.data.audioArr; 88 | //设置状态 89 | audioArr.forEach((v, i, array) => { 90 | v.bl = false; 91 | }) 92 | that.setData({ 93 | audioArr: audioArr 94 | }) 95 | 96 | myaudio.stop(); 97 | 98 | //停止监听 99 | myaudio.onStop(() => { 100 | console.log('停止播放'); 101 | }) 102 | }, 103 | 104 | onPullDownRefresh:function(){ 105 | wx.stopPullDownRefresh() 106 | }, 107 | 108 | onShareAppMessage: function (res) { 109 | if (res.from === 'button') { 110 | // 来自页面内转发按钮 111 | console.log(res.target) 112 | } 113 | return { 114 | title: this.data.catname, 115 | path: '/pages/index/index?pageId='+this.data.catname, 116 | success: function (res) { 117 | // 转发成功 118 | }, 119 | fail: function (res) { 120 | // 转发失败 121 | } 122 | } 123 | }, 124 | 125 | previewImage: function (e) { 126 | let that = this; 127 | let src = e.currentTarget.dataset.src; 128 | wx.previewImage({ 129 | current: src, 130 | urls: [src] 131 | }) 132 | }, 133 | 134 | onShareTimeline: function (res) { 135 | if (res.from === 'button') { 136 | // 来自页面内转发按钮 137 | console.log(res.target) 138 | } 139 | return { 140 | title: this.data.catname, 141 | path: '/pages/index/index?pageId='+this.data.catname, 142 | success: function (res) { 143 | // 转发成功 144 | }, 145 | fail: function (res) { 146 | // 转发失败 147 | } 148 | } 149 | }, 150 | 151 | }) 152 | //创建audio控件 153 | const myaudio = wx.createInnerAudioContext(); 154 | 155 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/一帆/一帆.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"一帆", 5 | catitems:[ 6 | {category:"毛色", 7 | content:" 奶牛",}, 8 | {category:"性别", 9 | content:" 公",}, 10 | {category:"状况", 11 | content:" 健康",}, 12 | {category:"绝育情况", 13 | content:" 已绝育",}, 14 | {category:"绝育时间", 15 | content:" 2019年12月05号",}, 16 | {category:"性格", 17 | content:" 怕人 安全距离 1m 以内",}, 18 | {category:"第一次目击", 19 | content:" 2017冬",}, 20 | {category:"外貌", 21 | content:" 无情的警长",}, 22 | {category:"关系", 23 | content:" 杰希之子",}, 24 | 25 | ], 26 | url: app.globalData.url, 27 | relationship:[{ rela:"杰希"}, 28 | ], 29 | nums:[ 30 | ], 31 | }, 32 | //音频播放 33 | audioPlay(e) { 34 | var that = this, 35 | id = e.currentTarget.dataset.id, 36 | key = e.currentTarget.dataset.key, 37 | audioArr = that.data.audioArr; 38 | 39 | //设置状态 40 | audioArr.forEach((v, i, array) => { 41 | v.bl = false; 42 | if (i == key) { 43 | v.bl = true; 44 | } 45 | }) 46 | that.setData({ 47 | audioArr: audioArr, 48 | audKey: key, 49 | }) 50 | 51 | myaudio.autoplay = true; 52 | var audKey = that.data.audKey, 53 | vidSrc = audioArr[audKey].src; 54 | myaudio.src = vidSrc; 55 | 56 | myaudio.play(); 57 | 58 | //开始监听 59 | myaudio.onPlay(() => { 60 | console.log('开始播放'); 61 | }) 62 | 63 | //结束监听 64 | myaudio.onEnded(() => { 65 | console.log('自动播放完毕'); 66 | audioArr[key].bl = false; 67 | that.setData({ 68 | audioArr: audioArr, 69 | }) 70 | }) 71 | 72 | //错误回调 73 | myaudio.onError((err) => { 74 | console.log(err); 75 | audioArr[key].bl = false; 76 | that.setData({ 77 | audioArr: audioArr, 78 | }) 79 | return 80 | }) 81 | 82 | }, 83 | 84 | // 音频停止 85 | audioStop(e) { 86 | var that = this, 87 | key = e.currentTarget.dataset.key, 88 | audioArr = that.data.audioArr; 89 | //设置状态 90 | audioArr.forEach((v, i, array) => { 91 | v.bl = false; 92 | }) 93 | that.setData({ 94 | audioArr: audioArr 95 | }) 96 | 97 | myaudio.stop(); 98 | 99 | //停止监听 100 | myaudio.onStop(() => { 101 | console.log('停止播放'); 102 | }) 103 | }, 104 | 105 | onPullDownRefresh:function(){ 106 | wx.stopPullDownRefresh() 107 | }, 108 | 109 | onShareAppMessage: function (res) { 110 | if (res.from === 'button') { 111 | // 来自页面内转发按钮 112 | console.log(res.target) 113 | } 114 | return { 115 | title: this.data.catname, 116 | path: '/pages/index/index?pageId='+this.data.catname, 117 | success: function (res) { 118 | // 转发成功 119 | }, 120 | fail: function (res) { 121 | // 转发失败 122 | } 123 | } 124 | }, 125 | 126 | previewImage: function (e) { 127 | let that = this; 128 | let src = e.currentTarget.dataset.src; 129 | wx.previewImage({ 130 | current: src, 131 | urls: [src] 132 | }) 133 | }, 134 | 135 | onShareTimeline: function (res) { 136 | if (res.from === 'button') { 137 | // 来自页面内转发按钮 138 | console.log(res.target) 139 | } 140 | return { 141 | title: this.data.catname, 142 | path: '/pages/index/index?pageId='+this.data.catname, 143 | success: function (res) { 144 | // 转发成功 145 | }, 146 | fail: function (res) { 147 | // 转发失败 148 | } 149 | } 150 | }, 151 | 152 | }) 153 | //创建audio控件 154 | const myaudio = wx.createInnerAudioContext(); 155 | 156 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/土谦/土谦.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"土谦", 5 | catitems:[ 6 | {category:"毛色", 7 | content:" 黑狸加白",}, 8 | {category:"性别", 9 | content:" 公",}, 10 | {category:"状况", 11 | content:" 送养",}, 12 | {category:"绝育情况", 13 | content:" 已绝育",}, 14 | {category:"绝育时间", 15 | content:" 2018年11月28号",}, 16 | {category:"性格", 17 | content:" 亲人可抱",}, 18 | {category:"第一次目击", 19 | content:" 2018秋 ",}, 20 | {category:"送养时间", 21 | content:" 2019年07月",}, 22 | {category:"外貌", 23 | content:" 白多 2018年尾突然亲人",}, 24 | {category:"关系", 25 | content:" 与杰希一家关系好",}, 26 | 27 | ], 28 | url: app.globalData.url, 29 | relationship:[{ rela:"杰希"}, 30 | ], 31 | nums:[ 32 | ], 33 | }, 34 | //音频播放 35 | audioPlay(e) { 36 | var that = this, 37 | id = e.currentTarget.dataset.id, 38 | key = e.currentTarget.dataset.key, 39 | audioArr = that.data.audioArr; 40 | 41 | //设置状态 42 | audioArr.forEach((v, i, array) => { 43 | v.bl = false; 44 | if (i == key) { 45 | v.bl = true; 46 | } 47 | }) 48 | that.setData({ 49 | audioArr: audioArr, 50 | audKey: key, 51 | }) 52 | 53 | myaudio.autoplay = true; 54 | var audKey = that.data.audKey, 55 | vidSrc = audioArr[audKey].src; 56 | myaudio.src = vidSrc; 57 | 58 | myaudio.play(); 59 | 60 | //开始监听 61 | myaudio.onPlay(() => { 62 | console.log('开始播放'); 63 | }) 64 | 65 | //结束监听 66 | myaudio.onEnded(() => { 67 | console.log('自动播放完毕'); 68 | audioArr[key].bl = false; 69 | that.setData({ 70 | audioArr: audioArr, 71 | }) 72 | }) 73 | 74 | //错误回调 75 | myaudio.onError((err) => { 76 | console.log(err); 77 | audioArr[key].bl = false; 78 | that.setData({ 79 | audioArr: audioArr, 80 | }) 81 | return 82 | }) 83 | 84 | }, 85 | 86 | // 音频停止 87 | audioStop(e) { 88 | var that = this, 89 | key = e.currentTarget.dataset.key, 90 | audioArr = that.data.audioArr; 91 | //设置状态 92 | audioArr.forEach((v, i, array) => { 93 | v.bl = false; 94 | }) 95 | that.setData({ 96 | audioArr: audioArr 97 | }) 98 | 99 | myaudio.stop(); 100 | 101 | //停止监听 102 | myaudio.onStop(() => { 103 | console.log('停止播放'); 104 | }) 105 | }, 106 | 107 | onPullDownRefresh:function(){ 108 | wx.stopPullDownRefresh() 109 | }, 110 | 111 | onShareAppMessage: function (res) { 112 | if (res.from === 'button') { 113 | // 来自页面内转发按钮 114 | console.log(res.target) 115 | } 116 | return { 117 | title: this.data.catname, 118 | path: '/pages/index/index?pageId='+this.data.catname, 119 | success: function (res) { 120 | // 转发成功 121 | }, 122 | fail: function (res) { 123 | // 转发失败 124 | } 125 | } 126 | }, 127 | 128 | previewImage: function (e) { 129 | let that = this; 130 | let src = e.currentTarget.dataset.src; 131 | wx.previewImage({ 132 | current: src, 133 | urls: [src] 134 | }) 135 | }, 136 | 137 | onShareTimeline: function (res) { 138 | if (res.from === 'button') { 139 | // 来自页面内转发按钮 140 | console.log(res.target) 141 | } 142 | return { 143 | title: this.data.catname, 144 | path: '/pages/index/index?pageId='+this.data.catname, 145 | success: function (res) { 146 | // 转发成功 147 | }, 148 | fail: function (res) { 149 | // 转发失败 150 | } 151 | } 152 | }, 153 | 154 | }) 155 | //创建audio控件 156 | const myaudio = wx.createInnerAudioContext(); 157 | 158 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/杰希/杰希.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"杰希", 5 | catitems:[ 6 | {category:"昵称", 7 | content:" 大眼",}, 8 | {category:"毛色", 9 | content:" 黑狸加白",}, 10 | {category:"性别", 11 | content:" 母",}, 12 | {category:"状况", 13 | content:" 送养",}, 14 | {category:"绝育情况", 15 | content:" 已绝育",}, 16 | {category:"性格", 17 | content:" 亲人不可抱 可摸",}, 18 | {category:"第一次目击", 19 | content:" 2016冬",}, 20 | {category:"送养时间", 21 | content:" 2020年05月",}, 22 | {category:"外貌", 23 | content:" 大小眼 白多",}, 24 | {category:"关系", 25 | content:" 英杰和一帆的母亲;同居猫:果冻",}, 26 | 27 | ], 28 | url: app.globalData.url, 29 | relationship:[{ rela:"英杰"}, 30 | { rela:"一帆"}, 31 | ], 32 | nums:[ 33 | ], 34 | }, 35 | //音频播放 36 | audioPlay(e) { 37 | var that = this, 38 | id = e.currentTarget.dataset.id, 39 | key = e.currentTarget.dataset.key, 40 | audioArr = that.data.audioArr; 41 | 42 | //设置状态 43 | audioArr.forEach((v, i, array) => { 44 | v.bl = false; 45 | if (i == key) { 46 | v.bl = true; 47 | } 48 | }) 49 | that.setData({ 50 | audioArr: audioArr, 51 | audKey: key, 52 | }) 53 | 54 | myaudio.autoplay = true; 55 | var audKey = that.data.audKey, 56 | vidSrc = audioArr[audKey].src; 57 | myaudio.src = vidSrc; 58 | 59 | myaudio.play(); 60 | 61 | //开始监听 62 | myaudio.onPlay(() => { 63 | console.log('开始播放'); 64 | }) 65 | 66 | //结束监听 67 | myaudio.onEnded(() => { 68 | console.log('自动播放完毕'); 69 | audioArr[key].bl = false; 70 | that.setData({ 71 | audioArr: audioArr, 72 | }) 73 | }) 74 | 75 | //错误回调 76 | myaudio.onError((err) => { 77 | console.log(err); 78 | audioArr[key].bl = false; 79 | that.setData({ 80 | audioArr: audioArr, 81 | }) 82 | return 83 | }) 84 | 85 | }, 86 | 87 | // 音频停止 88 | audioStop(e) { 89 | var that = this, 90 | key = e.currentTarget.dataset.key, 91 | audioArr = that.data.audioArr; 92 | //设置状态 93 | audioArr.forEach((v, i, array) => { 94 | v.bl = false; 95 | }) 96 | that.setData({ 97 | audioArr: audioArr 98 | }) 99 | 100 | myaudio.stop(); 101 | 102 | //停止监听 103 | myaudio.onStop(() => { 104 | console.log('停止播放'); 105 | }) 106 | }, 107 | 108 | onPullDownRefresh:function(){ 109 | wx.stopPullDownRefresh() 110 | }, 111 | 112 | onShareAppMessage: function (res) { 113 | if (res.from === 'button') { 114 | // 来自页面内转发按钮 115 | console.log(res.target) 116 | } 117 | return { 118 | title: this.data.catname, 119 | path: '/pages/index/index?pageId='+this.data.catname, 120 | success: function (res) { 121 | // 转发成功 122 | }, 123 | fail: function (res) { 124 | // 转发失败 125 | } 126 | } 127 | }, 128 | 129 | previewImage: function (e) { 130 | let that = this; 131 | let src = e.currentTarget.dataset.src; 132 | wx.previewImage({ 133 | current: src, 134 | urls: [src] 135 | }) 136 | }, 137 | 138 | onShareTimeline: function (res) { 139 | if (res.from === 'button') { 140 | // 来自页面内转发按钮 141 | console.log(res.target) 142 | } 143 | return { 144 | title: this.data.catname, 145 | path: '/pages/index/index?pageId='+this.data.catname, 146 | success: function (res) { 147 | // 转发成功 148 | }, 149 | fail: function (res) { 150 | // 转发失败 151 | } 152 | } 153 | }, 154 | 155 | }) 156 | //创建audio控件 157 | const myaudio = wx.createInnerAudioContext(); 158 | 159 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/小黄鸭/小黄鸭.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{catname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{item.category}} 36 | 37 | {{item.content}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | \n {{item.rela}} 46 | 47 | 48 | 49 | 50 | \n 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \n 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | \n 71 | 72 | 73 | 74 | 某位小黄鸭铁粉的介绍: 75 | 76 | 77 | 78 | 79 | 80 | 小黄鸭幼年时是个野孩子。他虽然和微草一家生活在一起,但经常被当作外来的弟弟欺负,摸爬滚打中也练就了一手猫猫拳。尽管脾气凶悍,因为他天真无邪的盛世童颜(有协会流传的歪头杀美照作证),前来撸他的两脚兽络绎不绝,刚喂完食就被他送去打疫苗的也络绎不绝。 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 小黄鸭的转变在土谦突然亲人之后。可能是他胖了,在无数的美食贿赂(和两脚兽的血泪)中想通了亲人的妙处,可能是难兄难弟你亲我也亲的家族情,也可能是被盘得太多了,终于小黄鸭这个熊孩子也想开了。解锁了亲人属性又凭着(胖了也有的)美貌,小黄鸭一时成了畅蠢之后的燕南园明星猫。 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 不过,小黄鸭的送养最终因为熊孩子属性爆发而凉掉。可能鸭鸭还是喜欢在燕南园自由地翻墙、和兄弟姐妹们追逐打闹,也享受着对两脚兽的呼来喝去。你好看就听你的吧,本小黄鸭铁粉绝不认输! 105 | 106 | 107 | 108 | \n 109 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/英杰/英杰.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"英杰", 5 | catitems:[ 6 | {category:"毛色", 7 | content:" 长毛奶牛",}, 8 | {category:"性别", 9 | content:" 母",}, 10 | {category:"状况", 11 | content:" 健康",}, 12 | {category:"绝育情况", 13 | content:" 已绝育",}, 14 | {category:"性格", 15 | content:" 薛定谔亲人",}, 16 | {category:"第一次目击", 17 | content:" 2017冬",}, 18 | {category:"外貌", 19 | content:" 好看的长毛奶牛 白多 小胡子",}, 20 | {category:"更多", 21 | content:" test",}, 22 | {category:"关系", 23 | content:" 杰希之女",}, 24 | {category:"是否加视频", 25 | content:" 1",}, 26 | 27 | ], 28 | url: app.globalData.url, 29 | relationship:[{ rela:"杰希"}, 30 | ], 31 | nums:[ 32 | { num: 1 }, 33 | { num: 2 }, 34 | { num: 3 }, 35 | ], 36 | MovieNums:[ 37 | { num: 1 }, 38 | ], 39 | audioArr: [ 40 | { 41 | src: 'https://pku-lostangel.oss-cn-beijing.aliyuncs.com/%E8%8B%B1%E6%9D%B01.m4a', 42 | bl: false 43 | }, 44 | ], 45 | audKey: '', 46 | }, 47 | 48 | //音频播放 49 | audioPlay(e) { 50 | var that = this, 51 | id = e.currentTarget.dataset.id, 52 | key = e.currentTarget.dataset.key, 53 | audioArr = that.data.audioArr; 54 | 55 | //设置状态 56 | audioArr.forEach((v, i, array) => { 57 | v.bl = false; 58 | if (i == key) { 59 | v.bl = true; 60 | } 61 | }) 62 | that.setData({ 63 | audioArr: audioArr, 64 | audKey: key, 65 | }) 66 | 67 | myaudio.autoplay = true; 68 | var audKey = that.data.audKey, 69 | vidSrc = audioArr[audKey].src; 70 | myaudio.src = vidSrc; 71 | 72 | myaudio.play(); 73 | 74 | //开始监听 75 | myaudio.onPlay(() => { 76 | console.log('开始播放'); 77 | }) 78 | 79 | //结束监听 80 | myaudio.onEnded(() => { 81 | console.log('自动播放完毕'); 82 | audioArr[key].bl = false; 83 | that.setData({ 84 | audioArr: audioArr, 85 | }) 86 | }) 87 | 88 | //错误回调 89 | myaudio.onError((err) => { 90 | console.log(err); 91 | audioArr[key].bl = false; 92 | that.setData({ 93 | audioArr: audioArr, 94 | }) 95 | return 96 | }) 97 | 98 | }, 99 | 100 | // 音频停止 101 | audioStop(e) { 102 | var that = this, 103 | key = e.currentTarget.dataset.key, 104 | audioArr = that.data.audioArr; 105 | //设置状态 106 | audioArr.forEach((v, i, array) => { 107 | v.bl = false; 108 | }) 109 | that.setData({ 110 | audioArr: audioArr 111 | }) 112 | 113 | myaudio.stop(); 114 | 115 | //停止监听 116 | myaudio.onStop(() => { 117 | console.log('停止播放'); 118 | }) 119 | }, 120 | 121 | onPullDownRefresh:function(){ 122 | wx.stopPullDownRefresh() 123 | }, 124 | 125 | onShareAppMessage: function (res) { 126 | if (res.from === 'button') { 127 | // 来自页面内转发按钮 128 | console.log(res.target) 129 | } 130 | return { 131 | title: this.data.catname, 132 | path: '/pages/index/index?pageId='+this.data.catname, 133 | success: function (res) { 134 | // 转发成功 135 | }, 136 | fail: function (res) { 137 | // 转发失败 138 | } 139 | } 140 | }, 141 | 142 | previewImage: function (e) { 143 | let that = this; 144 | let src = e.currentTarget.dataset.src; 145 | wx.previewImage({ 146 | current: src, 147 | urls: [src] 148 | }) 149 | }, 150 | 151 | onShareTimeline: function (res) { 152 | if (res.from === 'button') { 153 | // 来自页面内转发按钮 154 | console.log(res.target) 155 | } 156 | return { 157 | title: this.data.catname, 158 | path: '/pages/index/index?pageId='+this.data.catname, 159 | success: function (res) { 160 | // 转发成功 161 | }, 162 | fail: function (res) { 163 | // 转发失败 164 | } 165 | } 166 | }, 167 | 168 | }) 169 | //创建audio控件 170 | const myaudio = wx.createInnerAudioContext(); 171 | 172 | -------------------------------------------------------------------------------- /miniprogram/pages/cats/小黄鸭/小黄鸭.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | Page({ 3 | data: { 4 | catname:"小黄鸭", 5 | catitems:[ 6 | {category:"毛色", 7 | content:" 橘白",}, 8 | {category:"性别", 9 | content:" 公",}, 10 | {category:"状况", 11 | content:" 健康",}, 12 | {category:"绝育情况", 13 | content:" 已绝育",}, 14 | {category:"绝育时间", 15 | content:" 2018年11月08号",}, 16 | {category:"出生时间", 17 | content:" 2018年03月",}, 18 | {category:"性格", 19 | content:" 薛定谔亲人",}, 20 | {category:"第一次目击", 21 | content:" 2018秋",}, 22 | {category:"外貌", 23 | content:" 非常可爱的橘白",}, 24 | {category:"关系", 25 | content:" 与杰希一家关系好,经常跟云雾打架(还打不赢)",}, 26 | 27 | ], 28 | url: app.globalData.url, 29 | relationship:[{ rela:"杰希"}, 30 | ], 31 | nums:[ 32 | ], 33 | audioArr: [ 34 | { 35 | src: 'https://pku-lostangel.oss-cn-beijing.aliyuncs.com/%E5%B0%8F%E9%BB%84%E9%B8%AD1.m4a', 36 | bl: false 37 | }, 38 | { 39 | src: 'https://pku-lostangel.oss-cn-beijing.aliyuncs.com/%E5%B0%8F%E9%BB%84%E9%B8%AD2.m4a', 40 | bl: false 41 | }, 42 | ], 43 | audKey: '', 44 | }, 45 | 46 | //音频播放 47 | audioPlay(e) { 48 | var that = this, 49 | id = e.currentTarget.dataset.id, 50 | key = e.currentTarget.dataset.key, 51 | audioArr = that.data.audioArr; 52 | 53 | //设置状态 54 | audioArr.forEach((v, i, array) => { 55 | v.bl = false; 56 | if (i == key) { 57 | v.bl = true; 58 | } 59 | }) 60 | that.setData({ 61 | audioArr: audioArr, 62 | audKey: key, 63 | }) 64 | 65 | myaudio.autoplay = true; 66 | var audKey = that.data.audKey, 67 | vidSrc = audioArr[audKey].src; 68 | myaudio.src = vidSrc; 69 | 70 | myaudio.play(); 71 | 72 | //开始监听 73 | myaudio.onPlay(() => { 74 | console.log('开始播放'); 75 | }) 76 | 77 | //结束监听 78 | myaudio.onEnded(() => { 79 | console.log('自动播放完毕'); 80 | audioArr[key].bl = false; 81 | that.setData({ 82 | audioArr: audioArr, 83 | }) 84 | }) 85 | 86 | //错误回调 87 | myaudio.onError((err) => { 88 | console.log(err); 89 | audioArr[key].bl = false; 90 | that.setData({ 91 | audioArr: audioArr, 92 | }) 93 | return 94 | }) 95 | 96 | }, 97 | 98 | // 音频停止 99 | audioStop(e) { 100 | var that = this, 101 | key = e.currentTarget.dataset.key, 102 | audioArr = that.data.audioArr; 103 | //设置状态 104 | audioArr.forEach((v, i, array) => { 105 | v.bl = false; 106 | }) 107 | that.setData({ 108 | audioArr: audioArr 109 | }) 110 | 111 | myaudio.stop(); 112 | 113 | //停止监听 114 | myaudio.onStop(() => { 115 | console.log('停止播放'); 116 | }) 117 | }, 118 | 119 | onPullDownRefresh:function(){ 120 | wx.stopPullDownRefresh() 121 | }, 122 | 123 | onShareAppMessage: function (res) { 124 | if (res.from === 'button') { 125 | // 来自页面内转发按钮 126 | console.log(res.target) 127 | } 128 | return { 129 | title: this.data.catname, 130 | path: '/pages/index/index?pageId='+this.data.catname, 131 | success: function (res) { 132 | // 转发成功 133 | }, 134 | fail: function (res) { 135 | // 转发失败 136 | } 137 | } 138 | }, 139 | 140 | previewImage: function (e) { 141 | let that = this; 142 | let src = e.currentTarget.dataset.src; 143 | wx.previewImage({ 144 | current: src, 145 | urls: [src] 146 | }) 147 | }, 148 | 149 | onShareTimeline: function (res) { 150 | if (res.from === 'button') { 151 | // 来自页面内转发按钮 152 | console.log(res.target) 153 | } 154 | return { 155 | title: this.data.catname, 156 | path: '/pages/index/index?pageId='+this.data.catname, 157 | success: function (res) { 158 | // 转发成功 159 | }, 160 | fail: function (res) { 161 | // 转发失败 162 | } 163 | } 164 | }, 165 | 166 | }) 167 | //创建audio控件 168 | const myaudio = wx.createInnerAudioContext(); 169 | 170 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | \n\n\n 9 | 10 | 11 | {{item}} 12 | 13 | 14 | 15 | 93 | 94 | 95 | 96 | \n 97 | 98 | 111 | 112 | 113 | 114 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /miniprogram/pages/circle.py: -------------------------------------------------------------------------------- 1 | # !/usr/bin/python 2 | # -*- coding: UTF-8 -*- 3 | import json 4 | import argparse 5 | import sys 6 | import os 7 | import time 8 | import urllib.parse 9 | import urllib 10 | import openpyxl 11 | import shutil 12 | 13 | today = time.strftime("%Y-%m-%d", time.localtime()) 14 | 15 | 16 | workbook = openpyxl.load_workbook('猫咪档案.xlsx') 17 | 18 | data = workbook.active 19 | 20 | rowNum = data.max_row # sheet行数 21 | colNum = data.max_column # sheet列数 22 | 23 | 24 | # 获取所有单元格的内容 25 | data_list = [] 26 | for i in range(12, rowNum): 27 | rowlist = [] 28 | for j in range(colNum): 29 | cell = data.cell(i+1, j+1).value 30 | if cell == None: 31 | cell = '' 32 | rowlist.append(cell) 33 | data_list.append(rowlist) 34 | 35 | # print(data_list) 36 | 37 | 38 | # 输出所有单元格的内容 39 | 40 | rowNum -= 12 41 | 42 | """ 43 | 44 | for i in range(rowNum): 45 | for j in range(colNum): 46 | print(data_list[i][j], ' ',end="") 47 | print('\n') 48 | 49 | """ 50 | 51 | # 删除 cats 文件夹 52 | try: 53 | shutil.rmtree('cats/') 54 | except OSError as e: 55 | print("no cats") 56 | 57 | labels = [ 58 | [2, '名字', lambda x:'【还没有名字】' if len(x) < 1 else x], 59 | [3, '是否写入图鉴', lambda x:x], 60 | [4, '昵称', lambda x:x], 61 | [5, '毛色', lambda x:x], 62 | # [7, '出没地点', lambda x: str(x)], 63 | [8, '性别', lambda x:'公' if x == 1 else '母' if x == 0 else '未知'], 64 | [9, '状况', lambda x:'不明' if len(x) < 1 else x], 65 | [10, '绝育情况', lambda x:'已绝育' if x == 66 | 1 else '未绝育' if x == 0 else '未知/可能不适宜绝育'], 67 | [11, '绝育时间', lambda x:str(x)], 68 | [12, '出生时间', lambda x:x], 69 | [14, '性格', lambda x: '亲人可抱' if x == 6 else '亲人不可抱 可摸' if x == 5 else '薛定谔亲人' if x == 4 else '吃东西时可以一直摸' if x == 70 | 3 else '吃东西时可以摸一下' if x == 2 else '怕人 安全距离 1m 以内' if x == 1 else '怕人 安全距离 1m 以外' if x == 0 else '未知 数据缺失'], 71 | [15, '第一次目击', lambda x: str(x)], 72 | [20, '送养时间', lambda x:str(x)], 73 | [21, '离世时间', lambda x:x], 74 | [13, '外貌', lambda x:x], 75 | [18, '更多', lambda x:x], 76 | [17, '关系', lambda x: str(x)], 77 | [23, '是否加音频', lambda x:x], 78 | [24, '是否加视频', lambda x:x] 79 | ] 80 | 81 | data_json = [] 82 | 83 | for i in range(rowNum): 84 | json_line = {} 85 | 86 | if len(data_list[i][5]) < 1: # 毛色都不知道那就是没有【x 87 | continue 88 | 89 | for j in labels: 90 | json_line[j[1]] = j[2](data_list[i][j[0]]) 91 | 92 | data_json.append(json_line) 93 | # print(json_line) 94 | 95 | # 创建猫文件夹 96 | if not os.path.exists('cats'): 97 | os.makedirs('cats') 98 | 99 | # 用于搜索关系链接 100 | names = [] 101 | for line in data_json: 102 | if line['是否写入图鉴'] != '': 103 | names.append(line['名字']) 104 | # print(names) 105 | 106 | with open('../app.json', 'w', encoding='utf-8') as f: 107 | f.write('{\n "pages": [ \n "pages/index/index",\n') # 创建 app.json 文件 108 | 109 | 110 | for line in data_json: 111 | if line['是否写入图鉴'] != '': 112 | if not os.path.exists('cats/' + line['名字']): 113 | os.makedirs('cats/' + line['名字']) # 创建每只猫的文件夹 114 | # 创建js文件 115 | with open('cats/' + line['名字'] + '/' + line['名字'] + '.js', 'w', encoding='utf-8') as f: 116 | f.write('var app = getApp()\n Page({ \n data: {\n' 'catname:"' + 117 | line['名字'] + '",\n catitems:[ \n') 118 | for j in labels: 119 | # 打印名字 120 | if j[1] == '名字': 121 | print(str(line[j[1]])) 122 | continue 123 | if j[0] == 23: 124 | continue 125 | if str(line[j[1]]) == '' or j[1] == '是否写入图鉴': 126 | continue 127 | # print(j[1] + " " + str(line[j[1]])) 128 | f.write( 129 | '{category:"' + j[1] + '",\n content:" ' + str(line[j[1]]) + '",},\n') 130 | f.write('\n], \nurl: app.globalData.url,\n') 131 | # 增加关系跳转项 132 | f.write('relationship:[') 133 | for i in names: 134 | if i in line['关系'] and i != line['名字']: 135 | f.write('{ rela:"' + i + '"},\n') 136 | f.write('], \n') 137 | # 后面的图片数 138 | f.write('nums:[\n') 139 | for i in range(int(line['是否写入图鉴'])): 140 | f.write('{ ' + 'num: {} '.format(i+1) + '},\n') 141 | f.write('],\n') 142 | # 后面的视频数 143 | if line['是否加视频']: 144 | f.write('MovieNums:[\n') 145 | for i in range(int(line['是否加视频'])): 146 | f.write('{ ' + 'num: {} '.format(i+1) + '},\n') 147 | f.write('],\n') 148 | # 音频数 149 | if line['是否加音频']: 150 | audio = '//pku-lostangel.oss-cn-beijing.aliyuncs.com/' + \ 151 | line['名字'] 152 | audio = urllib.parse.quote(audio) 153 | f.write('audioArr: [\n') 154 | for i in range(line['是否加音频']): 155 | f.write('{\n ' + "src: 'https:" + audio + 156 | "{}.m4a'".format(i+1) + ',\nbl: false\n},\n') 157 | f.write("],\n audKey: '', \n},\n") 158 | else: 159 | f.write('},') 160 | with open('js.txt', 'r', encoding='utf-8') as f2: 161 | f.write(f2.read()) 162 | 163 | # 补充另外两个文件 164 | with open('cats/' + line['名字'] + '/' + line['名字'] + '.json', 'w', encoding='utf-8') as f: 165 | with open('json.txt', 'r', encoding='utf-8') as f2: 166 | f.write(f2.read()) 167 | with open('cats/' + line['名字'] + '/' + line['名字'] + '.wxml', 'w', encoding='utf-8') as f: 168 | with open('wxml.txt', 'r', encoding='utf-8') as f2: 169 | f.write(f2.read()) 170 | if line['名字'] == '小黄鸭': 171 | with open('文案/小黄鸭.txt', 'r', encoding='utf-8') as f2: 172 | f.write(f2.read()) 173 | 174 | # 补充 app.json 175 | with open('../app.json', 'a', encoding='utf-8') as f: # 补充 app.json 文件 176 | f.write(' "pages/cats/' + 177 | line['名字'] + '/' + line['名字'] + '",\n') 178 | 179 | 180 | # 填写 app.json 文件 181 | with open('../app.json', 'a', encoding='utf-8') as f: # 补充 app.json 文件 182 | with open('appjson.txt', 'r', encoding='utf-8') as f2: 183 | f.write(f2.read()) 184 | 185 | 186 | # 几个分页的index内容(显示哪些猫) 187 | health = [] 188 | fostered = [] 189 | dead = [] 190 | unknown = [] 191 | nainiu = [] 192 | sanhua = [] 193 | chunse = [] 194 | lihua = [] 195 | ju = [] 196 | suoyou = [] 197 | 198 | 199 | # 分类 200 | for i in range(rowNum): 201 | if data_list[i][3] != '': 202 | if data_list[i][9] == '离世': 203 | dead.append((data_list[i][2], data_list[i][21])) 204 | if data_list[i][9] == '送养': 205 | fostered.append((data_list[i][2], data_list[i][20])) 206 | if (data_list[i][9] == '不明' or data_list[i][9] == '许久未见' or data_list[i][9] == '失踪'): 207 | unknown.append(data_list[i][2]) 208 | if (data_list[i][9] == '健康' or data_list[i][9] == '口炎'): 209 | if data_list[i][6] == 1: 210 | lihua.append(data_list[i][2]) 211 | if data_list[i][6] == 2: 212 | ju.append(data_list[i][2]) 213 | if data_list[i][6] == 3: 214 | nainiu.append(data_list[i][2]) 215 | if data_list[i][6] == 4: 216 | sanhua.append(data_list[i][2]) 217 | if data_list[i][6] == 5: 218 | chunse.append(data_list[i][2]) 219 | 220 | health = lihua + ju + nainiu + sanhua + chunse 221 | suoyou = health 222 | 223 | # 调整寄养的时间顺序 224 | try: 225 | fostered = sorted(fostered, key=lambda student: student[1], reverse=True) 226 | except: 227 | print("请严格按照格式填写送养时间:2000年01月01日") 228 | 229 | # 调整离世的时间顺序 230 | try: 231 | dead = sorted(dead, key=lambda student: student[1], reverse=True) 232 | except: 233 | print("请严格按照格式填写离世时间:2000年01月01日") 234 | 235 | # 创建毛色分类的js文件 236 | # 奶牛 237 | if not os.path.exists('index/奶牛'): 238 | os.makedirs('index/' + '奶牛') # 创建每只猫的文件夹 239 | # 创建js文件 240 | with open('index/奶牛/奶牛' + '.js', 'w', encoding='utf-8') as f: 241 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 242 | for name in nainiu: 243 | f.write('{ name:"'+name+'"},') 244 | with open('js2.txt', 'r', encoding='utf-8') as f2: 245 | f.write(f2.read()) 246 | 247 | # 狸花 248 | if not os.path.exists('index/狸花'): 249 | os.makedirs('index/' + '狸花') # 创建每只猫的文件夹 250 | # 创建js文件 251 | with open('index/狸花/狸花' + '.js', 'w', encoding='utf-8') as f: 252 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 253 | for name in lihua: 254 | f.write('{ name:"'+name+'"},') 255 | with open('js2.txt', 'r', encoding='utf-8') as f2: 256 | f.write(f2.read()) 257 | 258 | # 玳瑁及三花 259 | if not os.path.exists('index/玳瑁及三花'): 260 | os.makedirs('index/' + '玳瑁及三花') # 创建每只猫的文件夹 261 | # 创建js文件 262 | with open('index/玳瑁及三花/玳瑁及三花' + '.js', 'w', encoding='utf-8') as f: 263 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 264 | for name in sanhua: 265 | f.write('{ name:"'+name+'"},') 266 | with open('js2.txt', 'r', encoding='utf-8') as f2: 267 | f.write(f2.read()) 268 | 269 | # 纯色 270 | if not os.path.exists('index/纯色'): 271 | os.makedirs('index/' + '纯色') # 创建每只猫的文件夹 272 | # 创建js文件 273 | with open('index/纯色/纯色' + '.js', 'w', encoding='utf-8') as f: 274 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 275 | for name in chunse: 276 | f.write('{ name:"'+name+'"},') 277 | with open('js2.txt', 'r', encoding='utf-8') as f2: 278 | f.write(f2.read()) 279 | 280 | # 橘猫及橘白 281 | if not os.path.exists('index/橘猫及橘白'): 282 | os.makedirs('index/' + '橘猫及橘白') # 创建每只猫的文件夹 283 | # 创建js文件 284 | with open('index/橘猫及橘白/橘猫及橘白' + '.js', 'w', encoding='utf-8') as f: 285 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 286 | for name in ju: 287 | f.write('{ name:"'+name+'"},') 288 | with open('js2.txt', 'r', encoding='utf-8') as f2: 289 | f.write(f2.read()) 290 | 291 | # 所有 292 | if not os.path.exists('index/所有'): 293 | os.makedirs('index/' + '所有') # 创建每只猫的文件夹 294 | # 创建js文件 295 | with open('index/所有/所有' + '.js', 'w', encoding='utf-8') as f: 296 | f.write('var app = getApp()\n Page({\ndata: { \n catlist: [\n') 297 | for name in suoyou: 298 | f.write('{ name:"'+name+'"},') 299 | with open('js2.txt', 'r', encoding='utf-8') as f2: 300 | f.write(f2.read()) 301 | 302 | # 创建状态分类的js文件 303 | with open('index/index' + '.js', 'w', encoding='utf-8') as f: 304 | f.write('var app = getApp()\n Page({\ndata: { \n') 305 | # fostered 306 | f.write(' fostered_catlist: [\n') 307 | for name in fostered: 308 | f.write('{ name:"'+name[0]+'"},\n') 309 | f.write('],\n') 310 | # unknown 311 | f.write(' unknown_catlist: [\n') 312 | for name in unknown: 313 | f.write('{ name:"'+name+'"},\n') 314 | f.write('],\n') 315 | # dead 316 | f.write(' dead_catlist: [\n') 317 | for name in dead: 318 | f.write('{ name:"'+name[0]+'"},\n') 319 | f.write('],\n') 320 | with open('js_index.txt', 'r', encoding='utf-8') as f2: 321 | f.write(f2.read()) 322 | 323 | 324 | # print(fostered) 325 | --------------------------------------------------------------------------------