Browse Source

[修改] 登录方式修改

master
邓平艺 4 years ago
parent
commit
2a9bd5e9b1
  1. 27
      App.vue
  2. 3
      common/api.js
  3. 44
      package-lock.json
  4. 23
      pages/contactService/index.vue
  5. 2
      pages/index/index.vue
  6. 3
      pages/login/index.vue
  7. 4
      pages/route/index.vue

27
App.vue

@ -4,7 +4,7 @@
},
onLaunch: function() {
this.login(); // TODO
this.getUserInfo();
},
onShow: function() {
// #ifdef MP-WEIXIN
@ -15,11 +15,27 @@
console.log('App Hide')
},
methods: {
//
getUserInfo(){
let userinfo = uni.getStorageSync('userinfo');
if(userinfo && userinfo.id){
return;
}
uni.login({
complete: result => {
if(result.errMsg == 'login:ok'){
let code = result.code;
this.userCode(code);
}
}
})
},
// code
userCode(code){
return console.log("code", code);
this.$http('', { code }).then(res => {
console.log("code", code);
this.$http(this.API.API_WXLOGIN, { code }).then(res => {
console.log("获得用户信息", res);
uni.setStorageSync('userinfo', res.data);
})
},
//
@ -27,12 +43,12 @@
this.checkSession().then(code => {
this.userCode(code);
}).catch(err => {
console.log("进入。。。。。。")
uni.login({
complete: result => {
console.log(result)
if(result.errMsg == 'login:ok'){
let code = result.code;
uni.setStorageSync('login_token', code);
this.userCode(code);
}
}
@ -45,7 +61,8 @@
uni.checkSession({
complete: result => {
if(result.errMsg == 'checkSession:ok'){ // session
let login_token = uni.getStorageSync('login_token');
// let login_token = uni.getStorageSync('login_token');
let login_token = undefined;
if(login_token){
resolve(login_token);
}else{

3
common/api.js

@ -24,4 +24,7 @@ export const API_COLLECT_DEAL = '/api/collect/deal'; // 商品收藏
/* 个人中心相关 */
export const API_COLLECT_LIST = '/api/collect/list'; // 我的收藏列表
/* 用户相关 */
export const API_WXLOGIN = '/api/wxlogin'; // 用户登录
export const TEST = '/api/order/deal';

44
package-lock.json

@ -2,46 +2,10 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"clipboard": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz",
"integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==",
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"requires": {
"delegate": "^3.1.2"
}
},
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"vue-clipboard2": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.3.1.tgz",
"integrity": "sha512-H5S/agEDj0kXjUb5GP2c0hCzIXWRBygaWLN3NEFsaI9I3uWin778SFEMt8QRXiPG+7anyjqWiw2lqcxWUSfkYg==",
"requires": {
"clipboard": "^2.0.0"
}
"tki-qrcode": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/tki-qrcode/-/tki-qrcode-0.1.6.tgz",
"integrity": "sha512-EnnlS8psowC7PsW3MDYcxvJYkuklX3WAZ/BYanR4TdBHTu74GfjTBX8Y16REP+AeDENiVtBPh4jtTRL2P736hQ=="
}
}
}

23
pages/contactService/index.vue

@ -8,7 +8,7 @@
<view class="lf-color-gray">服务时间</view>
<view>10:0020:00</view>
</view>
<view class="lf-row-between item">
<view class="lf-row-between item" @click="makePhoneCall">
<view class="lf-color-gray">客服电话</view>
<view>13278683790</view>
</view>
@ -20,12 +20,12 @@
<view class="lf-color-gray">客服微信</view>
<view>
<text>whhu8798</text>
<text class="lf-m-l-20 lf-color-primary">复制</text>
<text class="lf-m-l-20 lf-color-primary" @click="copy">复制</text>
</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">当前版本</view>
<view>1.0.1</view>
<view>{{ version }}</view>
</view>
</view>
</template>
@ -34,14 +34,25 @@
export default {
data(){
return {
version: ''
}
},
onLoad(){
this.version = this.API.VERSION;
},
methods: {
//
makePhoneCall(){
uni.makePhoneCall({
phoneNumber: ''
})
},
//
copy(){
uni.setClipboardData({
data: 'a'
})
}
}
}
</script>

2
pages/index/index.vue

@ -14,7 +14,7 @@
<view class="u-line-progress">
<u-line-progress :percent="item.specs[0].sold_percent" height="20" :striped="true" active-color="#FE9903" :show-percent="false" inactive-color="#F5F5F5"></u-line-progress>
</view>
<text class="progress">{{ item.specs[0].sold_percent_text }}</text>
<text class="progress lf-m-r-10">{{ item.specs[0].sold_percent_text }}</text>
<text class="bought">{{ item.specs[0].sold_stock_text }}</text>
</view>
<view class="lf-row-between price">

3
pages/login/index.vue

@ -41,7 +41,8 @@
return {
checked: false, //
isLogin: false, //
userInfo: {}
userInfo: {},
type: 'phone', // phone | userinfo
}
},
onLoad(){

4
pages/route/index.vue

@ -1,3 +1,7 @@
<template>
<view></view>
</template>
<script>
/* 路由分发页面仅供跳转页面 */
export default {

Loading…
Cancel
Save