You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
import Vue from 'vue'
|
|
|
|
import parseBaseApp from '../../../mp-weixin/runtime/wrapper/app-base-parser'
|
|
|
|
import {
|
|
mocks,
|
|
initRefs
|
|
} from './util'
|
|
|
|
export default function parseApp (vm) {
|
|
Object.defineProperty(Vue.prototype, '$slots', {
|
|
get () {
|
|
return this.$scope && this.$scope.props.$slots
|
|
},
|
|
set () {
|
|
|
|
}
|
|
})
|
|
Object.defineProperty(Vue.prototype, '$scopedSlots', {
|
|
get () {
|
|
return this.$scope && this.$scope.props.$scopedSlots
|
|
},
|
|
set () {
|
|
|
|
}
|
|
})
|
|
|
|
Vue.prototype.$onAliGetAuthorize = function onAliGetAuthorize (method, $event) {
|
|
my.getPhoneNumber({
|
|
success: (res) => {
|
|
$event.type = 'getphonenumber'
|
|
const response = JSON.parse(res.response).response
|
|
if (response.code === '10000') { // success
|
|
$event.detail.errMsg = 'getPhoneNumber:ok'
|
|
$event.detail.encryptedData = res.response
|
|
} else {
|
|
$event.detail.errMsg = 'getPhoneNumber:fail Error: ' + res.response
|
|
}
|
|
this[method]($event)
|
|
},
|
|
fail: (res) => {
|
|
$event.type = 'getphonenumber'
|
|
$event.detail.errMsg = 'getPhoneNumber:fail'
|
|
this[method]($event)
|
|
}
|
|
})
|
|
}
|
|
|
|
Vue.prototype.$onAliAuthError = function $onAliAuthError (method, $event) {
|
|
$event.type = 'getphonenumber'
|
|
$event.detail.errMsg = 'getPhoneNumber:fail Error: ' + $event.detail.errorMessage
|
|
this[method]($event)
|
|
}
|
|
|
|
return parseBaseApp(vm, {
|
|
mocks,
|
|
initRefs
|
|
})
|
|
}
|
|
|