Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product_new
commit
901f666fcb
|
@ -0,0 +1,20 @@
|
|||
FROM registry.cn-hangzhou.aliyuncs.com/lrh-public/openjdk:8u222-jre-up
|
||||
|
||||
LABEL Author="axzsd" \
|
||||
Email="atva725@qq.com" \
|
||||
Description="创盈支付服务端"
|
||||
|
||||
ENV SPRING_PROFILES_ACTIVE="dev"
|
||||
ENV JAVA_OPTIONS "-Xms800m -Xmx800m \
|
||||
-XX:+HeapDumpOnOutOfMemoryError \
|
||||
-Dfile.encoding=UTF-8 \
|
||||
-Djava.awt.headless=true \
|
||||
-Dsun.net.client.defaultConnectTimeout=10000 \
|
||||
-Dsun.net.client.defaultReadTimeout=30000"
|
||||
|
||||
|
||||
WORKDIR /work/projects/yudao-server
|
||||
COPY yudao-server/target/yudao-server.jar /opt/app.jar
|
||||
|
||||
EXPOSE 48080
|
||||
ENTRYPOINT exec java $JAVA_OPTIONS -jar -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /opt/app.jar
|
|
@ -0,0 +1,45 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
INTRANET_REGISTRY='192.168.1.124:10083'
|
||||
PUBLIC_REGISTRY='192.168.1.124:10083'
|
||||
IMAGE_NAMESPACE='cmx'
|
||||
IMAGE_NAME='yudao-server-api'
|
||||
GIT_BRANCH='feature/mall_product'
|
||||
Dockerfile='builds/Dockerfile'
|
||||
DockerComposefile='docker-compose-test.yml'
|
||||
}
|
||||
|
||||
|
||||
stages {
|
||||
stage('Pull Code') {
|
||||
steps {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "$GIT_BRANCH"]], extensions: [cloneOption(depth: 1, noTags: true, reference: '', shallow: true)], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/zenghuapei/cyywl_server.git']]])
|
||||
}
|
||||
}
|
||||
|
||||
stage('compile & buildImage->push') {
|
||||
steps {
|
||||
withMaven(maven: 'M3') {
|
||||
sh 'mvn clean package -Dmaven.test.skip=true'
|
||||
}
|
||||
withCredentials([usernamePassword(credentialsId: 'HxDockerRepo', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) {
|
||||
sh 'docker build -f $Dockerfile -t $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID .'
|
||||
sh 'echo "push start..."'
|
||||
sh 'docker push $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('SSH Deploy') {
|
||||
steps {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'halo-test-ssh', keyFileVariable: 'primaryKeyVar', usernameVariable: 'userVar')]) {
|
||||
sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/init_work_dir.sh | bash -s /opt/app/${IMAGE_NAME}"'
|
||||
sh 'scp -i ${primaryKeyVar} builds/${DockerComposefile} root@36.41.184.13:/opt/app/${IMAGE_NAME}'
|
||||
sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/docker_deploy.sh | bash -s /opt/app/${IMAGE_NAME} $PUBLIC_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID /opt/app/${IMAGE_NAME}/$DockerComposefile"'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
version: "3.9"
|
||||
services:
|
||||
yudao-server:
|
||||
image: ${IMAGE_VERSION}
|
||||
restart: always
|
||||
privileged: true
|
||||
container_name: yudao-server
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
SPRING_PROFILES_ACTIVE: test
|
||||
# volumes:
|
||||
# - /opt/logs/cyywl:/work/projects/yudao-server
|
||||
ulimits:
|
||||
nproc: 65535
|
||||
nofile:
|
||||
soft: 20000
|
||||
hard: 40000
|
||||
ports:
|
||||
- "48080:48080"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 800MB
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:48080/cyyywl-api/actuator/health"]
|
||||
timeout: 30s
|
||||
interval: 45s
|
||||
retries: 3
|
|
@ -1,5 +1,7 @@
|
|||
server:
|
||||
port: 48080
|
||||
servlet:
|
||||
context-path: /cyyywl-api
|
||||
|
||||
--- #################### 数据库相关配置 ####################
|
||||
|
||||
|
|
|
@ -1,26 +1,30 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<doc-alert title="SaaS 多租户" url="https://doc.iocoder.cn/saas-tenant/" />
|
||||
<doc-alert title="SaaS 多租户" url="https://doc.iocoder.cn/saas-tenant/"/>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="租户名" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入租户名" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable @keyup.enter.native="handleQuery"/>
|
||||
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系手机" prop="contactMobile">
|
||||
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable @keyup.enter.native="handleQuery"/>
|
||||
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择租户状态" clearable>
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
|
@ -32,54 +36,47 @@
|
|||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['system:tenant:create']">新增</el-button>
|
||||
v-hasPermi="['system:tenant:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['system:tenant:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['system:tenant:export']">导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="租户编号" align="center" prop="id" />
|
||||
<el-table-column label="租户名" align="center" prop="name" />
|
||||
<el-table-column label="租户套餐" align="center" prop="packageId">
|
||||
<el-table-column label="编号" align="center" prop="id"/>
|
||||
<el-table-column label="店铺LOGO" align="center" prop="logo">
|
||||
<template v-slot="scope">
|
||||
<el-tag v-if="scope.row.packageId === 0" type="danger">系统租户</el-tag>
|
||||
<el-tag v-else> {{getPackageName(scope.row.packageId)}} </el-tag>
|
||||
<img :src="scope.row.logo" width="50" height="50" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系人" align="center" prop="contactName" />
|
||||
<el-table-column label="联系手机" align="center" prop="contactMobile" />
|
||||
<el-table-column label="账号额度" align="center" prop="accountCount">
|
||||
<template v-slot="scope">
|
||||
<el-tag> {{scope.row.accountCount}} </el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="过期时间" align="center" prop="expireTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.expireTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="绑定域名" align="center" prop="domain" width="180" />
|
||||
<el-table-column label="租户状态" align="center" prop="status">
|
||||
<el-table-column label="店铺名称" align="center" prop="name"/>
|
||||
<el-table-column label="销售对接人" align="center" prop="saleContactName"/>
|
||||
<el-table-column label="销售对接号码" align="center" prop="saleContactMobile"/>
|
||||
<el-table-column label="店铺负责人" align="center" prop="contactName"/>
|
||||
<el-table-column label="店铺负责人号码" align="center" prop="contactMobile"/>
|
||||
<el-table-column label="店铺状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:tenant:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:tenant:delete']">删除</el-button>
|
||||
<el-button size="mini" type="text" @click="handleLook(scope.row)"
|
||||
v-hasPermi="['system:tenant:update']">查看
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:tenant:update']">编辑
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:tenant:delete']">禁用
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -88,44 +85,77 @@
|
|||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="租户名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入租户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户套餐" prop="packageId">
|
||||
<el-select v-model="form.packageId" placeholder="请选择租户套餐" clearable size="small">
|
||||
<el-option v-for="item in packageList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="form.contactName" placeholder="请输入联系人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系手机" prop="contactMobile">
|
||||
<el-input v-model="form.contactMobile" placeholder="请输入联系手机" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.id === undefined" label="用户名称" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入用户名称" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.id === undefined" label="用户密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号额度" prop="accountCount">
|
||||
<el-input-number v-model="form.accountCount" placeholder="请输入账号额度" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="过期时间" prop="expireTime">
|
||||
<el-date-picker clearable size="small" v-model="form.expireTime" type="date"
|
||||
value-format="timestamp" placeholder="请选择过期时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定域名" prop="domain">
|
||||
<el-input v-model="form.domain" placeholder="请输入绑定域名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px" :disabled="isLook">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="微信客户地址" prop="wxKfUrl">
|
||||
<el-input v-model="form.wxKfUrl" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="销售对接人" prop="saleContactName">
|
||||
<el-input v-model="form.saleContactName" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="销售对接号码" prop="saleContactMobile">
|
||||
<el-input v-model="form.saleContactMobile" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺负责人" prop="contactName">
|
||||
<el-input v-model="form.contactName" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺负责人号码" prop="contactMobile">
|
||||
<el-input v-model="form.contactMobile" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺LOGO图片" prop="logo">
|
||||
<el-input v-model="form.logo" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="店铺简介" prop="introduction">
|
||||
<el-input v-model="form.introduction" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="服务时间" prop="serviceTime">
|
||||
<el-input v-model="form.serviceTime" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="服务电话" prop="serviceMobile">
|
||||
<el-input v-model="form.serviceMobile" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
|
@ -136,14 +166,20 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { createTenant, updateTenant, deleteTenant, getTenant, getTenantPage, exportTenantExcel } from "@/api/system/tenant";
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
import {getTenantPackageList} from "@/api/system/tenantPackage";
|
||||
import {
|
||||
createTenant,
|
||||
updateTenant,
|
||||
deleteTenant,
|
||||
getTenant,
|
||||
getTenantPage,
|
||||
exportTenantExcel
|
||||
} from '@/api/system/tenant';
|
||||
import {CommonStatusEnum} from '@/utils/constants'
|
||||
import {getTenantPackageList} from '@/api/system/tenantPackage';
|
||||
|
||||
export default {
|
||||
name: "SystemTenant",
|
||||
components: {
|
||||
},
|
||||
name: 'SystemTenant',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
@ -159,7 +195,7 @@ export default {
|
|||
// 租户套餐列表
|
||||
packageList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
|
@ -174,17 +210,44 @@ export default {
|
|||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
isLook: false,
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "租户名不能为空", trigger: "blur" }],
|
||||
packageId: [{ required: true, message: "租户套餐不能为空", trigger: "blur" }],
|
||||
contactName: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
|
||||
status: [{ required: true, message: "租户状态不能为空", trigger: "blur" }],
|
||||
accountCount: [{ required: true, message: "账号额度不能为空", trigger: "blur" }],
|
||||
expireTime: [{ required: true, message: "过期时间不能为空", trigger: "blur" }],
|
||||
domain: [{ required: true, message: "绑定域名不能为空", trigger: "blur" }],
|
||||
username: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }],
|
||||
name: [{
|
||||
required: true,
|
||||
message: '名称不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
wxKfUrl: [{
|
||||
required: true,
|
||||
message: '微信客服地址不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
contactName: [{
|
||||
required: true,
|
||||
message: '店铺负责人不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
contactMobile: [{
|
||||
required: true,
|
||||
message: '店铺负责人号码不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
introduction: [{
|
||||
required: true,
|
||||
message: '店铺简介不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
serviceTime: [{
|
||||
required: true,
|
||||
message: '服务不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
serviceMobile: [{
|
||||
required: true,
|
||||
message: '服务不能为空',
|
||||
trigger: 'blur'
|
||||
}]
|
||||
}
|
||||
};
|
||||
},
|
||||
|
@ -224,7 +287,7 @@ export default {
|
|||
domain: undefined,
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
};
|
||||
this.resetForm("form");
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
|
@ -233,35 +296,44 @@ export default {
|
|||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
handleLook(row){
|
||||
this.form = row
|
||||
this.open = true
|
||||
this.isLook = true
|
||||
this.title = '查看店铺'
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加租户";
|
||||
this.isLook = false;
|
||||
this.title = '添加店铺';
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.isLook = false;
|
||||
const id = row.id;
|
||||
getTenant(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改租户";
|
||||
this.title = '修改店铺';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateTenant(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
@ -269,7 +341,7 @@ export default {
|
|||
}
|
||||
// 添加的提交
|
||||
createTenant(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
@ -278,12 +350,13 @@ export default {
|
|||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除租户编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteTenant(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.$modal.confirm('是否确认删除店铺编号为"' + id + '"的数据项?').then(function () {
|
||||
return deleteTenant(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
|
@ -293,12 +366,13 @@ export default {
|
|||
params.pageSize = undefined;
|
||||
// 执行导出
|
||||
this.$modal.confirm('是否确认导出所有租户数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportTenantExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '租户.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.exportLoading = true;
|
||||
return exportTenantExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '租户.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 套餐名格式化 */
|
||||
getPackageName(packageId) {
|
||||
|
|
|
@ -1,224 +1,249 @@
|
|||
<script>
|
||||
import {
|
||||
checkLogin
|
||||
} from "./libs/login";
|
||||
import {
|
||||
HTTP_REQUEST_URL
|
||||
} from './config/app';
|
||||
import Auth from './libs/wechat.js';
|
||||
import Routine from './libs/routine.js';
|
||||
import Apps from './libs/apps.js';
|
||||
import {
|
||||
mapActions
|
||||
} from 'vuex'
|
||||
import {
|
||||
checkLogin
|
||||
} from "./libs/login";
|
||||
import {
|
||||
refreshToken
|
||||
} from "@/api/api";
|
||||
import {
|
||||
HTTP_REQUEST_URL
|
||||
} from './config/app';
|
||||
import Auth from './libs/wechat.js';
|
||||
import Routine from './libs/routine.js';
|
||||
import Apps from './libs/apps.js';
|
||||
import {
|
||||
mapActions
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
globalData: {
|
||||
spid: 0,
|
||||
code: 0,
|
||||
isLogin: false,
|
||||
userInfo: {},
|
||||
MyMenus: [],
|
||||
windowHeight: 0,
|
||||
id: 0
|
||||
},
|
||||
onLaunch: function(option) {
|
||||
let that = this;
|
||||
// #ifdef H5
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
// 首页没有title获取的整个页面的高度,里面的页面有原生标题要减掉就是视口的高度
|
||||
// 状态栏是动态的可以拿到 标题栏是固定写死的是44px
|
||||
let height = res.windowHeight - res.statusBarHeight - 44
|
||||
// #ifdef H5
|
||||
that.globalData.windowHeight = res.windowHeight + 'px'
|
||||
// #endif
|
||||
export default {
|
||||
globalData: {
|
||||
spid: 0,
|
||||
code: 0,
|
||||
isLogin: false,
|
||||
userInfo: {},
|
||||
MyMenus: [],
|
||||
windowHeight: 0,
|
||||
id: 0
|
||||
},
|
||||
onLaunch: function(option) {
|
||||
let that = this;
|
||||
// #ifdef H5
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
// 首页没有title获取的整个页面的高度,里面的页面有原生标题要减掉就是视口的高度
|
||||
// 状态栏是动态的可以拿到 标题栏是固定写死的是44px
|
||||
let height = res.windowHeight - res.statusBarHeight - 44
|
||||
// #ifdef H5
|
||||
that.globalData.windowHeight = res.windowHeight + 'px'
|
||||
// #endif
|
||||
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef MP
|
||||
if (HTTP_REQUEST_URL == '') {
|
||||
console.error(
|
||||
"请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (option.query.hasOwnProperty('scene')) {
|
||||
switch(option.scene){
|
||||
case 1047: //扫描小程序码
|
||||
case 1048: //长按图片识别小程序码
|
||||
case 1049: //手机相册选取小程序码
|
||||
case 1001: //直接进入小程序
|
||||
let value = this.$util.getUrlParams(decodeURIComponent(option.query.scene));
|
||||
let values = value.split(',');
|
||||
if(values.length === 2){
|
||||
let v1 = values[0].split(":");
|
||||
if (v1[0] === 'pid') {
|
||||
that.globalData.spid = v1[1];
|
||||
} else{
|
||||
that.globalData.id = v1[1];
|
||||
}
|
||||
let v2 = values[1].split(":");
|
||||
if (v2[0] === 'pid') {
|
||||
that.globalData.spid = v2[1];
|
||||
}else{
|
||||
that.globalData.id = v2[1];
|
||||
}
|
||||
}else{
|
||||
that.globalData.spid = values[0].split(":")[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// 获取导航高度;
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
|
||||
}
|
||||
});
|
||||
// #ifdef MP
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
if (HTTP_REQUEST_URL == '') {
|
||||
console.error(
|
||||
"请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (option.query.hasOwnProperty('scene')) {
|
||||
switch (option.scene) {
|
||||
case 1047: //扫描小程序码
|
||||
case 1048: //长按图片识别小程序码
|
||||
case 1049: //手机相册选取小程序码
|
||||
case 1001: //直接进入小程序
|
||||
let value = this.$util.getUrlParams(decodeURIComponent(option.query.scene));
|
||||
let values = value.split(',');
|
||||
if (values.length === 2) {
|
||||
let v1 = values[0].split(":");
|
||||
if (v1[0] === 'pid') {
|
||||
that.globalData.spid = v1[1];
|
||||
} else {
|
||||
that.globalData.id = v1[1];
|
||||
}
|
||||
let v2 = values[1].split(":");
|
||||
if (v2[0] === 'pid') {
|
||||
that.globalData.spid = v2[1];
|
||||
} else {
|
||||
that.globalData.id = v2[1];
|
||||
}
|
||||
} else {
|
||||
that.globalData.spid = values[0].split(":")[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// 获取导航高度;
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
|
||||
}
|
||||
});
|
||||
// #ifdef MP
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
let snsapiBase = 'snsapi_base';
|
||||
let urlData = location.pathname + location.search;
|
||||
if (!that.$store.getters.isLogin && Auth.isWeixin()) {
|
||||
const {
|
||||
code,
|
||||
state,
|
||||
scope
|
||||
} = option.query;
|
||||
if (code && code != uni.getStorageSync('snsapiCode') && location.pathname.indexOf(
|
||||
'/pages/users/wechat_login/index') === -1) {
|
||||
// 存储静默授权code
|
||||
uni.setStorageSync('snsapiCode', code);
|
||||
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
||||
Auth.auth(code, that.$Cache.get('spread'))
|
||||
.then(res => {
|
||||
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query
|
||||
.back_url)));
|
||||
if (res.type === 'register') {
|
||||
this.$Cache.set('snsapiKey', res.key);
|
||||
}
|
||||
if (res.type === 'login') {
|
||||
this.$store.commit('LOGIN', {
|
||||
token: res.token
|
||||
});
|
||||
this.$store.commit("SETUID", res.uid);
|
||||
location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url)));
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// this.$util.Tips({
|
||||
// title: error
|
||||
// });
|
||||
if (!this.$Cache.has('snsapiKey')) {
|
||||
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
|
||||
Auth.oAuth(snsapiBase, option.query.back_url);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!this.$Cache.has('snsapiKey')) {
|
||||
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
|
||||
Auth.oAuth(snsapiBase, urlData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (option.query.back_url) {
|
||||
location.replace(uni.getStorageSync('snRouter'));
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
let snsapiBase = 'snsapi_base';
|
||||
let urlData = location.pathname + location.search;
|
||||
if (!that.$store.getters.isLogin && Auth.isWeixin()) {
|
||||
const {
|
||||
code,
|
||||
state,
|
||||
scope
|
||||
} = option.query;
|
||||
if (code && code != uni.getStorageSync('snsapiCode') && location.pathname.indexOf(
|
||||
'/pages/users/wechat_login/index') === -1) {
|
||||
// 存储静默授权code
|
||||
uni.setStorageSync('snsapiCode', code);
|
||||
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
||||
Auth.auth(code, that.$Cache.get('spread'))
|
||||
.then(res => {
|
||||
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query
|
||||
.back_url)));
|
||||
if (res.type === 'register') {
|
||||
this.$Cache.set('snsapiKey', res.key);
|
||||
}
|
||||
if (res.type === 'login') {
|
||||
this.$store.commit('LOGIN', {
|
||||
token: res.token
|
||||
});
|
||||
this.$store.commit("SETUID", res.uid);
|
||||
location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url)));
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// this.$util.Tips({
|
||||
// title: error
|
||||
// });
|
||||
if (!this.$Cache.has('snsapiKey')) {
|
||||
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
|
||||
Auth.oAuth(snsapiBase, option.query.back_url);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!this.$Cache.has('snsapiKey')) {
|
||||
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
|
||||
Auth.oAuth(snsapiBase, urlData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (option.query.back_url) {
|
||||
location.replace(uni.getStorageSync('snRouter'));
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef MP
|
||||
// 小程序静默授权
|
||||
if (!this.$store.getters.isLogin) {
|
||||
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
||||
Routine.getCode()
|
||||
.then(code => {
|
||||
Routine.authUserInfo(code, {
|
||||
'spread_spid': spread
|
||||
}).then(res => {
|
||||
// that.$store.commit('AuthorizeType', res.data.type);
|
||||
})
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
async mounted() {
|
||||
if(this.$store.getters.isLogin && !this.$Cache.get('USER_INFO'))await this.$store.dispatch('USERINFO');
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
onShow: function() {
|
||||
// #ifdef H5
|
||||
uni.getSystemInfo({
|
||||
success(e) {
|
||||
/* 窗口宽度大于420px且不在PC页面且不在移动设备时跳转至 PC.html 页面 */
|
||||
if (e.windowWidth > 420 && !window.top.isPC && !/iOS|Android/i.test(e.system)) {
|
||||
// window.location.pathname = 'https://java.crmeb.net/';
|
||||
/* 若你的项目未设置根目录(默认为 / 时),则使用下方代码 */
|
||||
window.location.pathname = '/static/html/pc.html';
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
onHide: function() {
|
||||
//console.log('App Hide')
|
||||
}
|
||||
}
|
||||
// #ifdef MP
|
||||
// 小程序静默授权
|
||||
if (!this.$store.getters.isLogin) {
|
||||
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
||||
Routine.getCode()
|
||||
.then(code => {
|
||||
Routine.authUserInfo(code, {
|
||||
'spread_spid': spread
|
||||
}).then(res => {
|
||||
// that.$store.commit('AuthorizeType', res.data.type);
|
||||
})
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
async mounted() {
|
||||
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
|
||||
await this.$store.dispatch('USERINFO');
|
||||
}
|
||||
setInterval(() => {
|
||||
if (this.$store.getters.isLogin) {
|
||||
this.setRefreshToken()
|
||||
}
|
||||
}, 60000)
|
||||
},
|
||||
methods: {
|
||||
setRefreshToken() {
|
||||
refreshToken(this.$Cache.get("REFRESH_TOKEN"))
|
||||
.then(res => {
|
||||
let data = res.data;
|
||||
this.$store.commit("LOGIN", {
|
||||
'token': data.accessToken,
|
||||
'refreshToken': data.refreshToken
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
this.$util.Tips({
|
||||
title: res
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
onShow: function() {
|
||||
// #ifdef H5
|
||||
uni.getSystemInfo({
|
||||
success(e) {
|
||||
/* 窗口宽度大于420px且不在PC页面且不在移动设备时跳转至 PC.html 页面 */
|
||||
if (e.windowWidth > 420 && !window.top.isPC && !/iOS|Android/i.test(e.system)) {
|
||||
// window.location.pathname = 'https://java.crmeb.net/';
|
||||
/* 若你的项目未设置根目录(默认为 / 时),则使用下方代码 */
|
||||
window.location.pathname = '/static/html/pc.html';
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
onHide: function() {
|
||||
//console.log('App Hide')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url("@/plugin/animate/animate.min.css");
|
||||
@import 'static/css/base.css';
|
||||
@import 'static/iconfont/iconfont.css';
|
||||
@import 'static/css/guildford.css';
|
||||
@import 'static/css/style.scss';
|
||||
@import url("@/plugin/animate/animate.min.css");
|
||||
@import 'static/css/base.css';
|
||||
@import 'static/iconfont/iconfont.css';
|
||||
@import 'static/css/guildford.css';
|
||||
@import 'static/css/style.scss';
|
||||
|
||||
/* 条件编译,仅在H5平台生效 */
|
||||
// #ifdef H5
|
||||
body::-webkit-scrollbar,
|
||||
html::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
/* 条件编译,仅在H5平台生效 */
|
||||
// #ifdef H5
|
||||
body::-webkit-scrollbar,
|
||||
html::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// #endif
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
// #endif
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.bg-color-red {
|
||||
background-color: #E93323 !important;
|
||||
}
|
||||
.bg-color-red {
|
||||
background-color: #E93323 !important;
|
||||
}
|
||||
|
||||
.syspadding {
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
.syspadding {
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.uni-scroll-view::-webkit-scrollbar {
|
||||
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
||||
display: none
|
||||
}
|
||||
.uni-scroll-view::-webkit-scrollbar {
|
||||
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
||||
display: none
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import request from "@/utils/request.js";
|
||||
/**
|
||||
* 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取主页数据 无需授权
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getIndexData()
|
||||
{
|
||||
|
@ -15,17 +15,22 @@ export function getIndexData()
|
|||
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getLogo()
|
||||
{
|
||||
return request.get('wechat/getLogo', {}, { noAuth : true});
|
||||
}
|
||||
|
||||
export function refreshToken(token)
|
||||
{
|
||||
return request.post('member/auth/refresh-token?refreshToken=' + token, {}, { noAuth : true});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存form_id
|
||||
* @param string formId
|
||||
* @param string formId
|
||||
*/
|
||||
export function setFormId(formId) {
|
||||
return request.post("wechat/set_form_id", { formId: formId});
|
||||
|
@ -34,7 +39,7 @@ export function setFormId(formId) {
|
|||
/**
|
||||
* 领取优惠卷
|
||||
* @param int couponId
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function setCouponReceive(couponId){
|
||||
return request.post('coupon/receive', { couponId: couponId});
|
||||
|
@ -57,7 +62,7 @@ export function getUserCoupons(data){
|
|||
|
||||
/**
|
||||
* 文章分类列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleCategoryList(){
|
||||
return request.get('article/category/list',{},{noAuth:true})
|
||||
|
@ -66,7 +71,7 @@ export function getArticleCategoryList(){
|
|||
/**
|
||||
* 文章列表
|
||||
* @param int cid
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleList(cid,data){
|
||||
return request.get('article/list/' + cid, data,{noAuth:true})
|
||||
|
@ -74,7 +79,7 @@ export function getArticleList(cid,data){
|
|||
|
||||
/**
|
||||
* 文章 热门列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleHotList(){
|
||||
return request.get('article/hot/list',{},{noAuth:true});
|
||||
|
@ -82,7 +87,7 @@ export function getArticleHotList(){
|
|||
|
||||
/**
|
||||
* 文章 轮播列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function getArticleBannerList(){
|
||||
return request.get('article/banner/list',{},{noAuth:true})
|
||||
|
@ -90,8 +95,8 @@ export function getArticleBannerList(){
|
|||
|
||||
/**
|
||||
* 文章详情
|
||||
* @param int id
|
||||
*
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function getArticleDetails(id){
|
||||
return request.get('article/info',id,{noAuth:true});
|
||||
|
@ -124,7 +129,7 @@ export function registerVerify(phone){
|
|||
/**
|
||||
* 手机号注册
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneRegister(data){
|
||||
return request.post('register',data,{noAuth:true});
|
||||
|
@ -133,7 +138,7 @@ export function phoneRegister(data){
|
|||
/**
|
||||
* 手机号修改密码
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneRegisterReset(data){
|
||||
return request.post('register/reset',data,{noAuth:true})
|
||||
|
@ -142,7 +147,7 @@ export function phoneRegisterReset(data){
|
|||
/**
|
||||
* 手机号+密码登录
|
||||
* @param object data
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function phoneLogin(data){
|
||||
return request.post('login',data,{noAuth:true})
|
||||
|
@ -169,7 +174,7 @@ export function switchH5Login() {
|
|||
|
||||
/**
|
||||
* 换绑手机号
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function bindingPhone(data){
|
||||
return request.post('update/binding',data);
|
||||
|
@ -177,7 +182,7 @@ export function bindingPhone(data){
|
|||
|
||||
/**
|
||||
* 换绑手机号校验
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function bindingVerify(data){
|
||||
return request.post('update/binding/verify',data);
|
||||
|
@ -185,7 +190,7 @@ export function bindingVerify(data){
|
|||
|
||||
/**
|
||||
* 退出登錄
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function logout(){
|
||||
return request.get('logout');
|
||||
|
@ -211,7 +216,7 @@ export function pink()
|
|||
* 获取城市信息
|
||||
*/
|
||||
export function getCity() {
|
||||
return request.get('city/list', { }, { noAuth: true });
|
||||
return request.get('area/tree', { }, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,9 +5,10 @@ import Cache from "@/utils/cache.js"
|
|||
*
|
||||
*/
|
||||
export function getUserInfo(){
|
||||
return request.get('user');
|
||||
return request.get('member/user/get');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置用户分享
|
||||
*
|
||||
|
@ -43,8 +44,8 @@ export function getCodeApi() {
|
|||
* h5用户发送验证码
|
||||
* @param data object 用户手机号
|
||||
*/
|
||||
export function registerVerify(phone){
|
||||
return request.post('member/auth/send-sms-code', { mobile: phone, scene: 4 },{noAuth:true},1)
|
||||
export function registerVerify(phone, scene){
|
||||
return request.post('member/auth/send-sms-code', { mobile: phone, scene },{noAuth:true},1)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,7 @@ export function register(data) {
|
|||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function registerReset(data) {
|
||||
return request.post("register/reset", data, { noAuth: true });
|
||||
return request.post("member/auth/reset-password", data, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,14 +291,14 @@ export function getAddressDetail(id){
|
|||
* @param object
|
||||
*/
|
||||
export function userEdit(data){
|
||||
return request.post('user/edit',data);
|
||||
return request.post('member/user/update-user',data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登录
|
||||
* */
|
||||
export function getLogout() {
|
||||
return request.get("logout");
|
||||
return request.post("member/auth/logout");
|
||||
}
|
||||
/**
|
||||
* 小程序充值
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = {
|
|||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
// 回话密钥名称 请勿修改此配置
|
||||
TOKENNAME: 'Authori-zation',
|
||||
TOKENNAME: 'Authorization',
|
||||
// 缓存时间 0 永久
|
||||
EXPIRE:0,
|
||||
//分页最多显示条数
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module.exports = {
|
||||
//token
|
||||
LOGIN_STATUS: 'LOGIN_STATUS_TOKEN',
|
||||
REFRESH_TOKEN: 'REFRESH_TOKEN',
|
||||
// uid
|
||||
UID:'UID',
|
||||
//用户信息
|
||||
|
|
|
@ -241,6 +241,12 @@
|
|||
"navigationBarTitleText": "地址管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_spread_user/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分销中心"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_address/index",
|
||||
"style": {
|
||||
|
@ -269,7 +275,7 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "修改密码",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
// #ifdef MP
|
||||
,
|
||||
"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
|
@ -314,7 +320,7 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "推广人排行",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
// #ifdef MP
|
||||
,
|
||||
"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
|
@ -522,6 +528,12 @@
|
|||
"selectedIconPath": "static/images/2-002.png",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/order_addcart/order_addcart",
|
||||
"iconPath": "static/images/3-001.png",
|
||||
"selectedIconPath": "static/images/3-002.png",
|
||||
"text": "会员申请"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/order_addcart/order_addcart",
|
||||
"iconPath": "static/images/3-001.png",
|
||||
|
@ -544,4 +556,4 @@
|
|||
"query": "" //启动参数,在页面的onLoad函数里面得到
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,33 +21,33 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="num" v-if="userInfo.phone && uid" @click="goEdit()">
|
||||
<view class="num-txt">{{userInfo.phone}}</view>
|
||||
<view class="num" v-if="userInfo.mobile && uid" @click="goEdit()">
|
||||
<view class="num-txt">{{userInfo.mobile}}</view>
|
||||
<view class="icon">
|
||||
<image src="/static/images/edit.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone">绑定手机号</view>
|
||||
<view class="phone" v-if="!userInfo.mobile && isLogin" @tap="bindPhone">绑定手机号</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="num-wrapper">
|
||||
<view class="num-item" @click="goMenuPage('/pages/users/user_money/index')">
|
||||
<!-- <view class="num-item" @click="goMenuPage('/pages/users/user_money/index')">
|
||||
<text
|
||||
class="num">{{userInfo.nowMoney && uid ?Number(userInfo.nowMoney).toFixed(2):0}}</text>
|
||||
<view class="txt">余额</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="num-item" @click="goMenuPage('/pages/users/user_integral/index')">
|
||||
<text class="num">{{userInfo.integral && uid ? userInfo.integral: 0}}</text>
|
||||
<view class="txt">积分</view>
|
||||
</view>
|
||||
<view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
|
||||
<!-- <view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
|
||||
<text class="num">{{userInfo.couponCount && uid ? userInfo.couponCount : 0}}</text>
|
||||
<view class="txt">优惠券</view>
|
||||
</view>
|
||||
<view class="num-item" @click="goMenuPage('/pages/users/user_goods_collection/index')">
|
||||
<text class="num">{{userInfo.collectCount && uid ? userInfo.collectCount : 0}}</text>
|
||||
<view class="txt">收藏</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <view class="sign" @click="goSignIn">签到</view> -->
|
||||
</view>
|
||||
|
@ -91,11 +91,15 @@
|
|||
<view class="menu-title">我的服务</view>
|
||||
<view class="list-box">
|
||||
<block v-for="(item,index) in MyMenus" :key="index">
|
||||
<navigator class="item" :url="item.url" hover-class="none"
|
||||
<!-- <navigator class="item" :url="item.url" hover-class="none"
|
||||
v-if="!(item.url =='/pages/service/index' || (item.url =='/pages/users/user_spread_user/index' && !userInfo.isPromoter))">
|
||||
<image :src="item.pic"></image>
|
||||
<text>{{item.name}}</text>
|
||||
</navigator>
|
||||
</navigator> -->
|
||||
<navigator class="item" :url="item.url" hover-class="none">
|
||||
<image :src="item.pic"></image>
|
||||
<text>{{item.name}}</text>
|
||||
</navigator>
|
||||
</block>
|
||||
<!-- #ifndef MP -->
|
||||
<view class="item" @click="kefuClick">
|
||||
|
@ -187,7 +191,18 @@
|
|||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
orderStatusNum: {},
|
||||
MyMenus: [],
|
||||
MyMenus: [
|
||||
{
|
||||
pic: '/static/images/address.png',
|
||||
url: '/pages/users/user_address_list/index',
|
||||
name: '收货地址'
|
||||
},
|
||||
{
|
||||
pic: '/static/images/record4.png',
|
||||
url: '/pages/users/user_spread_user/index',
|
||||
name: '分销中心'
|
||||
},
|
||||
],
|
||||
wechatUrl: [],
|
||||
servicePic: '/static/images/customer.png',
|
||||
sysHeight: sysHeight,
|
||||
|
@ -207,7 +222,7 @@
|
|||
// #ifdef H5
|
||||
that.$set(that, 'pageHeight', app.globalData.windowHeight);
|
||||
// #endif
|
||||
that.$set(that, 'MyMenus', app.globalData.MyMenus);
|
||||
// that.$set(that, 'MyMenus', app.globalData.MyMenus);
|
||||
if (!this.$Cache.has('cityList')) this.getCityList();
|
||||
if (that.isLogin == false) {
|
||||
// #ifdef H5
|
||||
|
@ -225,7 +240,6 @@
|
|||
});
|
||||
// #endif
|
||||
if (that.isLogin) {
|
||||
this.getMyMenus();
|
||||
// this.setVisit();
|
||||
this.getOrderData();
|
||||
this.$store.dispatch('USERINFO');
|
||||
|
@ -278,7 +292,7 @@
|
|||
},
|
||||
// 授权回调
|
||||
onLoadFun() {
|
||||
this.getMyMenus();
|
||||
// this.getMyMenus();
|
||||
// this.setVisit();
|
||||
this.getOrderData();
|
||||
},
|
||||
|
@ -299,26 +313,6 @@
|
|||
url: '/pages/users/app_login/index'
|
||||
})
|
||||
},
|
||||
/**
|
||||
*
|
||||
* 获取个人中心图标
|
||||
*/
|
||||
getMyMenus: function() {
|
||||
let that = this;
|
||||
if (this.MyMenus.length) return;
|
||||
getMenuList().then(res => {
|
||||
that.$set(that, 'MyMenus', res.data.routine_my_menus);
|
||||
that.wechatUrl = res.data.routine_my_menus.filter((item) => {
|
||||
return item.url.indexOf('service') !== -1
|
||||
})
|
||||
res.data.routine_my_menus.map((item) => {
|
||||
if (item.url.indexOf('service') !== -1) that.servicePic = item.pic
|
||||
})
|
||||
if(res.data.routine_my_banner){
|
||||
that.imgUrls = res.data.routine_my_banner
|
||||
}
|
||||
});
|
||||
},
|
||||
// 编辑页面
|
||||
goEdit() {
|
||||
if (this.isLogin == false) {
|
||||
|
@ -526,7 +520,7 @@
|
|||
padding: 30rpx 16rpx;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
||||
|
||||
.order-hd {
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<image :src="logoUrl"/>
|
||||
<!-- <image src="/static/images/logo2.png" v-if="!logoUrl" /> -->
|
||||
</div>
|
||||
<div class="whiteBg" v-if="formItem === 1">
|
||||
<div class="whiteBg">
|
||||
<div class="list" v-if="current !== 1">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="item">
|
||||
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
|
||||
<div class="list" v-if="current !== 0">
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
|
||||
|
@ -38,18 +38,12 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" v-if="isShowCode">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
|
||||
<div class="code" @click="again"><img :src="codeUrl" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="logon" @click="loginMobile" v-if="current !== 0">登录</div>
|
||||
<div class="logon" @click="submit" v-if="current === 0">登录</div>
|
||||
<div class="tips">
|
||||
<div @click="jumpRegister">注册账号</div>
|
||||
<div @click="jumpRetrievePassword">找回密码</div>
|
||||
<div v-if="current==0" @click="current = 1">快速登录</div>
|
||||
<div v-if="current==1" @click="current = 0">账号登录</div>
|
||||
</div>
|
||||
|
@ -95,182 +89,17 @@
|
|||
mobile: "",
|
||||
password: "",
|
||||
captcha: "",
|
||||
formItem: 1,
|
||||
type: "login",
|
||||
logoUrl: "",
|
||||
keyCode: "",
|
||||
codeUrl: "",
|
||||
codeVal: "",
|
||||
isShowCode: false,
|
||||
platform: '',
|
||||
appLoginStatus: false, // 微信登录强制绑定手机号码状态
|
||||
appUserInfo: null, // 微信登录保存的用户信息
|
||||
appleLoginStatus: false, // 苹果登录强制绑定手机号码状态
|
||||
appleUserInfo: null,
|
||||
appleShow: false // 苹果登录版本必须要求ios13以上的
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
formItem:function(nval,oVal){
|
||||
if(nval == 1){
|
||||
this.type = 'login'
|
||||
}else{
|
||||
this.type = 'register'
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.getCode();
|
||||
this.getLogoImage();
|
||||
},
|
||||
onLoad() {
|
||||
let self = this
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
if (res.platform.toLowerCase() == 'ios' && res.system.split(' ')[1] >= 13) {
|
||||
self.appleShow = true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 苹果登录
|
||||
appleLogin() {
|
||||
let self = this
|
||||
this.mobile = ''
|
||||
this.captcha = ''
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
})
|
||||
uni.login({
|
||||
provider: 'apple',
|
||||
timeout: 10000,
|
||||
success(loginRes) {
|
||||
uni.getUserInfo({
|
||||
provider: 'apple',
|
||||
success: function(infoRes) {
|
||||
self.appleUserInfo = infoRes.userInfo
|
||||
self.appleLoginApi()
|
||||
},
|
||||
fail() {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '获取用户信息失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
},
|
||||
fail(error) {
|
||||
uni.hideLoading()
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 苹果登录Api
|
||||
appleLoginApi() {
|
||||
let self = this
|
||||
appleLogin({
|
||||
openId: self.appleUserInfo.openId,
|
||||
email: self.appleUserInfo.email == undefined ? '' :self.appleUserInfo.email,
|
||||
identityToken: self.appleUserInfo.identityToken || ''
|
||||
}).then((res) => {
|
||||
this.$store.commit("LOGIN", {
|
||||
'token': res.data.token
|
||||
});
|
||||
this.getUserInfo(res.data);
|
||||
}).catch(error => {
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `错误信息${error}`,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
// App微信登录
|
||||
wxLogin() {
|
||||
let self = this
|
||||
this.mobile = ''
|
||||
this.captcha = ''
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
})
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(loginRes) {
|
||||
// 获取用户信息
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: function(infoRes) {
|
||||
uni.hideLoading();
|
||||
self.appUserInfo = infoRes.userInfo
|
||||
self.appUserInfo.type = self.platform === 'ios' ? 'iosWx' : 'androidWx'
|
||||
self.wxLoginGo(self.appUserInfo)
|
||||
},
|
||||
fail() {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '获取用户信息失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
},
|
||||
fail() {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
wxLoginGo(userInfo) {
|
||||
appAuth(userInfo).then(res => {
|
||||
if (res.data.type === 'register') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/app_login/index?authKey='+res.data.key
|
||||
})
|
||||
}
|
||||
if (res.data.type === 'login') {
|
||||
this.$store.commit("LOGIN", {
|
||||
'token': res.data.token
|
||||
});
|
||||
this.getUserInfo(res.data);
|
||||
}
|
||||
}).catch(res => {
|
||||
that.$util.Tips({
|
||||
title: res
|
||||
});
|
||||
});
|
||||
},
|
||||
again() {
|
||||
this.codeUrl =
|
||||
VUE_APP_API_URL +
|
||||
"/sms_captcha?" +
|
||||
"key=" +
|
||||
this.keyCode +
|
||||
Date.parse(new Date());
|
||||
},
|
||||
getCode() {
|
||||
let that = this
|
||||
},
|
||||
async getLogoImage() {
|
||||
let that = this;
|
||||
getLogo().then(res => {
|
||||
|
@ -300,7 +129,8 @@
|
|||
let data = res.data;
|
||||
let newTime = Math.round(new Date() / 1000);
|
||||
this.$store.commit("LOGIN", {
|
||||
'token': res.data.token
|
||||
'token': res.data.accessToken,
|
||||
'refreshToken': res.data.refreshToken
|
||||
});
|
||||
that.getUserInfo(data);
|
||||
})
|
||||
|
@ -353,6 +183,11 @@
|
|||
uni.navigateTo({
|
||||
url: '/pages/users/register/index'
|
||||
})
|
||||
},
|
||||
jumpRetrievePassword(){
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/retrievePassword/index'
|
||||
})
|
||||
},
|
||||
async code() {
|
||||
let that = this;
|
||||
|
@ -362,8 +197,7 @@
|
|||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.mobile)) return that.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
if (that.formItem == 2) that.type = "register";
|
||||
await registerVerify(that.mobile)
|
||||
await registerVerify(that.mobile, 1)
|
||||
.then(res => {
|
||||
that.$util.Tips({title:res.message});
|
||||
that.sendCode();
|
||||
|
@ -397,7 +231,8 @@
|
|||
data
|
||||
}) => {
|
||||
this.$store.commit("LOGIN", {
|
||||
'token': data.token
|
||||
'token': data.accessToken,
|
||||
'refreshToken': data.refreshToken
|
||||
});
|
||||
that.getUserInfo(data);
|
||||
})
|
||||
|
@ -408,10 +243,11 @@
|
|||
});
|
||||
},
|
||||
getUserInfo(data){
|
||||
this.$store.commit("SETUID", data.uid);
|
||||
this.$store.commit("SETUID", data.userId);
|
||||
getUserInfo().then(res => {
|
||||
this.$store.commit("UPDATE_USERINFO", res.data);
|
||||
let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
// let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
let backUrl = "/pages/index/index";
|
||||
if (backUrl.indexOf('/pages/users/login/index') !== -1) {
|
||||
backUrl = '/pages/index/index';
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.registerForm.mobile)) return this.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
await registerVerify(this.registerForm.mobile)
|
||||
await registerVerify(this.registerForm.mobile, 4)
|
||||
.then(res => {
|
||||
this.$util.Tips({
|
||||
title: res.message
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
},
|
||||
mixins: [sendVerifyCode],
|
||||
mounted: function() {
|
||||
this.getCode();
|
||||
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
|
@ -82,15 +82,6 @@
|
|||
this.codeUrl =
|
||||
VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date());
|
||||
},
|
||||
getCode() {
|
||||
getCodeApi()
|
||||
.then(res => {
|
||||
this.keyCode = res.data.key;
|
||||
})
|
||||
.catch(res => {
|
||||
this.$dialog.error(res.msg);
|
||||
});
|
||||
},
|
||||
async registerReset() {
|
||||
var that = this;
|
||||
if (!that.account) return that.$util.Tips({
|
||||
|
@ -103,10 +94,9 @@
|
|||
title: '请填写验证码'
|
||||
});
|
||||
registerReset({
|
||||
account: that.account,
|
||||
captcha: that.captcha,
|
||||
mobile: that.account,
|
||||
password: that.password,
|
||||
code: that.codeVal
|
||||
code: that.captcha
|
||||
})
|
||||
.then(res => {
|
||||
that.$util.Tips({
|
||||
|
@ -129,15 +119,9 @@
|
|||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
if (that.formItem == 2) that.type = "register";
|
||||
await registerVerify({
|
||||
phone: that.account,
|
||||
type: that.type,
|
||||
key: that.keyCode,
|
||||
code: that.codeVal
|
||||
})
|
||||
await registerVerify(that.account, 3)
|
||||
.then(res => {
|
||||
that.$dialog.success(res.message);
|
||||
// that.$dialog.success(res.message);
|
||||
that.sendCode();
|
||||
})
|
||||
.catch(res => {
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
getCity().then(res => {
|
||||
this.district = res.data;
|
||||
let oneDay = 24 * 3600 * 1000;
|
||||
// this.$Cache.set('cityList', JSON.stringify(res.data)); //设置不过期时间的方法
|
||||
// this.$Cache.set('cityList', JSON.stringify(res.data)); //设置不过期时间的方法
|
||||
this.$Cache.setItem({name:'cityList',value:res.data,expires:oneDay * 7}); //设置七天过期时间
|
||||
that.initialize();
|
||||
})
|
||||
|
@ -158,8 +158,8 @@
|
|||
initialize: function() {
|
||||
let that = this,province = [],city = [],area = [];
|
||||
if (that.district.length) {
|
||||
let cityChildren = that.district[0].child || [];
|
||||
let areaChildren = cityChildren.length ? (cityChildren[0].child || []) : [];
|
||||
let cityChildren = that.district[0].children || [];
|
||||
let areaChildren = cityChildren.length ? (cityChildren[0].children || []) : [];
|
||||
that.district.forEach(function(item) {
|
||||
province.push(item.name);
|
||||
});
|
||||
|
@ -175,9 +175,9 @@
|
|||
bindRegionChange: function(e) {
|
||||
let multiIndex = this.multiIndex,
|
||||
province = this.district[multiIndex[0]] || {
|
||||
child: []
|
||||
children: []
|
||||
},
|
||||
city = province.child[multiIndex[1]] || {
|
||||
city = province.children[multiIndex[1]] || {
|
||||
cityId: 0
|
||||
},
|
||||
multiArray = this.multiArray,
|
||||
|
@ -193,25 +193,25 @@
|
|||
column = e.detail.column,
|
||||
value = e.detail.value,
|
||||
currentCity = this.district[value] || {
|
||||
child: []
|
||||
children: []
|
||||
},
|
||||
multiArray = that.multiArray,
|
||||
multiIndex = that.multiIndex;
|
||||
multiIndex[column] = value;
|
||||
switch (column) {
|
||||
case 0:
|
||||
let areaList = currentCity.child[0] || {
|
||||
child: []
|
||||
let areaList = currentCity.children[0] || {
|
||||
children: []
|
||||
};
|
||||
multiArray[1] = currentCity.child.map((item) => {
|
||||
multiArray[1] = currentCity.children.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
multiArray[2] = areaList.child.map((item) => {
|
||||
multiArray[2] = areaList.children.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
let cityList = that.district[multiIndex[0]].child[multiIndex[1]].child || [];
|
||||
let cityList = that.district[multiIndex[0]].children[multiIndex[1]].children || [];
|
||||
multiArray[2] = cityList.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
|
@ -416,7 +416,7 @@
|
|||
},
|
||||
/**
|
||||
* 提交用户添加地址
|
||||
*
|
||||
*
|
||||
*/
|
||||
formSubmit: function(e) {
|
||||
let that = this,
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
},
|
||||
/**
|
||||
* 获取地址列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
getAddressList: function(isPage) {
|
||||
let that = this;
|
||||
|
@ -252,8 +252,8 @@
|
|||
that.loading = true;
|
||||
that.loadTitle = '';
|
||||
getAddressList({
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
pageNo: that.page,
|
||||
pageSize: that.limit
|
||||
}).then(res => {
|
||||
let list = res.data.list;
|
||||
let loadend = list.length < that.limit;
|
||||
|
@ -350,7 +350,7 @@
|
|||
goOrder: function(id) {
|
||||
if(this.preOrderNo){
|
||||
uni.redirectTo({
|
||||
url: '/pages/users/order_confirm/index?is_address=1&preOrderNo=' + this.preOrderNo + '&addressId=' + id
|
||||
url: '/pages/users/order_confirm/index?is_address=1&preOrderNo=' + this.preOrderNo + '&addressId=' + id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@
|
|||
<script>
|
||||
import {
|
||||
userEdit,
|
||||
getLogout
|
||||
getLogout,
|
||||
uploadAvatar
|
||||
} from '@/api/user.js';
|
||||
import {
|
||||
switchH5Login
|
||||
|
@ -128,7 +129,7 @@
|
|||
},
|
||||
/**
|
||||
* 退出登录
|
||||
*
|
||||
*
|
||||
*/
|
||||
outLogin: function() {
|
||||
let that = this;
|
||||
|
@ -157,17 +158,14 @@
|
|||
},
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
*
|
||||
*/
|
||||
uploadpic: function() {
|
||||
let that = this;
|
||||
that.$util.uploadImageOne({
|
||||
url: 'user/upload/image',
|
||||
name: 'multipart',
|
||||
model: "maintain",
|
||||
pid: 0
|
||||
name: 'file',
|
||||
}, function(res) {
|
||||
that.newAvatar = res.data.url;
|
||||
that.newAvatar = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
} from "../../api/user.js";
|
||||
import {
|
||||
LOGIN_STATUS,
|
||||
REFRESH_TOKEN,
|
||||
UID,
|
||||
PLATFORM
|
||||
} from '../../config/cache';
|
||||
|
@ -13,6 +14,7 @@ import {
|
|||
|
||||
const state = {
|
||||
token: Cache.get(LOGIN_STATUS) || '',
|
||||
refreshToken: Cache.get(REFRESH_TOKEN) || '',
|
||||
backgroundColor: "#fff",
|
||||
userInfo: Cache.get(USER_INFO)?JSON.parse(Cache.get(USER_INFO)):null,
|
||||
uid: Cache.get(UID) || null,
|
||||
|
@ -25,9 +27,11 @@ const state = {
|
|||
const mutations = {
|
||||
LOGIN(state, opt) {
|
||||
state.token = opt.token;
|
||||
state.refreshToken = opt.refreshToken;
|
||||
Cache.set(LOGIN_STATUS, opt.token);
|
||||
Cache.set(REFRESH_TOKEN, opt.refreshToken);
|
||||
},
|
||||
SETUID(state,val){
|
||||
SETUID(state,val){
|
||||
state.uid = val;
|
||||
Cache.set(UID, val);
|
||||
},
|
||||
|
@ -38,6 +42,7 @@ const mutations = {
|
|||
state.token = undefined;
|
||||
state.uid = undefined
|
||||
Cache.clear(LOGIN_STATUS);
|
||||
Cache.clear(REFRESH_TOKEN);
|
||||
Cache.clear(UID);
|
||||
Cache.clear(USER_INFO);
|
||||
},
|
||||
|
@ -88,7 +93,7 @@ const actions = {
|
|||
reslove(res.data);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
|
||||
});
|
||||
// debugger
|
||||
// if (state.userInfo !== null && !force)
|
||||
|
|
|
@ -32,7 +32,7 @@ function baseRequest(url, method, data, {
|
|||
});
|
||||
}
|
||||
}
|
||||
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
|
||||
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.request({
|
||||
url: Url + '/app-api/' + url,
|
||||
|
|
|
@ -108,7 +108,7 @@ export default {
|
|||
* @param int index 需要移除的数组的键值
|
||||
* @param string | int 值
|
||||
* @return array
|
||||
*
|
||||
*
|
||||
*/
|
||||
ArrayRemove: function(array, index, value) {
|
||||
const valueArray = [];
|
||||
|
@ -127,7 +127,7 @@ export default {
|
|||
* 生成海报获取文字
|
||||
* @param string text 为传入的文本
|
||||
* @param int num 为单行显示的字节长度
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
textByteLength: function(text, num) {
|
||||
|
||||
|
@ -164,8 +164,8 @@ export default {
|
|||
* @param string price 价格
|
||||
* @param string ot_price 原始价格
|
||||
* @param function successFn 回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
PosterCanvas: function(arr2, store_name, price, ot_price, successFn) {
|
||||
let that = this;
|
||||
|
@ -173,7 +173,7 @@ export default {
|
|||
ctx.clearRect(0, 0, 0, 0);
|
||||
/**
|
||||
* 只能获取合法域名下的图片信息,本地调试无法获取
|
||||
*
|
||||
*
|
||||
*/
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, 750, 1150);
|
||||
|
@ -331,7 +331,7 @@ export default {
|
|||
context.clearRect(0, 0, 0, 0);
|
||||
/**
|
||||
* 只能获取合法域名下的图片信息,本地调试无法获取
|
||||
*
|
||||
*
|
||||
*/
|
||||
context.fillStyle = '#fff';
|
||||
context.fillRect(0, 0, 594, 850);
|
||||
|
@ -425,8 +425,8 @@ export default {
|
|||
/*
|
||||
* 单图上传
|
||||
* @param object opt
|
||||
* @param callable successCallback 成功执行方法 data
|
||||
* @param callable errorCallback 失败执行方法
|
||||
* @param callable successCallback 成功执行方法 data
|
||||
* @param callable errorCallback 失败执行方法
|
||||
*/
|
||||
uploadImageOne: function(opt, successCallback, errorCallback) {
|
||||
let that = this;
|
||||
|
@ -440,20 +440,20 @@ export default {
|
|||
sourceType = opt.sourceType || ['album', 'camera'],
|
||||
is_load = opt.is_load || true,
|
||||
uploadUrl = opt.url || '',
|
||||
inputName = opt.name || 'pics',
|
||||
inputName = opt.name || 'file',
|
||||
pid = opt.pid,
|
||||
model = opt.model;
|
||||
|
||||
uni.chooseImage({
|
||||
count: count, //最多可以选择的图片总数
|
||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
||||
count: count, //最多可以选择的图片总数
|
||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function(res) {
|
||||
//启动上传等待中...
|
||||
//启动上传等待中...
|
||||
uni.showLoading({
|
||||
title: '图片上传中',
|
||||
});
|
||||
let urlPath = HTTP_ADMIN_URL + '/api/admin/upload/image' + "?model=" + model + "&pid=" + pid
|
||||
let urlPath = HTTP_ADMIN_URL + '/app-api/infra/file/upload'
|
||||
let localPath = res.tempFilePaths[0];
|
||||
uni.uploadFile({
|
||||
url: urlPath,
|
||||
|
@ -464,9 +464,11 @@ export default {
|
|||
// #ifdef MP
|
||||
"Content-Type": "multipart/form-data",
|
||||
// #endif
|
||||
[TOKENNAME]: store.state.app.token
|
||||
[TOKENNAME]: store.state.app.token,
|
||||
'tenant-id': 1
|
||||
},
|
||||
success: function(res) {
|
||||
console.log('res', res)
|
||||
uni.hideLoading();
|
||||
if (res.statusCode == 403) {
|
||||
that.Tips({
|
||||
|
@ -474,8 +476,7 @@ export default {
|
|||
});
|
||||
} else {
|
||||
let data = res.data ? JSON.parse(res.data) : {};
|
||||
if (data.code == 200) {
|
||||
data.data.localPath = localPath;
|
||||
if (data.code == 0) {
|
||||
successCallback && successCallback(data)
|
||||
} else {
|
||||
errorCallback && errorCallback(data);
|
||||
|
@ -509,7 +510,7 @@ export default {
|
|||
* @param string k 整体分割符 默认为:&
|
||||
* @param string p 单个分隔符 默认为:=
|
||||
* @return object
|
||||
*
|
||||
*
|
||||
*/
|
||||
// #ifdef MP
|
||||
getUrlParams: function(param, k, p) {
|
||||
|
|
Loading…
Reference in New Issue