大更新

This commit is contained in:
weipengfei 2023-10-11 10:01:28 +08:00
parent dc9b1ce7e4
commit 6f3da251f0
24 changed files with 2841 additions and 1315 deletions

View File

@ -1,7 +1,6 @@
<script>
// #ifdef APP-PLUS
import { initEvent } from "@/utils/uniMPevent.js"
import { plus } from "./uni_modules/uview-ui/libs/function/digit";
// #endif
export default {
onLaunch: function() {
@ -10,12 +9,16 @@ import { plus } from "./uni_modules/uview-ui/libs/function/digit";
initEvent();
// #endif
if(this.$store.state.app.token){
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen();
// #endif
}else {
uni.reLaunch({
url:'/pages/login/login',
success() {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen();
// #endif
}
})
}

3
androidPrivacy.json Normal file
View File

@ -0,0 +1,3 @@
{
"prompt": "template"
}

53
api/apiUser.js Normal file
View File

@ -0,0 +1,53 @@
import request from "@/utils/request.js";
import Cache from '@/utils/cache'
/**
* 登录
* @param object
*/
export function login(data) {
return request.post(`login/login`, data, {noAuth: true});
}
/**
* 注册
* @param object
*/
export function register(data) {
return request.post(`login/register`, data, {noAuth: true});
}
/**
* 验证码
* @param object
*/
export function indexCode(data) {
return request.post(`index/code`, data, {noAuth: true});
}
/**
* 退出登录
* @param object
*/
export function logout(data) {
return request.post(`login/logout`, data);
}
/**
* 修改密码
* @param object
*/
export function changePassword(data) {
return request.post(`user.user/changePassword`, data);
}
/**
* 重置密码
* @param object
*/
export function resetPassword(data) {
return request.post(`/user.user/resetPassword`, data);
}

365
components/Authorize.vue Normal file
View File

@ -0,0 +1,365 @@
<template>
<view>
<view class='mask' v-if='isShowAuth && code' @click='close'></view>
<view class='Popup' v-if='isShowAuth && code' :style="'top:'+top+'px;'">
<!-- <view class="logo-auth">
<image class="image" :src='routine_logo' mode="aspectFit"></image>
</view> -->
<!--#ifdef H5-->
<text v-if="isWeixin" class='title'>授权提醒</text>
<text v-else class='title'>{{title}}</text>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<text class='title'>用户登录</text>
<!--#endif-->
<!--#ifdef MP-->
<text class='title'>{{title}}</text>
<!--#endif-->
<!--#ifdef H5-->
<text v-if="isWeixin" class='tip'>请授权头像等信息以便为您提供更好的服务</text>
<text v-else class='tip'>{{info}}</text>
<!--#endif-->
<!--#ifdef APP-PLUS-->
<text class='tip'>请登录将为您提供更好的服务</text>
<!--#endif-->
<!--#ifdef MP-->
<text class='tip'>{{info}}</text>
<!--#endif-->
<view class='bottom flex'>
<text class='item' @click='close'>随便逛逛</text>
<!-- #ifdef MP -->
<button class="item grant" hover-class="none" @tap="getUserProfile"><text
class="text">去授权</text></button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button class="item grant" @tap="toWecahtAuth">
<text class="text">去登录</text>
</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<button class="item grant" @tap="toWecahtAuth">
<text v-if="isWeixin" class="text">去授权</text>
<text v-else class="text">去登录</text>
</button>
<!-- #endif -->
</view>
</view>
<!-- #ifdef MP -->
<editUserModal :isShow="editModal" @closeEdit="closeEdit" @editSuccess="editSuccess"></editUserModal>
<!-- #endif -->
</view>
</template>
<script>
const app = getApp();
import Cache from '../utils/cache';
import {
getLogo,
commonAuth
} from '../api/public';
import {
LOGO_URL,
USER_INFO,
EXPIRES_TIME
} from '../config/cache';
import {
mapGetters
} from 'vuex';
import Routine from '../libs/routine';
import {
configMap
} from '@/utils/index';
import Auth from '../libs/wechat';
import {
toLogin
} from '../libs/login';
// #ifdef MP
import editUserModal from '@/components/eidtUserModal/index.vue'
// #endif
export default {
name: 'Authorize',
props: {
isAuto: {
type: Boolean,
default: true
},
isGoIndex: {
type: Boolean,
default: true
},
isShowAuth: {
type: Boolean,
default: false
}
},
components: {
// #ifdef MP
editUserModal
// #endif
},
data() {
return {
title: '用户登录',
info: '请登录,将为您提供更好的服务!',
//#ifdef H5
isWeixin: this.$wechat.isWeixin(),
//#endif
//#ifdef MP
title: '授权提醒',
info: '请授权头像等信息,以便为您提供更好的服务!',
//#endif
canUseGetUserProfile: false,
code: null,
top: 0,
mp_is_new: this.$Cache.get('MP_VERSION_ISNEW') || false,
editModal: false, //
}
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'viewColor']),
...configMap(['routine_logo'])
},
watch: {
isLogin(n) {
n === true && this.$emit('onLoadFun', this.userInfo);
},
isShowAuth(n) {
this.getCode(this.isShowAuth)
}
},
created() {
// console.log('title' + this.title)
this.top = uni.getSystemInfoSync().windowHeight / 2 - 70
if (wx.getUserProfile) {
this.canUseGetUserProfile = true
}
this.setAuthStatus();
this.getCode(this.isShowAuth)
},
methods: {
// #ifdef MP
editSuccess() {
this.editModal = false
this.$emit('onLoadFun', this.userInfo);
},
closeEdit() {
this.editModal = false
},
// #endif
setAuthStatus() {
//#ifdef MP
Routine.authorize().then(res => {
if (res.islogin === false)
this.$emit('onLoadFun', this.userInfo);
}).catch(res => {
if (this.isAuto)
this.$emit('authColse', true);
})
//#endif
},
getCode(n) {
// #ifdef MP
if (n) {
uni.showLoading({
title: '正在登录中'
});
Routine.getCode().then(code => {
uni.hideLoading();
this.code = code;
}).catch(e => {
uni.hideLoading();
uni.showToast({
title: '登录失败',
duration: 2000
});
})
} else {
this.code = null;
}
// #endif
// #ifndef MP
if (n) {
this.code = 1;
}
// #endif
},
toWecahtAuth() {
toLogin(true);
},
getUserProfile() {
// console.log(11);
toLogin(true);
uni.navigateTo({
url: '/pages/users/login/login_copy'
})
// console.log(22);
return
let self = this;
Routine.getUserProfile()
.then(res => {
let userInfo = res.userInfo;
userInfo.code = this.code;
userInfo.spread = app.globalData.spid; //广ID
userInfo.spread_code = app.globalData.code; //广ID
commonAuth({
auth: {
type: 'routine',
auth: userInfo
}
}).then(res => {
if (res.data.status == 200) {
let time = res.data.result.expires_time - Cache.time();
self.$store.commit('UPDATE_USERINFO', res.data.result.user);
self.$store.commit('LOGIN', {
token: res.data.result.token,
time: time
});
self.$store.commit('SETUID', res.data.result.user.uid);
Cache.set(EXPIRES_TIME, res.data.result.expires_time, time);
Cache.set(USER_INFO, res.data.result.user, time);
this.$emit('onLoadFun', res.data.result.user);
if (res.data.result.user.isNew && this.mp_is_new) {
this.editModal = true;
}
} else {
uni.setStorageSync('auth_token', res.data.result.key);
return uni.navigateTo({
url: '/pages/users/login/login_copy'
})
}
}).catch(res => {
uni.hideLoading();
uni.showToast({
title: res.message,
icon: 'none',
duration: 2000,
});
});
})
.catch(res => {
uni.hideLoading();
});
},
close() {
let pages = getCurrentPages(),
currPage = pages[pages.length - 1];
this.$emit('authColse', false);
if (this.isGoIndex) {
uni.switchTab({
url: '/pages/index/index'
});
} else {
this.$emit('authColse', false);
}
},
}
}
</script>
<style scoped lang='scss'>
.Popup {
flex: 1;
align-items: center;
justify-content: center;
width: 500rpx;
background-color: #fff;
position: fixed;
top: 500rpx;
left: 125rpx;
z-index: 1000;
border-radius: 8px;
overflow: hidden;
}
.Popup {
.logo-auth {
z-index: -1;
position: absolute;
left: 50%;
top: 0%;
transform: translate(-50%, -50%);
width: 150rpx;
height: 150rpx;
display: flex;
align-items: center;
justify-content: center;
border: 8rpx solid #fff;
border-radius: 50%;
background: #fff;
}
.image {
height: 42rpx;
margin-top: -54rpx;
}
}
.Popup .title {
font-size: 28rpx;
color: #000;
text-align: center;
margin-top: 30rpx;
align-items: center;
justify-content: center;
width: 500rpx;
display: flex;
}
.Popup .tip {
font-size: 22rpx;
color: #555;
padding: 0 24rpx;
margin-top: 25rpx;
display: flex;
align-items: center;
justify-content: center;
}
.Popup .bottom .item {
width: 250rpx;
height: 80rpx;
background-color: #eeeeee;
text-align: center;
line-height: 80rpx;
margin-top: 54rpx;
font-size: 24rpx;
color: #666;
.text {
font-size: 24rpx;
color: #666;
}
}
.Popup .bottom .item.on {
width: 500rpx;
}
.flex {
display: flex;
flex-direction: row;
}
.Popup .bottom .item.grant {
font-weight: bold;
background-color: #E93323;
/* background-color: var(--view-theme); */
border-radius: 0;
padding: 0;
.text {
font-size: 28rpx;
color: #fff;
}
}
.mask {
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.65);
z-index: 99;
}
</style>

View File

@ -2,11 +2,10 @@
let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
// #endif
const MD5KEY = 'AK9F3AD3A7498A236D0DB76604CF1F3EA3'
let openPlantGrass = '-openPlantGrass-'
let httpApi
let httpApiTwo
let httpApiThree
let httpApiFour
// 在打包之前请检查当前环境是否正确
const env = 'dev'; // 开发
@ -15,22 +14,13 @@ const env = 'dev'; // 开发
switch (env) {
case 'prod':
httpApi = 'https://shop.lihaink.cn' // 生产
httpApiTwo = 'https://nk.lihaink.cn'
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour = 'https://worker-task.lihaink.cn'
httpApi = 'https://middle.lihaink.cn' // 生产
break;
case 'prew':
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
httpApiTwo = "https://nk.lihaink.cn"
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour = 'https://preview-worker-task.lihaink.cn'
httpApi = 'https://preview-middle.lihaink.cn' //预发布环境
break;
default:
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
httpApiTwo = "https://nk.lihaink.cn"
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour = 'https://ceshi-worker-task.lihaink.cn'
httpApi = "https://ceshi-middle.lihaink.cn" // 测试
}
@ -43,25 +33,28 @@ let wsApi = 'wss://shop.lihaink.cn'
module.exports = {
// 请求域名 格式: https://您的域名
// #ifdef MP || APP-PLUS
// HTTP_REQUEST_URL: httpApi,
HTTP_REQUEST_URL: httpApi,
HTTP_REQUEST_URL_TWO: httpApiTwo,
HTTP_REQUEST_URL_THREE: httpApiThree,
HTTP_REQUEST_URL_FOUR: httpApiFour,
// HTTP_REQUEST_URL_TWO: httpApiTwo,
// HTTP_REQUEST_URL_THREE: httpApiThree,
// HTTP_REQUEST_URL_FOUR: httpApiFour,
VUE_APP_WS_URL: `${wsApi}?type=user`,
// #endif
// #ifdef H5
//H5接口是浏览器地址
HTTP_REQUEST_URL_FOUR: httpApiFour|| window.location.protocol + "//" + window.location.host,
HTTP_REQUEST_URL: httpApi || window.location.protocol + "//" + window.location.host,
HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
// HTTP_REQUEST_URL_FOUR: httpApiFour|| window.location.protocol + "//" + window.location.host,
// HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
// 聊天长连接地址
VUE_APP_WS_URL: wsApi ? `${wsApi}?type=user` : VUE_APP_WS_URL,
// #endif
MD5KEY: MD5KEY,
openPlantGrass: openPlantGrass,
HEADER: {
'content-type': 'application/json',
// 'content-type': 'application/json',
'appid': 'AD1696910250',
'url': 'https://middle.lihaink.cn',
'timestamp': Date.now(),
//#ifdef H5
'Form-type': navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1 ? 'wechat' : 'h5',
//#endif
@ -73,7 +66,7 @@ module.exports = {
//#endif
},
// 回话密钥名称 请勿修改此配置
TOKENNAME: 'X-Token',
TOKENNAME: 'token',
// 缓存时间 0 永久
EXPIRE: 0,
};

View File

@ -1,6 +1,6 @@
import store from '@/store';
import { checkLogin } from './login';
import { login } from '@/api/pubic.js';
import { login } from '@/api/public.js';
import Cache from '@/utils/cache';
import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS } from '@/config/cache';

View File

@ -1,71 +1,177 @@
{
"name" : "lihaiCenter",
"appid" : "__UNI__BBF059D",
"name" : "里海中台",
"appid" : "__UNI__3A527D1",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"versionName" : "0.0.1",
"versionCode" : 1,
"transformPx" : false,
/* 5+App */
"app-plus" : {
"titleNView" : true,
"usingComponents" : true,
"nvueCompiler" : "uni-app",
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : false,
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : false,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {
"VideoPlayer" : {},
"iBeacon" : {},
"Barcode" : {},
"Camera" : {},
"Geolocation" : {},
"Payment" : {},
"Share" : {},
"OAuth" : {},
"UniMP" : {
"description" : "uni小程序"
},
"Maps" : {},
"Push" : {}
},
"safearea" : {
"bottom" : {
"offset" : "none"
}
},
/* */
"distribute" : {
/* android */
"android" : {
"resizeableActivity" : true,
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.BATTERY_STATS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_CONFIGURATION\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"permissionExternalStorage" : {
"request" : "none",
"prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
},
"permissionPhoneState" : {
"request" : "none" //
}
},
/* ios */
"ios" : {
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "上传用户头像保存分享海报",
"NSPhotoLibraryAddUsageDescription" : "上传用户头像保存分享海报",
"NSCameraUsageDescription" : "上传用户头像保存分享海报",
"NSLocationWhenInUseUsageDescription" : "根据客户地理位置推荐最近门店",
"NSLocationAlwaysUsageDescription" : "根据客户地理位置推荐最近门店",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "根据客户地理位置推荐最近门店"
},
"idfa" : false,
"dSYMs" : false
},
/* SDK */
"sdkConfigs" : {
"maps" : {
"amap" : {
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
}
},
"payment" : {
"weixin" : {
"__platform__" : [ "ios", "android" ],
"appid" : "wx9d68c92b550ddd1e",
"UniversalLinks" : "https://shop.lihaink.cn/"
}
},
"share" : {
"weixin" : {
"appid" : "wx9d68c92b550ddd1e",
"UniversalLinks" : "https://shop.lihaink.cn/"
}
},
"geolocation" : {
"amap" : {
"__platform__" : [ "ios", "android" ],
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
}
},
"oauth" : {},
"ad" : {},
"oauth" : {}
"push" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen" : {
"useOriginalMsgbox" : true
}
},
"nativePlugins" : {
"JG-JCore" : {
"JPUSH_APPKEY_IOS" : "",
"JPUSH_CHANNEL_IOS" : "",
"JPUSH_APPKEY_ANDROID" : "",
"JPUSH_APPKEY_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_CHANNEL_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_APPKEY_ANDROID" : "b5f679f4357018605ea6fd2e",
"JPUSH_CHANNEL_ANDROID" : "",
"__plugin_info__" : {
"name" : "JG-JCore",
"description" : "极光推送JCore插件",
"platforms" : "Android,iOS",
"url" : "",
"android_package_name" : "",
"android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
@ -74,7 +180,7 @@
"JPUSH_APPKEY_IOS" : {
"des" : "[iOS]极光portal配置应用信息时分配的AppKey",
"key" : "JCore:APP_KEY",
"value" : ""
"value" : "daebe19b547c43128796a078"
},
"JPUSH_CHANNEL_IOS" : {
"des" : "[iOS]用于统计分发渠道不需要可填默认值developer-default",
@ -95,9 +201,9 @@
}
},
"JG-JPush" : {
"JPUSH_ISPRODUCTION_IOS" : "",
"JPUSH_ISPRODUCTION_IOS" : "true",
"JPUSH_ADVERTISINGID_IOS" : "",
"JPUSH_DEFAULTINITJPUSH_IOS" : "",
"JPUSH_DEFAULTINITJPUSH_IOS" : "true",
"JPUSH_OPPO_APPKEY" : "",
"JPUSH_OPPO_APPID" : "",
"JPUSH_OPPO_APPSECRET" : "",
@ -112,7 +218,7 @@
"description" : "极光推送Hbuilder插件",
"platforms" : "Android,iOS",
"url" : "",
"android_package_name" : "",
"android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
@ -187,10 +293,19 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"appid" : "wxfb4695444ab8d0d0",
"setting" : {
"urlCheck" : false
"urlCheck" : false,
"minified" : true,
"postcss" : true,
"es6" : true
},
"permission" : {
"scope.userLocation" : {
"desc" : "获取您的位置"
}
},
"requiredPrivateInfos" : [ "getLocation", "chooseAddress" ],
"usingComponents" : true
},
"mp-alipay" : {
@ -202,8 +317,34 @@
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
"h5" : {
"devServer" : {
"proxy" : {
"baseUrlTest/api" : {
"target" : "https://ceshi-middle.lihaink.cn",
"changeOrigin" : true,
"pathRewrite" : {
"^/baseUrlTest/api" : "/api"
}
}
}
},
"router" : {
"mode" : "history",
"base" : ""
},
"domain" : "",
"sdkConfigs" : {
"maps" : {
"qqmap" : {
"key" : "SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7"
}
}
},
"title" : "加载中...",
"template" : "template.h5.html"
}
}
//
/* ios */

17
package-lock.json generated Normal file
View File

@ -0,0 +1,17 @@
{
"name": "lihaiCenter",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"crypto-js": "^4.1.1"
}
},
"node_modules/crypto-js": {
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",
"integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
}
}
}

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"crypto-js": "^4.1.1"
}
}

View File

@ -17,17 +17,14 @@
"navigationBarTitleText": "个人",
"enablePullDownRefresh": false
}
}
,{
}, {
"path": "pages/login/login",
"style" :
{
"style": {
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false
}
}
,{
}, {
"path": "uni_modules/guyue-updater/pages/updater",
"style": {
"app-plus": {
@ -44,6 +41,27 @@
"disableScroll": true,
"navigationStyle": "custom"
}
}, {
"path": "pages/error/error",
"style": {
"navigationBarTitleText": "错误",
"enablePullDownRefresh": false
}
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "用户",
"enablePullDownRefresh": false
}
},{
"path": "pages/user/updatePassword",
"style": {
"navigationBarTitleText": "修改密码",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
@ -57,8 +75,7 @@
"selectedColor": "#0122C7",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [
{
"list": [{
"pagePath": "pages/index/index",
"text": "首页"
},

30
pages/error/error.vue Normal file
View File

@ -0,0 +1,30 @@
<template>
<view class="box">
网站已关闭
</view>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
</script>
<style lang="scss">
.box{
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
font-size: 40rpx;
font-weight: bold;
color: #666;
text-align: center;
}
</style>

View File

@ -19,10 +19,18 @@
},
methods: {
test() {
mp.loadMP({
id: '__UNI__3A527D1',
file: '/static/wgt/__UNI__3A527D1.wgt'
// mp.loadMPlocalhost({
// id: '__UNI__3A527D1',
// file: '/static/wgt/__UNI__3A527D1.wgt'
// })
mp.loadMPlocalhost({
id: '__UNI__9EDFE40',
file: '/static/wgt/__UNI__9EDFE40.wgt'
})
// mp.loadMPlocalhost({
// id: '__UNI__1EE148C',
// file: '/static/wgt/__UNI__1EE148C.wgt'
// })
}
}
}

View File

@ -19,15 +19,14 @@
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入账号" placeholder-class="placeholder"
v-model="account" required />
<input type="text" placeholder="输入账号" placeholder-class="placeholder" v-model="account" required />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="password" placeholder="填写登录密码" placeholder-class="placeholder"
v-model="password" required />
<input type="password" placeholder="填写登录密码" placeholder-class="placeholder" v-model="password"
required />
</div>
</div>
</form>
@ -43,8 +42,7 @@
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder"
v-model="account" />
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" />
</div>
</div>
@ -54,8 +52,7 @@
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput"
v-model="captcha" maxlength="4" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="handleVerify">
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
{{ text }}
</button>
</div>
@ -77,9 +74,8 @@
<div class="protocol acea-row row-between-wrapper">
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
<checkbox class="checkbox" :checked="isAgree ? true : false" />
<text class="protocol_text">我已同意<text @click="userAgree"
class="font_pro">用户协议</text><text @click="userPrivacyAgree"
class="font_pro">隐私政策</text></text>
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">用户协议</text><text
@click="userPrivacyAgree" class="font_pro">隐私政策</text></text>
</checkbox-group>
</div>
@ -90,8 +86,7 @@
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder"
v-model="account" />
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" />
</div>
</div>
<div class="item">
@ -100,8 +95,7 @@
<input type="number" placeholder="填写验证码" maxLength='4' placeholder-class="placeholder" class="codeIput"
v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="handleVerify">
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
{{ text }}
</button>
</div>
@ -109,8 +103,7 @@
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_1.png"></image>
<input type="password" placeholder="填写您的登录密码" placeholder-class="placeholder"
v-model="password" />
<input type="password" placeholder="填写您的登录密码" placeholder-class="placeholder" v-model="password" />
</div>
</div>
@ -135,9 +128,8 @@
<div class="protocol acea-row row-between-wrapper">
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
<checkbox class="checkbox" :checked="isAgree ? true : false" />
<text class="protocol_text">我已同意<text @click="userAgree"
class="font_pro">用户协议</text><text @click="userPrivacyAgree"
class="font_pro">隐私政策</text></text>
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">用户协议</text><text
@click="userPrivacyAgree" class="font_pro">隐私政策</text></text>
</checkbox-group>
</div>
</div>
@ -157,8 +149,7 @@
<view class="ChangePassword">
<view class="list">
<view class="item">
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder'
v-model="account"></input>
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder' v-model="account"></input>
</view>
<view class="item acea-row row-between-wrapper">
@ -166,20 +157,18 @@
v-model="captcha"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled'
@click="handleVerify">
@click="handleVerify('register')">
{{ text }}
</button>
</view>
<view class="item">
<input type='password' placeholder='填写登录密码' placeholder-class='placeholder'
v-model="password"></input>
<input type='password' placeholder='填写登录密码' placeholder-class='placeholder' v-model="password"></input>
</view>
<view class="protocol acea-row row-between-wrapper">
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
<checkbox class="checkbox" :checked="isAgree ? true : false" />
<text class="protocol_text">我已同意<text @click="userAgree"
class="font_pro">用户协议</text><text @click="userPrivacyAgree"
class="font_pro">隐私政策</text></text>
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">用户协议</text><text
@click="userPrivacyAgree" class="font_pro">隐私政策</text></text>
</checkbox-group>
</view>
</view>
@ -191,8 +180,8 @@
{{ copyright.status == -1 ? `${copyright.year} ${copyright.url}` : copyright.Copyright }}
</view>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
ref="verify"></Verify>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify">
</Verify>
</div>
</template>
<script>
@ -210,7 +199,7 @@
loginH5,
loginMobile,
registerVerify,
register,
// register,
getCodeApi,
getUserInfo,
getCaptcha,
@ -218,6 +207,11 @@
appleLogin,
loginMpPhone
} from "@/api/user";
import {
login,
register,
indexCode
} from "@/api/apiUser";
import attrs, {
required,
alpha_num,
@ -246,6 +240,7 @@
mapGetters
} from "vuex";
import Verify from '@/components/verify/verify.vue';
import { Toast } from "../../libs/uniApi";
const BACK_URL = "login_back_url";
// #ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush");
@ -261,8 +256,8 @@
return {
navList: ["快速登录", "账号登录"],
current: 0,
account: "",
password: "",
account: "17685151643",
password: "123456",
captcha: "",
formItem: 1,
type: "login",
@ -592,18 +587,30 @@
that.agreement = res.data.sys_user_agree
})
},
getCode(data) {
//
getCode(data = 101) {
let that = this
getCodeApi()
.then(res => {
that.keyCode = res.data.key;
that.code(data);
})
.catch(res => {
indexCode({
phone: that.account,
scene: data
}).then((res) => {
that.sendCode();
Toast('验证码已发送');
}).catch(res => {
that.$util.Tips({
title: res
});
});
})
// getCodeApi()
// .then(res => {
// that.keyCode = res.data.key;
// that.code(data);
// })
// .catch(res => {
// that.$util.Tips({
// title: res
// });
// });
},
async loginMobile() {
let that = this;
@ -622,32 +629,31 @@
if (!that.isAgree) return that.$util.Tips({
title: '请勾选用户协议与隐私政策'
});
loginMobile({
auth_token: uni.getStorageSync('auth_token'),
phone: that.account,
sms_code: that.captcha,
spread: that.$Cache.get("spread"),
// #ifdef APP-PLUS
user_type: 'app',
// #endif
// #ifdef H5
user_type: 'h5',
// #endif
uni.showLoading({
title: '登录中'
})
login({
account: that.account,
code: that.captcha,
scene: 2, //
})
.then(({
data
}) => {
this.checkOpenId(data.user)
uni.showLoading({
title: '加载中'
})
// this.checkOpenId(data.user)
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
that.$store.commit("LOGIN", {
'token': data.token,
'time': data.exp
'time': Date.now()
});
that.$store.commit("SETUID", data.uid);
that.$store.commit("SET_USERINFO", {
account: that.account
});
that.$store.commit("SETUID", data.user.uid);
that.$store.commit('UPDATE_USERINFO', data.user);
let method
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
@ -666,14 +672,19 @@
return
}
uni[method]({
url: backUrl
url: backUrl,
success: () => {
uni.hideLoading();
}
});
})
.catch(res => {
.catch(e => {
uni.hideLoading();
that.$util.Tips({
title: res
title: e
});
});
},
async register() {
let that = this;
@ -699,30 +710,13 @@
title: '请勾选用户协议与隐私政策'
});
register({
auth_token: this.auth_token || uni.getStorageSync('auth_token'),
phone: that.account,
sms_code: that.captcha,
pwd: that.password,
spread: that.$Cache.get("spread"),
// #ifdef APP-PLUS
user_type: 'app',
// #endif
// #ifdef H5
user_type: 'h5',
// #endif
code: that.captcha,
password: that.password
})
.then(res => {
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
that.$store.commit("LOGIN", {
'token': res.data.token,
'time': res.data.exp
});
that.$store.commit("SETUID", res.data.user.uid);
that.$store.commit('UPDATE_USERINFO', res.data.user);
uni.switchTab({
url: '/pages/user/index'
})
Toast('注册成功');
that.formItem = 1;
})
.catch(res => {
that.$util.Tips({
@ -768,6 +762,7 @@
that.keyCode = data.data.key
})
that.isShowCode = true;
},
navTap: function(index) {
this.current = index;
@ -792,24 +787,28 @@
if (!that.isAgree) return that.$util.Tips({
title: '请勾选用户协议与隐私政策'
});
loginH5({
auth_token: uni.getStorageSync('auth_token'),
login({
account: that.account,
password: that.password,
spread: that.$Cache.get("spread")
scene: 1,
})
.then(({
data
}) => {
this.checkOpenId(data.user)
uni.showLoading({
title: '加载中'
})
// this.checkOpenId(data.user)
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
that.$store.commit("LOGIN", {
'token': data.token,
'time': data.exp
'time': Date.now()
});
that.$store.commit("SETUID", data.uid);
that.$store.commit("SET_USERINFO", {
account: that.account
});
that.$store.commit("SETUID", data.user.uid);
that.$store.commit('UPDATE_USERINFO', data.user);
let method
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
@ -828,7 +827,10 @@
return
}
uni[method]({
url: backUrl
url: backUrl,
success: () => {
uni.hideLoading();
}
});
})
.catch(e => {
@ -846,7 +848,8 @@
this.$refs.verify.hide();
this.code(data);
},
handleVerify() {
//
handleVerify(type = 'code') {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请输入手机号码'
@ -857,7 +860,10 @@
if (!that.isAgree) return that.$util.Tips({
title: '请勾选用户协议与隐私政策'
});
that.$refs.verify.show();
let data = 101;
if (type == 'register') data = 105
that.getCode(data);
// that.$refs.verify.show();
},
checkOpenId(user) {
if (user.wechat_user_id === 0) {

View File

@ -1,23 +1,492 @@
<template>
<view class=""></view>
<view :style="viewColor">
<form>
<view class='personal-data'>
<view class="wrapper" v-if="switchUserInfo.length>0">
<view class="wrapList">
<view class="item acea-row row-between-wrapper" :class="item.uid === userInfo.uid ? 'on' : ''"
:style="{ 'background-image': `url(${item.uid == userInfo.uid ? domain+'/static/diy/currentAcc'+keyColor+'.png' : '' })` }"
v-for="(item,index) in switchUserInfo" :key="index">
<view class="picTxt acea-row row-between-wrapper">
<block v-if='item.uid === userInfo.uid'>
<view class="pictrue" v-if="!mp_is_new" @click="uploadpic">
<image :src="item.avatar || '/static/images/f.png'"></image>
<view v-if="open_update_info != 0" class="radius"><span
class="iconfont iconfonta icon-jilu-xuanzhong"></span></view>
</view>
<button v-if="mp_is_new && open_update_info != 0" class="avatar-box pictrue" open-type="chooseAvatar"
@chooseavatar="onChooseAvatar">
<image :src="item.avatar || '/static/images/f.png'"></image>
<view class="radius"><span class="iconfont iconfonta icon-jilu-xuanzhong"></span></view>
</button>
<button v-else-if="mp_is_new && open_update_info == 0" class="avatar-box">
<image :src="item.avatar || '/static/images/f.png'"></image>
</button>
</block>
<view class="pictrue" v-else>
<image :src="item.avatar || '/static/images/f.png'"></image>
<view class="radius" v-if="open_update_info != 0"><span
class="iconfont iconfonta icon-jilu-xuanzhong"></span></view>
</view>
<view class="text">
<view class="name line1">{{ item.nickname }}</view>
</view>
</view>
<view class="currentBnt acea-row row-center-wrapper t-color" v-if='item.uid === userInfo.uid'>
当前账号
</view>
<view class="bnt t-color acea-row row-center-wrapper" @click='switchAccounts(item,index)' v-else>
使用账号
</view>
</view>
</view>
</view>
<view class="list" v-else>
<view class='item acea-row row-between-wrapper'>
<view>头像</view>
<view class="pictrue" v-if="!mp_is_new" @click="uploadpic">
<image class="avatar" :src="userInfo.avatar || '/static/images/f.png'"></image>
</view>
<button v-else class="avatar-box" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image :src="userInfo.avatar || '/static/images/f.png'"></image>
</button>
</view>
</view>
<view class='list' style="margin-top: 1rpx;">
<!-- <view class='item acea-row row-between-wrapper'>
<view>昵称</view>
<view class='input acea-row row-between-wrapper' @click="changeInput">
<input type='text' name='nickname' :value='userInfo.nickname'>
<text v-if="open_update_info != 0" class='iconfont icon-you'></text>
<text v-else class='iconfont icon-suozi'></text>
</view>
</view> -->
<view class='item acea-row row-between-wrapper'>
<view>ID号</view>
<view class='input acea-row row-between-wrapper'>
<input type='text' :value='userInfo.uid' disabled='true' class='id'></input>
<text class='iconfont icon-suozi'></text>
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view>手机号码</view>
<navigator url="/pages/users/user_phone/index" hover-class="none" class="input" v-if="!userInfo.account">
点击绑定手机号<text class="iconfont icon-xiangyou"></text>
</navigator>
<navigator url="/pages/users/user_modify_phone/index" hover-class="none"
class='input acea-row row-between-wrapper' v-else>
<input type='text' disabled='true' name='phone' :value='userInfo.account' class='id'></input>
<text class='iconfont icon-you'></text>
</navigator>
</view>
<view class='item acea-row row-between-wrapper'>
<view>登录密码</view>
<view class='input acea-row row-between-wrapper' @click="changePwd">
<input type='text' placeholder="修改登录密码" disabled='true' class='id'></input>
<text class='iconfont icon-you'></text>
</view>
</view>
<!--#ifdef APP-PLUS-->
<view class='item acea-row row-between-wrapper'>
<view>当前版本</view>
<view class='input acea-row row-between-wrapper'>
<input type='text' :value='version' disabled='true' class='id'></input>
</view>
</view>
<!--#endif-->
</view>
<!-- #ifdef H5 -->
<view class="logOut acea-row row-center-wrapper" @click="outLogin">退出登录</view>
<!-- #endif -->
<!-- #ifdef MP || APP-PLUS -->
<view class="logOut acea-row row-center-wrapper" @click="outLogin">退出登录</view>
<!-- #endif -->
<view class="foot-bar"></view>
</view>
</form>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
</view>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
getUserInfo,
userEdit,
getLogout,
userAcc,
editAvatar,
updateInfo
} from '@/api/user.js';
import {
logout
} from '@/api/apiUser.js';
import { mapGetters } from "vuex";
import { configMap } from '@/utils';
import authorize from '@/components/Authorize';
import Cache from '@/utils/cache';
import { HTTP_REQUEST_URL } from '@/config/app';
import { Toast } from '../../libs/uniApi';
export default {
components: {
authorize
},
data() {
return {
domain: HTTP_REQUEST_URL,
userInfo: {},
loginType: 'h5',
userIndex: 0,
switchUserInfo: [],
isAuto: false, //
isShowAuth: false, //
headBg: '../static/images/currentAcc',
mp_is_new: this.$Cache.get('MP_VERSION_ISNEW') || false,
version: ''
};
},
computed: configMap({ open_update_info: 0 }, mapGetters(['isLogin', 'viewColor', 'keyColor'])),
onLoad() {
this.version = uni.getSystemInfoSync().appVersion;
if (this.isLogin) {
this.getUserInfo();
} else {
this.isAuto = true;
this.isShowAuth = true
}
},
onLoad() {},
onShow() {},
methods: {},
onPullDownRefresh() {
uni.stopPullDownRefresh()
methods: {
/**
* 上传图片文件
*
*/
uploadpic: function() {
let that = this;
if (that.open_update_info == 0) {
return;
}
that.$util.uploadImageOne('upload/image', function(res) {
let userInfo = that.switchUserInfo[that.userIndex];
if (userInfo !== undefined) {
userInfo.avatar = res.data.path;
}
that.switchUserInfo[that.userIndex] = userInfo;
editAvatar({ avatar: res.data.path }).then((res) => {
that.$util.Tips({
title: res.message,
})
})
});
},
//
changeInput() {
},
/**
* 授权回调
*/
onLoadFun: function() {
this.isShowAuth = false;
this.getUserInfo();
},
//
authColse: function(e) {
this.isShowAuth = e
},
/**
* 退出登录
*
*/
outLogin: function() {
let that = this;
uni.showModal({
title: '提示',
content: '确认退出登录?',
success: function(res) {
if (res.confirm) {
logout()
.then(res => {
that.$store.commit("LOGOUT");
uni.reLaunch({
url: '/pages/login/login',
});
})
.catch(err => {
console.log('失败',err);
if(err.includes('登录超时')){
that.$store.commit("LOGOUT");
uni.reLaunch({
url: '/pages/login/login',
});
}else{
Toast(err);
}
});
} else if (res.cancel) {
// console.log('');
}
}
});
},
/**修改密码*/
changePwd() {
let that = this;
if (that.userInfo.account) {
uni.navigateTo({
url: `/pages/user/updatePassword`
})
} else {
that.$util.Tips({
title: '请先绑定手机号'
});
}
},
//
changeCancel() {
uni.navigateTo({
url: '/pages/users/user_about/index?from=' + 'the_cancellation_msg'
})
},
/**
* 获取用户详情
*/
getUserInfo: function() {
this.userInfo = this.$store.state.app.userInfo;
this.userInfo.uid = this.$store.state.app.uid;
console.log(this.userInfo);
}
}
}
</script>
<style lang="scss">
<style scoped lang="scss">
html {
-webkit-text-size-adjust: none;
}
.radius {
background-color: white;
width: 35rpx;
height: 35rpx;
border-radius: 50%;
border: 1px solid rgb(187, 43, 5);
line-height: 25rpx;
text-align: center;
position: absolute;
right: 0;
bottom: 0;
}
.iconfonta {
border-radius: 50%;
font-size: 20rpx;
color: red;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
}
.btnb {
border-radius: 0;
height: 100rpx;
line-height: 100rpx;
}
.btna {
height: 100rpx;
line-height: 100rpx;
border-radius: 10rpx 10rpx 0 0;
}
.btnc {
height: 130rpx;
line-height: 130rpx;
border-radius: 0;
}
.personal-data {
padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); /// IOS<11.2/
padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); /// IOS<11.2/
}
.personal-data .wrapper {
margin: 10rpx 0;
background-color: #fff;
padding: 36rpx 30rpx 13rpx 30rpx;
}
.personal-data .wrapper .title {
margin-bottom: 30rpx;
font-size: 32rpx;
color: #282828;
}
.personal-data .wrapper .wrapList .item {
width: 690rpx;
height: 160rpx;
background-color: #f8f8f8;
border-radius: 20rpx;
margin-bottom: 22rpx;
padding: 0 30rpx;
position: relative;
border: 2rpx solid #f8f8f8;
box-sizing: border-box;
}
.t-color {
color: var(--view-theme);
}
.personal-data .wrapper .wrapList .item.on {
border-color: var(--view-theme);
border-radius: 20rpx;
//background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAACgCAYAAADw+I85AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6M0QzNkY3NzlCNzJCMTFFOTgyNEU4QzhGQTRFRUY2REQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6M0QzNkY3N0FCNzJCMTFFOTgyNEU4QzhGQTRFRUY2REQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozRDM2Rjc3N0I3MkIxMUU5ODI0RThDOEZBNEVFRjZERCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozRDM2Rjc3OEI3MkIxMUU5ODI0RThDOEZBNEVFRjZERCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pn3rJMAAAArUSURBVHja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");
background-size: 100% 100%;
background-color: var(--view-minorColor);
background-repeat: no-repeat;
}
.personal-data .wrapper .wrapList .item .picTxt {
width: 445rpx;
}
.personal-data .wrapper .wrapList .item .picTxt .pictrue {
width: 96rpx;
height: 96rpx;
position: relative;
}
.personal-data .wrapper .wrapList .item .picTxt .pictrue image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.personal-data .wrapper .wrapList .item .picTxt .text {
width: 325rpx;
}
.personal-data .wrapper .wrapList .item .picTxt .text .name {
width: 100%;
font-size: 30rpx;
color: #282828;
}
.personal-data .wrapper .wrapList .item .picTxt .text .phone {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
}
.personal-data .wrapper .wrapList .item .bnt {
font-size: 24rpx;
background-color: #fff;
border-radius: 27rpx;
width: 140rpx;
height: 54rpx;
border: 2rpx solid var(--view-theme);
}
.personal-data .wrapper .wrapList .item .currentBnt {
position: absolute;
right: 0;
top: 0;
font-size: 26rpx;
background-color: var(--view-minorColor);
width: 140rpx;
height: 48rpx;
border-radius: 0 20rpx 0 20rpx;
}
.personal-data .list {
margin-top: 15rpx;
background-color: #fff;
}
.personal-data .list .item {
padding: 30rpx 30rpx 30rpx 0;
border-bottom: 1px solid #f2f2f2;
margin-left: 30rpx;
font-size: 32rpx;
color: #282828;
}
.personal-data .list .item .phone {
width: 160rpx;
height: 56rpx;
font-size: 24rpx;
color: #fff;
line-height: 56rpx;
border-radius: 32rpx
}
.personal-data .list .item .pictrue {
width: 88rpx;
height: 88rpx;
}
.personal-data .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.personal-data .list .item .input {
min-width: 415rpx;
text-align: right;
color: #868686;
}
.personal-data .list .item .input .id {
width: 365rpx;
}
.personal-data .list .item .input .iconfont {
font-size: 35rpx;
}
.personal-data .modifyBnt {
font-size: 32rpx;
color: #fff;
width: 690rpx;
height: 90rpx;
border-radius: 50rpx;
text-align: center;
line-height: 90rpx;
margin: 76rpx auto 0 auto;
background: var(--view-theme);
}
.personal-data .logOut {
font-size: 32rpx;
text-align: center;
width: 690rpx;
height: 90rpx;
border-radius: 45rpx;
margin: 30rpx auto 0 auto;
color: var(--view-theme);
border: 1px solid var(--view-theme);
}
.avatar-box {
width: 96rpx;
height: 96rpx;
background: transparent;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
</style>

View File

@ -0,0 +1,306 @@
<template>
<view :style="viewColor">
<view class="tab">
<u-tabs :list="tabList" :current="current" @change="change" :activeStyle="{color: '#333', fontSize: '32rpx'}" lineColor="#e93323"></u-tabs>
</view>
<form report-submit='true'>
<view>
<view class="ChangePassword">
<view class="list">
<view class="item">
<text class="phone">{{userInfo.account}}</text>
</view>
<view v-if="current==0" class="item acea-row row-between-wrapper codeVal">
<input type='number' placeholder='验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="handleVerify">
{{ text }}
</button>
</view>
<view v-else class="item">
<input type='password' placeholder='旧密码' placeholder-class='placeholder' v-model="old_password" autocomplete="off"></input>
</view>
<view class="border"></view>
<view class="item">
<input type='password' placeholder='新密码' placeholder-class='placeholder' v-model="password" autocomplete="off"></input>
</view>
<view class="item">
<input type='password' placeholder='确认新密码' placeholder-class='placeholder' v-model="password_confirm" autocomplete="off"></input>
</view>
</view>
</view>
<button form-type="submit" @click="confirmSubmit" class="confirmBnt">确认</button>
</view>
</form>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
</view>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { modifyPassword, verifyCode, appletsDecrypt } from '@/api/api.js';
import { registerVerify } from '@/api/user.js'
import { changePassword, indexCode, resetPassword } from '@/api/apiUser.js'
import {
mapGetters
} from "vuex";
import authorize from '@/components/Authorize';
import Verify from '@/components/verify/verify.vue';
import { Toast } from "../../libs/uniApi";
export default {
mixins: [sendVerifyCode],
components: {
authorize,
Verify
},
data() {
return {
userInfo: {},
account:'',
old_password: '',
password_confirm: '',
password: '',
captcha:'',
current: 0,
isAuto: false, //
isShowAuth: false, //
key: '',
codeVal: '',
disabled: false,
tabList: [
{name: '验证码'},
{name: '旧密码'},
]
};
},
computed: mapGetters(['isLogin', 'viewColor']),
onLoad() {
this.getUserInfo();
},
methods: {
change(e){
this.current = e.index;
},
onLoadFun:function(){
this.isShowAuth = false;
},
//
authColse: function(e) {
this.isShowAuth = e
},
/**
* 获取个人用户信息
*/
getUserInfo: function() {
this.userInfo = this.$store.state.app.userInfo;
},
confirmSubmit: function() {
let that = this;
if (!that.password) return that.$util.Tips({
title: '请填写密码!'
});
if (!that.password_confirm) return that.$util.Tips({
title: '请确认新密码!'
});
if (that.password !== that.password_confirm) return that.$util.Tips({
title: '两次密码不一致,请重新填写!'
});
if(this.current==0){
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
resetPassword({
phone: this.userInfo.account,
code: this.captcha,
password: this.password,
password_confirm: this.password_confirm
}).then(res => {
that.$util.Tips({
title: '修改成功!',
icon: 'success'
});
this.$u.sleep(800).then(()=>{
this.$store.commit('LOGOUT');
uni.reLaunch({
url:'/pages/login/login'
})
})
}).catch(err => {
return that.$util.Tips({
title: err
});
})
}
else if(this.current==1){
changePassword({
password: that.password,
password_confirm: that.password_confirm,
old_password: that.old_password
}).then(res => {
that.$util.Tips({
title: '修改成功!',
icon: 'success'
});
this.$u.sleep(800).then(()=>{
this.$store.commit('LOGOUT');
uni.reLaunch({
url:'/pages/login/login'
})
})
}).catch(err => {
return that.$util.Tips({
title: err
});
})
}
},
/**
* 发送验证码
*
*/
async code(data) {
let that = this;
// if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.userInfo.phone))) return that.$util.Tips({
// title: ''
// });
this.disabled = true
await registerVerify({
phone:that.userInfo.phone,
code:that.captcha,
type: 'change_pwd',
captchaType: 'blockPuzzle',
captchaVerification: data.captchaVerification
}).then(res => {
this.disabled = false
that.$util.Tips({
title: res.msg
});
that.sendCode();
}).catch(err => {
this.disabled = false
return that.$util.Tips({
title: err
});
});
},
success(data) {
this.$refs.verify.hide();
this.code(data);
},
handleVerify() {
indexCode({
phone: this.userInfo.account,
scene: 104 //
}).then((res)=>{
this.sendCode();
Toast('验证码已发送');
}).catch(e=>{
Toast(e)
})
}
}
}
</script>
<style lang="scss" scoped>
.tab{
background-color: #fff;
padding: 0 20rpx;
}
.ChangePassword{
background: #fff;
padding-top: 0;
}
.ChangePassword .phone {
font-size: 32rpx;
}
.ChangePassword .list .item {
width: 640rpx;
margin: 0 auto;
height: 110rpx;
border-bottom: 2rpx solid #f0f0f0;
display: flex;
align-items: center;
}
.ChangePassword .list .item input {
width: 100%;
font-size: 32rpx;
}
/deep/.uni-input-input{
// box-shadow: inset 0 0 0 0 #fff;
}
.ChangePassword .list .item .placeholder {
color: #b9b9bc;
}
.ChangePassword .list .item input.codeIput {
width: 340rpx;
}
.ChangePassword .list .item .code {
font-size: 32rpx;
position: relative;
padding-left: 26rpx;
color: var(--view-theme);
&::before{
content: "";
width: 1rpx;
height: 30rpx;
position: absolute;
top: 10rpx;
left: 0;
background: #DDDDDD;
display: inline-block;
}
}
.ChangePassword .list .item .code.on {
color: #b9b9bc !important;
}
.ChangePassword .list .border{
width: 100%;
height: 21rpx;
background: #F5F5F5;
}
.confirmBnt {
font-size: 32rpx;
width: 580rpx;
height: 90rpx;
border-radius: 45rpx;
color: #fff;
margin: 70rpx auto 0 auto;
text-align: center;
line-height: 90rpx;
background-color: var(--view-theme);
}
.getPhoneBtn{
font-size: 32rpx;
width: 580rpx;
height: 90rpx;
border-radius: 45rpx;
border: 1px solid var(--view-theme);
color: var(--view-theme);
margin: 40rpx auto 0 auto;
text-align: center;
line-height: 90rpx;
.iconfont{
font-size: 32rpx;
margin-right: 12rpx;
}
}
</style>

23
pages/user/user.vue Normal file
View File

@ -0,0 +1,23 @@
<template>
<view class=""></view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {},
onShow() {},
methods: {},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
</style>

BIN
static/images/code_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ const state = {
location: Cache.get('LOCATION_DATA', true) || {},
token: Cache.get(LOGIN_STATUS) || null,
backgroundColor: "#fff",
userInfo: Cache.get(USER_INFO)||null,
userInfo: Cache.get(USER_INFO, true)||null,
uid: Cache.get(UID) || null,
globalData: uni.getStorageSync('GLOBAL_DATA') || {},
homeActive: false,
@ -38,6 +38,7 @@ const mutations = {
uni.removeStorageSync('auth_token');
},
SET_USERINFO(state, opt){
console.log(opt);
state.userInfo = opt;
Cache.set(USER_INFO, opt);
},

View File

@ -13,6 +13,10 @@
*/
/* 颜色变量 */
@import '@/uni_modules/uview-ui/theme.scss';
/* 颜色变量 */
$uni-theme-color: #f45846;
$uni-theme-bg-color: linear-gradient(180deg, #f98649 0%, #f34e45 100%);
/* 行为相关颜色 */
$uni-color-primary: #007aff;

66
utils/encrypt.js Normal file
View File

@ -0,0 +1,66 @@
import Base64 from "@/utils/base64.js"
import cryptoJS from "crypto-js"
const key_code = 'gxzhptxiaochengxu_1';
// 加密
const encode = (key, data='')=>{
try{
let str;
typeof data == 'object'? str = JSON.stringify(data) : str = data;
str = cryptoJS.AES.encrypt(str, key_code).toString();
uni.setStorageSync(key, str)
return true;
}catch(e){
console.log(e);
return false;
}
}
// 解密
const decode = (key)=>{
try{
let str = uni.getStorageSync(key);
str = cryptoJS.AES.decrypt(str, key_code).toString(cryptoJS.enc.Utf8);
isJSON(str) ? str = JSON.parse(str) : null;
return str;
}catch(e){
console.log(e);
return undefined;
}
}
const isJSON = (str)=>{
try{
JSON.parse(str)
return true;
}catch(e){
return false;
}
}
const LOGIN = ()=>{
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api' + url,
method: 'POST',
data: data,
success: (res) => {
},
fail: (message) => {
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
export default {
encode,
decode
}

View File

@ -7,9 +7,11 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { HTTP_REQUEST_URL, HEADER, TOKENNAME } from '@/config/app';
import { HTTP_REQUEST_URL, HEADER, TOKENNAME, MD5KEY } from '@/config/app';
import { checkLogin } from '../libs/login';
import { Toast } from "../libs/uniApi.js";
import store from '../store';
import cryptoJS from "crypto-js"
function toLogin() {
@ -30,6 +32,9 @@ function baseRequest(url, method, data, {
}) {
let Url = HTTP_REQUEST_URL,
header = HEADER;
header.timestamp = Date.now();
header.sign = cryptoJS.MD5(`appid=${header.appid}&timestamp=${header.timestamp}&url=${header.url}&key=${MD5KEY}`).toString();
// 以上是中台必要的请求头加密校验,请勿更改
if (!noAuth) {
//登录过期自动登录
@ -41,32 +46,30 @@ function baseRequest(url, method, data, {
}
}
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api/' + url,
// url: '/baseUrlTest/api/'+url,
method: method || 'GET',
header: header,
data: data || {},
success: (res) => {
// #ifdef APP-PLUS
// console.log('app', Url + '/api/' + url, res.data);
// #endif
if (noVerify)
reslove(res.data, res);
else if (res.data.status == 200)
else if (res.data.code == 200||res.data.code == 1)
reslove(res.data, res);
else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
toLogin();
reject(res.data);
} else if (res.data.status == 501) {
} else if (res.data.code == 501) {
uni.reLaunch({
url: '/pages/error/index'
url: '/pages/error/error'
})
reject(res.data);
} else
reject(res.data.message || '系统错误');
reject(res.data.msg || '系统错误');
},
fail: (message) => {
reject('请求失败');

View File

@ -216,6 +216,18 @@ const loadMPurl = async (e) => {
};
// 加载本地自带小程序
const loadMPlocalhost = async (e) => {
appid = e.id;
wgtFile = e.file;
uni.showLoading({
title: '初始化中...',
mask: true
})
installMP();
};
// 小程序版本信息
const getVersion = (id) => {
appid = id;
@ -284,6 +296,7 @@ export default {
loadMP,
loadMPurl,
loadMPx,
loadMPlocalhost,
installMP,
doInstallMP,
getVersion,