|
@@ -92,12 +92,63 @@
|
|
|
};
|
|
|
},
|
|
|
onShow() {
|
|
|
+ if (uni.getStorageSync("userInfo")) {
|
|
|
+ this.userInfo = uni.getStorageSync("userInfo")
|
|
|
+ this.init()
|
|
|
+ } else {
|
|
|
+ this.login()
|
|
|
+ }
|
|
|
this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
|
|
|
},
|
|
|
methods: {
|
|
|
- toNotice(){
|
|
|
+ init(){
|
|
|
+
|
|
|
+ },
|
|
|
+ login() {
|
|
|
+ let that = this
|
|
|
+ uni.login({
|
|
|
+ "provider": "weixin",
|
|
|
+ success: function(wxres) {
|
|
|
+ that.$request.baseRequest('commonUserApp', 'commonUserLogin', {
|
|
|
+ loginType: 1,
|
|
|
+ raw: JSON.stringify(wxres)
|
|
|
+ }, failres => {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: failres.errmsg,
|
|
|
+ })
|
|
|
+ uni.hideLoading()
|
|
|
+ }).then(res => {
|
|
|
+ uni.getUserInfo({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: function(info) {
|
|
|
+ console.log(info)
|
|
|
+ res.data.nickname = info.userInfo.nickName
|
|
|
+ res.data.head = info.userInfo.avatarUrl
|
|
|
+ that.$request.baseRequest('commonUserApp', 'edit', {
|
|
|
+ commonUserInfo: JSON.stringify(res.data)
|
|
|
+ }, failres => {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: 'error',
|
|
|
+ message: failres.errmsg,
|
|
|
+ })
|
|
|
+ uni.hideLoading()
|
|
|
+ }).then(res1 => {
|
|
|
+ uni.setStorageSync("userInfo",res1.data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ // 登录授权失败
|
|
|
+ // err.code是错误码
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toNotice() {
|
|
|
uni.navigateTo({
|
|
|
- url:"/pages/cardHolder/notice"
|
|
|
+ url: "/pages/cardHolder/notice"
|
|
|
})
|
|
|
},
|
|
|
micOpen: function() {
|