├── README.md
├── cloudfunctions
├── login
│ ├── index.js
│ └── package.json
└── openapi
│ ├── config.json
│ ├── index.js
│ └── package.json
├── miniprogram
├── app.js
├── app.json
├── app.wxss
├── images
│ ├── 微信截图_20190704151136.png
│ ├── 微信截图_20190704151154.png
│ └── 微信截图_20190704151240.png
├── pages
│ ├── index
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ └── user-unlogin.png
│ └── print
│ │ └── word
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── list.js
│ │ ├── list.json
│ │ ├── list.wxml
│ │ ├── list.wxss
│ │ ├── select.js
│ │ ├── select.json
│ │ ├── select.wxml
│ │ └── select.wxss
└── sitemap.json
└── project.config.json
/README.md:
--------------------------------------------------------------------------------
1 | # consoleApp
2 | 校园云打印
3 |
4 | ### screen1
5 | 
6 |
7 | ### screen2
8 | 
9 |
10 | ### screen3
11 | 
12 |
--------------------------------------------------------------------------------
/cloudfunctions/login/index.js:
--------------------------------------------------------------------------------
1 | // 云函数模板
2 | // 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”
3 |
4 | const cloud = require('wx-server-sdk')
5 |
6 | // 初始化 cloud
7 | cloud.init()
8 |
9 | /**
10 | * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
11 | *
12 | * event 参数包含小程序端调用传入的 data
13 | *
14 | */
15 | exports.main = (event, context) => {
16 | console.log(event)
17 | console.log(context)
18 |
19 | // 可执行其他自定义逻辑
20 | // console.log 的内容可以在云开发云函数调用日志查看
21 |
22 | // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)
23 | const wxContext = cloud.getWXContext()
24 |
25 | return {
26 | event,
27 | openid: wxContext.OPENID,
28 | appid: wxContext.APPID,
29 | unionid: wxContext.UNIONID,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/cloudfunctions/login/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "login",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "wx-server-sdk": "latest"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/cloudfunctions/openapi/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "permissions": {
3 | "openapi": [
4 | "wxacode.get",
5 | "templateMessage.send",
6 | "templateMessage.addTemplate",
7 | "templateMessage.deleteTemplate",
8 | "templateMessage.getTemplateList",
9 | "templateMessage.getTemplateLibraryById",
10 | "templateMessage.getTemplateLibraryList"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/cloudfunctions/openapi/index.js:
--------------------------------------------------------------------------------
1 | // 云函数入口文件
2 | const cloud = require('wx-server-sdk')
3 |
4 | cloud.init()
5 |
6 | // 云函数入口函数
7 | exports.main = async (event, context) => {
8 | switch (event.action) {
9 | case 'sendTemplateMessage': {
10 | return sendTemplateMessage(event)
11 | }
12 | case 'getWXACode': {
13 | return getWXACode(event)
14 | }
15 | default: {
16 | return
17 | }
18 | }
19 | }
20 |
21 | async function sendTemplateMessage(event) {
22 | const { OPENID } = cloud.getWXContext()
23 |
24 | // 接下来将新增模板、发送模板消息、然后删除模板
25 | // 注意:新增模板然后再删除并不是建议的做法,此处只是为了演示,模板 ID 应在添加后保存起来后续使用
26 | const addResult = await cloud.openapi.templateMessage.addTemplate({
27 | id: 'AT0002',
28 | keywordIdList: [3, 4, 5]
29 | })
30 |
31 | const templateId = addResult.templateId
32 |
33 | const sendResult = await cloud.openapi.templateMessage.send({
34 | touser: OPENID,
35 | templateId,
36 | formId: event.formId,
37 | page: 'pages/openapi/openapi',
38 | data: {
39 | keyword1: {
40 | value: '未名咖啡屋',
41 | },
42 | keyword2: {
43 | value: '2019 年 1 月 1 日',
44 | },
45 | keyword3: {
46 | value: '拿铁',
47 | },
48 | }
49 | })
50 |
51 | await cloud.openapi.templateMessage.deleteTemplate({
52 | templateId,
53 | })
54 |
55 | return sendResult
56 | }
57 |
58 | async function getWXACode(event) {
59 |
60 | // 此处将获取永久有效的小程序码,并将其保存在云文件存储中,最后返回云文件 ID 给前端使用
61 |
62 | const wxacodeResult = await cloud.openapi.wxacode.get({
63 | path: 'pages/openapi/openapi',
64 | })
65 |
66 | const fileExtensionMatches = wxacodeResult.contentType.match(/\/([^\/]+)/)
67 | const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
68 |
69 | const uploadResult = await cloud.uploadFile({
70 | // 云文件路径,此处为演示采用一个固定名称
71 | cloudPath: `wxacode_default_openapi_page.${fileExtension}`,
72 | // 要上传的文件内容可直接传入图片 Buffer
73 | fileContent: wxacodeResult.buffer,
74 | })
75 |
76 | if (!uploadResult.fileID) {
77 | throw new Error(`upload failed with empty fileID and storage server status code ${uploadResult.statusCode}`)
78 | }
79 |
80 | return uploadResult.fileID
81 | }
82 |
--------------------------------------------------------------------------------
/cloudfunctions/openapi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "openapi",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "wx-server-sdk": "latest"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/miniprogram/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 |
5 | if (!wx.cloud) {
6 | console.error('请使用 2.2.3 或以上的基础库以使用云能力')
7 | } else {
8 | wx.cloud.init({
9 | traceUser: true,
10 | })
11 | }
12 |
13 | this.globalData = {}
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/miniprogram/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/print/word/index",
5 | "pages/print/word/select",
6 | "pages/print/word/list"
7 | ],
8 | "window": {
9 | "backgroundColor": "#fcfcfc",
10 | "backgroundTextStyle": "light",
11 | "navigationBarBackgroundColor": "#fff",
12 | "navigationBarTitleText": "校园打印助手",
13 | "navigationBarTextStyle": "black"
14 | },
15 | "sitemapLocation": "sitemap.json"
16 | }
--------------------------------------------------------------------------------
/miniprogram/app.wxss:
--------------------------------------------------------------------------------
1 | .top-img {
2 | display: flex;
3 | justify-content: center;
4 | margin-top: 16rpx;
5 | margin-bottom: 20rpx;
6 | }
7 |
8 | .img-one {
9 | width: 96%;
10 | border-radius: 10rpx;
11 | }
12 |
13 | .operator {
14 | padding: 60rpx;
15 | background: #fff;
16 | margin: 20rpx;
17 | border-radius: 10rpx;
18 | }
19 |
20 | .main-text {
21 | font-size: 36rpx;
22 | }
23 |
24 | .little-text {
25 | margin-top: 10rpx;
26 | font-size: 24rpx;
27 | color: #909399;
28 | }
29 |
--------------------------------------------------------------------------------
/miniprogram/images/微信截图_20190704151136.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaey/consoleApp/f562ac2f56e1391195391d54161c325bbb3c7901/miniprogram/images/微信截图_20190704151136.png
--------------------------------------------------------------------------------
/miniprogram/images/微信截图_20190704151154.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaey/consoleApp/f562ac2f56e1391195391d54161c325bbb3c7901/miniprogram/images/微信截图_20190704151154.png
--------------------------------------------------------------------------------
/miniprogram/images/微信截图_20190704151240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaey/consoleApp/f562ac2f56e1391195391d54161c325bbb3c7901/miniprogram/images/微信截图_20190704151240.png
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | const app = getApp()
3 |
4 | Page({
5 | data: {
6 |
7 | },
8 | navigPrint() {
9 | wx.navigateTo({
10 | url: "/pages/print/word/index",
11 | })
12 | },
13 |
14 | onLoad: function() {
15 |
16 | // 获取用户信息
17 | wx.getSetting({
18 | success: res => {
19 | if (res.authSetting['scope.userInfo']) {
20 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
21 | wx.getUserInfo({
22 | success: res => {
23 | this.setData({
24 | avatarUrl: res.userInfo.avatarUrl,
25 | userInfo: res.userInfo
26 | })
27 | }
28 | })
29 | }
30 | }
31 | })
32 | },
33 |
34 | onGetUserInfo: function(e) {
35 | if (!this.logged && e.detail.userInfo) {
36 | this.setData({
37 | logged: true,
38 | avatarUrl: e.detail.userInfo.avatarUrl,
39 | userInfo: e.detail.userInfo
40 | })
41 | }
42 | },
43 |
44 |
45 | })
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 照片打印
7 | 文档打印
8 |
9 |
10 | 我的订单
11 | 联系客服
12 | 打印点
13 | 关于我们
14 |
15 |
--------------------------------------------------------------------------------
/miniprogram/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
3 | }
4 |
5 | .top-img {
6 | display: flex;
7 | justify-content: center;
8 | margin-top: 16rpx;
9 | margin-bottom: 20rpx;
10 | }
11 |
12 | .img-one {
13 | width: 96%;
14 | border-radius: 10rpx;
15 | }
16 |
17 | .option {
18 | display: flex;
19 | flex-direction: row;
20 | justify-content: space-around;
21 | margin-top: 50rpx;
22 | }
23 |
24 | .btn-print {
25 | padding: 40rpx;
26 | background-color: #fff;
27 | border-radius: 10rpx;
28 | -moz-box-shadow: 4rpx 20rpx 18rpx #999;
29 | -webkit-box-shadow: 4rpx 10rpx 28rpx #999;
30 | box-shadow: 25rpx 20rpx 20rpx #999;
31 | }
32 |
33 | .btns {
34 | display: flex;
35 | flex-direction: column;
36 | margin: 20rpx;
37 | font-size: 28rpx;
38 | margin-top: 60rpx;
39 | }
40 |
41 | .btn {
42 | padding: 25rpx;
43 | background-color: #fff;
44 | margin-bottom: 40rpx;
45 | border-radius: 10rpx;
46 | -moz-box-shadow: 4rpx 20rpx 18rpx #999;
47 | -webkit-box-shadow: 4rpx 10rpx 28rpx #999;
48 | box-shadow: 25rpx 20rpx 20rpx #999;
49 | }
50 |
--------------------------------------------------------------------------------
/miniprogram/pages/index/user-unlogin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaey/consoleApp/f562ac2f56e1391195391d54161c325bbb3c7901/miniprogram/pages/index/user-unlogin.png
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 | data: {
4 |
5 | },
6 |
7 | navigator() {
8 | wx.navigateTo({
9 | url: 'select',
10 | })
11 | },
12 | onLoad: function(options) {
13 |
14 | },
15 |
16 |
17 | })
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "文档打印"
4 | }
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 选择微信文档打印
9 | 从微信聊天记录中选择文档打印,支持的文件格式有:Word、PPT、PDF、Excel
10 |
11 |
12 |
13 | 选择本地文档打印
14 | 手机本地文档一键打印
15 |
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
3 | }
4 |
5 | .operator {
6 | padding: 60rpx;
7 | background: #fff;
8 | margin: 20rpx;
9 | border-radius: 10rpx;
10 | }
11 |
12 | .main-text {
13 | font-size: 36rpx;
14 | }
15 |
16 | .little-text {
17 | margin-top: 10rpx;
18 | font-size: 24rpx;
19 | color: #909399;
20 | }
21 |
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/list.js:
--------------------------------------------------------------------------------
1 | // pages/print/word/list.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | uploadList: [{
9 | name: "1 - 副本 (2) - 副本.png",
10 | path: "http://tmp/wx0c160132b72ae839.o6zAJs9gSLEmu6OWAwsYlv8AwGa4.SyGLiNYMXUkD8e98e694afeed2b2e0180dabf79fba12.png",
11 | num: 1,
12 | double: "单面",
13 | ramark: undefined,
14 |
15 | }, {
16 | name: "1 - 副本 (2) - 副本.png",
17 | path: "http://tmp/wx0c160132b72ae839.o6zAJs9gSLEmu6OWAwsYlv8AwGa4.SyGLiNYMXUkD8e98e694afeed2b2e0180dabf79fba12.png",
18 | num: 1,
19 | double: "单面",
20 | ramark: undefined,
21 | }, {
22 | name: "1 - 副本 (2) - 副本.png",
23 | path: "http://tmp/wx0c160132b72ae839.o6zAJs9gSLEmu6OWAwsYlv8AwGa4.SyGLiNYMXUkD8e98e694afeed2b2e0180dabf79fba12.png",
24 | num: 1,
25 | double: "单面",
26 | ramark: undefined,
27 | }],
28 |
29 | items: [{
30 | name: '单面',
31 | value: '单面',
32 | checked: 'true'
33 | },
34 | {
35 | name: '双面',
36 | value: '双面',
37 | },
38 | ],
39 | array: ['1-333', '2-333', '3-333', '4-333', '5-333', '6-333'],
40 | index: 0,
41 | },
42 |
43 | bindPickerChange(e) {
44 | console.log('picker发送选择改变,携带值为', e.detail.value)
45 | this.setData({
46 | index: e.detail.value
47 | })
48 | },
49 |
50 | toSelect() {
51 | var that = this
52 | wx.chooseMessageFile({
53 | count: 100,
54 | type: 'file',
55 | success(res) {
56 | console.log(res)
57 |
58 | // tempFilePath可以作为img标签的src属性显示图片
59 | const tempFiles = res.tempFiles
60 | for (var i = 0; i < tempFiles.length; i++) {
61 | tempFiles[i].num = 1
62 | tempFiles[i].double = "单面"
63 | tempFiles[i].ramark = undefined
64 | }
65 |
66 | var data = that.data.uploadList.concat(res.tempFiles)
67 | that.setData({
68 | uploadList: data
69 | })
70 | }
71 | })
72 | },
73 |
74 | radioChange(e) {
75 | console.log(e)
76 | this.data.uploadList[e.currentTarget.dataset.index].double = e.detail.value
77 | this.setData({
78 | uploadList: this.data.uploadList
79 | })
80 | },
81 |
82 | changeRemark(e) {
83 | // console.log(e)
84 | // console.log(e.detail.value)
85 | this.data.uploadList[e.currentTarget.dataset.index].ramark = e.detail.value
86 |
87 | // this.setData({
88 | // uploadList: this.data.uploadList
89 | // })
90 | },
91 | toDelete(e) {
92 | this.data.uploadList.splice(e.currentTarget.dataset.index, 1)
93 | this.setData({
94 | uploadList: this.data.uploadList
95 | })
96 | wx.showToast({
97 | title: '删除成功',
98 | icon: 'none'
99 | })
100 | },
101 |
102 | changeNum(e) {
103 | console.log(e)
104 | if (e.detail.value <= 0) {
105 | wx.showToast({
106 | title: '份数错误,请检查',
107 | })
108 | } else {
109 | this.data.uploadList[e.currentTarget.dataset.index].num = e.detail.value
110 | this.setData({
111 | uploadList: this.data.uploadList
112 | })
113 | }
114 | },
115 |
116 | previewFile(e) {
117 | console.log(e)
118 | var filePath = this.data.uploadList[e.currentTarget.dataset.index].path
119 | wx.openDocument({
120 | filePath,
121 | success(res) {
122 | console.log('打开文档成功')
123 | },
124 | fail(e) {
125 | console.log(e)
126 | }
127 | })
128 | },
129 |
130 | submit() {
131 | wx.showNavigationBarLoading()
132 | wx.showLoading({
133 | title: '上传文件中',
134 | })
135 | var that = this
136 | var data = that.data.uploadList
137 |
138 | for (var i = 0; i < data.length; i++) {
139 | var time = Date.parse(new Date()) / 1000; //时间戳
140 | const cloudPath = 'zhku/我的打印机/' + time + data[i].name
141 | var count = 0
142 | wx.cloud.uploadFile({
143 | cloudPath,
144 | filePath: data[i].path, // 文件路径
145 | }).then(res => {
146 | count = count + 1
147 | // get resource ID
148 | console.log(res.fileID)
149 | if (count === data.length) {
150 | wx.hideLoading()
151 | wx.hideNavigationBarLoading()
152 |
153 | }
154 | }).catch(error => {
155 | wx.showToast({
156 | title: data[i].name + "上传失败",
157 | icon: 'none'
158 | })
159 | })
160 | }
161 |
162 |
163 |
164 | },
165 |
166 | onLoad: function(options) {
167 | // var filePaths = JSON.parse(options.filePath)
168 | // console.log(filePaths)
169 | },
170 |
171 |
172 | })
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/list.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "文档列表"
4 | }
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/list.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{item.name}}
6 | 预览
7 |
8 |
9 | 打印份数
10 |
11 |
12 |
13 |
14 |
15 |
16 | 双面打印
17 |
18 |
21 |
22 |
23 |
29 |
30 | 删除
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 继续选择
39 | 确认
40 |
41 |
42 |
43 |
44 | 打印地点
45 |
46 | {{array[index]}}
47 |
48 |
49 |
50 |
51 | 继续选择
52 | 确认
53 |
54 |
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/list.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
3 | }
4 |
5 | .outer {
6 | margin-bottom: 100rpx;
7 | }
8 |
9 | .row {
10 | display: flex;
11 | flex-direction: row;
12 | }
13 |
14 | .btn-dd {
15 | position: relative;
16 | }
17 |
18 | .btn-pre {
19 | display: flex;
20 | position: absolute;
21 | right: 50rpx;
22 | font-size: 24rpx;
23 | padding: 10rpx;
24 | background-color: #84fab0;
25 | }
26 |
27 | .btn-0 {
28 | display: flex;
29 | position: fixed;
30 | bottom: 0;
31 | color: #c6ab70;
32 | width: 50%;
33 | padding: 18rpx 0;
34 | justify-content: center;
35 | background-color: #f3eee1;
36 | z-index: 99;
37 | }
38 |
39 | .btn-1 {
40 | display: flex;
41 | padding: 18rpx 0;
42 | position: fixed;
43 | bottom: 0;
44 | left: 50%;
45 | width: 50%;
46 | justify-content: center;
47 | background-color: #c6ab70;
48 | color: #fff;
49 | z-index: 99;
50 | }
51 |
52 | .s-operator {
53 | padding: 40rpx;
54 | background: #fff;
55 | margin: 20rpx;
56 | padding-bottom: 90rpx;
57 | }
58 |
59 | .s-main-text {
60 | font-size: 28rpx;
61 | margin-bottom: 20rpx;
62 | }
63 |
64 | .s-row {
65 | display: flex;
66 | flex-direction: row;
67 | margin-top: 20rpx;
68 | }
69 |
70 | .s-text {
71 | display: flex;
72 | width: 80%;
73 | font-size: 28rpx;
74 | }
75 |
76 | .s-num {
77 | display: flex;
78 | justify-content: center;
79 | flex: 1;
80 | background-color: #f2f2f2;
81 | }
82 |
83 | .radio-group {
84 | display: flex;
85 | flex-direction: row;
86 | }
87 |
88 | .radio-text {
89 | display: flex;
90 | font-size: 28rpx;
91 | width: 63%;
92 | }
93 |
94 | .radio {
95 | display: flex;
96 | justify-content: center;
97 | align-items: center;
98 | flex-direction: row;
99 | font-size: 28rpx;
100 | }
101 |
102 | .b-remark {
103 | background-color: #f2f2f2;
104 | padding: 10rpx;
105 | }
106 |
107 | .b-text {
108 | font-size: 28rpx;
109 | margin-top: 20rpx;
110 | margin-bottom: 20rpx;
111 | }
112 |
113 | .s-remark {
114 | margin-bottom: 20rpx;
115 | }
116 |
117 | .remark {
118 | font-size: 22rpx;
119 | }
120 |
121 | .btn-de {
122 | display: flex;
123 | padding: 12rpx;
124 | width: 120rpx;
125 | background-color: #8fd3f4;
126 | font-size: 28rpx;
127 | color: #fff;
128 | justify-content: center;
129 | position: absolute;
130 | right: 0rpx;
131 | }
132 |
133 | /*弹出层*/
134 |
135 | .pop {
136 | position: fixed;
137 | bottom: 0;
138 | z-index: 999;
139 | background-color: #fff;
140 | width: 100%;
141 | height: 600rpx;
142 | }
143 |
144 | .pop-text {
145 | display: flex;
146 | font-size: 28rpx;
147 | width: 73%;
148 | }
149 |
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/select.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 |
4 | data: {
5 |
6 | },
7 | selectFile() {
8 |
9 | wx.chooseMessageFile({
10 | count: 100,
11 | type: 'file',
12 | success(res) {
13 | console.log(res)
14 | // tempFilePath可以作为img标签的src属性显示图片
15 | const tempFiles = res.tempFiles
16 | wx.navigateTo({
17 | url: 'list?filePath=' + JSON.stringify(res.tempFiles)
18 | })
19 | }
20 | })
21 | },
22 |
23 | onLoad: function(options) {
24 |
25 | },
26 |
27 | })
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/select.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/select.wxml:
--------------------------------------------------------------------------------
1 |
2 | 黑白模式
3 | 将文档以黑白色彩模式打印
4 |
5 |
6 | 全彩模式
7 | 将文档以全彩模式打印
8 |
9 |
10 |
11 | 如何选择打印文件?
12 |
13 | 1.选择想要打印文件的聊天纪录
14 |
15 |
16 | 2.勾选想要打印的文件即可打印啦
17 |
18 |
--------------------------------------------------------------------------------
/miniprogram/pages/print/word/select.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
3 | }
4 |
5 | .step {
6 | padding: 30rpx;
7 | background: #fff;
8 | margin: 20rpx;
9 | border-radius: 10rpx;
10 | margin-top: 100rpx;
11 | }
12 |
13 | .title {
14 | display: flex;
15 | justify-content: center;
16 | margin-bottom: 10rpx;
17 | }
18 |
19 | .tip {
20 | font-size: 28rpx;
21 | margin-top: 16rpx;
22 | color: #909399;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "miniprogramRoot": "miniprogram/",
3 | "cloudfunctionRoot": "cloudfunctions/",
4 | "setting": {
5 | "urlCheck": true,
6 | "es6": true,
7 | "postcss": true,
8 | "minified": true,
9 | "newFeature": true
10 | },
11 | "appid": "wx0c160132b72ae839",
12 | "projectname": "consoleApp",
13 | "libVersion": "2.5.0",
14 | "simulatorType": "wechat",
15 | "simulatorPluginLibVersion": {},
16 | "condition": {
17 | "search": {
18 | "current": -1,
19 | "list": []
20 | },
21 | "conversation": {
22 | "current": -1,
23 | "list": []
24 | },
25 | "plugin": {
26 | "current": -1,
27 | "list": []
28 | },
29 | "game": {
30 | "list": []
31 | },
32 | "miniprogram": {
33 | "current": 2,
34 | "list": [
35 | {
36 | "id": -1,
37 | "name": "打印下单",
38 | "pathName": "pages/print/word/index",
39 | "query": "",
40 | "scene": null
41 | },
42 | {
43 | "id": -1,
44 | "name": "打印选择",
45 | "pathName": "pages/print/word/select",
46 | "query": "",
47 | "scene": null
48 | },
49 | {
50 | "id": -1,
51 | "name": "打印下单",
52 | "pathName": "pages/print/word/list",
53 | "query": "",
54 | "scene": null
55 | }
56 | ]
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------