|
@@ -1,258 +1,284 @@
|
|
|
$(function () {
|
|
|
- var types = {
|
|
|
- 0:'其他',
|
|
|
- 1:'生活',
|
|
|
- 2:'文化',
|
|
|
- 3:'工业',
|
|
|
- }
|
|
|
-
|
|
|
- $("#jqGrid").Grid({
|
|
|
- url: '../brand/list',
|
|
|
- rownumWidth:60,
|
|
|
- colModel: [{
|
|
|
- label: 'id', name: 'id', index: 'id', key: true, hidden: true
|
|
|
- }, {
|
|
|
- label: '店铺名称', name: 'name', index: 'name', width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- label: '类型', name: 'type', index: 'type', width: 80,formatter: function (value) {
|
|
|
- return types[value] || '-'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '场景地址', name: 'sceneUrl', index: 'scene_url', width: 140
|
|
|
- },
|
|
|
- {
|
|
|
- label: '店铺封面',align:'center', name: 'listPicUrl', index: 'list_pic_url', width: 120, formatter: function (value) {
|
|
|
- return transImg(value,100,'auto');
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '分享图', align:'center', name: 'newPicUrl', index: 'new_pic_url', width: 120, formatter: function (value) {
|
|
|
- return transImg(value,100,'auto');
|
|
|
- }
|
|
|
- },
|
|
|
- // {
|
|
|
- // label: '描述', name: 'simpleDesc', index: 'simple_desc', width: 80
|
|
|
- // },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // {
|
|
|
- // label: '缩略图', align:'center',name: 'picUrl', index: 'pic_url', width: 120, formatter: function (value) {
|
|
|
- // return transImg(value,100,'auto');
|
|
|
- // }
|
|
|
- // },
|
|
|
- {
|
|
|
- label: '排序', name: 'sortOrder', index: 'sort_order', width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- label: '显示', name: 'isShow', index: 'is_show', width: 80, formatter: function (value) {
|
|
|
- return transIsNot(value)
|
|
|
- }
|
|
|
- },
|
|
|
- // {
|
|
|
- // label: '展示价格', name: 'floorPrice', index: 'floor_Price', width: 80
|
|
|
- // },
|
|
|
- // {
|
|
|
- // label: '封面图',align:'center', name: 'appListPicUrl', index: 'app_list_pic_url', width: 120, formatter: function (value) {
|
|
|
- // return transImg(value,100,'auto');
|
|
|
- // }
|
|
|
- // },
|
|
|
- // {
|
|
|
- // label: '新店铺', name: 'isNew', index: 'is_new', width: 80, formatter: function (value) {
|
|
|
- // return transIsNot(value)
|
|
|
- // }
|
|
|
- // },
|
|
|
-
|
|
|
- // {
|
|
|
- // label: '新店铺排序', name: 'newSortOrder', index: 'new_sort_order', width: 80
|
|
|
- // }
|
|
|
- ]
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
-
|
|
|
-const validateSceneUrlCheck = function (rule, value, callback){
|
|
|
- console.log(value)
|
|
|
- var link1 ='https://test.4dkankan.com/eShopMobile.html?m='
|
|
|
- var link2 ='https://www.4dkankan.com/eShopMobile.html?m='
|
|
|
-
|
|
|
- if (value === ''||!value) {
|
|
|
- callback(new Error('场景地址不能为空'));
|
|
|
- } else if(!~value.indexOf(link1)&&!~value.indexOf(link2)){
|
|
|
- callback(new Error('场景地址需为'+link2+'或'+link1));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
+ var types = {
|
|
|
+ 0:'其他',
|
|
|
+ 1:'生活',
|
|
|
+ 2:'文化',
|
|
|
+ 3:'工业',
|
|
|
}
|
|
|
-};
|
|
|
-
|
|
|
-var vm = new Vue({
|
|
|
- el: '#rrapp',
|
|
|
- data: {
|
|
|
- showList: true,
|
|
|
- title: null,
|
|
|
- brand: {listPicUrl: '',type:0, picUrl: '', appListPicUrl: '', newPicUrl: '', isShow: 1, isNew: 0},
|
|
|
- ruleValidate: {
|
|
|
- name: [
|
|
|
- {required: true, message: '店铺名称不能为空', trigger: 'blur'}
|
|
|
- ],
|
|
|
- listPicUrl: [
|
|
|
- {required: true, message: '图片不能为空', trigger: 'blur'}
|
|
|
- ],
|
|
|
- simpleDesc: [
|
|
|
- {required: true, message: '描述不能为空', trigger: 'blur'}
|
|
|
- ],
|
|
|
- sceneUrl: [
|
|
|
- {required: true, validator: validateSceneUrlCheck, trigger: 'blur'}
|
|
|
- ],
|
|
|
- picUrl: [
|
|
|
- {required: true, message: '缩略图不能为空', trigger: 'blur'}
|
|
|
- ]
|
|
|
- },
|
|
|
- q: {
|
|
|
- name: '',
|
|
|
- type:''
|
|
|
- },
|
|
|
- typeList:[
|
|
|
- {
|
|
|
- id:0,
|
|
|
- name:'其他'
|
|
|
- },
|
|
|
- {
|
|
|
- id:1,
|
|
|
- name:'生活'
|
|
|
- },
|
|
|
- {
|
|
|
- id:2,
|
|
|
- name:'文化'
|
|
|
- },
|
|
|
- {
|
|
|
- id:3,
|
|
|
- name:'工业'
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- methods: {
|
|
|
- query: function () {
|
|
|
- vm.reload();
|
|
|
- },
|
|
|
- add: function () {
|
|
|
- vm.showList = false;
|
|
|
- vm.title = "新增";
|
|
|
- vm.brand = {listPicUrl: '',type:0, picUrl: '', appListPicUrl: '', newPicUrl: '', isShow: 1, isNew: 0};
|
|
|
- },
|
|
|
- update: function (event) {
|
|
|
- var id = getSelectedRow("#jqGrid");
|
|
|
- if (id == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- vm.showList = false;
|
|
|
- vm.title = "修改";
|
|
|
-
|
|
|
- vm.getInfo(id)
|
|
|
- },
|
|
|
- saveOrUpdate: function (event) {
|
|
|
- var url = vm.brand.id == null ? "../brand/save" : "../brand/update";
|
|
|
- Ajax.request({
|
|
|
- type: "POST",
|
|
|
- url: url,
|
|
|
- contentType: "application/json",
|
|
|
- params: JSON.stringify(vm.brand),
|
|
|
- successCallback: function () {
|
|
|
- alert('操作成功', function (index) {
|
|
|
- vm.reload();
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
+ $("#jqGrid").Grid({
|
|
|
+ url: '../brand/list',
|
|
|
+ rownumWidth:60,
|
|
|
+ colModel: [{
|
|
|
+ label: 'id', name: 'id', index: 'id', key: true, hidden: true
|
|
|
+ }, {
|
|
|
+ label: '店铺名称', name: 'name', index: 'name', width: 80
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '类型', name: 'type', index: 'type', width: 80,formatter: function (value) {
|
|
|
+ return types[value] || '-'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '场景地址', name: 'sceneUrl', index: 'scene_url', width: 140
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '店铺封面',align:'center', name: 'listPicUrl', index: 'list_pic_url', width: 120, formatter: function (value) {
|
|
|
+ return transImg(value,100,'auto');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '分享图', align:'center', name: 'newPicUrl', index: 'new_pic_url', width: 120, formatter: function (value) {
|
|
|
+ return transImg(value,100,'auto');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // label: '描述', name: 'simpleDesc', index: 'simple_desc', width: 80
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // {
|
|
|
+ // label: '缩略图', align:'center',name: 'picUrl', index: 'pic_url', width: 120, formatter: function (value) {
|
|
|
+ // return transImg(value,100,'auto');
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ label: '排序', name: 'sortOrder', index: 'sort_order', width: 80
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '显示', name: 'isShow', index: 'is_show', width: 80, formatter: function (value) {
|
|
|
+ return transIsNot(value)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // label: '展示价格', name: 'floorPrice', index: 'floor_Price', width: 80
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '封面图',align:'center', name: 'appListPicUrl', index: 'app_list_pic_url', width: 120, formatter: function (value) {
|
|
|
+ // return transImg(value,100,'auto');
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '新店铺', name: 'isNew', index: 'is_new', width: 80, formatter: function (value) {
|
|
|
+ // return transIsNot(value)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
+ // {
|
|
|
+ // label: '新店铺排序', name: 'newSortOrder', index: 'new_sort_order', width: 80
|
|
|
+ // }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ const validateSceneUrlCheck = function (rule, value, callback){
|
|
|
+ console.log(value)
|
|
|
+ var link1 ='https://test.4dkankan.com/eShopMobile.html?m='
|
|
|
+ var link2 ='https://www.4dkankan.com/eShopMobile.html?m='
|
|
|
+
|
|
|
+ if (value === ''||!value) {
|
|
|
+ callback(new Error('场景地址不能为空'));
|
|
|
+ } else if(!~value.indexOf(link1)&&!~value.indexOf(link2)){
|
|
|
+ callback(new Error('场景地址需为'+link2+'或'+link1));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var vm = new Vue({
|
|
|
+ el: '#rrapp',
|
|
|
+ data: {
|
|
|
+ showList: true,
|
|
|
+ title: null,
|
|
|
+ brand: {listPicUrl: '',type:0, picUrl: '', appListPicUrl: '', newPicUrl: '', isShow: 1, isNew: 0},
|
|
|
+ ruleValidate: {
|
|
|
+ name: [
|
|
|
+ {required: true, message: '店铺名称不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ listPicUrl: [
|
|
|
+ {required: true, message: '图片不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ simpleDesc: [
|
|
|
+ {required: true, message: '描述不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ // sceneUrl: [
|
|
|
+ // {required: true, validator: validateSceneUrlCheck, trigger: 'blur'}
|
|
|
+ // ],
|
|
|
+ picUrl: [
|
|
|
+ {required: true, message: '缩略图不能为空', trigger: 'blur'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ q: {
|
|
|
+ name: '',
|
|
|
+ type:''
|
|
|
+ },
|
|
|
+ typeList:[
|
|
|
+ {
|
|
|
+ id:0,
|
|
|
+ name:'其他'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id:1,
|
|
|
+ name:'生活'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id:2,
|
|
|
+ name:'文化'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id:3,
|
|
|
+ name:'工业'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ phoneNum: "",
|
|
|
+ password: "",
|
|
|
+ index:''
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ addSceneLink: function () {
|
|
|
+
|
|
|
+ openWindow({
|
|
|
+ title: "四维看看账号",
|
|
|
+ area: ['400px', '400px'],
|
|
|
+ content: jQuery("#loginLayer")
|
|
|
});
|
|
|
- },
|
|
|
- del: function (event) {
|
|
|
- var ids = getSelectedRows("#jqGrid");
|
|
|
- if (ids == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- confirm('确定要删除选中的记录?', function () {
|
|
|
-
|
|
|
- Ajax.request({
|
|
|
- type: "POST",
|
|
|
- url: "../brand/delete",
|
|
|
- contentType: "application/json",
|
|
|
- params: JSON.stringify(ids),
|
|
|
- successCallback: function () {
|
|
|
- alert('操作成功', function (index) {
|
|
|
- vm.reload();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- getInfo: function (id) {
|
|
|
- Ajax.request({
|
|
|
- url: "../brand/info/" + id,
|
|
|
- async: true,
|
|
|
- successCallback: function (r) {
|
|
|
- vm.brand = r.brand;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- reload: function (event) {
|
|
|
- vm.showList = true;
|
|
|
- var page = $("#jqGrid").jqGrid('getGridParam', 'page');
|
|
|
- $("#jqGrid").jqGrid('setGridParam', {
|
|
|
- postData: {'name': vm.q.name,'type': vm.q.type},
|
|
|
- page: page
|
|
|
- }).trigger("reloadGrid");
|
|
|
- vm.handleReset('formValidate');
|
|
|
- },
|
|
|
- handleSuccessListPicUrl: function (res, file) {
|
|
|
- vm.brand.listPicUrl = file.response.url;
|
|
|
- vm.brand.appListPicUrl = file.response.url;
|
|
|
- },
|
|
|
- handleSuccessPicUrl: function (res, file) {
|
|
|
- vm.brand.picUrl = file.response.url;
|
|
|
- },
|
|
|
- handleSuccessAppListPicUrl: function (res, file) {
|
|
|
- vm.brand.appListPicUrl = file.response.url;
|
|
|
- },
|
|
|
- handleSuccessNewPicUrl: function (res, file) {
|
|
|
- vm.brand.newPicUrl = file.response.url;
|
|
|
- },
|
|
|
- handleFormatError: function (file) {
|
|
|
- this.$Notice.warning({
|
|
|
- title: '文件格式不正确',
|
|
|
- desc: '文件 ' + file.name + ' 格式不正确,请上传 jpg 或 png 格式的图片。'
|
|
|
- });
|
|
|
- },
|
|
|
- handleMaxSize: function (file) {
|
|
|
- this.$Notice.warning({
|
|
|
- title: '超出文件大小限制',
|
|
|
- desc: '文件 ' + file.name + ' 太大,不能超过 2M。'
|
|
|
- });
|
|
|
- },
|
|
|
- eyeImageListPicUrl: function () {
|
|
|
- var url = vm.brand.listPicUrl;
|
|
|
- eyeImage(url);
|
|
|
- },
|
|
|
- eyeImagePicUrl: function () {
|
|
|
- var url = vm.brand.picUrl;
|
|
|
- eyeImage(url);
|
|
|
- },
|
|
|
- eyeImageAppListPicUrl: function () {
|
|
|
- var url = vm.brand.appListPicUrl;
|
|
|
- eyeImage(url);
|
|
|
- },
|
|
|
- eyeImageNewPicUrl: function () {
|
|
|
- var url = vm.brand.newPicUrl;
|
|
|
- eyeImage(url);
|
|
|
- },
|
|
|
- handleSubmit: function (name) {
|
|
|
- handleSubmitValidate(this, name, function () {
|
|
|
- vm.saveOrUpdate()
|
|
|
- });
|
|
|
- },
|
|
|
- handleReset: function (name) {
|
|
|
- handleResetForm(this, name);
|
|
|
+ },
|
|
|
+ query: function () {
|
|
|
+ vm.reload();
|
|
|
+ },
|
|
|
+ add: function () {
|
|
|
+ vm.showList = false;
|
|
|
+ vm.title = "新增";
|
|
|
+ vm.brand = {listPicUrl: '',type:0,sceneUrl:'', picUrl: '', appListPicUrl: '', newPicUrl: '', isShow: 1, isNew: 0};
|
|
|
+ },
|
|
|
+ update: function (event) {
|
|
|
+ var id = getSelectedRow("#jqGrid");
|
|
|
+ if (id == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vm.showList = false;
|
|
|
+ vm.title = "修改";
|
|
|
+
|
|
|
+ vm.getInfo(id)
|
|
|
+ },
|
|
|
+ saveOrUpdate: function (event) {
|
|
|
+ var url = vm.brand.id == null ? "../brand/save" : "../brand/update";
|
|
|
+ Ajax.request({
|
|
|
+ type: "POST",
|
|
|
+ url: url,
|
|
|
+ contentType: "application/json",
|
|
|
+ params: JSON.stringify(vm.brand),
|
|
|
+ successCallback: function () {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ vm.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ del: function (event) {
|
|
|
+ var ids = getSelectedRows("#jqGrid");
|
|
|
+ if (ids == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ confirm('确定要删除选中的记录?', function () {
|
|
|
+
|
|
|
+ Ajax.request({
|
|
|
+ type: "POST",
|
|
|
+ url: "../brand/delete",
|
|
|
+ contentType: "application/json",
|
|
|
+ params: JSON.stringify(ids),
|
|
|
+ successCallback: function () {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ vm.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getInfo: function (id) {
|
|
|
+ Ajax.request({
|
|
|
+ url: "../brand/info/" + id,
|
|
|
+ async: true,
|
|
|
+ successCallback: function (r) {
|
|
|
+ vm.brand = r.brand;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ reload: function (event) {
|
|
|
+ vm.showList = true;
|
|
|
+ var page = $("#jqGrid").jqGrid('getGridParam', 'page');
|
|
|
+ $("#jqGrid").jqGrid('setGridParam', {
|
|
|
+ postData: {'name': vm.q.name,'type': vm.q.type},
|
|
|
+ page: page
|
|
|
+ }).trigger("reloadGrid");
|
|
|
+ vm.handleReset('formValidate');
|
|
|
+ },
|
|
|
+ handleSuccessListPicUrl: function (res, file) {
|
|
|
+ vm.brand.listPicUrl = file.response.url;
|
|
|
+ vm.brand.appListPicUrl = file.response.url;
|
|
|
+ },
|
|
|
+ handleSuccessPicUrl: function (res, file) {
|
|
|
+ vm.brand.picUrl = file.response.url;
|
|
|
+ },
|
|
|
+ handleSuccessAppListPicUrl: function (res, file) {
|
|
|
+ vm.brand.appListPicUrl = file.response.url;
|
|
|
+ },
|
|
|
+ handleSuccessNewPicUrl: function (res, file) {
|
|
|
+ vm.brand.newPicUrl = file.response.url;
|
|
|
+ },
|
|
|
+ handleFormatError: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '文件格式不正确',
|
|
|
+ desc: '文件 ' + file.name + ' 格式不正确,请上传 jpg 或 png 格式的图片。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleMaxSize: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '超出文件大小限制',
|
|
|
+ desc: '文件 ' + file.name + ' 太大,不能超过 2M。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ eyeImageListPicUrl: function () {
|
|
|
+ var url = vm.brand.listPicUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ eyeImagePicUrl: function () {
|
|
|
+ var url = vm.brand.picUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ eyeImageAppListPicUrl: function () {
|
|
|
+ var url = vm.brand.appListPicUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ eyeImageNewPicUrl: function () {
|
|
|
+ var url = vm.brand.newPicUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ handleSubmit: function (name) {
|
|
|
+ handleSubmitValidate(this, name, function () {
|
|
|
+ vm.saveOrUpdate()
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleReset: function (name) {
|
|
|
+ handleResetForm(this, name);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ window.addEventListener('message', function(e) {
|
|
|
+ var data = e.data;
|
|
|
+ console.log(data);
|
|
|
+ if (data==='close') {
|
|
|
+ layer.closeAll()
|
|
|
}
|
|
|
+
|
|
|
+ if (data.website) {
|
|
|
+ vm.brand.sceneUrl = data.website || ''
|
|
|
+ console.log(vm.brand.sceneUrl);
|
|
|
+ layer.closeAll()
|
|
|
+ }
|
|
|
+ }, false);
|
|
|
}
|
|
|
-});
|
|
|
+ });
|