Commit af58cd8f1cc409666e47bddaf5cdd7f0bb822d65

Authored by 陈威
1 parent c43b7cea
Exists in dev

1: 移除url 中的/#/

frontend/app-user/App.vue
... ... @@ -44,7 +44,7 @@
44 44 const pages = getCurrentPages()
45 45 // 当前页面
46 46 const page = pages?.[pages.length - 1]?.$page?.fullPath
47   - return !page || page === '/pages/login' || page === '/pages/code'
  47 + return !page || page === '/pages/login' || page === '/pages/code' || page === '/pages/jump/weChatOffAcc'
48 48 },
49 49 checkWhite(url) {
50 50 const path = url.split('?')[0]
... ... @@ -69,4 +69,4 @@
69 69 /*每个页面公共scss */
70 70 @import 'app.scss';
71 71 @import '@/static/scss/index.scss'
72   -</style>
73 72 \ No newline at end of file
  73 +</style>
... ...
frontend/app-user/api/login.js
... ... @@ -83,6 +83,17 @@ export function getUserInfo(params) {
83 83 })
84 84 }
85 85  
  86 +
  87 +export function getWechatOpenId(code) {
  88 + return request({
  89 + 'url': '/sso/weixinPublic?code=' + code,
  90 + 'method': 'get'
  91 + })
  92 +}
  93 +
  94 +
  95 +
  96 +
86 97 // 获取短信验证码
87 98 export function getCode(params) {
88 99 return request({
... ... @@ -137,5 +148,6 @@ export default {
137 148 codeLogin,
138 149 getPublicKey,
139 150 changUserPsd,
140   - forgotPassword
  151 + forgotPassword,
  152 + getWechatOpenId
141 153 }
... ...
frontend/app-user/manifest.json
... ... @@ -142,8 +142,8 @@
142 142 "https" : false
143 143 },
144 144 "router" : {
145   - "base" : "./",
146   - "mode" : "hash"
  145 + "base" : "",
  146 + "mode" : "history"
147 147 },
148 148 "sdkConfigs" : {
149 149 "maps" : {
... ...
frontend/app-user/pages.json
... ... @@ -286,7 +286,7 @@
286 286 // 退瓶列表
287 287 {
288 288 "path" : "pages/mine/appList/listOfBottleReturn/listOfBottleReturn",
289   - "style" :
  289 + "style" :
290 290 {
291 291 "navigationStyle": "custom",
292 292 "enablePullDownRefresh" : true
... ... @@ -295,11 +295,17 @@
295 295 // 其他气站电话
296 296 {
297 297 "path" : "pages/home/otherGasStationsPhone",
298   - "style" :
  298 + "style" :
299 299 {
300 300 "navigationStyle": "custom",
301 301 "enablePullDownRefresh" : true
302 302 }
  303 + },
  304 + {
  305 + "path": "pages/jump/weChatOffAcc",
  306 + "style": {
  307 + "navigationStyle": "custom"
  308 + }
303 309 }
304 310 ],
305 311 "tabBar": {
... ... @@ -322,4 +328,4 @@
322 328 "navigationStyle": "custom",
323 329 "backgroundColor": "#F8F8F8"
324 330 }
325   -}
326 331 \ No newline at end of file
  332 +}
... ...
frontend/app-user/pages/jump/weChatOffAcc.vue 0 → 100644
... ... @@ -0,0 +1,125 @@
  1 +<template>
  2 + <view class="container">
  3 + <div>微信公众号-授权认证中</div>
  4 + </view>
  5 +</template>
  6 +
  7 +<script>
  8 +
  9 +const {Base64} = require('js-base64');
  10 +export default {
  11 + data() {
  12 + return {
  13 + currentModeIndex: 2, //1账号密码 2验证码 3忘记密码
  14 + inputType: 'password',
  15 + codeDisabled: false,
  16 + codeTips: '',
  17 + formData: {
  18 + mobile: '',
  19 + password: '',
  20 + },
  21 + flag: true,
  22 + rules: {
  23 + mobile: [{
  24 + type: 'string',
  25 + required: true,
  26 + message: '请输入手机号',
  27 + trigger: ['blur', 'change']
  28 + },
  29 + // {
  30 + // // 自定义验证函数,见上说明
  31 + // validator: (rule, value, callback) => {
  32 + // // 上面有说,返回true表示校验通过,返回false表示不通过
  33 + // // uni.$u.test.mobile()就是返回true或者false的
  34 + // return uni.$u.test.mobile(value)
  35 + // },
  36 + // message: '手机号码不正确',
  37 + // // 触发器可以同时用blur和change
  38 + // trigger: ['change', 'blur']
  39 + // }
  40 + ],
  41 + password: {
  42 + type: 'string',
  43 + min: 4,
  44 + max: 16,
  45 + required: true,
  46 + message: '密码长度4-16位密码',
  47 + trigger: ['blur', 'change']
  48 + },
  49 + code: {
  50 + type: 'integer',
  51 + len: 4,
  52 + required: true,
  53 + message: '请填写4位验证码',
  54 + trigger: ['blur', 'change']
  55 + }
  56 + },
  57 + isAutoLogin: [], //是否自动登录
  58 + hasForgot: false, //忘记密码
  59 + loginText: "短信登录",
  60 + btnText: "发送验证码",
  61 + checkValue: ['agree'],
  62 + accountTile: "短信验证码登录",
  63 + accountTip: "未注册手机号登录后自动生成账号",
  64 + accountPlaceholder: "请输入手机号",
  65 + appid: this.$config.appid,
  66 + openId: null
  67 + }
  68 + },
  69 + created() {
  70 + this.handleAuthorization();
  71 + },
  72 + methods: {
  73 + handleAuthorization() {
  74 + console.log("================================");
  75 + this.code = "";
  76 + let local = window.location.href;
  77 + console.log("local", local);
  78 + console.log("this.code", this.code);
  79 + let scope = "snsapi_base"; //静默授权 用户无感知
  80 + console.log("this.scope", scope);
  81 + this.code = this.getUrlCode().code;
  82 + console.log("this.code", this.code);
  83 +
  84 + this.getOpenId(this.code);
  85 + console.log("================================");
  86 + },
  87 + getOpenId(code) {
  88 + let that = this;
  89 + this.$api.loginApi.getWechatOpenId(code).then(res => {
  90 + console.log("11111that.res ", res);
  91 + if (res.status == 1000) {
  92 + that.openId = res.data.openId;
  93 + console.log("that.openId ", that.openId);
  94 + } else {
  95 + Toast(res.message);
  96 + }
  97 + });
  98 +
  99 + },
  100 + getUrlCode() {
  101 + let fullUrl = window.location.href;
  102 + console.log("fullUrl ", fullUrl);
  103 + let theRequest = new Object();
  104 + if (fullUrl.indexOf("?") != -1) {
  105 + var temp = fullUrl.split("?");
  106 + let str = temp[1];
  107 + let strs = str.split("&");
  108 + for (var i = 0; i < strs.length; i++) {
  109 + theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
  110 + }
  111 + }
  112 + return theRequest;
  113 + },
  114 + }
  115 +};
  116 +</script>
  117 +
  118 +<style lang="scss" scoped>
  119 +.container {
  120 + display: flex;
  121 + justify-content: center;
  122 + align-items: center;
  123 + height: 100vh;
  124 +}
  125 +</style>
... ...
frontend/app-user/permission.js
... ... @@ -7,7 +7,7 @@ const loginPage = &quot;/pages/login&quot;
7 7  
8 8 // 页面白名单
9 9 const whiteList = [
10   - '/pages/login', '/pages/code', '/pages/register', '/pages/forgotPassword', '/pages/common/webview/index'
  10 + '/pages/login', '/pages/code', '/pages/register', '/pages/forgotPassword', '/pages/common/webview/index', '/pages/jump/weChatOffAcc'
11 11 ]
12 12  
13 13 // 检查地址白名单
... ... @@ -42,4 +42,4 @@ list.forEach(item =&gt; {
42 42 console.log(err)
43 43 }
44 44 })
45   -})
46 45 \ No newline at end of file
  46 +})
... ...
frontend/app-user/utils/request.js
... ... @@ -107,7 +107,7 @@ function isLoginPage() {
107 107 const pages = getCurrentPages()
108 108 // 当前页面
109 109 const page = pages?.[pages.length - 1]?.$page?.fullPath
110   - return !page || page === '/pages/login' || page === '/pages/code'
  110 + return !page || page === '/pages/login' || page === '/pages/code'|| page === '/pages/jump/weChatOffAcc'
111 111 }
112 112  
113   -export default request
114 113 \ No newline at end of file
  114 +export default request
... ...