Skip to content

Commit 056c2d6

Browse files
第一次提交
0 parents  commit 056c2d6

File tree

443 files changed

+56111
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+56111
-0
lines changed

.hbuilderx/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
2+
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
3+
"version": "0.0",
4+
"configurations": [{
5+
"type": "uniCloud",
6+
"default": {
7+
"launchtype": "local"
8+
}
9+
}
10+
]
11+
}

App.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
<script>
3+
export default {
4+
onLaunch: function() {
5+
console.log('App Launch')
6+
},
7+
onShow: function() {
8+
console.log('App Show')
9+
},
10+
onHide: function() {
11+
console.log('App Hide')
12+
}
13+
}
14+
</script>
15+
16+
<style>
17+
/*每个页面公共css */
18+
</style>

js_sdk/mmmm-image-tools/index.js

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
function getLocalFilePath(path) {
2+
if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
3+
return path
4+
}
5+
if (path.indexOf('file://') === 0) {
6+
return path
7+
}
8+
if (path.indexOf('/storage/emulated/0/') === 0) {
9+
return path
10+
}
11+
if (path.indexOf('/') === 0) {
12+
var localFilePath = plus.io.convertAbsoluteFileSystem(path)
13+
if (localFilePath !== path) {
14+
return localFilePath
15+
} else {
16+
path = path.substr(1)
17+
}
18+
}
19+
return '_www/' + path
20+
}
21+
22+
var index = 0
23+
function getNewFileId() {
24+
return Date.now() + String(index++)
25+
}
26+
27+
function biggerThan(v1, v2) {
28+
var v1Array = v1.split('.')
29+
var v2Array = v2.split('.')
30+
var update = false
31+
for (var index = 0; index < v2Array.length; index++) {
32+
var diff = v1Array[index] - v2Array[index]
33+
if (diff !== 0) {
34+
update = diff > 0
35+
break
36+
}
37+
}
38+
return update
39+
}
40+
41+
export function pathToBase64(path) {
42+
return new Promise(function(resolve, reject) {
43+
if (typeof window === 'object' && 'document' in window) {
44+
if (typeof FileReader === 'function') {
45+
var xhr = new XMLHttpRequest()
46+
xhr.open('GET', path, true)
47+
xhr.responseType = 'blob'
48+
xhr.onload = function() {
49+
if (this.status === 200) {
50+
let fileReader = new FileReader()
51+
fileReader.onload = function(e) {
52+
resolve(e.target.result)
53+
}
54+
fileReader.onerror = reject
55+
fileReader.readAsDataURL(this.response)
56+
}
57+
}
58+
xhr.onerror = reject
59+
xhr.send()
60+
return
61+
}
62+
var canvas = document.createElement('canvas')
63+
var c2x = canvas.getContext('2d')
64+
var img = new Image
65+
img.onload = function() {
66+
canvas.width = img.width
67+
canvas.height = img.height
68+
c2x.drawImage(img, 0, 0)
69+
resolve(canvas.toDataURL())
70+
canvas.height = canvas.width = 0
71+
}
72+
img.onerror = reject
73+
img.src = path
74+
return
75+
}
76+
if (typeof plus === 'object') {
77+
plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
78+
entry.file(function(file) {
79+
var fileReader = new plus.io.FileReader()
80+
fileReader.onload = function(data) {
81+
resolve(data.target.result)
82+
}
83+
fileReader.onerror = function(error) {
84+
reject(error)
85+
}
86+
fileReader.readAsDataURL(file)
87+
}, function(error) {
88+
reject(error)
89+
})
90+
}, function(error) {
91+
reject(error)
92+
})
93+
return
94+
}
95+
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
96+
wx.getFileSystemManager().readFile({
97+
filePath: path,
98+
encoding: 'base64',
99+
success: function(res) {
100+
resolve('data:image/png;base64,' + res.data)
101+
},
102+
fail: function(error) {
103+
reject(error)
104+
}
105+
})
106+
return
107+
}
108+
reject(new Error('not support'))
109+
})
110+
}
111+
112+
export function base64ToPath(base64) {
113+
return new Promise(function(resolve, reject) {
114+
if (typeof window === 'object' && 'document' in window) {
115+
base64 = base64.split(',')
116+
var type = base64[0].match(/:(.*?);/)[1]
117+
var str = atob(base64[1])
118+
var n = str.length
119+
var array = new Uint8Array(n)
120+
while (n--) {
121+
array[n] = str.charCodeAt(n)
122+
}
123+
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type })))
124+
}
125+
var extName = base64.match(/data\:\S+\/(\S+);/)
126+
if (extName) {
127+
extName = extName[1]
128+
} else {
129+
reject(new Error('base64 error'))
130+
}
131+
var fileName = getNewFileId() + '.' + extName
132+
if (typeof plus === 'object') {
133+
var basePath = '_doc'
134+
var dirPath = 'uniapp_temp'
135+
var filePath = basePath + '/' + dirPath + '/' + fileName
136+
if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) {
137+
plus.io.resolveLocalFileSystemURL(basePath, function(entry) {
138+
entry.getDirectory(dirPath, {
139+
create: true,
140+
exclusive: false,
141+
}, function(entry) {
142+
entry.getFile(fileName, {
143+
create: true,
144+
exclusive: false,
145+
}, function(entry) {
146+
entry.createWriter(function(writer) {
147+
writer.onwrite = function() {
148+
resolve(filePath)
149+
}
150+
writer.onerror = reject
151+
writer.seek(0)
152+
writer.writeAsBinary(base64.replace(/^data:\S+\/\S+;base64,/, ''))
153+
}, reject)
154+
}, reject)
155+
}, reject)
156+
}, reject)
157+
return
158+
}
159+
var bitmap = new plus.nativeObj.Bitmap(fileName)
160+
bitmap.loadBase64Data(base64, function() {
161+
bitmap.save(filePath, {}, function() {
162+
bitmap.clear()
163+
resolve(filePath)
164+
}, function(error) {
165+
bitmap.clear()
166+
reject(error)
167+
})
168+
}, function(error) {
169+
bitmap.clear()
170+
reject(error)
171+
})
172+
return
173+
}
174+
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
175+
var filePath = wx.env.USER_DATA_PATH + '/' + fileName
176+
wx.getFileSystemManager().writeFile({
177+
filePath: filePath,
178+
data: base64.replace(/^data:\S+\/\S+;base64,/, ''),
179+
encoding: 'base64',
180+
success: function() {
181+
resolve(filePath)
182+
},
183+
fail: function(error) {
184+
reject(error)
185+
}
186+
})
187+
return
188+
}
189+
reject(new Error('not support'))
190+
})
191+
}

main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Vue from 'vue'
2+
import App from './App'
3+
4+
5+
Vue.config.productionTip = false
6+
7+
App.mpType = 'app'
8+
9+
const app = new Vue({
10+
...App
11+
})
12+
app.$mount()

manifest.json

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"name" : "SDUT校庆头像框",
3+
"appid" : "__UNI__5D6CF0C",
4+
"description" : "山东理工大学65周年头像制作小程序",
5+
"versionName" : "1.0.0",
6+
"versionCode" : "100",
7+
"transformPx" : true,
8+
/* 网络请求时间配置 */
9+
"networkTimeout" : {
10+
"request" : 60000,
11+
"connectSocket" : 60000,
12+
"uploadFile" : 60000,
13+
"downloadFile" : 60000
14+
},
15+
/* 5+App特有相关 */
16+
"app-plus" : {
17+
"usingComponents" : true,
18+
"nvueCompiler" : "uni-app",
19+
"compilerVersion" : 3,
20+
"splashscreen" : {
21+
"alwaysShowBeforeRender" : true,
22+
"waiting" : true,
23+
"autoclose" : true,
24+
"delay" : 0
25+
},
26+
/* 模块配置 */
27+
"modules" : {},
28+
/* 应用发布信息 */
29+
"distribute" : {
30+
/* android打包配置 */
31+
"android" : {
32+
"permissions" : [
33+
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
34+
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
35+
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
36+
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
37+
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
38+
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
39+
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
40+
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
41+
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
42+
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
43+
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
44+
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
45+
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
46+
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
47+
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
48+
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
49+
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
50+
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
51+
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
52+
"<uses-feature android:name=\"android.hardware.camera\"/>",
53+
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
54+
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
55+
]
56+
},
57+
/* ios打包配置 */
58+
"ios" : {},
59+
/* SDK配置 */
60+
"sdkConfigs" : {}
61+
},
62+
"uniStatistics" : {
63+
"enable" : false
64+
}
65+
},
66+
/* 快应用特有相关 */
67+
"quickapp" : {},
68+
/* 小程序特有相关 */
69+
"mp-weixin" : {
70+
"appid" : "wxec136a173fe6b537",
71+
"setting" : {
72+
"urlCheck" : false
73+
},
74+
"usingComponents" : true,
75+
"uniStatistics" : {
76+
"enable" : false
77+
},
78+
"permission" : {}
79+
},
80+
"mp-alipay" : {
81+
"usingComponents" : true,
82+
"uniStatistics" : {
83+
"enable" : false
84+
}
85+
},
86+
"mp-baidu" : {
87+
"usingComponents" : true,
88+
"uniStatistics" : {
89+
"enable" : false
90+
}
91+
},
92+
"mp-toutiao" : {
93+
"usingComponents" : true,
94+
"uniStatistics" : {
95+
"enable" : false
96+
}
97+
},
98+
"uniStatistics" : {
99+
"enable" : false
100+
},
101+
"h5" : {
102+
"uniStatistics" : {
103+
"enable" : false
104+
}
105+
},
106+
"mp-qq" : {
107+
"uniStatistics" : {
108+
"enable" : false
109+
}
110+
}
111+
}

node_modules/.bin/atob

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/atob.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)