omi-cloud - test get openid & fix config dir position
This commit is contained in:
parent
dfb212fcf5
commit
0cdace1ca3
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"miniprogramRoot": "miniprogram/",
|
||||
"cloudfunctionRoot": "cloudfunctions/",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"newFeature": true
|
||||
},
|
||||
"appid": "wxdf970566455966b0",
|
||||
"projectname": "omi-cloud",
|
||||
"libVersion": "2.2.5",
|
||||
"condition": {
|
||||
"search": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"plugin": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"list": []
|
||||
},
|
||||
"miniprogram": {
|
||||
"current": 0,
|
||||
"list": [
|
||||
{
|
||||
"id": -1,
|
||||
"name": "db guide",
|
||||
"pathName": "pages/databaseGuide/databaseGuide"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1059,9 +1059,14 @@ function buildProjectConfig () {
|
|||
projectConfigFileName = 'project.config.json'
|
||||
}
|
||||
fs.ensureDirSync(outputDir)
|
||||
//@fix
|
||||
// fs.writeFileSync(
|
||||
// path.join(outputDir, projectConfigFileName),
|
||||
// JSON.stringify(Object.assign({}, origProjectConfig, { miniprogramRoot: './' }), null, 2)
|
||||
// )
|
||||
fs.writeFileSync(
|
||||
path.join(outputDir, projectConfigFileName),
|
||||
JSON.stringify(Object.assign({}, origProjectConfig, { miniprogramRoot: './' }), null, 2)
|
||||
path.join(path.resolve(outputDir, '..'), projectConfigFileName),
|
||||
JSON.stringify(Object.assign({}, origProjectConfig), null, 2)
|
||||
)
|
||||
Util.printLog(Util.pocessTypeEnum.GENERATE, '工具配置', `${outputDirName}/${projectConfigFileName}`)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ define('my-app', class extends WeElement {
|
|||
userInfo: null
|
||||
}
|
||||
|
||||
install() {
|
||||
install() {
|
||||
// 展示本地存储能力
|
||||
var logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
|
@ -56,6 +56,14 @@ define('my-app', class extends WeElement {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (!wx.cloud) {
|
||||
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
|
||||
} else {
|
||||
wx.cloud.init({
|
||||
traceUser: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onShow() { }
|
||||
|
|
|
@ -26,6 +26,27 @@ define('page-index', class extends WeElement {
|
|||
})
|
||||
}
|
||||
|
||||
onGetOpenid = () => {
|
||||
// 调用云函数
|
||||
wx.cloud.callFunction({
|
||||
name: 'login',
|
||||
data: {},
|
||||
success: res => {
|
||||
console.log('[云函数] [login] user openid: ', res.result.openid)
|
||||
app.globalData.openid = res.result.openid
|
||||
wx.navigateTo({
|
||||
url: '../userConsole/userConsole',
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.error('[云函数] [login] 调用失败', err)
|
||||
wx.navigateTo({
|
||||
url: '../deployFunctions/deployFunctions',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
install() {
|
||||
if (app.globalData.userInfo) {
|
||||
this.data.userInfo = app.globalData.userInfo
|
||||
|
@ -71,6 +92,9 @@ define('page-index', class extends WeElement {
|
|||
<block>
|
||||
<image bindtap={this.bindViewTap} class="userinfo-avatar" src={userInfo.avatarUrl} mode="cover"></image>
|
||||
<text class="userinfo-nickname">{userInfo.nickName}</text>
|
||||
<view >
|
||||
<button bindtap={this.onGetOpenid}>获取 openid</button>
|
||||
</view>
|
||||
</block>
|
||||
)}
|
||||
</view>
|
||||
|
@ -84,4 +108,4 @@ define('page-index', class extends WeElement {
|
|||
</view>
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue