Commit 1cb7f09e authored by 石家欣's avatar 石家欣

sjx

parent 364d6703
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
//"appid" : "__UNI__FC9419E", //"appid" : "__UNI__FC9419E",
"appid" : "__UNI__1EA80F1", //这个是 web "appid" : "__UNI__1EA80F1", //这个是 web
"description" : "", "description" : "",
"versionName" : "1.0.57", "versionName" : "1.0.60",
"versionCode" : 157, "versionCode" : 160,
"transformPx" : false, "transformPx" : false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus" : {
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
} }
} }
}, },
"compilerVersion" : 3 "compilerVersion" : 2
}, },
/* 快应用特有相关 */ /* 快应用特有相关 */
"quickapp" : {}, "quickapp" : {},
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
,{ ,{
"path" : "pages/edit/shop/shop", "path" : "pages/edit/shop/shop",
"style" : { "style" : {
"navigationBarTitleText":"商家信息编辑" "navigationBarTitleText":"商家信息"
} }
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<view class="inputitem flex"> <view class="inputitem flex">
<view class="names">发放数量</view> <view class="names">发放数量</view>
<input type="number" placeholder="请填写满多少元可以使用" v-model="parameter.count" class="inputs" placeholder-class="plclass"> <input type="number" placeholder="请填写发放的数量" v-model="parameter.count" class="inputs" placeholder-class="plclass">
</view> </view>
</view> </view>
<!-- 第一块结束 --> <!-- 第一块结束 -->
......
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
// console.info(this.goodsCate[i].children[j],"111111"); // console.info(this.goodsCate[i].children[j],"111111");
let itemtwo = this.goodsCate[i].children[j]; let itemtwo = this.goodsCate[i].children[j];
if(itemtwo.cate_id==this.canform.cate_id){ if(itemtwo.cate_id==this.canform.cate_id){
console.info("111这个才是",itemtwo); // console.info("111这个才是",itemtwo);
this.datachind=itemone;//二级赋值 this.datachind=itemone;//二级赋值
this.cate_name = this.goodsCate[i].value;//一级名称 this.cate_name = this.goodsCate[i].value;//一级名称
...@@ -375,12 +375,12 @@ ...@@ -375,12 +375,12 @@
}, },
//富文本处理完毕 事件 获取最后的html 数据 子组件调用的 //富文本处理完毕 事件 获取最后的html 数据 子组件调用的
editOk(e){//2.xxxx editOk(e){//2.xxxx
console.info("col",e.html); // console.info("col",e.html);
//调用完毕 调用 create_goods //调用完毕 调用 create_goods
let htaltag = e.html let htaltag = e.html
let newStr = htaltag.replace(new RegExp(/\"/g), ""); let newStr = htaltag.replace(new RegExp(/\"/g), "");
console.log(newStr); // console.log(newStr);
this.canform.details = newStr;//e.html this.canform.details = newStr;//e.html
this.create_goods(); this.create_goods();
...@@ -419,15 +419,16 @@ ...@@ -419,15 +419,16 @@
}) })
console.info(this.canform,"canform"); // console.info(this.canform,"canform");
// return false; // return false;
//添加 //添加
if(this.canform.price<this.canform.mall_price){ console.log(this.canform.mall_price)
console.log(this.canform.price)
if(parseFloat(this.canform.price)<parseFloat(this.canform.mall_price)){
this.$api.msg('商城价格不能大于市场价格'); this.$api.msg('商城价格不能大于市场价格');
this.issubmit=true; this.issubmit=true;
return; return;
} }
let res = await addEditGoods(this.canform) let res = await addEditGoods(this.canform)
...@@ -457,12 +458,12 @@ ...@@ -457,12 +458,12 @@
}, },
//多选 勾选 列表 //多选 勾选 列表
checkboxChange(e){ checkboxChange(e){
console.log(e); // console.log(e);
this.selchildList = e.detail.value; this.selchildList = e.detail.value;
}, },
// 改变下拉选项 一级的 // 改变下拉选项 一级的
bindPickerChange (event) { bindPickerChange (event) {
console.info(event.detail.value); // console.info(event.detail.value);
this.parent_name = ""; this.parent_name = "";
this.canform.cate_id = ""; this.canform.cate_id = "";
this.cate_name = this.goodsCate[event.detail.value].value; this.cate_name = this.goodsCate[event.detail.value].value;
...@@ -471,7 +472,7 @@ ...@@ -471,7 +472,7 @@
}, },
//二级分类选中后处理 //二级分类选中后处理
bindPickerss (event) { bindPickerss (event) {
console.log(event.detail.value); // console.log(event.detail.value);
this.parent_name = this.datachind[event.detail.value].value; this.parent_name = this.datachind[event.detail.value].value;
this.canform.cate_id = this.datachind[event.detail.value].cate_id;//分类id this.canform.cate_id = this.datachind[event.detail.value].cate_id;//分类id
}, },
......
<template> <template>
<!-- 店铺信息 编辑修改页面 设置店铺信息 --> <!-- 店铺信息 编辑修改页面 设置店铺信息 -->
<view class="shopinfoss"> <view class="shopinfoss">
<view class="logobox"> <view class="logobox">
<image v-if="fromdata.logo!='' && fromdata.logo!=null" @tap="uploadimgs" class="islogimg" :src="staticUrl+fromdata.logo" mode=""></image> <image v-if="fromdata.logo!='' && fromdata.logo!=null" class="islogimg" :src="staticUrl+fromdata.logo"
<view class="islogimg" v-else @tap="uploadimgs">上传logo</view> mode=""></image>
<!-- <view class="islogimg" v-else @tap="uploadimgs">上传logo</view> -->
</view> </view>
<view class="biao"> <view class="biao">
<view class="cu-form-group "> <view class="cu-form-group ">
<view class="title">联系人:</view> <view class="title">联系人:</view>
<input class="title" style="flex-grow: 1;" placeholder="请输入联系人" v-model="fromdata.contact"></input> <input class="title" style="flex-grow: 1;" placeholder="请输入联系人" disabled="disabled" v-model="fromdata.contact"></input>
</view> </view>
<view class="cu-form-group "> <view class="cu-form-group ">
<view class="title">店铺电话:</view> <view class="title">店铺电话:</view>
<input class="title" style="flex-grow: 1;" placeholder="请输入店铺电话" v-model="fromdata.tel"></input> <input class="title" style="flex-grow: 1;" placeholder="请输入店铺电话" disabled="disabled" v-model="fromdata.tel"></input>
</view> </view>
<view class="cu-form-group "> <view class="cu-form-group ">
<view class="title">店铺地址:</view> <view class="title">店铺地址:</view>
<input class="title" style="flex-grow: 1;" placeholder="请输入店铺地址" v-model="fromdata.addr"></input> <input class="title" style="flex-grow: 1;" placeholder="请输入店铺地址" disabled="disabled" v-model="fromdata.addr"></input>
</view> </view>
<view class="cu-form-group" @click="biaozu"> <!-- @click="biaozu" -->
<!-- <view class="cu-form-group" >
<view class="title">标注位置:</view> <view class="title">标注位置:</view>
<input :placeholder="address" name="input" disabled></input> <input :placeholder="address" name="input" disabled></input>
<text v-if="!address" class='cuIcon-locationfill text-orange'></text> <text v-if="!address" class='cuIcon-locationfill text-orange'></text>
</view> </view> -->
<view class="biao_05 cu-form-group"> <view class="cu-form-group flex" style="padding: 30upx;">
<view class="title">营业时间:</view> <view class="title">营业时间:</view>
<view class="time flex" > <view class="time flex">
<view class="biao_05_2"> <view class="biao_05_2">
<view class="uni-list-cell-db flex"> <view class="uni-list-cell-db flex">
<picker mode="time" :value="time" @change="bindTimeChange" style="margin-top: 6px;"> <!-- @change="bindTimeChange" -->
<!-- <picker mode="time" :value="time" style="margin-top: 6px;"> -->
<view class="uni-input">{{time}}</view> <view class="uni-input">{{time}}</view>
</picker> <!-- </picker> -->
</view> </view>
</view> </view>
<view class="biao_05_2 flex" style="margin: 10upx 10px 0 0;">--</view> <view class="biao_05_2 flex" style="margin: 0 0 0 10px;">--</view>
<view class="uni-list-cell-db flex"> <view class="uni-list-cell-db flex">
<picker mode="time" :value="time_close" @change="bindTimeChange_close" style="margin-top: 6px;"> <!-- @change="bindTimeChange_close" -->
<!-- <picker mode="time" :value="time_close" style="margin-top: 6px;"> -->
<view class="uni-input">{{time_close}}</view> <view class="uni-input">{{time_close}}</view>
</picker> <!-- </picker> -->
</view> </view>
</view> </view>
</view> </view>
...@@ -48,7 +52,9 @@ ...@@ -48,7 +52,9 @@
<view class="title">介绍:</view> <view class="title">介绍:</view>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<textarea maxlength="-1" v-model="fromdata.details" placeholder="请输入介绍"></textarea> <!-- <textarea maxlength="-1" type="rich-text" v-model="fromdata.details" placeholder="请输入介绍"></textarea> -->
<!-- <editor id="editor" @input="onEditorInput" @ready="onEditorReady(fromdata.details)"></editor> -->
<rich-text contenteditable="false" :nodes="fromdata.details"></rich-text>
<!-- :disabled="modalName!=null" --> <!-- :disabled="modalName!=null" -->
</view> </view>
<!-- <view class="cu-form-group "> <!-- <view class="cu-form-group ">
...@@ -57,83 +63,86 @@ ...@@ -57,83 +63,86 @@
<switch @change="SwitchAchange" :class="switchA?'checked':''" :checked="switchA?true:false" color="#e54d42"></switch> <switch @change="SwitchAchange" :class="switchA?'checked':''" :checked="switchA?true:false" color="#e54d42"></switch>
</view> </view>
</view> --> </view> -->
</view> </view>
<view class="p_btn"> <!-- <view class="p_btn">
<view class=" flex flex-direction"> <view class=" flex flex-direction">
<button @tap="addNewStoreFun()" class="cu-btn bg-red margin-tb-sm lg">提交</button> <button @tap="addNewStoreFun()" class="cu-btn bg-red margin-tb-sm lg">提交</button>
</view> </view>
</view> </view> -->
</view> </view>
</template> </template>
<script> <script>
import uniIcon from "@/components/uni-icon/uni-icon.vue" import uniIcon from "@/components/uni-icon/uni-icon.vue"
import wPicker from "@/components/w-picker/w-picker.vue"; import wPicker from "@/components/w-picker/w-picker.vue";
import graceRichText from "@/utils/richText.js";
import config from "@/utils/config.js"; import config from "@/utils/config.js";
import {addNewStore,shopDetail} from "@/utils/api/api.js"; import {
addNewStore,
shopDetail
} from "@/utils/api/api.js";
import QQMapWX from "@/utils/libs/qqmap-wx-jssdk.min.js"; import QQMapWX from "@/utils/libs/qqmap-wx-jssdk.min.js";
var qqmapsdk = new QQMapWX({ var qqmapsdk = new QQMapWX({
key: 'KROBZ-N2ORJ-VYBFJ-F76TY-ASPMT-JFBFH' key: 'KROBZ-N2ORJ-VYBFJ-F76TY-ASPMT-JFBFH'
}); });
export default { export default {
data() { data() {
return { return {
content: [], content: [],
list:[], list: [],
address: '', address: '',
time: '09:00', time: '09:00',
time_close: '19:00', time_close: '19:00',
modalName:"",//? modalName: "", //?
switchA:false, switchA: false,
//提交的表单 //提交的表单
fromdata:{ fromdata: {
contact :"",//联系人 contact: "", //联系人
tel:"",//电话 tel: "", //电话
lat:"",///经纬度 lat: "", ///经纬度
lng:"",//经纬度 lng: "", //经纬度
details:"",//介绍 details: "", //介绍
addr:"",//地址 addr: "", //地址
business_time:"",//时间 business_time: "", //时间
logo:"",//店铺logo logo: "", //店铺logo
// city_code: "",//城市代码 // city_code: "",//城市代码
// area_code: "",//区号 // area_code: "",//区号
}, },
//addr: "南昌市" //addr: "南昌市"
//contact: "" //contact: ""
//business_time: "9:00-18:00" //business_time: "9:00-18:00"
//logo: "" //logo: ""
//lat: 28.68503 //lat: 28.68503
//lng: 115.89925 //lng: 115.89925
//可能少的 //可能少的
//address: "",//详细地址 //address: "",//详细地址
cate_id: 0,//分了id cate_id: 0, //分了id
shop_name: "",//店铺名称 shop_name: "", //店铺名称
makeruid: "", makeruid: "",
city_code: 360100,//城市代码 city_code: 360100, //城市代码
area_code: 360102,//区号 area_code: 360102, //区号
cate_name: "品牌服装",//分类名称 文字 cate_name: "品牌服装", //分类名称 文字
shopinfos:{}, shopinfos: {},
}; };
}, },
onLoad() { onLoad() {
this.content=this.$api.json.content; this.content = this.$api.json.content;
//获取之前设置过的信息 //获取之前设置过的信息
this.getshopDetail(); this.getshopDetail();
}, },
...@@ -142,109 +151,115 @@ ...@@ -142,109 +151,115 @@
wPicker wPicker
}, },
//计算属性 //计算属性
computed:{ computed: {
staticUrl(){ staticUrl() {
return this.$store.state.staticUrl; return this.$store.state.staticUrl;
}, },
uploaddata(){ uploaddata() {
return {model:"shopphoto",user_token:this.$store.state.token,shop_id:this.$store.state.userInfo.shop_id} return {
model: "shopphoto",
user_token: this.$store.state.token,
shop_id: this.$store.state.userInfo.shop_id
}
} }
}, },
methods: { methods: {
//获取之前设置过的信息 //获取之前设置过的信息
async getshopDetail(){ async getshopDetail() {
let res = await shopDetail({ let res = await shopDetail({
}); });
if(res.code==0){ if (res.code == 0) {
this.shopinfos = res.data; this.shopinfos = res.data;
this.fromdata.contact = this.shopinfos.contact; this.fromdata.contact = this.shopinfos.contact;
this.fromdata.tel = this.shopinfos.tel; this.fromdata.tel = this.shopinfos.tel;
this.fromdata.lat = this.shopinfos.lat; this.fromdata.lat = this.shopinfos.lat;
this.fromdata.lng = this.shopinfos.lng; this.fromdata.lng = this.shopinfos.lng;
this.fromdata.details = this.shopinfos.details; // this.fromdata.details = this.shopinfos.details;
this.fromdata.details = graceRichText.format(this.shopinfos.details);
this.fromdata.addr = this.shopinfos.addr; this.fromdata.addr = this.shopinfos.addr;
this.fromdata.business_time = this.shopinfos.business_time;//营业时间 需要特殊处理 this.fromdata.business_time = this.shopinfos.business_time; //营业时间 需要特殊处理
this.fromdata.logo = this.shopinfos.logo; this.fromdata.logo = this.shopinfos.logo;
//console.info(this.fromdata.business_time.split("---"),"business_time"); //console.info(this.fromdata.business_time.split("---"),"business_time");
if(this.fromdata.business_time.indexOf("---")!=-1){ if (this.fromdata.business_time.indexOf("---") != -1) {
let timearr = this.fromdata.business_time.split("---"); let timearr = this.fromdata.business_time.split("---");
if(timearr.length!=0){ if (timearr.length != 0) {
this.time = timearr[0]; this.time = timearr[0];
this.time_close=timearr[1]; this.time_close = timearr[1];
} }
}else if(this.fromdata.business_time.indexOf("--")!=-1){ } else if (this.fromdata.business_time.indexOf("--") != -1) {
let timearr = this.fromdata.business_time.split("--"); let timearr = this.fromdata.business_time.split("--");
if(timearr.length!=0){ if (timearr.length != 0) {
this.time = timearr[0]; this.time = timearr[0];
this.time_close=timearr[1]; this.time_close = timearr[1];
} }
}else if(this.fromdata.business_time.indexOf("-")!=-1){ } else if (this.fromdata.business_time.indexOf("-") != -1) {
let timearr = this.fromdata.business_time.split("-"); let timearr = this.fromdata.business_time.split("-");
if(timearr.length!=0){ if (timearr.length != 0) {
this.time = timearr[0]; this.time = timearr[0];
this.time_close=timearr[1]; this.time_close = timearr[1];
} }
} }
} else {
}else{
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
}, },
//上传图片方法 //上传图片方法
uploadimgs(){ uploadimgs() {
uni.chooseImage({ uni.chooseImage({
count:1, count: 1,
success: (chooseImageRes) => { success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths; const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({ uni.uploadFile({
url: config.SiteBaseUrl+'FileUpload/uploadify', //仅为示例,非真实的接口地址 url: config.SiteBaseUrl + 'FileUpload/uploadify', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
name: 'img', name: 'img',
formData: this.uploaddata, formData: this.uploaddata,
success: (uploadFileRes) => { success: (uploadFileRes) => {
console.log(uploadFileRes.data,"上传成功后~"); console.log(uploadFileRes.data, "上传成功后~");
let resdata = JSON.parse(uploadFileRes.data); let resdata = JSON.parse(uploadFileRes.data);
console.info(resdata,"resdata"); console.info(resdata, "resdata");
this.fromdata.logo = resdata.data; this.fromdata.logo = resdata.data;
} }
}); });
} }
}); });
}, },
//提交修改 //提交修改
async addNewStoreFun(){ async addNewStoreFun() {
this.fromdata.business_time = this.time + "---" + this.time_close;//营业时间 this.fromdata.business_time = this.time + "---" + this.time_close; //营业时间
// console.info(this.fromdata); // console.info(this.fromdata);
// return false; // return false;
let objs = {...this.shopinfos,...this.fromdata}; let objs = { ...this.shopinfos,
...this.fromdata
let res = await addNewStore(this.fromdata);//this.fromdata };
if(res.code==0){
let res = await addNewStore(this.fromdata); //this.fromdata
if (res.code == 0) {
this.$api.msg(res.msg); this.$api.msg(res.msg);
}else{ } else {
this.$api.msg(res.msg); this.$api.msg(res.msg);
} }
// else if(res.code==-1){ // else if(res.code==-1){
// this.$api.msg("暂时不允许修改"); // this.$api.msg("暂时不允许修改");
// } // }
}, },
textareaAInput(e){ textareaAInput(e) {
}, },
SwitchAchange(e){ SwitchAchange(e) {
}, },
TimeChange(e) { TimeChange(e) {
this.time = e.detail.value this.time = e.detail.value
...@@ -262,13 +277,13 @@ ...@@ -262,13 +277,13 @@
if (e.target.value) { if (e.target.value) {
this.list.shop_state = true // 1 checked的值为布尔值 this.list.shop_state = true // 1 checked的值为布尔值
} else { } else {
this.list.shop_state = false // 0 this.list.shop_state = false // 0
} }
}, },
//选择位置 //选择位置
biaozu() { biaozu() {
const that = this const that = this
//微信 //微信
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
uni.getSetting({ uni.getSetting({
...@@ -288,7 +303,7 @@ ...@@ -288,7 +303,7 @@
} }
}) })
//#endif //#endif
//不是微信 //不是微信
//#ifndef MP-WEIXIN //#ifndef MP-WEIXIN
that.chooseLocation() that.chooseLocation()
...@@ -298,23 +313,23 @@ ...@@ -298,23 +313,23 @@
chooseLocation() { chooseLocation() {
const that = this const that = this
uni.chooseLocation({ uni.chooseLocation({
success: (res)=> { success: (res) => {
that.address = res.name that.address = res.name
that.list.position = res that.list.position = res
this.fromdata.lat = res.latitude; this.fromdata.lat = res.latitude;
this.fromdata.lng = res.longitude; this.fromdata.lng = res.longitude;
console.info(res); console.info(res);
qqmapsdk.reverseGeocoder({ qqmapsdk.reverseGeocoder({
location: { location: {
latitude: res.latitude, latitude: res.latitude,
longitude: res.longitude longitude: res.longitude
}, },
success: (restwo)=>{ success: (restwo) => {
//debugger //debugger
//console.log(res) //console.log(res)
let province = res.result.ad_info.province; let province = res.result.ad_info.province;
...@@ -323,29 +338,45 @@ ...@@ -323,29 +338,45 @@
// this.province=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%1000;//省级ID // this.province=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%1000;//省级ID
// this.citys=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%100;//市级ID // this.citys=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%100;//市级ID
// this.countys=Number(res.result.ad_info.adcode);//区县级ID // this.countys=Number(res.result.ad_info.adcode);//区县级ID
// this.fromdata.city_code=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%100;//城市代码 // this.fromdata.city_code=Number(res.result.ad_info.adcode)-Number(res.result.ad_info.adcode)%100;//城市代码
// this.fromdata.area_code=Number(res.result.ad_info.adcode);//区号 // this.fromdata.area_code=Number(res.result.ad_info.adcode);//区号
//console.info(restwo); //console.info(restwo);
}, },
fail: (err)=>{ fail: (err) => {
console.log(err) console.log(err)
} }
}) })
} }
}); });
}, },
onEditorReady(data) {
uni.createSelectorQuery().select('#editor').context((res) => {
console.log(res)
this.editorCtx = res.context;
let content = {
html: data
}
this.editorCtx.setContents(content); //设置富文本编辑器的内容
}).exec()
},
onEditorInput(res){
if(res.detail.html){
this.fromdata.details = res.detail.html
}
}
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.logobox{ .logobox {
padding: 15upx 0; padding: 15upx 0;
text-align: center; text-align: center;
.islogimg{
.islogimg {
width: 200upx; width: 200upx;
height: 200upx; height: 200upx;
line-height: 200upx; line-height: 200upx;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="container"> <view class="container">
<navigator url="/pages/edit/shop/shop" class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50"> <navigator url="/pages/edit/shop/shop" class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
<text class="cell-tit">门店编辑</text> <text class="cell-tit">门店信息</text>
<image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image> <image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image>
</navigator> </navigator>
<navigator url="/pages/edit/Qualifications/Qualifications" class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50"> <navigator url="/pages/edit/Qualifications/Qualifications" class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50">
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
<text class="cell-tit">切换门店</text> <text class="cell-tit">切换门店</text>
<image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image> <image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image>
</navigator> </navigator>
<view class="list-cell b-b" @tap="oneTodeleteStore" hover-class="cell-hover" > <!-- <view class="list-cell b-b" @tap="oneTodeleteStore" hover-class="cell-hover" >
<text class="cell-tit">关闭店铺</text> <text class="cell-tit">关闭店铺</text>
<image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image> <image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image>
</view> </view> -->
<navigator url="/pages/setPassword/setPassword?is_pay=0" class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50"> <navigator url="/pages/setPassword/setPassword?is_pay=0" class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50">
<text class="cell-tit">修改登录密码</text> <text class="cell-tit">修改登录密码</text>
<image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image> <image class="jiantousi" src="/static/news/jiantousi.png" mode=""></image>
......
/*
graceUI rich-text 加强工具
link : graceui.hcoder.net
author : 5213606@qq.com 深海
*/
// 正则变量
var graceRichTextReg;
// 批量替换的样式 [ 根据项目需求自行设置 ]
var GRT = [
// div 样式
['div', "line-height:2em;"],
// h1 样式
['h1', "font-size:3em; line-height:1.5em;"],
// h2 样式
['h2', "font-size:2em; line-height:1.8em;"],
// h3 样式
['h3', "font-size:1.6em; line-height:2em;"],
// h4 样式
['h4', "font-size:1.2em; line-height:2em;"],
// h5 样式
['h5', "font-size:1em; line-height:2em;"],
// h6 样式
['h6', "font-size:0.9em; line-height:2em;"],
// p 样式
['p', "font-size:1em; line-height:2em;"],
// b 样式
['b', "font-size:1em; line-height:2em;"],
// strong 样式
['strong', "font-size:1em; line-height:2em;"],
// code 样式
['code', "font-size:1em; line-height:1.2em; background:#F6F7F8; padding:8px 2%; width:96%;"],
// img 样式
['img', "width:100%; margin:8px 0;"],
// blockquote
['blockquote', "font-size:1em; border-left:3px solid #D1D1D1; line-height:2em; border-radius:5px; background:#F6F7F8; padding:8px 2%;"],
// li 样式
['ul', "padding:5px 0; list-style:none; padding:0; margin:0;"],
['li', "line-height:1.5em; padding:5px 0; list-style:none; padding:0; margin:0; margin-top:10px;"],
// table
['table', "width:100%; border-left:1px solid #F2F3F4; border-top:1px solid #F2F3F4;"],
['th', "border-right:1px solid #F2F3F4; border-bottom:1px solid #F2F3F4;"],
['td', "border-right:1px solid #F2F3F4; border-bottom:1px solid #F2F3F4; padding-left:5px;"]
];
module.exports = {
format : function(html){
html = html.replace(/<pre.*pre>?/gis, function(word){
word = word.replace(/[\n]/gi,'<br />');
word = word.replace(/ /gi,'<span style="padding-left:2em;"></span>');
return word.replace(/[\t]/gi, '<span style="padding-left:2em;"></span>');
});
html = html.replace(/<pre/gi, '<p style="font-size:1em; margin:12px 0; line-height:1.2em; background:#F6F7F8; border-radius:5px; padding:8px 4%; width:92%;"');
html = html.replace(/<\/pre/gi,"</p");
for(let i = 0; i < GRT.length; i++){
graceRichTextReg = new RegExp('<'+GRT[i][0]+'>|<'+GRT[i][0]+' (.*?)>', 'gi');
html = html.replace(graceRichTextReg , function(word){
// 分析 dom 上是否带有 style=""
if(word.indexOf('style=') != -1){
var regIn = new RegExp('<' + GRT[i][0] + '(.*?)style="(.*?)"(.*?)(/?)>', 'gi');
return word.replace(regIn, '<'+ GRT[i][0] +'$1style="$2 ' + GRT[i][1] +'"$3$4>');
}else{
var regIn = new RegExp('<' + GRT[i][0] + '(.*?)(/?)>', 'gi');
return word.replace(regIn, '<'+ GRT[i][0] +'$1 style="' + GRT[i][1] +'$2">');
}
});
}
return html;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment