发布开始修改细节

master
Sigo 4 years ago
parent abb95b0fc9
commit 000cf9254d

@ -4,7 +4,9 @@ import "babel-polyfill";
import "es6-promise/auto";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import { Message } from "element-ui";
import {
Message
} from "element-ui";
Vue.use(ElementUI);
import App from "./App.vue";
import store from "./store";
@ -22,18 +24,26 @@ import "./utils/dialog";
import "./plugins";
// import "./utils/directive/focus";
import echarts from "echarts";
import { getCookie } from "./utils/utils.js";
import {
getCookie
} from "./utils/utils.js";
import apiConfig from "../config/api.config.js";
import vueEsign from "vue-esign";
import animated from "animate.css"; // npm install animate.css --save安装在引入
import formatTime from "./utils/filters.js";
import arrDiff from "./utils/array.js";
import { Loading } from "element-ui";
import {
Loading
} from "element-ui";
import countdown from "./utils/countdown.js";
import "./utils/rem.js";
Vue.use(animated);
Vue.use(vueEsign);
import {
thousands
} from '@/utils/index.js'
import Vue from "vue";
import Router from "vue-router";
import router from "./router";
@ -44,10 +54,13 @@ Vue.use(VueAxios, axios);
axios.defaults.baseURL = apiConfig.baseUrl;
Vue.use(Print); //注册
import { message } from "./utils/resetMessage.js"; //现在提示弹窗每次只弹一条
import {
message
} from "./utils/resetMessage.js"; //现在提示弹窗每次只弹一条
// import VueParticles from 'vue-particles'
// Vue.use(VueParticles)
Vue.prototype.$thousands = thousands
Vue.prototype.$message = message;
Vue.prototype.$countdown = countdown;
Vue.prototype.bus = new Vue();
@ -66,7 +79,7 @@ export function getNextDate(date, day) {
}
axios.defaults.withCredentials = true; //让ajax携带cookie
// 全局过滤器--时间戳格式化时间//.padStart(2 , "0") 不足两位的用0填充
Vue.filter("dateFormat", function(originVal) {
Vue.filter("dateFormat", function (originVal) {
const dt = new Date(originVal);
const y = dt.getFullYear();
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
@ -76,7 +89,7 @@ Vue.filter("dateFormat", function(originVal) {
const ss = (dt.getSeconds() + "").padStart(2, "0");
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});
Vue.filter("dateMonth", function(originVal) {
Vue.filter("dateMonth", function (originVal) {
const dt = new Date(originVal);
const y = dt.getFullYear();
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
@ -86,10 +99,10 @@ Vue.filter("dateMonth", function(originVal) {
const ss = (dt.getSeconds() + "").padStart(2, "0");
return `${y}-${m}-${d}`;
});
Vue.filter("phone", function(phone) {
Vue.filter("phone", function (phone) {
return phone.substring(0, 3) + "****" + phone.substring(phone.length - 4);
});
Vue.filter("identityNum", function(identityNum) {
Vue.filter("identityNum", function (identityNum) {
return (
identityNum.substring(0, 4) +
"**************" +
@ -97,11 +110,11 @@ Vue.filter("identityNum", function(identityNum) {
);
});
Vue.filter("money", function(money) {
Vue.filter("money", function (money) {
return (money * 1).toFixed(2);
});
Vue.prototype.openLoading = function() {
Vue.prototype.openLoading = function () {
const loading = this.$loading({
// 声明一个loading对象
lock: true, // 是否锁屏
@ -112,7 +125,7 @@ Vue.prototype.openLoading = function() {
body: true,
customClass: "mask" // 遮罩层新增类名
});
setTimeout(function() {
setTimeout(function () {
// 设定定时器超时5S后自动关闭遮罩层避免请求失败时遮罩层一直存在的问题
loading.close(); // 关闭遮罩层
}, 5000);
@ -151,7 +164,9 @@ router.beforeEach((to, from, next) => {
message: "请先登录",
duration: 2000
});
next({ path: "/login" });
next({
path: "/login"
});
}
});
Vue.directive("role", {
@ -178,7 +193,9 @@ new Vue({
el: "#app",
router,
store,
components: { App },
components: {
App
},
template: "<App/>"
});

@ -56,7 +56,7 @@
<el-form-item v-show="form.shareCommissionRules===1" :prop="form.shareCommissionRules===1?'orderCommission':''">
<amount-input ref="orderCommission" @amount="handleAmount" name="orderCommission" placeholder="单据金额抽成(%)"></amount-input>
</el-form-item>
<el-form-item label="推广图片">
<el-form-item label="活动图片" prop="imageUrl">
<active-img @active-img="handleImage"></active-img>
</el-form-item>
</el-form>
@ -120,37 +120,17 @@ export default {
shareCommissionRules: [
{ required: true, message: '请选择分享提成规则', trigger: ['blur', 'change'] },
],
couponNum: [{ required: true, message: '优惠券数量', trigger: 'blur' }],
shareAmount: [
{ required: true, message: '请输入分润', trigger: 'blur' },
{
pattern: /^\d*(?:\.\d{0,2})?$/,
//pattern: /^1[3456789]\d{9}$/,
message: '最多能输入两位小数',
trigger: 'blur',
},
],
phone: [
{ required: true, message: '请输入联系方式', trigger: 'blur' },
{ min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' },
{
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
//pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
imgUrl: [{ required: true, message: '请上传活动图片', trigger: 'change' }],
region: [{ required: true, message: '请选择活动区域', trigger: 'change' }],
// imageUrl: [{ required: true, message: '', trigger: ['blur', 'change'] }],
},
}
},
methods: {
// ============================== ============================== //
//
handleNext() {
this.$refs.form.validate((valid) => {
if (valid) {
this.$emit('next', 2)
this.$emit('next', 2, this.form)
} else {
return false
}
@ -164,6 +144,7 @@ export default {
this.$refs.form.resetFields()
this.$baseMessage('重置成功', 'success')
},
// ============================== ============================== //
//
handleImage(file) {
let form = Object.assign({}, this.form);
@ -190,4 +171,7 @@ export default {
justify-content: center;
padding: 50px 0;
}
.form .el-form-item {
margin-bottom: 15px;
}
</style>

@ -34,9 +34,15 @@ export default {
data() {
return {
choose: 0,
form: {}
}
},
methods: {
//
handleData(form) {
this.form = Object.assign({}, form);
console.log('form', form);
},
handleChoose(num) {
this.choose = num
},

@ -94,8 +94,10 @@ export default {
this.form = Object.assign({}, form)
},
//
handleNext(active) {
handleNext(active, form) {
this.active = active
let activeName = active == 1 ? 'edit' : active == 2 ? 'templates' : 'complete'
this.$refs[activeName].handleData(fiorm)
},
},
}

@ -156,9 +156,9 @@ export function translateDataToTree(data) {
const temp = JSON.parse(JSON.stringify(children));
temp.splice(index, 1);
translator([current], temp);
typeof parent.children !== "undefined"
? parent.children.push(current)
: (parent.children = [current]);
typeof parent.children !== "undefined" ?
parent.children.push(current) :
(parent.children = [current]);
}
});
});
@ -263,8 +263,8 @@ export function random(m, n) {
* @description addEventListener
* @type {function(...[*]=)}
*/
export const on = (function() {
return function(element, event, handler, useCapture = false) {
export const on = (function () {
return function (element, event, handler, useCapture = false) {
if (element && event && handler) {
element.addEventListener(event, handler, useCapture);
}
@ -275,8 +275,8 @@ export const on = (function() {
* @description removeEventListener
* @type {function(...[*]=)}
*/
export const off = (function() {
return function(element, event, handler, useCapture = false) {
export const off = (function () {
return function (element, event, handler, useCapture = false) {
if (element && event) {
element.removeEventListener(event, handler, useCapture);
}
@ -350,16 +350,16 @@ export function getNextDate(date, day) {
// -------------------------- 基于只能输入数字与小数点情况下获取两位小数 ------------------------- //
export function parseNumber(values) {
if (values.split(".")[1]) {
return values.split(".")[1].length > 2
? parseFloat(
return values.split(".")[1].length > 2 ?
parseFloat(
values.split(".")[0] +
"." +
values
.split(".")[1]
.toString()
.slice(0, 2)
)
: parseFloat(values.split(".")[0] + "." + values.split(".")[1]);
) :
parseFloat(values.split(".")[0] + "." + values.split(".")[1]);
} else {
return values;
}
@ -375,7 +375,10 @@ export function handleSelectOption(data, labelField, valueField) {
const cloneData = JSON.parse(JSON.stringify(data));
let result = [];
data.forEach(item => {
result.push({ label: item[labelField], value: item[valueField] });
result.push({
label: item[labelField],
value: item[valueField]
});
});
return result;
}
@ -483,7 +486,10 @@ export function compoteFormatTimestamp(timestamp) {
* @param {object} param
*/
export function getTableSummation(param) {
const { columns, data } = param;
const {
columns,
data
} = param;
const sums = [];
const fields = ["price", "number", "amount"];
columns.forEach((column, index) => {
@ -524,3 +530,21 @@ export function stateFormat(row, column, cellValue) {
.replace(/\.$/, "");
}
}
/**
* @description (/\d{1,3}(?=(\d{3})+$)/g, '$&,') 只能正数使用
*/
// -------------------------- 千分号 ------------------------- //
export function thousands(value) {
;
/\d{1,3}(?=(\d{3})+$)/g, '$&,'
if (value) {
if (value.includes('.')) {
let array = value.split('.')
let data = array[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,')
return data + '.' + array[1]
} else {
let data = value.replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,')
return data
}
}
}

Loading…
Cancel
Save